import type { Action, ActionResult, HandlerOptions, StreamChunkCallback } from "../types/components.js"; import type { AgentContext, RoleGateRole } from "../types/contexts.js"; import type { Memory } from "../types/memory.js"; import type { IAgentRuntime } from "../types/runtime.js"; import type { State } from "../types/state.js"; import type { PlannerToolCall } from "./planner-types.js"; import { type EntityAliasCapabilityMap } from "./tool-arg-aliases.js"; export interface ExecutePlannedToolCallContext { message: Memory; /** The parent turn will synthesize from complete action results. */ replyOwner?: "planner"; state?: State; activeContexts?: readonly AgentContext[]; userRoles?: readonly RoleGateRole[]; previousResults?: readonly ActionResult[]; callback?: Parameters[4]; responses?: Memory[]; /** * Explicit per-turn alias grants for redaction placeholders in tool args *. When absent, the executor mints the map itself via * `buildTurnEntityAliases` from the composed state, resolved roles, and * canonical owner context; supplying it lets a planner boundary pass a * pre-authorized capability map. Never sourced from ambient settings. */ entityAliases?: EntityAliasCapabilityMap; } export type ExecutePlannedToolCallOptions = HandlerOptions & { actions?: readonly Action[]; onStreamChunk?: StreamChunkCallback; abortSignal?: AbortSignal; /** * Observes the normalized handler result immediately after settlement and * before post-execution bookkeeping can fail. Sensitive and owner-exclusive * payloads are projected before observation. The observer is isolated from * action execution and is never forwarded into HandlerOptions. */ onSettledResult?: (result: ActionResult) => void; /** Projected settlement for turn-owned recovery before buffered callbacks. */ onBeforeCallbacks?: (result: ActionResult) => void; }; /** * A result may opt out per invocation because multi-mode actions only return * sensitive data for some operations. Static action metadata remains the * stronger default for actions whose every result is sensitive. */ export declare function shouldSuppressActionResultClipboard(action: Pick | undefined, result: { data?: Readonly>; }): boolean; /** * Keep the outcome and intentional user-facing projections while removing the * structured payload that must not enter planner prompts or client clipboards. */ export declare function projectActionResultForClipboard(action: Pick | undefined, result: ActionResult, actionName?: string | undefined): ActionResult; export declare function executePlannedToolCall(runtime: IAgentRuntime, ctx: ExecutePlannedToolCallContext, toolCall: PlannerToolCall, options?: ExecutePlannedToolCallOptions): Promise; /** * Treat an empty-string value as omitted only when an OPTIONAL parameter * explicitly declares that model omission sentinel. * * Some strict provider schemas force the model to emit every key. Actions that * observed `""` as the provider's unset representation opt in through * `modelOmissionSentinels`; other actions may use an empty string as legitimate * data and must receive it byte-for-byte. Required parameters are always left * untouched so an empty required value still fails loudly. */ export declare function dropEmptyOptionalArgs(action: Action, args: Record): Record;