import { D as DualPathVerifier } from './router-w_4lkJaq.js'; import { ZodSchema } from 'zod'; type VerificationSeverity = "critical" | "warning" | "info"; interface VerificationCheck { name: string; passed: boolean; severity: VerificationSeverity; message: string; } interface VerificationRule { name: string; check: (toolName: string, input: Record, context: VerificationContext) => VerificationCheck; } interface VerificationContext { turnCount: number; previousToolCalls: Array<{ name: string; input: Record; }>; cwd: string; } interface VerificationResult { approved: boolean; checks: VerificationCheck[]; rejectedBy?: string; reason?: string; } declare class ToolVerifier { private rules; constructor(); addRule(rule: VerificationRule): void; verify(toolName: string, input: Record, context: VerificationContext): VerificationResult; } /** JSON Schema representation of a tool for LLM function calling APIs. */ interface APIToolDefinition { name: string; description: string; input_schema: Record; } /** Core tool abstraction that every tool must implement. */ interface Tool

{ readonly name: string; readonly description: string; readonly inputSchema: ZodSchema

; readonly isReadOnly: boolean; readonly isConcurrencySafe: boolean; execute(input: P, context: ToolContext): Promise; toAPI(): APIToolDefinition; toString(input: P): string; } /** Configuration object for defining a tool. */ interface ToolExecuteOptions

{ name: string; description: string; inputSchema: ZodSchema

; isReadOnly?: boolean; isConcurrencySafe?: boolean; execute: (input: P, context: ToolContext) => Promise; } /** Define a tool from a configuration object. */ declare function defineTool

(config: ToolExecuteOptions

): Tool

; /** Wrap a class-based tool into the standard Tool interface. */ declare function defineToolFromClass(ctor: new () => Tool): Tool; interface StreamEvent { type: "text_delta" | "tool_use_start" | "tool_use_delta" | "tool_result" | "done" | "error"; text?: string; id?: string; name?: string; input?: string; output?: string; usage?: TokenUsage; error?: Error; } declare function createStreamAggregator(): { push: (event: StreamEvent) => void; getResponse: () => { text: string; toolCalls: { id: string; name: string; input: string; }[]; usage?: TokenUsage; stopReason: string; }; }; interface Provider { readonly model: string; chat(request: ChatRequest): Promise; chatStream?(request: ChatRequest): AsyncGenerator; } interface ChatRequest { messages: ChatMessage[]; tools?: APIToolDefinition[]; systemPrompt?: string; maxOutputTokens?: number; temperature?: number; abortSignal?: AbortSignal; } interface ChatMessage { role: "user" | "assistant" | "tool"; content: string | ContentBlock[]; tool_use_id?: string; is_error?: boolean; } declare class RetryableError extends Error { readonly cause?: Error; constructor(message: string, cause?: Error); } declare abstract class BaseProvider implements Provider { readonly model: string; readonly maxOutputTokens?: number; readonly temperature?: number; constructor(config: ProviderConfig); abstract chat(request: ChatRequest): Promise; protected abstract mapMessages(messages: ChatMessage[]): unknown[]; protected abstract mapTools(tools?: APIToolDefinition[]): unknown[] | undefined; protected abstract mapUsage(providerUsage: unknown): TokenUsage; protected mapStopReason(reason: string): ModelResponse["stopReason"]; } type Message = UserMessage | AssistantMessage | ToolResultMessage; interface UserMessage { role: "user"; content: string; } interface AssistantMessage { role: "assistant"; content: ContentBlock[]; } interface ToolResultMessage { role: "tool"; tool_use_id: string; content: string; is_error?: boolean; } type ContentBlock = TextBlock | ToolUseBlock | ThinkingBlock; interface TextBlock { type: "text"; text: string; } interface ToolUseBlock { type: "tool_use"; id: string; name: string; input: Record; } interface ThinkingBlock { type: "thinking"; thinking: string; } type LoopEvent = { type: "text"; text: string; } | { type: "thinking"; thinking: string; } | { type: "tool_use"; id: string; name: string; input: Record; } | { type: "tool_result"; id: string; name: string; output: string; isError: boolean; } | { type: "error"; error: Error; } | { type: "done"; usage: TokenUsage; messages: Message[]; }; interface TokenUsage { inputTokens: number; outputTokens: number; cacheReadTokens?: number; cacheWriteTokens?: number; } interface ModelResponse { content: ContentBlock[]; usage: TokenUsage; stopReason: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence"; } interface ToolContext { cwd: string; env: Record; abortSignal?: AbortSignal; } interface ProviderConfig { model: string; maxOutputTokens?: number; temperature?: number; } interface AgentConfig { model: Provider; tools?: Tool[]; systemPrompt?: string; maxTurns?: number; context?: ContextConfig; permissions?: PermissionConfig; cwd?: string; maxRetries?: number; verifier?: ToolVerifier; dualPathVerifier?: DualPathVerifier; } interface ContextConfig { maxTokens?: number; compactThreshold?: number; maxOutputTokens?: number; } interface PermissionConfig { allowedTools?: string[]; deniedTools?: string[]; askTools?: string[]; defaultAction?: "allow" | "deny" | "ask"; } interface CompactionResult { messages: Message[]; tokensSaved: number; method: "snip" | "compact" | "none"; } declare const DEFAULT_CONTEXT_WINDOW = 200000; declare const DEFAULT_MAX_OUTPUT_TOKENS = 16384; declare const DEFAULT_COMPACT_THRESHOLD = 0.85; declare const DEFAULT_MAX_TURNS = 100; declare const MAX_CONCURRENT_TOOLS = 10; export { type APIToolDefinition as A, BaseProvider as B, type ChatRequest as C, DEFAULT_COMPACT_THRESHOLD as D, defineToolFromClass as E, type LoopEvent as L, type ModelResponse as M, type ProviderConfig as P, RetryableError as R, type StreamEvent as S, type TokenUsage as T, type UserMessage as U, type VerificationCheck as V, type ChatMessage as a, type Provider as b, type Message as c, type CompactionResult as d, type AgentConfig as e, type Tool as f, type ContextConfig as g, type PermissionConfig as h, ToolVerifier as i, type AssistantMessage as j, type ContentBlock as k, DEFAULT_CONTEXT_WINDOW as l, DEFAULT_MAX_OUTPUT_TOKENS as m, DEFAULT_MAX_TURNS as n, MAX_CONCURRENT_TOOLS as o, type TextBlock as p, type ThinkingBlock as q, type ToolContext as r, type ToolExecuteOptions as s, type ToolResultMessage as t, type ToolUseBlock as u, type VerificationContext as v, type VerificationResult as w, type VerificationRule as x, createStreamAggregator as y, defineTool as z };