Skip to content

createPlainToolIndication

createPlainToolIndication(emit?, isRaterClarification?): PlainToolIndicationObserver

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/plainToolIndication.ts:67

Create the per-stream observer. State is scoped to one stream (one agent.stream() call); tool_call deltas are accumulated from tool_call_chunks (keyed by the provider’s chunk index, which restarts per LLM round — the map is flushed into the by-id map whenever a ToolMessage arrives, mirroring processEventStream’s reset-per-round). Deliberately does NOT concat() whole AIMessageChunks: only the tool-call slices are needed, which also sidesteps the TUI-C29 __raw_response aggregation-growth trap entirely.

emit is injectable for tests; production uses the INFO-level displayToolIndication.

(text) => void

(toolCallId) => boolean

[[TUI-C69]] §5.4 — was this call refused back to the agent as a negotiation round? Asked per tool-call id at the moment the result is rendered, never earlier: the gate decides while this stream is being drained, so a snapshot taken when the observer was built would always say no.

Defaults to “nothing is a clarification”, which is what a surface with no gate behind it (and every existing caller) means.

PlainToolIndicationObserver