Skip to content

ModelMessageEvent

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

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:644

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:638


readonly agent: LocalAgent;

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


readonly message: Message;

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


readonly stopReason: StopReason;

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


readonly invocationState: InvocationState;

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

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

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

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

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