MessageAddedEvent
Defined in: src/hooks/events.ts:234
Event triggered when the framework adds a message to the conversation history.
Fired for user input, assistant responses, and tool-result messages added
during agent execution. Does not fire for messages preloaded via
AgentConfig.messages or messages manually pushed to agent.messages.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MessageAddedEvent(data): MessageAddedEvent;Defined in: src/hooks/events.ts:240
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | { agent: LocalAgent; message: Message; invocationState: InvocationState; } & HookableEventData |
Returns
Section titled “Returns”MessageAddedEvent
Overrides
Section titled “Overrides”Properties
Section titled “Properties”invocationContext?
Section titled “invocationContext?”readonly optional 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: "messageAddedEvent";Defined in: src/hooks/events.ts:235
readonly agent: LocalAgent;Defined in: src/hooks/events.ts:236
message
Section titled “message”readonly message: Message;Defined in: src/hooks/events.ts:237
invocationState
Section titled “invocationState”readonly invocationState: InvocationState;Defined in: src/hooks/events.ts:238
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): Pick<MessageAddedEvent, "type" | "message">;Defined in: src/hooks/events.ts:251
Serializes for wire transport, excluding the agent reference and invocationState. Called automatically by JSON.stringify().
Returns
Section titled “Returns”Pick<MessageAddedEvent, "type" | "message">