Skip to content

ContentBlockEvent

Defined in: src/hooks/events.ts:571

Event triggered when a content block completes during model inference. Wraps completed content blocks (TextBlock, ToolUseBlock, ReasoningBlock) from model streaming. This is intentionally separate from ModelStreamUpdateEvent. The model’s streamAggregated() yields two kinds of output: ModelStreamEvent (transient streaming deltas — partial data arriving while the model generates) and ContentBlock (fully assembled results after all deltas accumulate). These represent different granularities with different semantics, so they are wrapped in distinct event classes rather than combined into a single event.

new ContentBlockEvent(data): ContentBlockEvent;

Defined in: src/hooks/events.ts:577

ParameterType
data{ agent: LocalAgent; contentBlock: ContentBlock; invocationState: InvocationState; }
data.agentLocalAgent
data.contentBlockContentBlock
data.invocationStateInvocationState

ContentBlockEvent

HookableEvent.constructor

readonly type: "contentBlockEvent";

Defined in: src/hooks/events.ts:572


readonly agent: LocalAgent;

Defined in: src/hooks/events.ts:573


readonly contentBlock: ContentBlock;

Defined in: src/hooks/events.ts:574


readonly invocationState: InvocationState;

Defined in: src/hooks/events.ts:575

toJSON(): Pick<ContentBlockEvent, "type" | "contentBlock">;

Defined in: src/hooks/events.ts:588

Serializes for wire transport, excluding the agent reference and invocationState. Called automatically by JSON.stringify().

Pick<ContentBlockEvent, "type" | "contentBlock">