import type { Message, Tool } from 'ollama';
import type { ChatResult, IChatClient, StreamChunk } from './chatClient';
export type { ChatResult, StreamChunk, TokenUsage } from './chatClient';
export interface OllamaChatRetryEvent {
    type: 'model_retry';
    model: string;
    attempt: number;
    maxAttempts: number;
    delayMs: number;
    reason: string;
}
export declare function drainOllamaChatRetryEvents(): OllamaChatRetryEvent[];
export interface OllamaClientConfig {
    host?: string;
    model: string;
    keepAlive?: string;
    numCtx?: number;
}
export declare class OllamaClient implements IChatClient {
    private client;
    private model;
    private keepAlive;
    private numCtx?;
    constructor(config: OllamaClientConfig);
    chat(messages: Message[], tools?: Tool[], abortSignal?: AbortSignal): Promise<ChatResult>;
    chatOnce(messages: Message[], tools?: Tool[]): Promise<ChatResult>;
    chatStream(messages: Message[], tools?: Tool[], abortSignal?: AbortSignal): AsyncGenerator<StreamChunk>;
    listModels(): Promise<string[]>;
    getContextWindow(): Promise<number | null>;
    healthCheck(): Promise<{
        ok: boolean;
        error?: string;
    }>;
    getModel(): string;
}
/**
 * Some Ollama models (notably qwen2.5-coder, several gemma variants, and
 * older deepseek builds) ignore the structured `tool_calls` field and emit
 * tool invocations as JSON inside `message.content`. The agent loop only
 * dispatches when `message.tool_calls` is populated, so without this lift
 * the harness sees a chatty model and stops after one turn.
 * This function scans `message.content` for objects shaped like
 * `{ "name": "...", "arguments": {...} }` (also accepting the OpenAI
 * `function_call` shape) and promotes them to `message.tool_calls`. It
 * preserves any pre-existing structured tool_calls, never throws on
 * malformed JSON, and removes only the matched JSON spans from the
 * surfaced text content so the UI does not double-render the call.
 */
export declare function liftInlineToolCalls(message: Message | undefined): void;
export declare function longLivedFetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
//# sourceMappingURL=ollamaClient.d.ts.map