Repository navigation
Focus the exact cmux surface for Claude sessions - #11
Conversation
fdussert
left a comment
There was a problem hiding this comment.
Thanks for this — landing on the exact cmux surface instead of just fronting the app is a nice touch, and the UUID validation before anything reaches an argument list is exactly right.
A few things before it can go in:
-
Which cmux version handles
cmux://workspace/<id>/surface/<id>? The cmux 0.62.2 bundle I checked only declareshttp/httpsinCFBundleURLTypes, and I couldn't find acmux://handler in the binary. Could you point to the cmux docs for this scheme, or confirm you tested it by hand? Otherwise cmux ships an AppleScript dictionary (focuson aterminalbyid); passed throughon run argv, that would match the Terminal/iTerm2 path in this file. The bundled CLI (cmux focus-panel --panel <id> --workspace <id>) would work too. -
If
openfails here (server/src/claude/focus.ts, around line 200), the exception reaches the outercatchand the card saysfailed. The Orca and tty paths fall back to fronting the application instead. Could this branch do the same (catch→focusApp(CMUX_BUNDLE, runner)), and only reporthow: 'pane'when the surface was actually selected? -
For a session with no hook-reported bundle id, the cmux check now runs before the Orca handle and the process-tree walk. A process that inherited
CMUX_*(VS Code launched withcode .from a cmux shell, for instance) will be sent to cmux. Could the cmux route requireTERM_PROGRAM/__CFBundleIdentifierto agree, or at least yield toORCA_TERMINAL_HANDLE? Reusing the firstclientOfProcessresult would also save the second pair ofpscalls. -
Please add a cmux row to the client table in
docs/claude-code.md, and move the CHANGELOG line under### Added/### Changed(or fold it into the existing "go to the session" entry). #10, #12 and #13 add a loose bullet at the same spot, so expect a small rebase.
|
Thanks for the quick turnaround, Florian! The bundled CLI is a much better route: fixed argument list, validated UUIDs, a fallback to fronting cmux, and Orca now wins over an inherited handle. Points 1, 2 and 4 are done. Three small things left:
Thanks again! |
a062d1a to
1e2eb34
Compare
|
Thanks for the quick turnaround, Florian! All three points are covered, and the socket-mode note in the docs is exactly what users need. The only thing left is a rebase on main: |
1e2eb34 to
07d5184
Compare
fdussert
left a comment
There was a problem hiding this comment.
Thanks Florian — rebased cleanly, and the socket-access wording in the changelog is a nice touch. Merging (squash).
Read validated workspace and surface IDs from the live Claude process before opening cmux, so touching a session selects its panel instead of merely activating the app. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Use known TERM_PROGRAM values before selecting a cmux panel. Document the socket access limitation and the application fallback. Co-Authored-By: Claude <noreply@anthropic.com>
07d5184 to
b4dbca0
Compare
What this changes
Touching a Claude session in cmux used to activate the application without selecting its panel. Fremkit now reads validated workspace and surface IDs from the live process and asks the bundled cmux CLI to focus that panel. If socket policy denies the command or the panel is gone, it activates cmux. A session launched in VS Code, iTerm2 or Terminal from a cmux shell follows its actual
TERM_PROGRAMinstead of inherited cmux IDs.The helper runs outside cmux. I verified that
cmux pingfrom this environment is denied under the current socket policy, so exact panel selection requires a socket mode allowing external clients. The documentation explains the restriction and its security tradeoff. The hook itself does not send cmux IDs; the server reads them from the live process.Related fork issue: FlorianBruniaux#19
Checks
pnpm typecheck,pnpm test(1,366 server and 385 UI tests) andpnpm buildpass after rebase.