TurnSink
TurnSink =
object
Defined in: types/channel-types/index.ts:193
A provider’s output for one turn. Each optional member maps 1:1 onto an
optional runTurn dep: supplying onTextChunk or onReasoningChunk puts
runTurn on its streamText path. Google Chat supplies only
onReasoningChunk (never onTextChunk), so answer streaming never starts there.
Properties
Section titled “Properties”dispose
Section titled “dispose”dispose: () =>
void
Defined in: types/channel-types/index.ts:211
Release per-turn resources. Idempotent.
Returns
Section titled “Returns”void
finalize
Section titled “finalize”finalize: (
finalText,info?) =>Promise<void>
Defined in: types/channel-types/index.ts:209
Deliver the model’s complete final text, with what the core says about it (see FinalizeInfo).
Parameters
Section titled “Parameters”finalText
Section titled “finalText”string
Returns
Section titled “Returns”Promise<void>
onReasoningChunk?
Section titled “onReasoningChunk?”
optionalonReasoningChunk?: (chunk,id) =>void
Defined in: types/channel-types/index.ts:201
Reasoning-token delta (Ollama extended thinking, behind OLLAMA_THINK). Present ⇒ streamText. Never reaches SessionHistory. id is the reasoning-block id; a turn can reason more than once, each burst with its own id.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”void
onReasoningEnd?
Section titled “onReasoningEnd?”
optionalonReasoningEnd?: (id,failed) =>void
Defined in: types/channel-types/index.ts:203
Closes a reasoning block that started (even if the turn aborts with it open), so a live display doesn’t get stuck. Never for an id onReasoningChunk didn’t report. failed is true only on abort.
Parameters
Section titled “Parameters”string
failed
Section titled “failed”boolean
Returns
Section titled “Returns”void
onStep?
Section titled “onStep?”
optionalonStep?: (step) =>void
Defined in: types/channel-types/index.ts:205
Provider-local per-step bookkeeping (the terminal’s /dump buffer).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
onTextChunk?
Section titled “onTextChunk?”
optionalonTextChunk?: (chunk) =>void
Defined in: types/channel-types/index.ts:199
Present ⇒ runTurn uses streamText. Must stay undefined for Google Chat’s own answer delivery.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
onToolFinish?
Section titled “onToolFinish?”
optionalonToolFinish?: (toolCallId,outcome) =>void
Defined in: types/channel-types/index.ts:197
Paired with onToolStart via toolCallId once the call settles. Optional — only Google Chat implements it (patches its status card).
Parameters
Section titled “Parameters”toolCallId
Section titled “toolCallId”string
outcome
Section titled “outcome”Returns
Section titled “Returns”void
onToolStart
Section titled “onToolStart”onToolStart: (
label,detail?,toolCallId?,toolName?) =>void
Defined in: types/channel-types/index.ts:195
onToolStart for buildTools. detail/toolCallId present for a real tool call or a capture-ping with its own id; both undefined = a caller with no correlation id. toolName only for a real tool call (the model’s tool, e.g. jiraCommand), never for a capture-ping.
Parameters
Section titled “Parameters”string
detail?
Section titled “detail?”string
toolCallId?
Section titled “toolCallId?”string
toolName?
Section titled “toolName?”string
Returns
Section titled “Returns”void
onUsage?
Section titled “onUsage?”
optionalonUsage?: (inputTokens) =>void
Defined in: types/channel-types/index.ts:207
Provider-local usage handling (the terminal’s prompt indicator, Chat’s stderr line).
Parameters
Section titled “Parameters”inputTokens
Section titled “inputTokens”number | undefined
Returns
Section titled “Returns”void