/** * `cleo go` autopilot driver — the thin orchestration sequencer. * * This is the canonical entry point for `cleo go` (SG-AUTOPILOT / T11492). * It is PURE GLUE: it sequences existing core engines without adding new * orchestration math. * * ## Pipeline * * ``` * sagaNext() — pick highest-priority non-terminal saga * → orchestrateReady(sagaId) — fetch readyFrontier * → branch on pipelineStage of the active epic: * AC-only (no children, research stage) * → { action: 'needsDecomposition', sagaId, epicId } * research | specification | decomposition * → { action: 'lifecycleHop', sagaId, epicId, currentStage } * implementation | validation | testing | release | contribution * → draft a goal/v1 contract for the ready wave and hand it to the * goal runtime (CLEO Goal) in the current harness * → { action: 'goalHandoff', sagaId, epicId, tasks, goal, runtime } * → return ONE LAFS-compatible EngineResult envelope * ``` * * ## Goal handoff (T13821 · owner decision 2026-10-16 · ADR-097) * * CLEO owns the goal protocol; CLEO Goal is the goal runtime. `cleo go` * no longer drives an IVTR loop itself: for implementation-stage work it runs * `cleo goal draft` over the ready wave (reusing a draft that already exists, * never overwriting it) and returns the exact next step: `/goal start ` * when the CLEO Goal bin (`cleo-goal`, then `ocg`) resolves, otherwise the * commands that install it (project-scoped; never user-global harness config). * * ## Design constraints * * - AC2: ONE LAFS envelope per call — all branching produces a single return. * - AC3: empty ready-set + zero children → `needsDecomposition` (typed, not silent []). * - No new orchestration math — only sequences ops from `sagas`, `orchestrate`, * and `lifecycle` modules. * - CORE-FIRST: all logic here in `packages/core/src/go/`; CLI is a thin dispatch. * * @module @cleocode/core/go * * @task T11494 — E2-CLEO-GO * @saga T11492 — SG-AUTOPILOT */ import type { GoalRuntimeHandoff, TaskViewPipelineStage } from '@cleocode/contracts'; import { type EngineResult } from '../engine-result.js'; /** * Input parameters for {@link cleoGo}. * * @task T11494 */ export interface CleoGoParams { /** * Optional saga ID to scope the autopilot run. When omitted, `sagaNext` * auto-selects the highest-priority non-terminal Saga in canonical order. */ sagaId?: string; /** * When true, suppress any interactive output suitable for daemon / unattended * runs. The result shape is identical; only side-channel logging is affected. */ headless?: boolean; /** Override project root (useful in tests). */ projectRoot?: string; } /** * Discriminated union of the action outcomes `cleoGo` can produce. * * Consumers pattern-match on `action` to route further processing. * * @task T11494 */ export type CleoGoAction = { /** No children + research stage — the epic needs decomposition first. */ action: 'needsDecomposition'; sagaId: string; /** The AC-only epic that needs task children added. */ epicId: string; /** Current pipelineStage (always `'research'` for AC-only epics). */ currentStage: TaskViewPipelineStage; } | { /** Pre-implementation stage — lifecycle must hop before IVTR is valid. */ action: 'lifecycleHop'; sagaId: string; epicId: string; currentStage: TaskViewPipelineStage; /** All ready-frontier task IDs (may be empty while lifecycle hops). */ readyFrontier: string[]; } | { /** * Implementation-stage work handed to the goal runtime: a goal/v1 * contract drafted for the ready wave (T13821). */ action: 'goalHandoff'; sagaId: string; epicId: string; currentStage: TaskViewPipelineStage; /** The ready wave the goal serves. */ tasks: string[]; /** The drafted (or already drafted) goal, or null when none could be drafted. */ goal: { slug: string; path: string; reused: boolean; } | null; /** The goal runtime and the exact next step in the current harness. */ runtime: GoalRuntimeHandoff; } | { /** No non-terminal sagas remain — the workgraph is complete. */ action: 'complete'; }; /** * Result payload for {@link cleoGo}. * * @task T11494 */ export interface CleoGoResult { /** The action taken by the driver in this turn. */ outcome: CleoGoAction; /** * Structured diagnostics for display / logging. Always present; may be empty. */ diagnostics: string[]; } /** * Run one turn of the `cleo go` autopilot pipeline. * * Returns a single LAFS-compatible {@link EngineResult} wrapping a * {@link CleoGoResult}. Its only side effect is drafting a goal/v1 contract for * the ready wave (never overwriting one); the driver carries no mutable state. * * @param params - Input parameters controlling the saga scope and mode. * @returns EngineResult with {@link CleoGoResult}. * * @task T11494 * @saga T11492 */ export declare function cleoGo(params?: CleoGoParams): Promise>; //# sourceMappingURL=driver.d.ts.map