export interface ToolCall {
    id: string;
    type: 'function';
    function: {
        name: string;
        arguments: string;
    };
}
export interface ChatMessage {
    id?: string;
    role: 'system' | 'user' | 'assistant' | 'tool';
    content: string | null | any[];
    tool_calls?: ToolCall[];
    tool_call_id?: string;
    name?: string;
    reasoning_content?: string;
    reasoning_details?: any[];
}
export interface ToolDefinition {
    type: 'function';
    function: {
        name: string;
        description: string;
        parameters: Record<string, any>;
    };
}
export interface ToolEntry {
    name: string;
    toolset: string;
    schema: Record<string, any>;
    handler: ToolHandler;
    checkFn?: () => boolean;
    requiresEnv?: string[];
    isAsync: boolean;
    description: string;
    emoji: string;
    maxResultSizeChars?: number;
}
export type ToolHandler = (args: Record<string, any>, context: ToolContext) => Promise<string> | string;
export interface ToolContext {
    signal: AbortSignal;
    sessionId: string;
    workingDir: string;
    taskId: string;
}
export interface FallbackEntry {
    baseUrl: string;
    apiKey: string;
    model?: string;
    customHeaders?: Record<string, string>;
    provider?: string;
}
export interface AgentConfig {
    /** Base URL of the LLM API (OpenAI-compatible) */
    baseUrl: string;
    /** API key for authentication */
    apiKey: string;
    /** Model identifier (e.g., 'gpt-4o', 'claude-3-opus') */
    model: string;
    /** Optional session ID for persistence (if not provided, auto-generated) */
    sessionId?: string;
    /** Maximum tool-calling iterations per turn (default: 30) */
    maxIterations?: number;
    /** Maximum output tokens (default: 4096) */
    maxTokens?: number;
    /** Sampling temperature (default: 0.7) */
    temperature?: number;
    /** Working directory for file/terminal operations */
    workingDir?: string;
    /** Ephemeral system message added to system prompt */
    systemMessage?: string;
    /** Custom headers for the LLM API request */
    customHeaders?: Record<string, string>;
    /** Fallback providers when primary fails */
    fallbacks?: FallbackEntry[];
    /** OAuth token refresh callback */
    refreshTokenCallback?: () => Promise<{
        apiKey: string;
        baseUrl?: string;
    } | null>;
    /** Called when a tool requires user approval */
    toolApprovalCallback?: (name: string, args: Record<string, any>) => Promise<boolean | 'session'>;
    /** Called for each streaming text delta */
    streamDeltaCallback?: (delta: string) => void;
    /** Called for status updates (progress, etc.) */
    statusCallback?: (status: string) => void;
    /** Optional: context window size for token estimation */
    contextWindow?: number;
    /** Optional: provider name for detection logic */
    provider?: string;
    /** Optional: extra body params sent to the API */
    extraBody?: Record<string, any>;
}
export interface LLMStreamChunk {
    id: string;
    object: string;
    created: number;
    model: string;
    choices: Array<{
        index: number;
        delta: {
            role?: string;
            content?: string | null;
            tool_calls?: Array<{
                index: number;
                id?: string;
                type?: 'function';
                function?: {
                    name?: string;
                    arguments?: string;
                };
            }>;
            reasoning_content?: string;
        };
        finish_reason: string | null;
    }>;
    usage?: {
        prompt_tokens: number;
        completion_tokens: number;
        total_tokens: number;
    };
}
export interface LLMResponse {
    id: string;
    object: string;
    created: number;
    model: string;
    choices: Array<{
        index: number;
        message: ChatMessage;
        finish_reason: string | null;
    }>;
    usage?: {
        prompt_tokens: number;
        completion_tokens: number;
        total_tokens: number;
    };
}
export interface SSEEvent {
    event: string;
    data: Record<string, any>;
}
export interface ConversationResult {
    finalResponse: string;
    messages: ChatMessage[];
    apiCalls: number;
    completed: boolean;
    failed: boolean;
    partial: boolean;
    interrupted: boolean;
    error?: string;
}
export interface SessionRow {
    sessionId: string;
    source: string;
    model: string;
    systemPrompt: string | null;
    createdAt: string;
    updatedAt: string;
}
export interface MessageRow {
    id: string;
    sessionId: string;
    role: string;
    content: string;
    toolCalls: string | null;
    toolCallId: string | null;
    name: string | null;
    createdAt: string;
}
export declare enum FailoverReason {
    rate_limit = "rate_limit",
    billing = "billing",
    context_overflow = "context_overflow",
    payload_too_large = "payload_too_large",
    overloaded = "overloaded",
    content_policy_blocked = "content_policy_blocked",
    auth_error = "auth_error",
    invalid_request = "invalid_request",
    stream_timeout = "stream_timeout",
    stream_stale = "stream_stale",
    unknown = "unknown"
}
export interface ClassifiedError {
    reason: FailoverReason;
    statusCode: number;
    message: string;
    retryable: boolean;
    rawError?: any;
}
export interface CompressionResult {
    summary: string;
    removedCount: number;
    tokenEstimate: number;
}
export interface ToolDispatchResult {
    toolCallId: string;
    name: string;
    result: string;
    isError: boolean;
    duration: number;
}
export declare enum ToolPermission {
    /** Read-only, auto-approve */
    READONLY = 1,
    /** Write operations */
    WRITE = 2,
    /** Dangerous, requires user confirmation */
    DANGEROUS = 3
}
export declare const TOOL_PERMISSIONS: Record<string, ToolPermission>;
export declare const READONLY_TOOLS: Set<string>;
//# sourceMappingURL=types.d.ts.map