/** * Loop state management for ARCS projects. * * Stores active loop state as loop-state.json in each project directory. * Used by CLI commands (start/cancel/get) and the OpenCode plugin hook * (which reads state directly from disk to drive iteration). */ export interface LoopState { active: boolean; iteration: number; maxIterations: number; completionPromise: string; startedAt: string; prompt: string; sessionId: string; strategy: "continue" | "reset"; projectSlug: string; messageCountAtStart?: number; } export interface StartLoopInput { sessionId: string; prompt: string; maxIterations?: number; completionPromise?: string; strategy?: "continue" | "reset"; projectSlug: string; messageCountAtStart?: number; } export declare const LOOP_STATE_FILE = "loop-state.json"; export declare const DEFAULT_MAX_ITERATIONS = 100; export declare const DEFAULT_COMPLETION_PROMISE = "DONE"; export declare const COMPLETION_TAG_PATTERN: RegExp; /** Read loop-state.json from a project directory. Returns null if missing or corrupt. */ export declare function readLoopState(projectDir: string): Promise; /** Write loop-state.json to a project directory. */ export declare function writeLoopState(projectDir: string, state: LoopState): Promise; /** Delete loop-state.json from a project directory. Returns true if the file was removed. */ export declare function clearLoopState(projectDir: string): Promise; /** Read loop state, bump iteration count, write back, and return the updated state. */ export declare function incrementLoopIteration(projectDir: string): Promise; /** Create initial loop state for a project. Throws if a loop is already active. */ export declare function startLoop(projectDir: string, input: StartLoopInput): Promise; /** Cancel an active loop if the session ID matches. Returns true if cleared. */ export declare function cancelLoop(projectDir: string, sessionId: string): Promise; /** Scan all projects for an active loop-state.json. Returns the first match or null. */ export declare function findActiveLoop(): Promise<{ slug: string; projectDir: string; state: LoopState; } | null>; //# sourceMappingURL=loop-state.d.ts.map