import type { TaskState, TaskStatus } from './task-state.js'; /** * In-memory task store with FSM-validated state transitions. * * This is the single source of truth for task state. It enforces the FSM at * the data layer — illegal transitions are rejected before any mutation occurs. * * Terminal tasks can be evicted by age to prevent unbounded memory growth. */ export declare class TaskStore { private readonly tasks; /** Store a new task. Overwrites if the ID already exists. */ create(task: TaskState): void; /** Retrieve a task by its unique ID. */ get(id: string): TaskState | undefined; /** Linear scan for a task matching the given session ID. */ getBySessionId(sessionId: string): TaskState | undefined; /** Return all tasks as an array. */ getAll(): TaskState[]; /** * Transition a task to a new status. * * Returns `true` if the transition was valid and applied, `false` if the * task was not found or the transition is illegal per the FSM. */ updateStatus(id: string, next: TaskStatus): boolean; /** * Apply a partial update to a task. If the update includes a `status` * change, the FSM is validated first — an illegal transition causes the * entire update to be rejected (returns `undefined`). */ update(id: string, updates: Partial): TaskState | undefined; /** Remove a task by ID. Returns `true` if it existed. */ delete(id: string): boolean; /** * Remove terminal tasks whose `updatedAt` timestamp is older than * `maxAgeMs` milliseconds from now. * * Returns the number of tasks evicted. */ evict(maxAgeMs: number): number; /** Remove all tasks. */ clear(): void; /** Return the number of stored tasks. */ size(): number; }