import { type RecoveryPhase } from "./recovery-phase.js"; import { type AssistantErrorMessage, type ErrorRecoveryCounters, type RecoveryAttention } from "./recovery.js"; export type { GoalStartTurnStrategy, RecoveryPhase } from "./recovery-phase.js"; export { goalStartTurnStrategy, recoveryPhaseBlocksContinuation, recoveryPhaseNeedsUserStartTurn, } from "./recovery-phase.js"; export type RecoveryAction = { type: "noop"; } | { type: "pending"; reason: string; } | { type: "pause"; reason: string; }; export interface GoalRecoveryMachineState { counters: ErrorRecoveryCounters; attention: RecoveryAttention | null; phase: RecoveryPhase; } export declare function createGoalRecoveryMachine(): GoalRecoveryMachineState; export declare function resetRecoveryMachine(state: GoalRecoveryMachineState): void; export declare function resetRecoveryCounters(state: GoalRecoveryMachineState): void; export declare function onRecoveryUserInput(state: GoalRecoveryMachineState): void; export declare function onRecoverySuccessfulTurn(state: GoalRecoveryMachineState, message: AssistantErrorMessage): boolean; export declare function onRecoverySessionCompact(state: GoalRecoveryMachineState): void; export declare function setRecoveryPendingAttention(state: GoalRecoveryMachineState, reason: string): RecoveryAttention; export declare function setRecoveryPausedAttention(state: GoalRecoveryMachineState, reason: string): RecoveryAttention; export declare function clearActiveHostOverflowRecovery(state: GoalRecoveryMachineState): void; export declare function applyHostOverflowUserResetPersistence(state: GoalRecoveryMachineState, needsUserReset: boolean): boolean; export declare function syncHostOverflowUserResetFromSession(state: GoalRecoveryMachineState, needsUserReset: boolean): void; /** Session-level overflow: require a user-started goal turn even without an active goal. */ export declare function requireHostOverflowUserReset(state: GoalRecoveryMachineState): boolean; export declare function beginHostOverflowRecovery(state: GoalRecoveryMachineState): { attention: RecoveryAttention; persistHostOverflowCapReset: boolean; }; /** * Plans extension recovery only after pi host post-run retry/compaction has finished. * Host AgentSession._handlePostAgentRun() owns retry and overflow compaction; this * extension tracks persistent failures and pauses with attention when caps are exceeded. */ export declare function planRecoveryForAssistantError(state: GoalRecoveryMachineState, message: AssistantErrorMessage): RecoveryAction; export declare function planRecoveryForSilentContextOverflow(state: GoalRecoveryMachineState): RecoveryAction; /** True when another overflow in this recovery cycle would exceed the compaction cap. */ export declare function isRepeatOverflowCompactionDue(state: GoalRecoveryMachineState): boolean; //# sourceMappingURL=recovery-machine.d.ts.map