/** * Session state file writing utilities. * Provides atomic writes for session state files. */ import type { SessionState } from './types'; /** * Serialize session state to YAML frontmatter format. */ export declare function serializeSessionState(state: SessionState): string; /** * Create full session file content with YAML frontmatter and prompt. */ export declare function createSessionFileContent(state: SessionState, prompt: string): string; /** * Write session state file atomically. * Uses temp file + rename pattern to ensure atomic writes. */ export declare function writeSessionFile(filePath: string, state: SessionState, prompt: string): Promise; /** * Update specific fields in an existing session state file. * Reads, modifies, and atomically writes the file. */ export declare function updateSessionState(filePath: string, updates: Partial, existingContent?: { state: SessionState; prompt: string; }): Promise; /** * Bind a new run to the session, retiring the previous active run to history. * * Invariant: only one run is active at a time (`runId`). * The previous `runId` (if any) is pushed into `runIds` as audit history. * Idempotent: re-binding the same runId is a no-op. * * Throws if the caller tries to bind a new run while `runId` is still set * and `retirePrevious` is not explicitly true — this forces callers to * acknowledge that the prior run is done. */ export declare function addRunToSession(state: SessionState, runId: string, options?: { retirePrevious?: boolean; }): SessionState; /** * Get the historical audit trail of all run IDs for this session (GAP-SESSION-001). * Falls back to [runId] when runIds is empty for backward compatibility * with sessions created before the runIds field existed. */ export declare function getSessionRuns(state: SessionState): string[]; /** * Get current ISO timestamp. */ export declare function getCurrentTimestamp(): string; /** * Convert ISO timestamp to epoch seconds. * Returns null if conversion fails. */ export declare function isoToEpochSeconds(isoTimestamp: string): number | null; /** * Calculate iteration duration and update times array. * Keeps only the last 10 durations for diagnostics. */ export declare function updateIterationTimes(existingTimes: number[], lastIterationAt: string, currentTime: string): number[]; //# sourceMappingURL=write.d.ts.map