feat(core): add fullStreamToUIMessageStream for subagent metadata
Draft
MA
9mo ago+847+847+012345678901234567890123456789-69-69-01234567890123456789
Summary
- Add
fullStreamToUIMessageStreammethod to convert fullStream to UIMessageStream with subagent metadata preserved - Add
fullStreamToUIMessageStreamResponsemethod for direct HTTP streaming responses - Fix PlanAgent to register subagents with parent Agent class for proper event forwarding
Test plan
- Verify streaming with subagent metadata propagates correctly
- Test
fullStreamToUIMessageStreamreturns proper UIMessageChunk format - Test
fullStreamToUIMessageStreamResponsereturns valid Response object
🤖 Generated with Claude Code
Summary by cubic
Adds helpers to convert fullStream to UIMessageStream while preserving subagent metadata across all chunk types, enabling correct UI chunks and direct HTTP streaming. Also fixes PlanAgent to forward subagent events by registering subagents with the parent Agent.
-
New Features
- Added fullStreamToUIMessageStream(...) to emit UI message chunks with subagent context (subAgentId, subAgentName, executingAgentId, executingAgentName, parentAgentId, parentAgentName, agentPath).
- Added fullStreamToUIMessageStreamResponse(...) for direct HTTP streaming.
- Config flags to include/exclude: text deltas, reasoning, sources, tool events (call/result/input start/input delta/error), start/finish, errors; plus custom error handler.
- Exported SUBAGENT_METADATA_KEYS and SubagentMetadata in the public API.
-
Bug Fixes
- PlanAgent now registers subagents with the parent Agent so fullStreamWriter is created and subagent events propagate correctly.
- Guardrail sanitizers now set both text and delta fields for safer, correct output handling.
Summary by CodeRabbit
-
New Features
- UI streaming API now emits configurable, UI-ready message chunks that include subagent metadata and support async stream and HTTP response outputs.
-
Improvements
- Parent agent registers and forwards subagents for reliable event routing.
- Granular toggles to filter which stream events are emitted (text, reasoning, sources, tool events, start/finish/error) and customizable error handling.
- Subagent metadata and metadata keys exposed in public API.
-
Tests
- Comprehensive unit tests and mock hooks validating UI stream conversion and metadata propagation.
-
Documentation
- Added guide on converting full streams to UI message format (content duplicated).
✏️ Tip: You can customize this high-level summary in your review settings.