/** * Protocol engine — `vines/spec.md` §3. * * - §3.1 Triage — decide whether an objective qualifies for the protocol. * - §3.2 Workflow — drive the 7-step sequence end-to-end, recording * transitions in both Linear (ground truth for sub-task state) and the * ledger (recovery anchor). * * Collaborators are injected so the protocol can be unit-tested with fakes. */ import type { Ledger } from "./persistence.js"; import type { LinearClient } from "./linear-client.js"; import type { DispatchResult, OrchestrationResult, SpecialistId, SubTask } from "./types.js"; /** Signature for the dispatch primitive the orchestrator depends on. */ export type DispatchFn = (agent: SpecialistId, message: string, timeoutSeconds: number) => Promise; export interface TriageDecision { activate: boolean; reason: string; } /** * Activate the protocol when **estimated > 30 seconds** *or* **distinct agent * domains > 2**. Both conditions are strict inequalities, per the spec text * "*more than* 30 seconds" / "*more than* two". */ export declare function triage(estimatedSeconds: number, agentDomains: readonly string[]): TriageDecision; /** * Construct a {@link SubTask}, validating the specialist id at the call site * so we surface programmer errors early. */ export declare function subTask(args: { title: string; agent: SpecialistId; message: string; timeoutSeconds?: number; }): SubTask; export interface OrchestratorOptions { ledger: Ledger; linear: LinearClient; /** Linear team UUID — `linear.team.id` from the API. */ linearTeamId: string; /** Linear workflow-state UUID for "done" (e.g. the team's `Done` state). */ linearDoneStateId?: string; /** Override the default dispatch (used by tests). */ dispatch: DispatchFn; } /** Returns the planned sub-task list for the §3.2 step 4 "Strategic Planning". */ export type Planner = (objective: string, researchBrief: string | null) => SubTask[] | Promise; export interface RunOptions { objective: string; planner: Planner; /** * If provided, the orchestrator skips the §3.2 step 3 research gate and * uses this string as the research brief. */ researchBrief?: string; } /** * The orchestrator. Construct once per long-lived process; call {@link run} * for each operator request. */ export declare class Orchestrator { private readonly ledger; private readonly linear; private readonly teamId; private readonly doneStateId; private readonly dispatch; constructor(opts: OrchestratorOptions); /** Execute the §3.2 workflow end-to-end for one operator request. */ run(opts: RunOptions): Promise; private researchGate; private runSubTask; } //# sourceMappingURL=orchestrator.d.ts.map