import { o as ToolSchema, M as MaybePromise, T as Tool, c as ToolPolicy, d as ToolInvocationListener } from './types-c3u6kU61.js'; import { ReactNode } from 'react'; interface CommandExecutionContext { query: string; close: () => void; runAgent: (input: string, options?: AgentRunOptions) => Promise; } interface CommandChoice { /** Stable identifier. A page-scoped command overrides a global command with the same id. */ id: string; label: string; description?: string; group?: string; keywords?: readonly string[]; shortcut?: readonly string[] | string; icon?: ReactNode; disabled?: boolean; priority?: number; closeOnSelect?: boolean; run: (context: CommandExecutionContext) => MaybePromise; } interface AgentToolCall { name: string; arguments?: Record; } interface AgentResponse { type: "call" | "respond" | string; success?: boolean; error?: string | null; error_code?: string | null; function_calls?: readonly AgentToolCall[]; reasoning?: string; response?: string; confidence?: number; [key: string]: unknown; } /** @deprecated Use `ToolContext`. */ interface AgentToolContext { signal: AbortSignal; step: number; input: string; invocationId?: string; source?: string; metadata?: Readonly>; } /** @deprecated Use `Tool`. Tools are independent of any Agent engine. */ type AgentTool = Record, TResult = unknown> = Tool; /** @deprecated Use `ToolSchema`. */ type AgentToolSchema = ToolSchema; interface AgentExecutedCall { call: AgentToolCall; result?: unknown; error?: string; step: number; } interface AgentRunResult { input: string; response: AgentResponse; calls: readonly AgentExecutedCall[]; steps: number; } interface AgentRunOptions { maxSteps?: number; maxNewTokens?: number; /** Calls below this confidence are returned but not executed. Defaults to 0. */ confidenceThreshold?: number; /** Override the Agent engine's system facts for this run. */ systemPrompt?: string; signal?: AbortSignal; /** Legacy per-call authorization. Return false to deny an individual Agent call. */ confirm?: (call: AgentToolCall, tool: Tool) => MaybePromise; /** Shared tool policy for lower-level Agent runners. The provider supplies its configured policy. */ toolPolicy?: ToolPolicy; /** Observe tool calls made during this Agent run. */ onToolInvocation?: ToolInvocationListener; } interface AgentOptions { /** Engine instance or lazy factory. Factories keep vendor adapters out of the initial bundle. */ engine: AgentEngine | (() => MaybePromise); /** System facts supplied whenever an Agent run initializes its tools. */ systemPrompt?: string | (() => string); /** Warm the engine after page load during idle time. Defaults to true. */ preload?: boolean; } /** Configuration for the built-in Cactus Needle WASM engine adapter. */ interface NeedleWasmEngineOptions { /** URL of the official Emscripten `needle.js` artifact. */ glueUrl: string; /** URL of the matching `needle.wasm` artifact. */ wasmUrl: string; /** URL of the matching `needle2.cact` model. */ modelUrl: string; /** Override the library's bundled classic worker. */ workerUrl?: string | URL; bufferSize?: number; maxNewTokens?: number; } interface AgentEngine { initialize(tools: readonly ToolSchema[], systemPrompt?: string): Promise; complete(input: string, maxNewTokens?: number): Promise; reset(): Promise; dispose(): void; } export type { AgentRunOptions as A, CommandChoice as C, NeedleWasmEngineOptions as N, AgentRunResult as a, AgentOptions as b, AgentEngine as c, AgentExecutedCall as d, AgentResponse as e, AgentTool as f, AgentToolCall as g, AgentToolContext as h, AgentToolSchema as i, CommandExecutionContext as j };