Skip to content

ModelMessageEvent

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

Event triggered when the model completes a full message. Wraps the assembled message and stop reason after model streaming finishes.

new ModelMessageEvent(data): ModelMessageEvent;

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

ParameterType
data{ agent: LocalAgent; message: Message; stopReason: StopReason; invocationState: InvocationState; } & HookableEventData

ModelMessageEvent

HookableEvent.constructor

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.

HookableEvent.invocationContext


readonly type: "modelMessageEvent";

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


readonly agent: LocalAgent;

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


readonly message: Message;

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


readonly stopReason: StopReason;

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


readonly invocationState: InvocationState;

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

toJSON(): Pick<ModelMessageEvent, "type" | "message" | "stopReason">;

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

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

Pick<ModelMessageEvent, "type" | "message" | "stopReason">