/** * task-store.ts — File-backed task store with CRUD, dependency management, and file locking. * * Session-scoped (default): in-memory Map — no disk I/O. * Shared (PI_TASK_LIST_ID set): ~/.pi/tasks/.json with file locking. */ import type { Task, TaskStatus, TaskStoreData } from "./types.js"; export declare class TaskStore { private filePath; private lockPath; private nextId; private tasks; constructor(listIdOrPath?: string); /** Read store from disk (file-backed mode only). */ private load; /** Write store to disk atomically (file-backed mode only). */ private save; /** Execute a mutation with file locking (if file-backed). */ private withLock; create(subject: string, description: string, activeForm?: string, metadata?: Record): Task; get(id: string): Task | undefined; /** List all tasks, sorted by the given order (defaults to ID ascending). */ list(sortOrder?: "id" | "status" | "recent" | "oldest"): Task[]; update(id: string, fields: { status?: TaskStatus | "deleted"; subject?: string; description?: string; activeForm?: string; owner?: string; metadata?: Record; addBlocks?: string[]; addBlockedBy?: string[]; }): { task: Task | undefined; changedFields: string[]; warnings: string[]; }; /** Delete a task by ID. Returns true if deleted. */ delete(id: string): boolean; /** Remove all tasks. */ clearAll(): number; /** Capture full store state — used to carry tasks into a forked session. */ snapshot(): TaskStoreData; /** Seed an empty store from a snapshot. No-op if the store already has tasks, * so re-pointing to an already-seeded fork file never duplicates. */ seed(data: TaskStoreData): void; /** Delete the backing file (if file-backed and empty). */ deleteFileIfEmpty(): boolean; /** Remove all completed tasks. */ clearCompleted(): number; }