/** * Canonical task view derivation — the single source of truth for task state. * * `computeTaskView` is the SINGLE derivation function consumed by the SDK, * CLI, and REST surfaces. Prior to T943, `/tasks` read `status`+child-rollup, * `/tasks/pipeline` read `pipelineStage`, and neither consulted * `lifecycle_pipelines`. This function unifies all three reads into one * deterministic projection so every surface returns identical state. * * Design contract: * - Pure read — no writes, no side effects. * - `pipelineStage` reads `tasks.pipelineStage` directly (Option B cached * projection). Dropping the column is deferred to the follow-up epic. * - `lifecycleProgress` is derived from `lifecycle_pipelines` + * `lifecycle_stages` when a pipeline record exists; graceful empty default * when the task has no pipeline. * - `childRollup` counts non-archived direct children only. * - `gatesStatus` is populated from `tasks.verification.gates`; optional * gates (`documented`) use `undefined` when absent. * - `readyToComplete` requires all required gates green, no blocking deps, * and non-terminal status. * - `nextAction` is derived via a priority ladder so agents always know what * to do next without extra logic in the caller. * * @task T943 */ import type { DataAccessor, TaskView } from '@cleocode/contracts'; /** * Compute the canonical {@link TaskView} for a single task. * * All reads happen in three phases: * 1. Task row — via `accessor.loadSingleTask`. * 2. Child aggregates + lifecycle progress — two native SQL queries. * 3. Dependency resolution — via `accessor.loadTasks` for `task.depends`. * * Returns `null` when the task does not exist. * * @param taskId - Identifier of the task to project (e.g. `T123`). * @param accessor - Storage accessor for the target project's tasks.db. * @returns The projected view, or `null` if the task is missing. * * @example * ```ts * const view = await computeTaskView('T123', accessor); * if (view) { * console.log(view.nextAction); // 'verify' | 'spawn-worker' | … * } * ``` * * @task T943 */ export declare function computeTaskView(taskId: string, accessor: DataAccessor): Promise; /** * Compute canonical {@link TaskView}s for many tasks in a single batch. * * Issues exactly one task load, one child-aggregate query, and one lifecycle * query regardless of batch size. Results preserve input order; missing IDs * are omitted from the return array. * * @param taskIds - Ordered list of task identifiers. * @param accessor - Storage accessor for the target project's tasks.db. * @returns Views in input order, minus any missing IDs. * * @task T943 */ export declare function computeTaskViews(taskIds: string[], accessor: DataAccessor): Promise; //# sourceMappingURL=compute-task-view.d.ts.map