import { type WorkflowLifecycleStateToken } from "../io/workflow-lifecycle-state.js"; import type { ProjectReadSnapshot } from "../io/project-read-snapshot.js"; export type RalphLoopStopReason = "finish-passed" | "max-attempts" | "no-blockers" | "unmapped-blocker"; export type RalphLoopBlockerAttemptState = { readonly attempts: number; readonly capped: boolean; readonly lastUtteranceAt: string | null; }; export type RalphLoopSessionState = { readonly attemptsUsed: number; readonly blockerAttempts: Readonly>; readonly capped: boolean; readonly capSummaryNotified: boolean; readonly lastBlockerId: string | null; readonly lastStopReason: RalphLoopStopReason | null; readonly lastUtteranceAt: string | null; }; export type RalphLoopStateFile = { readonly schemaVersion: "workflow-ralph-loop-state.1"; readonly sessions: Readonly>; readonly updatedAt: string; }; export type RalphLoopStateSnapshot = { readonly integrity: "absent" | "malformed" | "unsafe" | "valid"; readonly state: RalphLoopStateFile; readonly token: WorkflowLifecycleStateToken; }; export declare const EMPTY_RALPH_LOOP_SESSION_STATE: RalphLoopSessionState; export declare function ralphLoopStatePath(projectDir: string): string; export declare function emptyRalphLoopState(now: string): RalphLoopStateFile; export declare function readRalphLoopStateSnapshot(projectDir: string, now?: string, snapshot?: ProjectReadSnapshot): RalphLoopStateSnapshot; export declare function readRalphLoopState(projectDir: string, now?: string): RalphLoopStateFile; export declare function writeRalphLoopState(projectDir: string, state: RalphLoopStateFile, expectedToken?: WorkflowLifecycleStateToken): boolean; export declare function sessionRalphLoopState(state: RalphLoopStateFile, sessionID: string): RalphLoopSessionState; export declare function withRalphLoopSessionState(state: RalphLoopStateFile, sessionID: string, sessionState: RalphLoopSessionState, now: string): RalphLoopStateFile;