/** * Continue-intent detection + continuation resolution. * * ## Problem * * Users frequently type a bare "continue" (or "devam", "go on", "keep going") * to nudge the agent forward without supplying any new instruction. On its own * that word carries no information about *what* to continue — the model has to * re-derive "what was next" from history, which drifts as the context window is * compacted. Left unanchored, a run of "continue … continue … continue" turns * into an ever-vaguer manual loop: the model repeats work, declares completion * prematurely, or wanders. * * ## Approach * * A bare "continue" is not new information — it points at an *existing* goal. * So instead of asking the model to remember a hidden per-message marker, we * resolve the continuation against the state we already keep: * * 1. **Open todos** — the strongest, most durable anchor. Survives context * compaction (todos are re-injected each turn) and goal.json persistence. * "continue" = resume the next open todo. * 2. **Parsed `` suggestions** — the menu surfaced after the last * completed turn (already extracted and stored by the surface's * suggestion store). "continue" = do suggestion #1. * 3. **Open continuation** — no explicit task is queued, but the user still * wants work to proceed. We inject an instruction that tells the model to * pick the single most valuable next step itself and carry it out — while * explicitly forbidding fabricated busywork. This is what keeps "continue" * from ever dead-ending. * * This module is pure and surface-agnostic: detection takes the raw string, * resolution takes already-collected data (todos + parsed suggestion strings). * The REPL and TUI wire it in at the point where a user message becomes an * agent run, *before* prompt refinement — a bare "continue" has nothing * meaningful to refine, and refining it would only add latency and drift. * * The three triggers of the same continuation machinery — the user typing * "continue", the model emitting the `[continue]` marker (see * {@link parseContinueDirective}), and an autonomy tick — all ultimately want * the same thing: advance the plan. This module is the manual-trigger path. */ import type { TodoItem } from './context.js'; /** * True when `raw` is a bare "continue"-style nudge and nothing else. * * Strict by construction: the message must normalize to exactly one of * {@link CONTINUE_PHRASES}. Anything with additional substance ("continue but * skip tests", "go on to the next file and commit") normalizes to a string * outside the set and returns false, so it is handled as an ordinary message. */ export declare function detectContinueIntent(raw: string): boolean; /** * Where the resolved continuation came from: * - `todo` — resumed the next open todo (strongest anchor) * - `suggestion` — took the top parsed `` suggestion * - `open` — no explicit task queued; model self-determines the step */ export type ContinuationSource = 'todo' | 'suggestion' | 'open'; export interface ContinuationInput { /** Live todo list (`ctx.todos`). */ todos?: readonly TodoItem[] | undefined; /** Already-parsed `` suggestion strings from the surface store. */ suggestions?: readonly string[] | undefined; } export interface ResolvedContinuation { source: ContinuationSource; /** * The concrete instruction injected as the next user turn in place of the * bare "continue". Written for the model, not the human. */ text: string; /** * Short one-line label for the surface to echo (dim) so the human sees what * "continue" resolved to without the full injected paragraph. */ label: string; } /** * Resolve what a bare "continue" should do, given the current run state. * * The ladder — first match wins: * 1. an open todo (in-progress preferred, else the first pending), * 2. the top stored suggestion, * 3. an open continuation that never dead-ends. * * Always returns a usable {@link ResolvedContinuation}; the `open` branch is * the guaranteed fallback so "continue" keeps work moving even with no todos * and no suggestions. */ export declare function resolveContinuation(input: ContinuationInput): ResolvedContinuation; //# sourceMappingURL=continue-intent.d.ts.map