Skip to content

feat(typescript): forward GroundedAgent widget chunk through the orchestrator stream - #599

Merged
cornelcroi merged 1 commit into
mainfrom
feat/typescript-orchestrator-widget-forward
Jul 14, 2026
Merged

feat(typescript): forward GroundedAgent widget chunk through the orchestrator stream#599
cornelcroi merged 1 commit into
mainfrom
feat/typescript-orchestrator-widget-forward

Conversation

@cornelcroi

Copy link
Copy Markdown
Collaborator

Issue Link

Closes #598

Summary

Makes AgentSquad.routeRequest forward a GroundedAgent { ui } widget chunk to the caller instead of dropping it. Previously the orchestrator's AccumulatorTransform forwarded only text, so widgets worked only when consuming the agent directly — a usability gap and a divergence from Python (whose orchestrator forwards the chunk unchanged).

Stacked on #597 (base feat/typescript-mcp-tool-ui) to keep the TS stack linear and update both docs notes without conflict. Merge order: #591#593#597 → this.

Changes

  • AccumulatorTransform._transform: a { ui } object chunk is pushed downstream and returns early — never added to the text accumulator, so the saved assistant text stays clean.
  • Docs: the grounded-agent and MCP notes now say the widget is delivered on the stream whether you drive the agent directly or route through the orchestrator.

User experience

Streaming via orchestrator.routeRequest, the caller now receives the { ui } widget chunk interleaved with text-string chunks (check each chunk's type) — matching how Python delivers it.

Checklist

  • Backward compatible — the new branch is entered only for object && chunk.ui; a stream with no widget is byte-identical; object chunks (thinking) already flowed through this transform; saved text unaffected
  • Tests added (widget forwarded but not accumulated; plain text unchanged; falsy .ui not treated as widget); npm run build/lint/coverage green (172 tests, 17 suites)
  • Docs updated
  • Reviewed by the TypeScript expert (APPROVED, no required changes)

Code written by Claude (Opus 4.8), architected and approved by @cornelcroi.

@cornelcroi
cornelcroi force-pushed the feat/typescript-mcp-tool-ui branch from bd3668a to 77677c6 Compare July 14, 2026 20:28
…estrator

AccumulatorTransform now forwards a { ui } object chunk to the stream consumer
and keeps it out of the accumulated text answer, so widgets reach callers via
AgentSquad.routeRequest — not only when driving the agent directly. A stream
with no widget chunk is byte-identical to before; object chunks (e.g. thinking)
already flowed through this transform. Docs updated.

Closes #598

Code written by Claude (Opus 4.8), architected and approved by @cornelcroi.
@cornelcroi
cornelcroi force-pushed the feat/typescript-orchestrator-widget-forward branch from 7ebf2b0 to 4849841 Compare July 14, 2026 20:30
@cornelcroi
cornelcroi changed the base branch from feat/typescript-mcp-tool-ui to main July 14, 2026 20:30
@cornelcroi
cornelcroi merged commit 29bbb01 into main Jul 14, 2026
7 checks passed
@cornelcroi
cornelcroi deleted the feat/typescript-orchestrator-widget-forward branch July 14, 2026 20:30
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.

TypeScript: forward GroundedAgent widget chunk through the orchestrator stream

1 participant