import type { CheckpointTuple } from '@langchain/langgraph'; /** * Where a resume is asked for. `interactive` is every spelling that lands in a `chat`/`code` * session; `history` is `gth history resume`, which always runs the conversation as the command it * was recorded under. */ export declare const RESUME_SURFACES: readonly ['ask', 'exec', 'interactive', 'history']; export type ResumeSurface = (typeof RESUME_SURFACES)[number]; /** The commands a conversation can have been recorded as and still be resumed. */ export declare const RESUMABLE_RECORDED_COMMANDS: readonly ['ask', 'exec', 'chat', 'code']; export type ResumableRecordedCommand = (typeof RESUMABLE_RECORDED_COMMANDS)[number]; /** * One cell of the matrix. * * - `resume` — the existing GS2-20 cell, unchanged: an interactive conversation re-entered as an * interactive session. * - `resume-if-clean` — a cell this node added. It resumes only when the stored thread does not end * on a tool call that was never answered. Such a thread is what a run leaves when it stopped at * an approval it could not ask anyone about; appending a user message to it sends the model an * assistant tool call with no result, which real providers reject (measured on GS2-106 Task 2, * `handoff/gs2-106-2-interrupt-probe.out`). GS2-20's own cell is left alone on purpose; its * exposure is a separate follow-up. */ export type ResumeCell = 'resume' | 'resume-if-clean'; /** * THE table. Read by {@link resumeMatrixVerdict} only; see the module docblock for why each cell is * what it is. */ export declare const RESUME_MATRIX: Readonly>>>; /** * The subcommands a `--resume ` may be given to, and the surface each one is. The root * `gth --resume ` derives the set it accepts from this map's keys. */ export declare const RESUME_SURFACE_OF_SUBCOMMAND: Readonly>; /** What the matrix says about one conversation on one surface. */ export type ResumeMatrixVerdict = { ok: true; /** Whether the stored thread must also end cleanly ({@link threadTail}) for this cell. */ requireCleanTail: boolean; } | { ok: false; reason: 'fan-out'; origin: string; command?: string; } | { ok: false; reason: 'unsupported-command'; command?: string; }; /** The two columns of a conversation row the matrix reads. */ export interface ResumeMatrixRow { command?: string; origin?: string; } /** * Look one conversation up in {@link RESUME_MATRIX}. The origin is checked first: a fan-out cell is * refused on every surface, and its command column cannot be trusted to say otherwise because it * names the mode the cell ran under. */ export declare function resumeMatrixVerdict(row: ResumeMatrixRow, surface: ResumeSurface): ResumeMatrixVerdict; /** * How a stored thread ends, read off its newest checkpoint. * * - `clean` — it can take another user message. * - `pending-tool-call` — its last assistant message asked for a tool call that has no result, or * the checkpoint carries a pending interrupt write. Both are what a run leaves when it stopped at * an approval nobody could answer. * * **Read off the checkpoint, not asked of the runner.** The runner's own pending-interrupt query * answered 0 for exactly this thread while the interrupt write was on disk (the same probe), because * it asks the graph for its tasks and a run that threw has none. The tuple is the ground truth. */ export type ThreadTail = 'clean' | 'pending-tool-call'; export declare function threadTail(tuple: CheckpointTuple): ThreadTail;