Type Alias: DispatchContextHooks
ts
type DispatchContextHooks = {
deletedMemory: [[string], []];
deletedMessage: [[string], []];
deletedRetrievable: [[string], []];
deletedStandingInstruction: [[Tokenizable], []];
deletedThought: [[string], []];
deletedToolCall: [[string], []];
message: [[TurnStreamableContent], []];
mutatedMemory: [[Memory], []];
mutatedMessage: [[Message], []];
mutatedRetrievable: [[Retrievable], []];
mutatedStandingInstruction: [[Tokenizable], []];
mutatedThought: [[Thought], []];
mutatedToolCall: [[ToolCall], []];
storedMemory: [[Memory], []];
storedMessage: [[Message], []];
storedRetrievable: [[Retrievable], []];
storedStandingInstruction: [[Tokenizable], []];
storedThought: [[Thought], []];
storedToolCall: [[ToolCall], []];
thought: [[TurnStreamableContent], []];
toolCall: [[TurnToolCallContent], []];
toolExecutionEnd: [[ToolExecutionEndEvent], []];
toolExecutionStart: [[ToolExecutionStartEvent], []];
};Hook event map for @nhtio/adk!DispatchContext.
Remarks
Each key maps to a tuple of [HookArgs, CleanupArgs]. These events mirror the functional and observability events on @nhtio/adk!TurnRunner but are surfaced through @nhtio/hooks rather than TypedEventEmitter, which allows the entire execution context to be garbage-collected once execution completes — no lingering listener references.
Mutation hooks (stored* / mutated* / deleted*) fire on every mutation in both standalone and derived paths. The DispatchRunner subscribes to these hooks to queue deltas for later bubbling to a parent TurnContext; users may subscribe for observability or testing.
Properties
| Property | Type | Description |
|---|---|---|
deletedMemory | [[string], []] | Fired after a memory is removed locally and from persistence. Payload is the deleted id. |
deletedMessage | [[string], []] | Fired after a message is removed locally and from persistence. Payload is the deleted id. |
deletedRetrievable | [[string], []] | Fired after a retrievable record is removed locally and from persistence. Payload is the deleted id. |
deletedStandingInstruction | [[Tokenizable], []] | Fired after a standing instruction is removed locally and from persistence. |
deletedThought | [[string], []] | Fired after a thought is removed locally and from persistence. Payload is the deleted id. |
deletedToolCall | [[string], []] | Fired after a tool call is removed locally and from persistence. Payload is the deleted id. |
message | [[TurnStreamableContent], []] | Fired when a streaming message chunk is emitted during execution. |
mutatedMemory | [[Memory], []] | Fired after a memory is mutated locally and persisted. |
mutatedMessage | [[Message], []] | Fired after a message is mutated locally and persisted. |
mutatedRetrievable | [[Retrievable], []] | Fired after a retrievable record is mutated locally and persisted. |
mutatedStandingInstruction | [[Tokenizable], []] | Fired after a standing instruction is mutated locally and persisted. |
mutatedThought | [[Thought], []] | Fired after a thought is mutated locally and persisted. |
mutatedToolCall | [[ToolCall], []] | Fired after a tool call is mutated locally and persisted. Remarks See DispatchContextHooks.storedToolCall for the fromArtifactTool / Tokenizable-shaped results invariant. |
storedMemory | [[Memory], []] | Fired after a memory is stored locally and persisted. |
storedMessage | [[Message], []] | Fired after a message is stored locally and persisted. |
storedRetrievable | [[Retrievable], []] | Fired after a retrievable record is stored locally and persisted. |
storedStandingInstruction | [[Tokenizable], []] | Fired after a standing instruction is stored locally and persisted. |
storedThought | [[Thought], []] | Fired after a thought is stored locally and persisted. |
storedToolCall | [[ToolCall], []] | Fired after a tool call is stored locally and persisted. Remarks ToolCalls with fromArtifactTool === true originated from an @nhtio/adk!ArtifactTool invocation and carry a @nhtio/adk!Tokenizable in results (NOT a @nhtio/adk!SpooledArtifact). Subsequent SpooledArtifact.forgeTools(ctx) calls filter these out of the callId enum to prevent the artifact-grep-on-an-artifact-grep recursion. |
thought | [[TurnStreamableContent], []] | Fired when a reasoning trace chunk is emitted during execution. |
toolCall | [[TurnToolCallContent], []] | Fired when a tool call is emitted (on request and again on settlement). |
toolExecutionEnd | [[ToolExecutionEndEvent], []] | Fired after a tool handler returns or throws. |
toolExecutionStart | [[ToolExecutionStartEvent], []] | Fired immediately before a tool handler is called (after arg validation). |