/** * Ralph Loop Hook * * Self-referential work loop that continues until a completion promise is detected. * Named after the character who keeps working until the job is done. * * Ported from oh-my-opencode's ralph-loop hook. */ export interface RalphLoopState { /** Whether the loop is currently active */ active: boolean; /** Current iteration number */ iteration: number; /** Maximum iterations before stopping */ max_iterations: number; /** The promise phrase to detect for completion */ completion_promise: string; /** When the loop started */ started_at: string; /** The original prompt/task */ prompt: string; /** Session ID the loop is bound to */ session_id?: string; } export interface RalphLoopOptions { /** Maximum iterations (default: 10) */ maxIterations?: number; /** Custom completion promise (default: "TASK_COMPLETE") */ completionPromise?: string; } export interface RalphLoopHook { startLoop: (sessionId: string, prompt: string, options?: RalphLoopOptions) => boolean; cancelLoop: (sessionId: string) => boolean; getState: () => RalphLoopState | null; } /** * Read Ralph Loop state from disk */ export declare function readRalphState(directory: string): RalphLoopState | null; /** * Write Ralph Loop state to disk */ export declare function writeRalphState(directory: string, state: RalphLoopState): boolean; /** * Clear Ralph Loop state */ export declare function clearRalphState(directory: string): boolean; /** * Increment Ralph Loop iteration */ export declare function incrementRalphIteration(directory: string): RalphLoopState | null; /** * Detect completion promise in session transcript */ export declare function detectCompletionPromise(sessionId: string, promise: string): boolean; /** * Create a Ralph Loop hook instance */ export declare function createRalphLoopHook(directory: string): RalphLoopHook; //# sourceMappingURL=index.d.ts.map