import type { GoalState } from "../domain/types.js"; import { GoalStoreConcurrencyError } from "./process-lock.js"; export { GoalStoreConcurrencyError }; export type { GoalStoreConcurrencyKind } from "./process-lock.js"; export type GoalArchiveReason = "cleared" | "replaced"; export type GoalStoreIntegrityKind = "invalid_json" | "invalid_state" | "invalid_archive" | "unsafe_path"; export type GoalStoreTransitionReason = "completed" | "blocked" | "paused"; export declare class GoalStoreIntegrityError extends Error { readonly file: string; readonly kind: GoalStoreIntegrityKind; readonly code = "GOAL_STORE_INTEGRITY"; constructor(file: string, kind: GoalStoreIntegrityKind, detail: string); } export interface GoalArchiveRecord { schemaVersion: 1; goalID: string; sessionID: string; reason: GoalArchiveReason; archivedAt: number; goal: GoalState; } export interface GoalHistoryPruneResult { keep: number; kept: GoalArchiveRecord[]; removed: GoalArchiveRecord[]; } export type GoalRestoreResult = { ok: true; goal: GoalState; source: GoalArchiveRecord; } | { ok: false; reason: "not_found"; matches: []; } | { ok: false; reason: "ambiguous"; matches: GoalArchiveRecord[]; } | { ok: false; reason: "live_unfinished"; current: GoalState; } | { ok: false; reason: "already_current"; current: GoalState; } | { ok: false; reason: "completed"; source: GoalArchiveRecord; }; export interface GoalStoreOptions { processLockTimeoutMs?: number; onTransition?: (goal: GoalState, reason: GoalStoreTransitionReason) => void; } export declare function assertGoalStoragePathSafe(directory: string, target: string): Promise; export declare class GoalStore { #private; readonly directory: string; readonly root: string; readonly locksRoot: string; readonly processLockTimeoutMs: number; readonly onTransition: ((goal: GoalState, reason: GoalStoreTransitionReason) => void) | undefined; constructor(directory: string, options?: GoalStoreOptions); fileFor(sessionID: string): string; lockFileFor(sessionID: string): string; historyRootFor(sessionID: string): string; archiveFileFor(sessionID: string, goalID: string): string; load(sessionID: string): Promise; list(): Promise; history(sessionID: string, limit?: number): Promise; pruneHistory(sessionID: string, keep: number): Promise; restore(sessionID: string, goalIDPrefix: string, now?: number): Promise; save(state: GoalState): Promise; clear(sessionID: string): Promise; } //# sourceMappingURL=store.d.ts.map