import type { DialogDisplayTextI18n, DialogLlmRetryExhaustedReason } from '@longrun-ai/kernel/types/display-state';
import { Dialog } from '../../dialog';
import type { FuncTool, ToolArguments } from '../../tool';
import { type LlmFailureQuirkHandlerSession } from '../api-quirks';
import type { ProviderConfig } from '../client';
import { type LlmFailureClassifier } from '../gen';
import type { KernelDriverPrompt } from './types';
export declare class LlmRetryStoppedError extends Error {
    readonly reason: DialogLlmRetryExhaustedReason;
    constructor(reason: DialogLlmRetryExhaustedReason, message: string);
}
export declare class LlmRequestFailedError extends Error {
    readonly detail: string;
    readonly streamErrorEmitted: boolean;
    readonly i18nStopReason?: DialogDisplayTextI18n;
    constructor(args: {
        message: string;
        detail: string;
        streamErrorEmitted: boolean;
        i18nStopReason?: DialogDisplayTextI18n;
    });
}
type DiligencePromptPreparation = {
    kind: 'disabled';
    nextRemainingBudget: number;
} | {
    kind: 'budget_exhausted';
    maxInjectCount: number;
    nextRemainingBudget: number;
} | {
    kind: 'prompt';
    prompt: KernelDriverPrompt;
    maxInjectCount: number;
    nextRemainingBudget: number;
};
export type DiligenceAutoContinueGateDecision = {
    kind: 'allowed';
} | {
    kind: 'blocked';
    reason: 'not_main_dialog' | 'active_run' | 'stop_requested' | 'execution_interrupted' | 'execution_dead' | 'q4h' | 'active_reply_obligation' | 'active_callee_dispatches';
};
export declare function evaluateDiligenceAutoContinueGate(options: {
    dlg: Dialog;
    requireIdleRunSlot: boolean;
}): Promise<DiligenceAutoContinueGateDecision>;
export declare function maybePrepareDiligenceAutoContinuePrompt(options: {
    dlg: Dialog;
    remainingBudget: number;
    diligencePushMax: number;
    suppressDiligencePush?: boolean;
    ignoreBudgetExhaustion?: boolean;
}): Promise<DiligencePromptPreparation>;
export declare function suspendForKeepGoingBudgetExhausted(options: {
    dlg: Dialog;
    maxInjectCount: number;
}): Promise<void>;
export declare function validateFuncToolArguments(tool: FuncTool, rawArgs: unknown): {
    ok: true;
    args: ToolArguments;
} | {
    ok: false;
    error: string;
};
export declare function runLlmRequestWithRetry<T>(params: {
    dlg: Dialog;
    provider: string;
    modelId: string;
    providerConfig: ProviderConfig;
    abortSignal?: AbortSignal;
    aggressiveRetryMaxRetries: number;
    retryInitialDelayMs: number;
    retryConservativeDelayMs: number;
    retryBackoffMultiplier: number;
    retryMaxDelayMs: number;
    classifyFailure?: LlmFailureClassifier;
    quirkFailureHandlerSession?: LlmFailureQuirkHandlerSession;
    canRetry: () => boolean;
    onRetry?: () => Promise<void> | void;
    onGiveUp?: () => Promise<void> | void;
    onRetryStopped?: (reason: DialogLlmRetryExhaustedReason) => Promise<'continue' | 'stop'> | 'continue' | 'stop';
    doRequest: () => Promise<T>;
}): Promise<T>;
export {};
