import { type ConversationRepairOptions, type OpenAiChatMessageLike, type OpenAiResponsesItemLike } from "./conversation-repair.js";
export interface ToolLoopState<TMessage = unknown> {
    round: number;
    maxRounds: number;
    pendingToolCallIds: string[];
    completedToolCallIds: string[];
    lastStopReason?: string;
    replayMessages: TMessage[];
}
export interface ToolLoopRepairAction {
    kind: "strip-forced-stop-tool-metadata" | "inject-placeholder-tool-result" | "drop-orphan-tool-result" | "rewrite-openai-function-call-pair" | "drop-trailing-reasoning";
    detail?: string;
}
export interface RepairToolLoopStateResult<TMessage> {
    state: ToolLoopState<TMessage>;
    recoveryActions: ToolLoopRepairAction[];
}
export declare function createToolLoopState<TMessage>(params: {
    maxRounds: number;
    replayMessages?: readonly TMessage[];
    round?: number;
    pendingToolCallIds?: readonly string[];
    completedToolCallIds?: readonly string[];
    lastStopReason?: string;
}): ToolLoopState<TMessage>;
export declare function advanceToolLoopState<TMessage>(state: ToolLoopState<TMessage>, params: {
    replayMessages?: readonly TMessage[];
    pendingToolCallIds?: readonly string[];
    completedToolCallIds?: readonly string[];
    lastStopReason?: string;
}): ToolLoopState<TMessage>;
export declare function settleToolLoopState<TMessage>(state: ToolLoopState<TMessage>, params: {
    replayMessages?: readonly TMessage[];
    completedToolCallIds?: readonly string[];
    lastStopReason?: string;
}): ToolLoopState<TMessage>;
export declare function recoverToolLoopStateFromChatConversation<TMessage extends OpenAiChatMessageLike>(params: {
    maxRounds: number;
    replayMessages: readonly TMessage[];
    round?: number;
    lastStopReason?: string;
    options?: ConversationRepairOptions;
}): RepairToolLoopStateResult<TMessage>;
export declare function recoverToolLoopStateFromResponsesItems<TItem extends OpenAiResponsesItemLike>(params: {
    maxRounds: number;
    replayItems: readonly TItem[];
    round?: number;
    lastStopReason?: string;
    options?: ConversationRepairOptions;
}): RepairToolLoopStateResult<TItem>;
