/** * Lead-tier wave roll-up — aggregates Worker status across a single wave of * an epic, producing a unified contract for the top-level Orchestrator. * * Reads from two sources: * 1. `pipeline_manifest` table — worker self-reports (manifest entries * linked to tasks in the wave). * 2. Task verification rows — gate state and evidence atoms. * * Conduit topic subscription (epic-.wave-) is supported via the * optional `conduitMessages` parameter — callers (e.g. `cleo orchestrate * roll-up`, the ct-lead skill) can drain the topic and pass collected * messages so the rollup is conduit-aware. The function does NOT subscribe * to topics directly: that is the Lead's responsibility, not core's. * * # Mode resolution (T10513 — council action #9) * * The Lead↔Worker Max-N loop scaffolded by E-VALIDATOR-ROLE (T10383) is * gated behind the `leadRollup.mode` config key, NOT a function parameter. * Public function signatures stay identical so existing callers never need * to change. Internally each rollup invocation calls * {@link resolveLeadRollupMode} to look up the operative mode from the * `.cleo/config.json` cascade (default: `'passive'`). * * - `'passive'` — Legacy behaviour. The roll-up contract is unchanged. * - `'active'` — Reserved for the Lead↔Worker Max-N runtime shipping under * T10512. Until that runtime lands, the active branch logs a debug marker * and falls through to passive — so flipping the flag NEVER breaks an * existing project. * - `'auto'` — Treated as `'passive'` until the heuristic ships. * * @task T9082 * @task T10513 * @saga T10377 * @adr ADR-070 */ import type { EpicRollup, LeadRollupMode, WaveRollup } from '@cleocode/contracts'; /** * Optional conduit message used to enrich the rollup with live status * events that may not yet be reflected in the manifest table. */ export interface ConduitStatusMessage { /** Task ID the event refers to. */ taskId: string; /** Free-form status payload — typically `complete | partial | blocked`. */ status: string; /** ISO timestamp the event was published. */ publishedAt: string; } /** Options for `rollupWaveStatus`. */ export interface RollupWaveStatusOptions { /** * Optional pre-collected conduit messages from epic-.wave-. The * caller (Lead) is expected to drain its subscription and pass messages * here. When omitted, rollup is computed from manifest + verification * only. */ conduitMessages?: ConduitStatusMessage[]; } /** * Resolve the operative `leadRollup.mode` from the `.cleo/config.json` cascade. * * Resolution rules: * 1. Look up `leadRollup.mode` via the SSoT config registry's `getConfigValue` * helper (T9878). Project config (precedence 20) wins over global (10). * 2. When the key is absent, return the contract default `'passive'`. * 3. When the key is present but malformed (not one of the three valid * `LeadRollupMode` values), fall back to `'passive'` rather than throwing — * a typo'd config MUST NEVER break an existing caller's rollup call. * * Failures from the registry IO (e.g. unreadable config file) are caught and * downgraded to `'passive'` for the same reason. * * @param projectRoot - Project root to read the cascade from. Defaults to the * `getProjectRoot()` discovery path (falling back to `process.cwd()` only * when no `.cleo` sentinel is found) via `resolveOrCwd` — same convention * the rest of `packages/core/src` uses (T9584). * @returns The resolved `LeadRollupMode` — guaranteed to be one of the three * valid values, never `undefined`. * * @task T10513 */ export declare function resolveLeadRollupMode(projectRoot?: string): Promise; /** * Compute a roll-up for a single wave of an epic. * * @param epicId - Parent epic ID. * @param waveId - Wave number (0 = first wave). Must match `cleo deps waves` * output. * @param projectRoot - Optional project root for SDK consumers (test fixtures * pass an explicit root; CLI consumers omit it). Also used to resolve the * `leadRollup.mode` feature flag from the project config cascade. * @param options - Optional inputs (conduit messages). * @returns A `WaveRollup` shape. Returns an empty wave (`workers: []`) when * the wave has no tasks. */ export declare function rollupWaveStatus(epicId: string, waveId: number, projectRoot?: string, options?: RollupWaveStatusOptions): Promise; /** * Roll-up every wave of an epic at once. Composes `rollupWaveStatus` per * wave and returns an `EpicRollup`. */ export declare function rollupEpicStatus(epicId: string, projectRoot?: string, options?: RollupWaveStatusOptions): Promise; //# sourceMappingURL=lead-rollup.d.ts.map