/** * [WHO]: Task store - CRUD operations with disk persistence * [FROM]: Inspired by Claude Code utils/tasks.ts * [TO]: Consumed by all task tools * [HERE]: extensions/builtin/task/task-store.ts - task state management with atomic file writes * * Task list isolation: per CC semantics, each session/terminal gets its own * task list. Priority: CATUI_TASK_LIST_ID env > team name > session ID. * Legacy fallback: DEFAULT_TASK_LIST_ID ("tasklist") for existing data. * * Cross-terminal updates: fs.watch monitors the tasks directory and notifies * in-process listeners. A 5s polling fallback handles edge cases. */ import type { Task } from "./task-types.js"; /** * Resolve the task list ID for the current context. * * Priority (per CC): * 1. CATUI_TASK_LIST_ID env var (explicit override) * 2. Team name (if in team context) * 3. Session ID (default — each terminal gets its own task list) * * Falls back to DEFAULT_TASK_LIST_ID ("tasklist") for legacy compatibility. */ export declare function getTaskListId(sessionId?: string, teamName?: string): string; type TaskUpdateListener = () => void; /** Subscribe to task update notifications. Returns unsubscribe function. */ export declare function onTasksUpdated(listener: TaskUpdateListener): () => void; /** * Start watching a task directory for changes (fs.watch + 5s polling fallback). * Multiple calls with the same dir are idempotent. */ export declare function startTaskFileWatcher(dir: string): void; /** * Stop watching a task directory. */ export declare function stopTaskFileWatcher(dir: string): void; /** * Stop all task file watchers. Called on session shutdown. */ export declare function stopAllTaskFileWatchers(): void; export declare function getTasksDir(agentDir: string, taskListId?: string): string; /** * Create a new task. Returns the created task with assigned ID. */ export declare function createTask(agentDir: string, taskListId: string, taskData: Omit): Promise; /** * Get a task by ID. Returns null if not found. */ export declare function getTask(agentDir: string, taskListId: string, taskId: string): Promise; /** * Update a task. Merges partial updates into existing task. * Returns the updated task, or null if not found. */ export declare function updateTask(agentDir: string, taskListId: string, taskId: string, updates: Partial>): Promise; /** * Delete a task. Updates high water mark to prevent ID reuse. * Also cleans up blocks/blockedBy references from other tasks. */ export declare function deleteTask(agentDir: string, taskListId: string, taskId: string): Promise; /** * List all tasks in a task list. */ export declare function listTasks(agentDir: string, taskListId: string): Promise; /** * Add a block relationship: fromTask blocks toTask. */ export declare function blockTask(agentDir: string, taskListId: string, fromTaskId: string, toTaskId: string): Promise; /** * Reset a task list - clears all tasks but preserves high water mark. */ export declare function resetTaskList(agentDir: string, taskListId: string): Promise; export {};