githubnext/chopinPublic

Let's compose rich plans together

Stream Planner tool calls from their own start and end, including Atomic's own tools (#306)

A Planner turn looked frozen: a tool row appeared only once the model's
input was complete, and settled only when the harness finished the whole
model step. Under HARNESS=atomic, Atomic's builtin, extension, workflow and
subagent tools never reached the chat at all. If they had, the fixed
PLANNER_TOOL_NAMES check would have aborted the turn.

Server and protocol only. The chat presentation is Maggie's design work
(#296), so apps/web is unchanged, and every wire addition is optional:
- Activity.startedAt (server time when the tool's input began),
  Activity.refused, and Turn.startedAt in milliseconds. A client that
  ignores them keeps working.
- A row opens on tool-input-start and settles when the tool itself
  finishes. Host tools report through a wrapper on execute, because
  HarnessAgent buffers results until step end. Partial output updates the
  running row.
- Args and results are truncated and secrets masked. read_reference
  output stays private.
- The Atomic adapter turns tool_execution_* and tool-call input streaming
  into stream parts for tools Atomic runs itself. A full session's allowed
  set is its running turn's active tools. copilot-sdk and pi still fail
  closed on any tool outside their fixed set.
- Running tools are marked failed when a turn ends or a room is restored,
  and a mid-turn reconnect restores the turn and running rows from history.
- Reasoning is deliberately not sent to clients. It can quote read_reference
  content, and showing it is a design decision for #296.

Refs #306

Assistant-model: Claude Opus 5.5
Assistant-workflow: goal (run 1e1a9fe2-7263-4372-9eb3-31c679ccb69e), finished inline
Assistant-duration: 3h15m converged, estimated 2h30m
Assistant-verification: bun test passed: 3685 tests, 3 skip, 0 fail (translate tool-input/settle/boundary/reasoning-privacy cases, Atomic tool_execution_* and input-streaming cases)
Assistant-verification: bun run types passed: all workspaces
Assistant-verification: bun run ci passed: dprint, oxlint, tokens, design contract, design record, Impeccable (no new findings)
Assistant-verification: playwright e2e passed: bun run e2e e2e/harness.e2e.ts e2e/smoke.e2e.ts e2e/responsive-activity.e2e.ts, 28 passed (wire tests: tool row opens before text and settles at its own ~2.5s end inside a 7.5s turn; reconnect restores the running row and turn start)
Assistant-verification: real GitHub QA passed: githubnext/pdd-demo with HARNESS=atomic on the final build; Atomic's builtin Bash showed live and settled at 4.9s for `sleep 4`; no boundary failure in the server log
User-preference: Don't overlap teammates' in-flight UI work; leave chat, composer and design changes to Maggie's design track (#296)
User-preference: Don't show Planner reasoning where it conflicts with Maggie's design
Co-authored-by: Alex Lavaee <lavaman131@github.com>
ALAlex Lavaee authored
dfe16a9Patch
Parent009aafc
13 files changed+864-105
StackedSplit
apps/server/src/chat/activity.ts+30 −0
apps/server/src/chat/service.test.ts+214 −1
apps/server/src/chat/service.ts+140 −58
apps/server/src/harness/agents.ts+30 −1
apps/server/src/harness/atomic.contract.test.ts+1 −0
apps/server/src/harness/atomic/adapter.test.ts+85 −1
apps/server/src/harness/atomic/adapter.ts+97 −0
apps/server/src/harness/atomic/full.test.ts+52 −4
apps/server/src/harness/atomic/full.ts+7 −0
apps/server/src/harness/session.ts+12 −4
e2e/harness.e2e.ts+101 −0
e2e/harness/fake-harness.ts+87 −34
packages/protocol/chat.d.ts+8 −2