BeforeModelCallEvent
Defined in: src/hooks/events.ts:323
Event triggered just before the model is invoked. Fired before sending messages to the model for inference.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BeforeModelCallEvent(data): BeforeModelCallEvent;Defined in: src/hooks/events.ts:344
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { agent: LocalAgent; model: Model; invocationState: InvocationState; projectedInputTokens?: number; } |
data.agent | LocalAgent |
data.model | Model |
data.invocationState | InvocationState |
data.projectedInputTokens? | number |
Returns
Section titled “Returns”BeforeModelCallEvent
Overrides
Section titled “Overrides”Properties
Section titled “Properties”readonly type: "beforeModelCallEvent";Defined in: src/hooks/events.ts:324
readonly agent: LocalAgent;Defined in: src/hooks/events.ts:325
readonly model: Model;Defined in: src/hooks/events.ts:326
invocationState
Section titled “invocationState”readonly invocationState: InvocationState;Defined in: src/hooks/events.ts:327
cancel
Section titled “cancel”cancel: string | boolean = false;Defined in: src/hooks/events.ts:334
Set by hook callbacks to cancel this model call.
When set to true, a default cancel message is used.
When set to a string, that string is used as the assistant response message.
projectedInputTokens?
Section titled “projectedInputTokens?”readonly optional projectedInputTokens?: number;Defined in: src/hooks/events.ts:342
Projected input token count for the upcoming model call. Computed by the agent loop from message metadata and token estimation. Available for hooks and plugins (e.g. conversation managers) to make proactive decisions about context management.
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): Pick<BeforeModelCallEvent, "type" | "projectedInputTokens">;Defined in: src/hooks/events.ts:363
Serializes for wire transport, excluding the agent reference and invocationState. Called automatically by JSON.stringify().
Returns
Section titled “Returns”Pick<BeforeModelCallEvent, "type" | "projectedInputTokens">