/** * Shared tool policy and execution record types. */ import { z } from "zod"; export interface ToolPolicy { /** * Whether the tool can be executed at all. * @default true */ enabled?: boolean; /** * Whether this tool can run without asking the client for approval. * @default true */ autoApprove?: boolean; } /** * Record of a tool call execution */ export interface ToolCallRecord { /** Unique identifier for this tool call */ id: string; /** Name of the tool that was called */ name: string; /** Absent for ordinary AgentRuntime-executed tools. */ execution?: "client" | "provider"; /** Input passed to the tool */ input: unknown; /** Output returned from the tool (if successful) */ output: unknown; /** Error message (if the tool failed) */ error?: string; /** Time taken to execute the tool in milliseconds */ durationMs: number; /** Timestamp when the tool call started */ startedAt: Date; /** Timestamp when the tool call ended */ endedAt: Date; } export interface ToolApprovalRequest { /** * Core/hub runtime session identifier. * * This is the routing and lifecycle id for the task/session that owns the * tool call. Hosts and hub transports use it to deliver approval events to * clients subscribed to that session and to correlate approval responses * with the pending runtime session. It should not be used as the transcript * id for model history. */ sessionId: string; /** * Agent instance identifier. * * This identifies the lead or delegated agent that requested the tool call. * It is used for attribution in approval prompts, events, telemetry, and * team/sub-agent flows. It is not a hub routing key and should not be used * to find the owning runtime session. */ agentId: string; /** * Agent conversation/transcript identifier. * * This identifies the model conversation that produced the tool call. Tools, * hooks, telemetry, and persisted session metadata use it to correlate work * with the agent's message history. It is contextual data, not the hub event * routing key. */ conversationId: string; iteration: number; toolCallId: string; toolName: string; input: unknown; policy: ToolPolicy; } export interface ToolApprovalResult { approved: boolean; reason?: string; } export declare const ToolCallRecordSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; execution: z.ZodOptional>; input: z.ZodUnknown; output: z.ZodUnknown; error: z.ZodOptional; durationMs: z.ZodNumber; startedAt: z.ZodDate; endedAt: z.ZodDate; }, z.core.$strip>;