feat(panel,host): a shown transcript tab hears its pages pushed, with no read loop
Merged
CH
5d ago+489+489+012345678901234567890123456789-682-682-012345678901234567890123456789
The window half of making the agent transcript live on main. It's stacked on #4175 and replaces #3931, which was built on the old stack.
What changed
packages/panel/src/tasks/use-agent-transcript.ts: the hook takes a transcript key and aTranscriptFollower.- While the tab is shown it holds the transcript's stream open on the act port (
codingAgents.transcript, from #4175), and closes it when hidden or unmounted. - Each pushed page joins the held messages by id. The read loop, the cursor and the read-through bookkeeping are gone.
- A stream that won't open, or a failure page, sets
failed. Try again opens the stream again, and the messages held stay meanwhile.
- While the tab is shown it holds the transcript's stream open on the act port (
- Tabs: the agent tab, the agent-worker tab and the task's planning-worker tab follow by key. The planning worker uses
{ kind: "taskWorker", taskId, callId }.CodingAgentsControl.transcriptsis the window's follower. - Copy transcript:
codingAgents.messagesandtasks.messageswith acallIdstay, because Copy transcript reads them. The host'scodingAgents.messagesnow answers at once through the service'swait=noneread. - Host: the held read is retired:
transcriptPast,readUntilSaid,TranscriptReadsand the 20 sHOLD. So isfollowsAgent, which only the loop used.
Tests
- New
use-agent-transcript.test.ts:- A shown tab follows its transcript, joins its pages by id, and lets the stream go once hidden.
- A failure offers Try again, which follows again while the held messages stay.
- The tab tests that stubbed
readTranscriptnow push pages throughpushedTranscripts(#testing/tasks-control). The agent page test answers the stream with a generator. - Deleted, since they test the retired held read: four
compose-coding-agents.test.tstests, "a running agent's transcript is held open…", "a worker's transcript is followed under its own seal…", "a transcript the account does not reach is not found…" and "a read the service says only the clock may end…". #4175's follow tests cover the live behaviour.
Checks run locally
pnpm check:affected gets OOM-killed in the sandbox, so I ran its pieces one at a time:
repository-checks.sh,biome check .,oxlint,kniptscfor host and panel- vitest for host and for panel's
tasksanddesktop(2115 tests)
What to check by hand (desktop and web)
- Running agent: show its tab. Lines land as it writes them, with no lag of about a second.
- Ended agent: show it. The whole transcript appears, and the spinner doesn't stay.
- Hide and show: switch tabs and come back. The transcript is complete, with no duplicated lines.
- Agent's worker: open a worker's tab. It fills in and keeps up.
- Planning worker: during a call, open one from the plan's work. It fills in.
- Web: the same agent tab in the web app updates live.
- Copy transcript: it still gives the full text.
Made with Luke