/** AsyncLocalStorage propagates the executing action’s modelClass to nested useModel calls across asynchronous boundaries. */ import type { BoundRequestOperationAttempt } from "../actions/task-extraction-context.js"; import type { ActionModelClass } from "../types/components.js"; import type { Memory } from "../types/memory.js"; import type { IAgentRuntime } from "../types/runtime.js"; import type { State } from "../types/state.js"; export interface ActionRoutingContext { /** Name of the action currently executing. Surfaced for telemetry. */ readonly actionName: string; /** The action's `modelClass` hint, if set. */ readonly modelClass: ActionModelClass | undefined; /** Trusted caller owns final synthesis; never inferred from tool arguments. */ readonly replyOwner?: "planner"; readonly messageId?: string; /** Host-only current action provenance; never populated from tool arguments. */ readonly requestMessage?: Memory; readonly requestState?: State; readonly requestRuntime?: IAgentRuntime; readonly hostAttemptId?: string; /** Actual opaque executor attempt, never reconstructed from that string. */ readonly requestOperationAttempt?: BoundRequestOperationAttempt; } export declare function runWithActionRoutingContext(ctx: ActionRoutingContext | undefined, fn: () => T | Promise): T | Promise; export declare function getActionRoutingContext(): ActionRoutingContext | undefined; /** * Run `fn` with the action routing context temporarily cleared. Used by the * runtime's `useModel` to invoke a routed sub-call without re-entering the * routing seam (which would otherwise loop on the same chain). */ export declare function runWithoutActionRoutingContext(fn: () => T | Promise): T | Promise;