/** * Goal auto-continuation loop. * * Extracted verbatim from agent-session.ts (god-file decomposition). Drives the bounded "keep the * active goal moving" loop: each pass reads the goal runtime snapshot, and — only while the snapshot * says `continue` — submits one continuation prompt back through the session's own prompt path. It * owns no state; the goal state lives in the session log and is read fresh every pass. Termination is * gated only by real terminal conditions and limits the owner explicitly supplied: an optional * per-invocation turn cap, an optional per-invocation wall-clock cap, and an optional durable token * budget on the goal. Each submitted pass still reports turn/wall-clock telemetry; provider usage * and spend are attributed at the response boundary. The host compares each pass's authoritative * progress revision and records unchanged passes as stalls, so the continuation prompt can force * a different recovery approach even when a model omits a voluntary `no_progress` call. */ import type { GoalContinuationLoopOptions, GoalContinuationLoopResult, GoalContinuationOnceOptions, GoalContinuationOnceResult, PromptOptions } from "./agent-session-contracts.ts"; import type { GoalRuntimeSnapshot, GoalRuntimeSnapshotSettings } from "./goals/goal-runtime-snapshot.ts"; export interface GoalLoopControllerDeps { /** Read the current goal runtime snapshot (continuation decision + goal state) fresh each pass. */ getGoalRuntimeSnapshot(settings: GoalRuntimeSnapshotSettings): GoalRuntimeSnapshot; /** Submit a continuation prompt through the session's own prompt path. */ prompt(text: string, options?: PromptOptions): Promise<"completed" | "interrupted">; /** * Persist one submitted pass's turn and active-wall-clock contribution. Provider usage is charged * at each assistant response before another request can be admitted. Called once per * pass actually SUBMITTED (never for a no-op `continueGoalOnce` call). */ recordGoalContinuationPass(pass: { turns: number; wallClockMs: number; goalId: string; progressRevision: number; stallTurns: number; }): void; /** Persist an exhausted/non-retryable continuation failure as a stopped goal state. */ recordGoalContinuationFailure(error: unknown): void; /** Persist a reason-specific budget terminal state before returning control. */ markGoalBudgetLimited(reason: string): void; } export declare class GoalLoopController { private readonly deps; constructor(deps: GoalLoopControllerDeps); continueGoalOnce(options: GoalContinuationOnceOptions): Promise; continueGoalLoop(options: GoalContinuationLoopOptions): Promise; } //# sourceMappingURL=goal-loop-controller.d.ts.map