import type { AgentEvent, StoredMessage, ToolContext, ToolDefinition } from "./types.js";
import type { Provider } from "./providers/types.js";
export interface ApprovalDecision {
    allow: boolean;
    reason?: string;
}
export type ApprovalCallback = (toolName: string, toolInput: unknown) => Promise<ApprovalDecision> | ApprovalDecision;
/**
 * Mid-session system-prompt hot-reload (Phase 1.1 of AUTONOMY_ROADMAP).
 *
 * If provided, the agent loop calls `rebuild()` at the top of every turn
 * after the first. If the returned `fingerprint` differs from the stored
 * one, the new `text` becomes the system prompt for the next provider call.
 * This lets soul_patch / skill_create / memory writes take effect within
 * the same conversation rather than only next session.
 *
 * Cost: one cheap fingerprint check per turn. When the fingerprint changes
 * the next provider call has a cache miss on the system prompt — accepted
 * cost for the agent actually experiencing her own self-update.
 */
export interface PromptHotReload {
    initialFingerprint: string;
    rebuild: () => Promise<{
        text: string;
        fingerprint: string;
    }>;
}
export interface RunAgentOptions {
    provider: Provider;
    systemPrompt: string;
    tools: ToolDefinition[];
    toolCtx: ToolContext;
    history: StoredMessage[];
    userMessage: string;
    userFiles?: Array<{
        name: string;
        mediaType: string;
        data: string;
    }>;
    model: string;
    maxTokens?: number;
    thinking?: boolean;
    compaction?: boolean;
    onEvent?: (event: AgentEvent) => void;
    onMessagePersist?: (message: StoredMessage) => Promise<void> | void;
    approval?: ApprovalCallback;
    preToolHook?: (name: string, input: unknown) => Promise<{
        block?: string;
        rewriteResult?: string;
    } | void>;
    postToolHook?: (name: string, input: unknown, result: string, isError: boolean) => Promise<{
        rewriteResult?: string;
    } | void>;
    maxIterations?: number;
    /** When set, the system prompt is rebuilt between turns if its source state changed. */
    hotReload?: PromptHotReload;
}
export interface RunAgentResult {
    finalText: string;
    history: StoredMessage[];
    iterations: number;
    cacheReadTokens: number;
    cacheWriteTokens: number;
    inputTokens: number;
    outputTokens: number;
    stopReason: string;
}
export declare function runAgent(opts: RunAgentOptions): Promise<RunAgentResult>;
export declare function extractTextFromContent(content: StoredMessage["content"]): string;
//# sourceMappingURL=agent.d.ts.map