engine | "sqlite" | Yes | The storage engine backing this accessor. |
loadArchive | () => Promise<ArchiveFile | null> | Yes | Load the archive file. Returns null if archive doesn’t exist. |
saveArchive | (data: ArchiveFile) => Promise<void> | Yes | Save the archive file atomically. Creates backup before write. |
loadSessions | () => Promise<Session[]> | Yes | Load all sessions from the store. Returns empty array if none exist. |
saveSessions | (sessions: Session[]) => Promise<void> | Yes | Save all sessions to the store atomically. |
appendLog | (entry: Record<string, unknown>) => Promise<void> | Yes | Append an entry to the audit log. |
close | () => Promise<void> | Yes | Release any resources (close DB connections, etc.). |
upsertSingleTask | (task: Task) => Promise<void> | Yes | Upsert a single task (targeted write, no full-file reload). |
archiveSingleTask | (taskId: string, fields: ArchiveFields) => Promise<void> | Yes | Archive a single task by ID (sets status=‘archived’ + archive metadata). |
removeSingleTask | (taskId: string) => Promise<void> | Yes | Delete a single task permanently from the tasks table. |
loadSingleTask | (taskId: string) => Promise<Task | null> | Yes | Load a single task by ID with its dependencies and relations. Returns null if not found. |
addRelation | (taskId: string, relatedTo: string, relationType: string, reason?: string | undefined) => Promise<void> | No | Insert a row into the task_relations table (T5168). |
getMetaValue | <T>(key: string) => Promise<T | null> | Yes | Read a typed value from the metadata store. Returns null if not found. |
setMetaValue | (key: string, value: unknown) => Promise<void> | Yes | Write a typed value to the metadata store. |
getSchemaVersion | () => Promise<string | null> | Yes | Read the schema version from metadata. Convenience for getMetaValue(‘schema_version’). |
queryTasks | (filters: TaskQueryFilters) => Promise<QueryTasksResult> | Yes | Query tasks with filters, pagination, and ordering. Returns matching tasks + total count. |
countTasks | (filters?: \{ status?: "cancelled" | "pending" | "active" | "blocked" | "done" | "archived" | ("cancelled" | "pending" | "active" | "blocked" | "done" | "archived")[] | undefined; parentId?: string | undefined; \} | undefined) => Promise<...> | No | Count tasks matching optional filters. Excludes archived by default. |
getChildren | (parentId: string) => Promise<Task[]> | Yes | Get direct children of a parent task. |
countChildren | (parentId: string) => Promise<number> | Yes | Count direct children of a parent task (all statuses except archived). |
countActiveChildren | (parentId: string) => Promise<number> | Yes | Count active (non-terminal) children of a parent task. |
getAncestorChain | (taskId: string) => Promise<Task[]> | Yes | Get ancestor chain from task to root via WITH RECURSIVE CTE. Ordered root-first. |
getSubtree | (rootId: string) => Promise<Task[]> | Yes | Get full subtree rooted at taskId via WITH RECURSIVE CTE. Includes root. |
getDependents | (taskId: string) => Promise<Task[]> | Yes | Get tasks that depend on (are blocked by) the given task. Reverse dep lookup. |
getDependencyChain | (taskId: string) => Promise<string[]> | Yes | Get transitive dependency chain via WITH RECURSIVE CTE. Returns task IDs. |
taskExists | (taskId: string) => Promise<boolean> | Yes | Check if a task exists (any status including archived). |
loadTasks | (taskIds: string[]) => Promise<Task[]> | Yes | Load multiple tasks by ID in a single batch query. |
updateTaskFields | (taskId: string, fields: TaskFieldUpdates) => Promise<void> | Yes | Update specific fields on a task without full load/save cycle. |
getNextPosition | (parentId: string | null) => Promise<number> | Yes | Get next available position for a task within a parent scope (SQL-level, race-safe). |
shiftPositions | (parentId: string | null, fromPosition: number, delta: number) => Promise<void> | Yes | Shift positions of siblings = fromPosition by delta (bulk SQL update). |
transaction | <T>(fn: (tx: TransactionAccessor) => Promise<T>) => Promise<T> | Yes | Execute a function inside a SQLite transaction (BEGIN IMMEDIATE / COMMIT / ROLLBACK). |
getActiveSession | () => Promise<Session | null> | Yes | Get the currently active session (status=‘active’, most recent). |
upsertSingleSession | (session: Session) => Promise<void> | Yes | Upsert a single session (targeted write). |
removeSingleSession | (sessionId: string) => Promise<void> | Yes | Remove a single session by ID. |