Skip to content

mergeToolOutputIntoEvents

mergeToolOutputIntoEvents(inner): AsyncGenerator<AgentStreamEvent>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/toolOutputChannel.ts:160

Merge live tool output into an agent event stream: subscribes to the channel for the lifetime of inner and yields each emitted chunk as a tool_output event, interleaved with inner’s own events in arrival order. Because tool child output arrives WHILE the graph stream is awaiting its next message, the merge is push-based (a woken queue), so a long-running command’s output streams into the consumer live rather than batching until the tool finishes.

Used by the TUI session around processMessagesWithEvents; always unsubscribes (restoring the default stdout sink) when the inner stream completes, throws, or the consumer stops early. Errors from inner (including aborts) propagate unchanged after the queue drains.

AsyncGenerator<AgentStreamEvent>

AsyncGenerator<AgentStreamEvent>