Agent pane: an acpmux run --parent child draws from acpmux's records

Merged
TE
12d ago
+239-13

Follow-up to #25043 (the agent-run card, landed) and #25040 (the parser, landed). Based on feat-cmux-next.

Leo: "this is mildly interesting i think being able to do it like a cmux-next natively rendered thing of subsession/non-same-model-family subagent would be a cool depiction" and "plus supporting the situation better in acpmux".

This is the typed-data follow-up. #25019 (merged) made acpmux new|run --parent start a real sub-session, and the parent chat's log now gets mux records of kind subsession: started (harness, model, effort, title, prompt) and turn_ended (state and a typed result with reply and error).

What changes:

  • agentRuns.ts: acpmux run --parent X is no longer ignored. The run carries parent.
  • subagentFold.ts: a --parent call is held as pending and still draws as its Command row. When the chat's started record arrives and the child is of another family, the call becomes the run. A record is matched to a call only by the call's -n name or by the start of its prompt, never by guessing, because a start_session child has the same parent. A call that names neither (its prompt is in a file) stays a Command row. A call that ended in the foreground leaves the pending list; one moved to the background stays. The card takes its harness, model and effort from acpmux, so this works even when the command names none. Each turn_ended sets the state and the reply, and acpmux's reply wins over whatever the shell printed. A same-family child stays a command. A start_session tool child (no matching call) is ignored, because it already has its own SubsessionCallCard. At most 16 calls are held pending.
  • direct.ts: handles mux subsession records and drops the call's row once it is a run.
  • AgentRunCard.tsx: Open chat goes straight to the recorded child session id.
  • Gallery: new agent-pane.agent-runs variant card-child.

No visual change to the card itself (it is the same card as #25043's card-done). The model line and reply now come from acpmux's records. The gallery visual evidence job captures card-child.

Risk: low. This only touches --parent shell calls in a chat whose harness is known, plus mux subsession records, which the pane ignored before. The worst case is that a --parent call stays a Command row, which is what it was before.

Tests: agentRuns.test.ts (--parent parsing) and agentRunFold.test.ts (start, typed reply over shell output, a later failed turn, a same-family child, a start_session child). Webview tsc, lint, fmt and tests run in this PR's CI (huge-blue is out of memory, so they are not run locally).

Agent session: cosmic-gray

šŸ¤– Generated with Claude Code