import { c as VaultOptions, a as Vault } from './vault.interface-BZt4wlVo.js'; declare enum MessageRole { USER = "user", ASSISTANT = "assistant", SYSTEM = "system" } type ContentPart = { type: "text"; text: string; } | { type: "image"; data: string; mediaType: string; } | { type: "image-url"; url: string; } | { type: "file"; data: string; mediaType: string; name?: string; }; interface Message { role: MessageRole; content: string | ContentPart[]; } /** Normalized tool output; provider parsers map into this shape. */ type ToolResultContent = { type: "text"; text: string; } | { type: "citation"; url: string; title?: string; excerpts?: string[]; } | { type: "json"; value: unknown; } | { type: "media"; mediaType: string; data: string; name?: string; } | { type: "unknown"; providerType: string; data: Record; }; interface ToolResult { toolUseId: string; content: ToolResultContent[]; isError?: boolean; approved?: boolean; } interface RequestParams { /** Messages for this turn. May include system, user, and assistant messages. */ messages: Message[]; /** Opaque session identifier returned by a prior response. Absent means start a new session. */ sessionId?: string; /** Vault IDs to bind to this request (credentials available to MCP servers). */ vaultIds?: string[]; /** Approval responses or tool outputs from a previous requires-action turn. */ toolResults?: ToolResult[]; /** Pass-through options forwarded directly to the underlying provider SDK call. */ providerOptions?: Record; /** When fired, the SDK closes the connection and the operation yields an `AbortedError`. */ abortSignal?: AbortSignal; /** Metadata forwarded in the webhook payload for routing/context on the receiving end. */ webhookMetadata?: Record; } interface SessionOptions { vaultIds?: string[]; providerOptions?: Record; } interface Usage { inputTokens?: number; outputTokens?: number; totalTokens?: number; } type ToolSource = { type: "builtin"; } | { type: "custom"; } | { type: "mcp"; serverName: string; }; type McpApprovalPolicy = "always" | "never" | { except: string[]; }; interface McpServerConfig { name: string; url: string; authorization?: string; allowedTools?: string[]; approvalPolicy?: McpApprovalPolicy; } interface McpToolDef { name: string; description?: string; inputSchema?: Record; } type ActionRequired = { type: "tool-confirmation"; toolUseId: string; toolName: string; input?: Record; } | { type: "mcp-approval"; toolUseId: string; toolName: string; serverName: string; input?: Record; }; interface Response { content: string; /** Session identifier to pass as `sessionId` on the next turn to continue the conversation. */ sessionId?: string; finishReason: "stop" | "length" | "error" | "requires-action" | "refused" | "other"; usage?: Usage; actionsRequired?: ActionRequired[]; } type AgentStatus = "running" | "queued" | "retrying" | "idle"; type StreamPart = { type: "text-delta"; text: string; } | { type: "refusal"; text: string; } | { type: "thinking"; text: string; } | { type: "tool-use-start"; toolName: string; toolUseId: string; source?: ToolSource; } | { type: "tool-use-delta"; toolUseId: string; argumentsDelta: string; } | { type: "tool-use-done"; toolName: string; toolUseId: string; input?: Record; source?: ToolSource; } | { type: "tool-use-result"; toolUseId: string; content: ToolResultContent[]; isError?: boolean; source?: ToolSource; } | { type: "mcp-tools-discovered"; serverName: string; tools: McpToolDef[]; } | { type: "step-start"; stepIndex: number; } | { type: "step-done"; stepIndex: number; } | { type: "status-change"; status: AgentStatus; } | { type: "stream-start"; sessionId?: string; } | { type: "finish"; response: Response; } | { type: "error"; error: Error; } | { type: "provider-event"; provider: string; event: string; data: Record; }; interface StreamCallbacks { /** Fires for every stream part, before type-specific callbacks. */ onPart?: (part: StreamPart) => void | Promise; onTextDelta?: (part: Extract) => void | Promise; onThinking?: (part: Extract) => void | Promise; onRefusal?: (part: Extract) => void | Promise; onToolUseStart?: (part: Extract) => void | Promise; onToolUseDelta?: (part: Extract) => void | Promise; onToolUseDone?: (part: Extract) => void | Promise; onToolUseResult?: (part: Extract) => void | Promise; onMcpToolsDiscovered?: (part: Extract) => void | Promise; onStepStart?: (part: Extract) => void | Promise; onStepDone?: (part: Extract) => void | Promise; onStatusChange?: (part: Extract) => void | Promise; onStreamStart?: (part: Extract) => void | Promise; onFinish?: (part: Extract) => void | Promise; onError?: (part: Extract) => void | Promise; onProviderEvent?: (part: Extract) => void | Promise; } interface SendResult extends PromiseLike { /** Unique identifier for this `send()` invocation. Known synchronously. */ readonly runId: string; readonly sessionId: Promise; readonly response: Promise; text(): Promise; } interface WebhookSendResult { sessionId: string; /** Unique identifier for this `send()` invocation, also present in every webhook event. */ runId: string; } type SessionEventsFactory = (sessionId: string, runId: string) => StreamCallbacks; interface BaseProvider { readonly provider: string; readonly runtimeId: string; createVault(options: VaultOptions): Promise; getVault(vaultId: string): Promise; createSession(options?: SessionOptions): Promise; endSession(sessionId: string): Promise; } interface StreamingProvider extends BaseProvider { send(params: RequestParams): SendResult; } interface WebhookProvider extends BaseProvider { send(params: RequestParams): Promise; } type Provider = StreamingProvider | WebhookProvider; declare const ANTHROPIC: "anthropic"; declare const OPENAI: "openai"; export { ANTHROPIC as A, type ContentPart as C, type Message as M, OPENAI as O, type Provider as P, type RequestParams as R, type SessionEventsFactory as S, type ToolResult as T, type Usage as U, type WebhookProvider as W, type StreamingProvider as a, type McpServerConfig as b, type StreamCallbacks as c, type StreamPart as d, type SendResult as e, type ActionRequired as f, type AgentStatus as g, type McpApprovalPolicy as h, type McpToolDef as i, MessageRole as j, type Response as k, type SessionOptions as l, type ToolResultContent as m, type ToolSource as n, type WebhookSendResult as o };