import { R as RequestAdapter } from './types-CbTsi9CZ.js';

type PromptVariableValue = string | number | boolean | null | undefined;
type PromptVariables = Record<string, PromptVariableValue>;
declare const normalizePromptVariables: (variables?: PromptVariables) => Record<string, string>;

interface AiProvider {
    id?: string;
    sendChat(request: AiChatRequest, config: ResolvedAiClientConfig): Promise<AiChatResponse>;
    streamChat?(request: AiChatRequest, config: ResolvedAiClientConfig): AsyncIterable<AiChatChunk>;
}

type AiRole = 'system' | 'user' | 'assistant' | 'tool';
type AiToolChoice = {
    type: 'function';
    function: {
        name: string;
    };
};
type AiToolDefinition = {
    type: 'function';
    function: {
        name: string;
        description?: string;
        parameters?: Record<string, any>;
    };
};
type AiToolCall = {
    id: string;
    type: 'function';
    function: {
        name: string;
        arguments: string;
    };
};
interface AiMessage {
    role: AiRole;
    content: string;
    name?: string;
    toolCallId?: string;
    toolCalls?: AiToolCall[];
}
interface AiUsage {
    promptTokens?: number;
    completionTokens?: number;
    totalTokens?: number;
}
interface AiChatRequestOptions {
    model?: string;
    temperature?: number;
    maxTokens?: number;
    topP?: number;
    stop?: string | string[];
    stream?: boolean;
    tools?: AiToolDefinition[];
    toolChoice?: 'auto' | 'none' | AiToolChoice;
}
interface AiChatRequest extends AiChatRequestOptions {
    messages: AiMessage[];
}
interface AiChatResponse {
    id: string;
    content: string;
    message?: AiMessage;
    usage?: AiUsage;
    raw?: unknown;
    toolCalls?: AiToolCall[];
}
interface AiChatChunk {
    id: string;
    content?: string;
    delta?: string;
    toolCalls?: AiToolCall[];
    raw?: unknown;
}
interface AiLogger {
    debug?: (message: string, data?: any) => void;
    info?: (message: string, data?: any) => void;
    warn?: (message: string, data?: any) => void;
    error?: (message: string, error?: any) => void;
}
interface AiClientConfig {
    apiKey?: string;
    getApiKey?: () => Promise<string> | string;
    baseUrl?: string;
    model?: string;
    headers?: Record<string, string>;
    timeoutMs?: number;
    requestAdapter?: RequestAdapter;
    logger?: AiLogger;
    provider?: AiProvider;
}
interface ResolvedAiClientConfig extends AiClientConfig {
    baseUrl: string;
    headers: Record<string, string>;
    timeoutMs: number;
}
interface AiClient {
    sendChat(request: AiChatRequest): Promise<AiChatResponse>;
    sendMessage(content: string, options?: AiChatRequestOptions & {
        systemPrompt?: string;
    }): Promise<AiChatResponse>;
}
type AiChatStatus = 'idle' | 'loading' | 'success' | 'error';
interface AiChatInputOptions extends AiChatRequestOptions {
    template?: string;
    variables?: PromptVariables;
}
interface AiChatSessionOptions {
    client: AiClient;
    systemPrompt?: string;
    template?: string;
    initialMessages?: AiMessage[];
}
interface AiChatSession {
    getMessages(): AiMessage[];
    setSystemPrompt(prompt?: string): void;
    reset(): void;
    sendMessage(input: string, options?: AiChatInputOptions): Promise<AiChatResponse>;
}

export { type AiRole as A, type PromptVariableValue as P, type ResolvedAiClientConfig as R, type AiToolChoice as a, type AiToolDefinition as b, type AiToolCall as c, type AiMessage as d, type AiUsage as e, type AiChatRequestOptions as f, type AiChatRequest as g, type AiChatResponse as h, type AiChatChunk as i, type AiLogger as j, type AiClientConfig as k, type AiClient as l, type AiChatStatus as m, type AiChatInputOptions as n, type AiChatSessionOptions as o, type AiChatSession as p, type PromptVariables as q, normalizePromptVariables as r, type AiProvider as s };
