/** * wait Command - Block until agent completion or prompt detection * Issue #518: [DR1-08] Factory pattern * * Exit codes [DR1-03]: * - 0: SUCCESS (agent completed) * - 10: PROMPT_DETECTED (agent waiting for user input, including arrow-key * selection lists — Issue #1628 — and interactive frames the detection * layer could not classify at all — Issue #1708. Both are reported as * exit 10 with a distinguishing `type` rather than a new exit code, so * callers that already branch on 10 keep working. Issue #2463: a prompt * the target's own Auto-Yes is answering is held for --auto-yes-grace * seconds before it is reported.) * - 11: UPSTREAM_FAULT (--fail-on-upstream-fault only, Issue #1839: the agent * came back to its composer with an upstream API failure on the frame) * - 124: TIMEOUT (--timeout exceeded) * Issue #1544 adds --verify / --require-work, which can turn a detected * completion into 20 (VERIFY_FAILED) or 21 (NOT_STARTED). * Issue #1628 also returns 21 without --verify when the session was never * running: a wait with nothing to wait for must not report success. * Infrastructure errors use ExitCode (1, 2, 99) */ import { Command } from 'commander'; import type { WaitPromptOutput } from '../types/api-responses'; import { ApiClient } from '../utils/api-client'; import type { PollWorktreeOptions } from './wait-poll-state'; export { formatRestartReleaseNotice } from './wait-notices'; export { SELF_RESUME_CAPABILITY, SELF_RESUME_HOLD_MS, SELF_RESUME_PENDING_DETAIL, TURN_OPENING_EVENT_TYPES, } from './wait-turn-boundary'; export type { PollWorktreeOptions } from './wait-poll-state'; export { HOOK_STOP_SETTLE_INTERVAL_MS, HOOK_STOP_SETTLE_MAX_MS, settleCurrentOutputPath, } from './wait-hook-stop-settle'; /** * Poll a single worktree until completion, prompt, or timeout. * * Exported since Issue #2376 so `ask` can do the WAITING half of its round trip * with this function rather than a second implementation of it. `ask` is * `send` + `wait` + "read the reply", and a private copy of the turn-boundary * rules here (#1839's `basis`, #1975's unanswered-prompt hold, #1708's * unclassified dwell) is a copy that would drift into reporting a completion * this one refuses. #2463's Auto-Yes hold is shared the same way: `ask` passes * no `autoYesGrace` and holds for the default. * * `options.instance` must already be a resolved instance ID — see * {@link resolveWaitInstance}. */ export declare function pollWorktree(client: ApiClient, worktreeId: string, options: PollWorktreeOptions): Promise<{ exitCode: number; output?: WaitPromptOutput; /** Set with exit 11: which upstream fault was on the frame (Issue #3011). */ upstreamFault?: { id: string; matchedText: string; }; }>; export declare function createWaitCommand(): Command; //# sourceMappingURL=wait.d.ts.map