docs/v2-api-migration.md
This doc tracks the migration from the existing v1 line protocol (space-delimited commands) to a v2 JSON protocol intended for LLM agents.
window_id, workspace_id, pane_id, surface_id).tests/)tests_v2/)surface.trigger_flash (agent-visible highlight for a surface)tests_v2/ using v2 client./scripts/run-tests-v1.sh, ./scripts/run-tests-v2.sh)Notes:
Sources/Workspace.swift, Sources/Panels/TerminalPanel.swift).Each request is one JSON object per line:
{"id":"1","method":"workspace.list","params":{}}
Each response is one JSON object per line:
{"id":"1","ok":true,"result":{...}}
Errors:
{"id":"1","ok":false,"error":{"code":"not_found","message":"workspace not found"}}
Notes:
id is echoed back when present (string or number).index fields for ordering/debugging, but IDs are the stable handles.Windows:
window.listwindow.currentwindow.focuswindow.createwindow.closeworkspace.move_to_windowWorkspaces:
workspace.listworkspace.createworkspace.selectworkspace.currentworkspace.closeSurfaces / Splits:
surface.listsurface.focussurface.splitsurface.createsurface.closesurface.drag_to_splitsurface.refreshsurface.healthsurface.trigger_flash (new in v2)Panes:
pane.listpane.focuspane.surfacespane.createInput:
surface.send_textsurface.send_keyNotifications:
notification.createnotification.create_for_surfacenotification.create_for_targetnotification.listnotification.clearapp.focus_override.setapp.simulate_activeBrowser:
browser.open_splitbrowser.navigatebrowser.backbrowser.forwardbrowser.reloadbrowser.url.getbrowser.focus_webviewbrowser.is_webview_focusedDebug / Test-only:
debug.shortcut.setdebug.shortcut.simulatedebug.typedebug.app.activatedebug.terminal.is_focuseddebug.terminal.read_textdebug.terminal.render_statsdebug.layoutdebug.bonsplit_underflow.*debug.empty_panel.*debug.notification.focusdebug.flash.*debug.panel_snapshot.*debug.window.screenshotv1 suite stays in tests/.
v2 suite lives in tests_v2/ and should:
tests_v2/cmux.py)VM runners:
ssh cmux-vm 'cd /Users/cmux/GhosttyTabs && ./scripts/run-tests-v1.sh'ssh cmux-vm 'cd /Users/cmux/GhosttyTabs && ./scripts/run-tests-v2.sh'workspace_id/surface_id for all operations, or default to the currently-focused ones?