/** * Persistence layer for the Loop scheduler. * * Handles disk I/O for: * - loops.json (Loop definitions) * - loop-executions//index.jsonl (per-loop execution metadata) * - loop-executions//.jsonl (per-execution raw message log) * * Pure I/O — no scheduling, no in-memory state. Atomic write for loops.json * (write tmp → rename) to survive crashes. */ import type { ClaudeMessage } from './claude.js'; import type { HistoryMessage } from './history.js'; import type { Loop, LoopExecution } from './scheduler.js'; export declare function loadLoopsFromDisk(): Loop[]; export declare function saveLoopsToDisk(loops: Loop[]): void; export declare function ensureExecutionDir(loopId: string): void; export declare function getExecutionIndexPath(loopId: string): string; export declare function getExecutionLogPath(loopId: string, executionId: string): string; export declare function appendExecutionIndex(loopId: string, execution: LoopExecution): void; export declare function updateExecutionIndex(loopId: string, execution: LoopExecution): void; /** * Read the execution index for a loop, sorted by startedAt descending. * Caller is responsible for merging in-memory running-state overrides. */ export declare function readExecutionIndex(loopId: string, limit: number): LoopExecution[]; export declare function appendToExecutionLog(loopId: string, executionId: string, msg: ClaudeMessage): void; export declare function readExecutionLog(loopId: string, executionId: string): HistoryMessage[];