/** * runDiablo is the top-level orchestrator the CLI calls: it ensures an isolated * worktree exists for the issue (resume-aware), loads the issue into an * executable pipeline (generating the frozen plan if absent), runs every stage, * then optionally integrates the work branch into the target branch. Keeping * this here — not in the CLI composition root — keeps main.ts pure wiring and * lets the full run be tested against fakes. */ import type { AgentPort } from "../ports/agent.ts"; import type { GitPort } from "../ports/git.ts"; import type { GitMergePort } from "../ports/git-merge.ts"; import type { FsPort } from "../ports/fs.ts"; import { type LoadIssueConfig } from "./load-issue.ts"; import { type IssueResult } from "./run-issue.ts"; import type { RetryPolicy } from "./run-stage.ts"; import { type IntegrateResult } from "./integrate.ts"; import type { GatePort } from "../ports/gate.ts"; import type { ProgressPort } from "../ports/progress.ts"; import type { RunStepDeps } from "./run-step.ts"; export interface IntegrationConfig { targetBranch: string; branchPrefix: string; autoMerge: boolean; } export interface RunDiabloConfig extends LoadIssueConfig { baseBranch: string; /** Bounded worker-retry policy on implementation FAIL; default no retry. */ retry?: RetryPolicy; /** Branch-integration policy applied after a successful run; omitted = no integration step. */ integration?: IntegrationConfig; } export interface RunDiabloDeps { agent: AgentPort; git: GitPort; fs: FsPort; gate?: GatePort; /** Required only when config.integration requests a merge. */ merge?: GitMergePort; /** Optional progress sink; structured run events are emitted to it when present. */ progress?: ProgressPort; /** Optional liveness-ticker factory; bracketed around each agent run (see RunStepDeps). */ heartbeat?: RunStepDeps["heartbeat"]; /** Optional per-step deadline factory; arms a kill-on-timeout around each agent run. */ deadline?: RunStepDeps["deadline"]; /** Optional global run-budget gate; checked before each step (wall-clock + step count). */ budget?: RunStepDeps["budget"]; /** Optional engine-owned verification gate; measured gate commands per verifying step. */ verifyGate?: RunStepDeps["verifyGate"]; } export interface RunDiabloResult extends IssueResult { /** The outcome of the integration step, if integration was configured. */ integration?: IntegrateResult; } export declare function runDiablo(deps: RunDiabloDeps, config: RunDiabloConfig): Promise;