/** * File-backed task graph engine for team coordination. * * Port of cc-agent-teams-impl-mcp tasks.py into TypeScript. * * Storage layout: ~/.codex-teams-mcp/tasks//.json * Each task is a separate JSON file with auto-incrementing string IDs ("1", "2", ...). * File locking via O_EXCL ensures safe concurrent access. * * The most complex operation is updateTask, which uses a 4-phase approach: * Phase 1: Read current state from disk * Phase 2: Validate all constraints (no writes) * Phase 3: Mutate in-memory objects (track pending writes) * Phase 4: Flush all writes atomically */ import type { TeamTask, TeamTaskStatus } from './types.js'; export interface TaskUpdateOptions { status?: TeamTaskStatus | 'deleted'; owner?: string; subject?: string; description?: string; activeForm?: string; addBlocks?: string[]; addBlockedBy?: string[]; metadata?: Record; } /** * Compute the next available task ID for a team. * Scans existing *.json files, parses stems as integers, * returns max+1 as a string (or "1" if no tasks exist). */ export declare function nextTaskId(teamName: string): Promise; /** * Create a new task in the team's task graph. * Acquires a file lock to ensure ID uniqueness. */ export declare function createTask(teamName: string, subject: string, description: string, activeForm?: string, metadata?: Record): Promise; /** * Read a single task by ID. */ export declare function getTask(teamName: string, taskId: string): Promise; /** * List all tasks for a team, sorted by numeric ID. * Filters out tasks with 'deleted' status (defensive — deleted tasks * are normally unlinked, but this handles edge cases). */ export declare function listTasks(teamName: string): Promise; /** * Update a task with the 4-phase read/validate/mutate/write approach. * * This is the most complex function in the module. It: * - Validates dependency references and cycle-freedom * - Enforces monotonic status transitions * - Maintains bidirectional blocks/blockedBy relationships * - Cascades completed/deleted status to dependent tasks * - Writes all changes atomically under a file lock */ export declare function updateTask(teamName: string, taskId: string, updates: TaskUpdateOptions): Promise; /** * Reset all tasks owned by a specific agent. * For each task owned by ownerName that is not completed: * - Set status back to 'pending' * - Clear the owner field * * Used when an agent disconnects or is removed from the team. */ export declare function resetOwnerTasks(teamName: string, ownerName: string): Promise; //# sourceMappingURL=tasks.d.ts.map