Skip to content

feat(app): a chat agent's board card shows what it asks or last said, not its host's frames - #182

Open
Stener1 wants to merge 1 commit into
cosscom:mainfrom
Stener1:chat-cards-show-what-the-agent-does
Open

Stener1 wants to merge 1 commit into
cosscom:mainfrom
Stener1:chat-cards-show-what-the-agent-does

Conversation

@Stener1

@Stener1 Stener1 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

An agent that runs in chat (structured: claude, codex, acp under berthd agent-host) has only the host in its pane. So its Agent Dashboard card showed the host's frames (out stream_event, out control_request) and quoted “stdio”, the last word of the host's command line ('--permission-prompt-tool' 'stdio'). Its card now reads the agent instead. Terminal cards are unchanged.

 <AgentCard>
-  useScreenTail()                       # the pane: host frames for a chat agent
-  quote = promptOf(command)             # "stdio"
+  terminal: useScreenTail()             # unchanged
+  chat:     chatCard(session.ask, waiting, useChatTail())   # lib/chat-card.ts
+              waiting   → reason + "$ command" (or the question), ask.choices as chips
+              otherwise → last lines of its newest reply, or its latest step / notice
+              nothing   → box hidden
+            quote = useOpeningPrompt()   # first prompt or command ("/ship ACME-12")

How it reads, without adding polling:

  • Tail: transcript?since=N&gen=…, as a chat reads it. The recent window comes once, then only what was added; the box reads on from where it was. On real 4.7–33 MB host logs that was 60–77 ms for the first read and ~8 ms for each one after. It runs when the screen read would have run, in its place (useCardRead, now shared with useScreenTail: one read at a time, events only prompt it). It doesn't run while the card shows an ask.
  • Quote: one read per session of the page at the record's start (transcript?before=262144&limit=50, paging back if that holds more). The first prompt comes after the agent's opening frame, tens of KB in. GET conversations isn't used: its title is empty when the prompt was sent after the session started, which is how orchestrators start agents.
  • describeAgent no longer quotes a chat session's command line.
  • The question tools regex is shared with Home's Needs you widget.

Mock: ?structured now runs four agents in chat (waiting on a Bash permission with choices, an AskUserQuestion, working, done), with the host's command line and pane log as a real box has them. checkout-fix stays in its terminal.

Follow-up, not in this PR: Review's last words and suggested commit message (views/review/summary.ts, review-detail.tsx, review-actions.tsx) and Home's Working widget step (useLiveStep) still read the pane for agents in chat.

Evidence

?mock=1&structured=1, the same build before and after; only the fixtures above are added to the "before" build.

  • Before: every chat card quotes “stdio” and shows host frames.
    before
    After: the command and why with its answers, the question, the reply's last lines, the opening prompt. The terminal card (Fix checkout webhook retries) is unchanged.
    after

Cards one at a time: waiting on a command (before) · a question · working · terminal, unchanged (before)

Checks:

  • .claude/skills/verify-berthd chat-board-cards (new scenario + features/chat-board-cards.md): OK. It asserts each card's text and chips, and that the board has no out stream_event / out control_request / stdio, with no console errors.
  • e2e/dashboard-chat-cards.spec.ts (new: waiting, working, terminal) with ask-card, dashboard-turn-check, dashboard-off-board, dashboard-stop-archive, agents-in-chat, home-widgets, resume-picker, chat-long: passed.
  • pnpm test: 589 passed, including src/lib/chat-card.test.ts (ask → reply tail → hidden; quote; merging reads). typecheck:plugins, check:titles, check:type, check:grid, check:csp, check:themes, tsc -p e2e and pnpm build pass, as do go vet, go test -race ./... and the docs build.
  • Real data, not mock: on a box's live chat sessions, transcript?since=0 plus the head page, run through chatCard/openingPrompt, give quotes like /ship … and /intake … (were “stdio”). They give the reply's last lines or Run … steps (were out … frames), and an AskUserQuestion's first lines.

Not verified here: the Mac app window itself; the board on a real box through the app (the data path was checked on a real box's API as above).

Merge Danger

Door: two-way

App only. No daemon or API change; it uses endpoints boxes already serve (transcript?since, transcript?before). Revert the commit to undo.

Blast Radius: dashboard

Only chat agents' cards change, plus useScreenTail's read loop (now useCardRead, shared), which terminal cards run on. Boxes without the transcript capability show no box on chat cards (never host frames). Boxes without history show no quote.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown

@Stener1 is attempting to deploy a commit to the seanbrydonio's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Stener1

Stener1 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

CI: this fork's account can't add the run-ci label here, so a maintainer needs to add it (or approve the workflow run). The checks from AGENTS.md were run locally and pass: Go vet + go test -race ./..., the app's checks + pnpm test (589) + build, tsc -p e2e, the docs build, and the touched browser specs (listed in Evidence).

… not its host's frames

An agent that runs in chat has only berthd agent-host in its pane, so its
Agent Dashboard card showed the host's log ("out stream_event", "out
control_request") and quoted "stdio", the last word of the host's
command line. Its card now reads the agent instead:

- waiting: Session.ask, the reason and command (or the question), with
  ask.choices as chips;
- otherwise: the last lines of its newest reply or step, from the
  transcript read as a chat reads it (since=N: the recent window once,
  then what was added), one read at a time, in place of the screen read
  and as often;
- the quote: the conversation's opening prompt or command, read once
  from the record's start;
- hidden when there is nothing yet. Terminal cards are unchanged.

The mock's ?structured runs four agents in chat with the host's command
line and pane log; verify-berthd gets the chat-board-cards scenario and
e2e the dashboard-chat-cards spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Stener1
Stener1 force-pushed the chat-cards-show-what-the-agent-does branch from 2b7e848 to 0f16d67 Compare October 23, 2026 23:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants