Commit graph

12 commits

Author SHA1 Message Date
Lawrence Chen
27fa3873be
Add claude-teams, omo, and __tmux-compat to Go relay CLI for SSH sessions (#2238)
* Add claude-teams, omo, and __tmux-compat to Go relay CLI

These commands previously only existed in the Swift CLI which uses Unix
domain sockets and can't connect over TCP relay. The Go relay CLI already
handles TCP connections, so adding the commands here makes them work
inside `cmux ssh` sessions.

- `cmux claude-teams`: creates tmux shim scripts, configures environment
  (fake TMUX/TMUX_PANE, socket path, workspace/surface IDs), and execs
  into `claude --teammate-mode auto`
- `cmux omo`: same pattern for OpenCode with terminal-notifier shim
- `cmux __tmux-compat`: translates tmux commands (split-window,
  send-keys, capture-pane, display-message, list-panes, etc.) into cmux
  JSON-RPC calls over the relay socket. Includes main-vertical layout
  tracking, wait-for signaling, and format string rendering.

* Fix: search original PATH before environment modification

findExecutable was called after configureAgentEnvironment prepended the
shim directory to PATH. The Swift CLI searches the original PATH before
modification. Renamed to findExecutableInPath with explicit PATH arg and
moved the search before configureAgentEnvironment.

* Fix cmux omo hang and port oh-my-opencode plugin setup

Root cause: socketRoundTripV2 had no read timeout. When connecting to a
stale relay port (accepted TCP but never responded), the read blocked
forever. This caused getFocusedContext to hang, blocking agent launch.

Fixes:
- Add 15s read deadline to socketRoundTripV2 (affects all v2 RPC calls)
- Add 5s timeout to getFocusedContext so agent launch proceeds even if
  system.identify is slow
- Port omoEnsurePlugin from Swift: creates shadow config dir, adds
  oh-my-opencode to plugin list, symlinks node_modules/package.json,
  installs plugin via bun/npm if missing, configures tmux settings
  (enabled=true, lower min widths), sets OPENCODE_CONFIG_DIR

* Fix: use bun as runtime for node-script opencode when node is missing

opencode is installed via bun as a #!/usr/bin/env node script, but on
some systems (like the macmini) bun is installed without a standalone
node binary. Detect node scripts and fall back to bun as the runtime
since bun is node-compatible.

* Fix subagent pane theme: preserve COLORTERM, keep TERM_PROGRAM

The cmux ssh bootstrap exports COLORTERM=truecolor and TERM_PROGRAM=ghostty.
Our configureAgentEnvironment was unsetting TERM_PROGRAM and not setting
COLORTERM, causing subagent panes (created via split-window) to lose
truecolor detection and render with wrong theme colors.

* Restore TERM_PROGRAM unset, keep COLORTERM=truecolor

* Force dark colorScheme in opencode shadow config for SSH

* Remove hardcoded dark colorScheme, let opencode detect naturally

* Detect system color scheme for opencode over SSH

* Remove color scheme detection workaround, let opencode handle natively

---------

Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
2026-03-27 21:04:24 -07:00
Lawrence Chen
bbdb626ef3
Fix nightly remote daemon and SSH relay wiring 2026-03-17 00:59:52 -07:00
Lawrence Chen
832426af56
Stabilize SSH remote flow after merging main 2026-03-16 23:57:48 -07:00
Lawrence Chen
b0bfabdb6a Optimize remote daemon builds and TCP latency 2026-03-13 04:34:58 -07:00
Lawrence Chen
2e6856ff2f Fix ssh stack review regressions 2026-03-13 04:14:52 -07:00
Lawrence Chen
19b59cae37 Reapply "Merge pull request #239 from manaflow-ai/issue-151-ssh-remote-port-proxying"
This reverts commit f7cbbad434.
2026-03-12 15:54:26 -07:00
Lawrence Chen
f7cbbad434 Revert "Merge pull request #239 from manaflow-ai/issue-151-ssh-remote-port-proxying"
This reverts commit 78e4bd32ba, reversing
changes made to cf75da8f8a.
2026-03-12 14:45:58 -07:00
Lawrence Chen
a75faa82f1 Fix SSH review regressions 2026-03-12 05:24:12 -07:00
Lawrence Chen
8a9e28e129 Secure remote daemon distribution and relay auth 2026-03-12 05:04:44 -07:00
Lawrence Chen
daa340fa87 Harden cmux ssh for mixed-version remote sessions 2026-02-24 22:09:27 -08:00
Lawrence Chen
257afc0623 Fix SSH relay/socket regressions and restore session/focus contracts 2026-02-24 21:20:24 -08:00
Raghav Pillai
1a1caca99d Add cmux CLI relay and tests
- Introduce CLI client (cmux) to relay v1 text and v2 JSON-RPC commands over Unix/TCP sockets
- Implement command specs, flag parsing, v1/v2 round-trips, TCP retry with address refresh
- Add browser subcommand mapping and rpc passthrough support
- Support busybox-style invocation when argv[0]=="cmux" and add 'cli' subcommand
- Add comprehensive unit tests for socket dialing, CLI commands, flag-to-param mapping, and env defaults
- Add socket_addr file fallback reader and random request id generation
2026-02-23 18:24:14 +02:00