ContentBlockEvent
Defined in: src/hooks/events.ts:609
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.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ContentBlockEvent(data): ContentBlockEvent;Defined in: src/hooks/events.ts:615
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { agent: LocalAgent; contentBlock: ContentBlock; invocationState: InvocationState; } & HookableEventData |
Returns
Section titled “Returns”ContentBlockEvent
Overrides
Section titled “Overrides”Properties
Section titled “Properties”invocationContext?
Section titled “invocationContext?”readonly invocationContext?: InvocationContext;Defined in: src/hooks/events.ts:100
The request this event belongs to (undefined outside one); pass it to InvokeOptions.invocationContext to join it.
Inherited from
Section titled “Inherited from”HookableEvent.invocationContext
readonly type: "contentBlockEvent";Defined in: src/hooks/events.ts:610
readonly agent: LocalAgent;Defined in: src/hooks/events.ts:611
contentBlock
Section titled “contentBlock”readonly contentBlock: ContentBlock;Defined in: src/hooks/events.ts:612
invocationState
Section titled “invocationState”readonly invocationState: InvocationState;Defined in: src/hooks/events.ts:613
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): Pick<ContentBlockEvent, "type" | "contentBlock">;Defined in: src/hooks/events.ts:628
Serializes for wire transport, excluding the agent reference and invocationState. Called automatically by JSON.stringify().
Returns
Section titled “Returns”Pick<ContentBlockEvent, "type" | "contentBlock">