cmux NEXT agent pane: a click on a sub-session opens its chat (chat.offer.open)

Merged
TE
15d ago
+305-15

Follows #22827, now merged; the diff is only this PR's Mac handler, family check and tests.

#22827's page asks the Mac app to open a sub-session's chat with chat.offer.open, but nothing on the Mac side handled it. Clicking a sub-session card, the Subagents summary, or a received message's sender did nothing.

  • A click on a sub-session opens its chat. If a tab already shows that session, it is shown and focused. Otherwise the chat opens in the side pane beside the chat, the same way side chats open. Nothing opens without a click; sub-sessions still don't auto-open.
  • Only the chat's family can be opened. That is a session the pane started, a sub-session at any depth, or the session that started this one. The chat itself never counts. The turn-state watch now keeps acpmux's startedBy links, which this check uses.
  • Cloud VM chats work too. Their family comes from that machine's daemon (RemoteAgentSessionLinks), as chat.sideChat already used. A Cloud VM chat's sub-sessions open, and so does the session that started it.
  • Tests: AgentPaneOfferOpenTests, AgentSubsessionFamilyTests.

No capture: nothing new is drawn. The existing cards, Subagents rows and sender names now open a chat when clicked, and the tests above cover which chats open.

This is the useful part of the dead subsession-visibility lane's uncommitted WIP (branches orphan/subsession-visibility-mac-wip and orphan/subsession-visibility-web2-wip). I did not port:

  • The sidebar sub-session rows. They were on by default, they overlap the off-by-default sidebar.sessionTree, and their opener lives in CmuxNextApp, which may not grow.
  • An auto-open that was on by default.
  • The web WIP. #22827 (#22895) already has the received-message line. Reading the envelope from live prompts was ruled out on purpose in #22013. The rest of the web WIP was half-done.
    Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Clicking a sub-session now opens its chat on the Mac: the transcript's sub-session cards, the Subagents summary rows, and a received message's sender all open that session's chat beside the current one. Nothing opened before—the page asked for it with chat.offer.open, but no Mac host answered.

Agent pane

  • The tab that already shows the session is brought up and focused; otherwise the chat opens in the side pane beside the current chat, focused because the person asked. Nothing opens without a click.
  • Only a session this pane started, one of the chat's family (a sub-session at any depth, or the session that started it), or one chat.sideChat may open can open. The turn-state watch now mirrors acpmux's startedBy links, which the check uses.
  • Cloud VM chats open through that machine's daemon links (RemoteAgentSessionLinks): a remote chat's children and the session that started it open, as chat.sideChat opens them.
  • The page asks the app first and falls back to chat.sideChat only when the host does not support chat.offer.open; a chat.offer.refused answer is final, so a session outside the family never opens.