feat: expose per-surface TTY in tree output (#2040)

Add tty field to surface items in system.tree JSON response,
reading from existing surfaceTTYNames dictionary. Also show
tty= in the CLI text tree output for terminals that have a
registered TTY.

This enables external tools (e.g. CodeV) to cross-reference
claude process TTYs with cmux surfaces for accurate session
detection when multiple sessions share the same working directory.
This commit is contained in:
Grimmer Kang 2026-03-25 11:27:23 +08:00 committed by GitHub
parent b24a53dc06
commit 2a2374afcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -8565,6 +8565,9 @@ struct CMUXCLI {
if (surface["here"] as? Bool) == true {
parts.append("◀ here")
}
if let tty = surface["tty"] as? String, !tty.isEmpty {
parts.append("tty=\(tty)")
}
if surfaceType.lowercased() == "browser",
let url = surface["url"] as? String,
!url.isEmpty {

View file

@ -2849,7 +2849,8 @@ class TerminalController {
"selected_in_pane": v2OrNull(selectedInPaneByPanelId[panel.id]),
"pane_id": v2OrNull(paneUUID?.uuidString),
"pane_ref": v2Ref(kind: .pane, uuid: paneUUID),
"index_in_pane": v2OrNull(indexInPaneByPanelId[panel.id])
"index_in_pane": v2OrNull(indexInPaneByPanelId[panel.id]),
"tty": v2OrNull(workspace.surfaceTTYNames[panel.id])
]
if panel.panelType == .browser, let browserPanel = panel as? BrowserPanel {