/** * sagaNext — one-shot "what should the orchestrator work on?" primitive. * * Composes {@link sagaList} + {@link sagaTraversal} to return the single * highest-priority non-terminal Saga with its ready frontier. The result is * the primary autonomous entry-point for `cleo go` (SG-AUTOPILOT / T11494). * * The canonical Saga-to-Saga order is encoded as a ranked list below (North * Star §0.1). The first non-terminal Saga in that list is the "active" saga * returned by `sagaNext`. If an explicit `sagaId` is supplied the traversal * is scoped to that Saga only. * * @task T11493 — E1-SAGA-RESOLVE: sagaNext() in core * @saga T11492 — SG-AUTOPILOT */ import { type EngineResult } from '../engine-result.js'; import { type SagaTraversalResult } from './rollup.js'; /** Input parameters for {@link sagaNext}. */ export interface SagaNextParams { /** * Optional saga ID to scope the traversal. When omitted, the first * non-terminal Saga in canonical rank order is selected automatically. */ sagaId?: string; } /** * Result payload for {@link sagaNext}. * * Extends the full traversal result with the active saga identity so callers * do not need a separate lookup. */ export interface SagaNextResult extends SagaTraversalResult { /** The saga ID that was selected (auto or explicit). */ sagaId: string; /** Saga title. */ sagaTitle?: string; /** Human-readable label from the canonical rank order table. */ sagaLabel?: string; /** * Zero-based rank in the canonical Saga-to-Saga sequence (lower = higher * priority). Absent when `sagaId` was supplied explicitly. */ canonicalRank?: number; /** * Total number of non-terminal sagas found. Useful for progress dashboards. */ activeSagaCount: number; } /** * Canonical Saga-to-Saga ordering (rank-ascending, lower index = higher priority). * * This list mirrors the `ORDER` constant in `scripts/workgraph-status.mjs` * (the script is deleted in T11493 — this is the authoritative source). * * @task T11493 */ export declare const CANONICAL_SAGA_ORDER: ReadonlyArray; /** * Return the next actionable Saga and its ready frontier. * * When no `sagaId` is provided, the function walks the canonical Saga-to-Saga * order and returns the first non-terminal Saga that exists in the database. * When `sagaId` is provided, the traversal is scoped to that Saga only. * * The result includes the full {@link SagaTraversalResult} (rollup counters, * member-epic progress, ready frontier, and blockers) extended with saga * identity fields for caller convenience. * * @param projectRoot - Absolute path to the project root (for DB resolution). * @param params - Optional parameters, currently `sagaId` for explicit scoping. * @returns EngineResult wrapping {@link SagaNextResult}. * * @task T11493 * @saga T11492 */ export declare function sagaNext(projectRoot: string, params?: SagaNextParams): Promise>; //# sourceMappingURL=next.d.ts.map