import { type AssistantMessage, type AssistantMessageEvent, type ToolResultMessage } from "@earendil-works/pi-ai"; import type { AgentLoopConfig } from "./types.ts"; type TerminalAssistantMessageEvent = Extract; export declare class ProviderRetryWatchdogAbortError extends Error { readonly providerCause: string; constructor(providerCause: string); } /** * Marks a terminal message whose `toolUse` stop reason was demoted because the provider sent no * tool call. Demotion rewrites the stop reason, so this diagnostic is the only surviving evidence * that the turn was malformed rather than a clean stop; downstream recovery keys on it. */ export declare const EMPTY_TOOL_USE_DEMOTION_DIAGNOSTIC = "empty_tool_use_terminal_state"; export declare function demoteToolUseWithoutToolCalls(message: AssistantMessage): AssistantMessage; export declare function promoteStopWithPendingToolCalls(message: AssistantMessage): AssistantMessage; export declare function shouldTerminateAssistantTurn(message: AssistantMessage): boolean; export declare function isStreamIdleTimeoutError(error: unknown): boolean; /** * After tools already finished (Cursor exec-resolved or buffered results), * a silent provider is a finished turn, not a failed one. */ export declare function shouldFinalizeIdleAsStop(partialMessage: AssistantMessage | null, providerToolResults: readonly ToolResultMessage[]): boolean; export declare function createTerminalFailureAssistantMessage(model: AgentLoopConfig["model"], reason: Extract, error: unknown, partialMessage: AssistantMessage | null): AssistantMessage; export declare function normalizeTerminalAssistantMessage(message: AssistantMessage, event: TerminalAssistantMessageEvent): AssistantMessage; export {}; //# sourceMappingURL=assistant-terminal-state.d.ts.map