/** * UltraWork State Manager * * File-based session state persistence for the Ralph Loop pattern. * Each session gets its own directory under ~/.mama/workspace/ultrawork/{session_id}/ * * Directory structure: * session.json - Session metadata (task, phase, agents) * plan.md - Phase 1 result: implementation plan * progress.json - Completed steps array * retrospective.md - Phase 3 result: retrospective notes */ export type UltraWorkPhase = 'planning' | 'building' | 'retrospective' | 'completed'; export interface UltraWorkSessionState { id: string; task: string; phase: UltraWorkPhase; agents: string[]; createdAt: number; updatedAt: number; } export interface UltraWorkStepRecord { stepNumber: number; agentId: string; action: string; responseSummary: string; isDelegation: boolean; duration: number; timestamp: number; } export declare class UltraWorkStateManager { private baseDir; private sessionLocks; constructor(baseDir?: string); /** * Validates sessionId to prevent path traversal attacks. * Only allows alphanumeric, hyphen, and underscore characters. */ private validateSessionId; private sessionDir; /** * Executes a function with an exclusive lock on the given sessionId. * Prevents TOCTOU race conditions on read-modify-write operations. */ private withSessionLock; createSession(sessionId: string, task: string, agents: string[]): Promise; loadSession(sessionId: string): Promise; updatePhase(sessionId: string, phase: UltraWorkPhase): Promise; savePlan(sessionId: string, plan: string): Promise; loadPlan(sessionId: string): Promise; recordStep(sessionId: string, step: UltraWorkStepRecord): Promise; loadProgress(sessionId: string): Promise; saveRetrospective(sessionId: string, retro: string): Promise; deleteSession(sessionId: string): Promise; listSessions(): Promise; } //# sourceMappingURL=ultrawork-state.d.ts.map