-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
With @anthropic-ai/claude-agent-sdk 0.1.46/0.1.47, the SDK streams items as { type: "stream_event", event: {...}, session_id }. The adapter’s normalizeClaudeStreamMessage only inspects the top-level type and short-circuits to init when session_id is present. Result: every chunk becomes init; no message/tool_use/usage/done events are emitted, so assistant text is never captured.
Reproduce
- Use
runStreamedwithstreamPartialMessages: true. - Log events:
initonly entries withoriginalItem.type === "stream_event"(e.g.,content_block_delta/text_delta), but nomessage/done. - Final review buffer stays empty (
[no assistant response captured]).
Expected mapping
- Unwrap
stream_event.event, keepsession_id. content_block_delta/text_delta→message(delta: true).content_block_starttool_use →tool_use.message_deltausage →usage;message_stop→done.- Only actual system/sdk init should map to
init.
Versions
@headless-coder-sdk/claude-adapter: 0.22.0@headless-coder-sdk/core: 0.22.0@anthropic-ai/claude-agent-sdk: 0.1.46, 0.1.47- Node: 18+/25, macOS
Fix suggestion
Update normalizeClaudeStreamMessage to unwrap stream_event, handle content_block_*/message_delta/message_stop, and stop treating the mere presence of session_id as init.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working