/** * wait Command - re-reading the pane after a hook_stop (Issue #3956) * Issue #3964: split out of wait.ts; wait.ts re-exports what it exported. */ import type { CurrentOutputResponse } from '../types/api-responses'; import type { PollContext, PollState } from './wait-poll-state'; /** * Interval between the re-reads of the pane after a `hook_stop`, under * `--fail-on-upstream-fault` (Issue #3956). See {@link settleAfterHookStop}. */ export declare const HOOK_STOP_SETTLE_INTERVAL_MS = 500; /** * Longest `wait` re-reads the pane after a `hook_stop` before judging the last * frame it read (Issue #3956). See {@link settleAfterHookStop}. */ export declare const HOOK_STOP_SETTLE_MAX_MS = 5000; /** * The path {@link settleAfterHookStop} re-reads the pane on (Issue #3956): * `?fresh=1` past the server's capture cache, whose 5 s TTL would otherwise * answer two reads 500 ms apart with the same capture and read a pane still * drawing as settled. A server older than the parameter ignores it and answers * as before, from the cache. */ export declare function settleCurrentOutputPath(worktreeId: string, instanceId?: string): string; /** * The frame a `hook_stop` completion is judged on, once the pane has settled * (Issue #3956). * * The agent's `Stop` can land before its reply is drawn. Measured 2026-10-27 on * codex-cli 0.164.0: `ask` returned on `basis=hook_stop` with the pane ending at * row 441–445 of 480, and the last rows were drawn ~3 s later. An upstream fault * printed at the end of the turn is in those rows, so the frame of the `Stop` * poll can carry no `upstreamFault` while the turn did fail. * * So the pane is read again every {@link HOOK_STOP_SETTLE_INTERVAL_MS} until two * reads in a row carry the same frame, and that frame is the one judged — by * every stage of a poll, not by the fault alone: {@link pollWorktree} judges it * as the next poll, so a prompt or a new turn drawn meanwhile is read as one. * The bound is {@link HOOK_STOP_SETTLE_MAX_MS}: no re-read starts after it, and * a pane still drawing then is judged on the last frame read rather than held. * The re-reads ask for a fresh capture ({@link settleCurrentOutputPath}); the * poll that saw the `Stop` does not. * * `--timeout` / `--stall-timeout` bound it too: no interval is slept that the * next re-read could not finish within, and each re-read is aborted at the * earliest of one interval, the bound and those deadlines — so the verdict * comes at most {@link HOOK_STOP_SETTLE_MAX_MS} after the `Stop` poll. The bound * is `settleDeadline`, set by {@link readyStage} when it reads the `Stop` poll and * shared with the ledger read of {@link faultFrameHasStop}, so time spent there * is not given again here. A re-read that is aborted or * fails ends the settle on the frame before it (an `ApiError` that is not an * abort still ends the wait, as on any poll). Frames that change count as * activity for `--stall-timeout`, as on any poll. */ export declare function settleAfterHookStop(poll: PollContext, state: PollState, data: T, settleDeadline: number): Promise; /** * Whether the agent has reported the end of the turn on a frame that carries an * upstream fault, so that frame is judged once settled (Issue #3956). * * The same two records {@link readyCompletionBasis} reads as `hook_stop`: a * `Stop` at or after the adopted turn, or — with no turn adopted — a `Stop` * after the newest prompt in the chat ledger. Neither is #1839's case (back at * the composer with no `Stop`), whose fault is reported on the spot as before. */ export declare function faultFrameHasStop(poll: PollContext, state: PollState, data: CurrentOutputResponse, settleDeadline: number): Promise; //# sourceMappingURL=wait-hook-stop-settle.d.ts.map