/** * Pure classifier for the persisted state of an agent-submission input * (v2 migration, phase A5). * * Given a session's active path and a submission id, decides how far the * submission progressed before the session was last saved. It is the single * source of truth for reconciliation: the runner claims a replacement * attempt (or settles) based on this classification, and the executor's * `session.prompt({ submission })` path is idempotent by submission id, so a * re-run after `continuable`/`uncertain` never double-applies the input. * * Adaptation from flue's fine-grained `classifySubmissionState`: the harness * SessionEntry DAG has no per-turn stop-reason records, so the fine states * collapse to the coarse inspection union reconciliation actually consumes. * One deliberate divergence: flue classifies "a later user input exists" as * uncertain and fails the operation; the harness classifies it `completed`. * A later prompt means the input entry is already part of durable model * context and was consumed by the conversation moving on — re-executing * would double-deliver, and failing would misreport work the model already * absorbed. Settling as completed is the only outcome that cannot corrupt * the session. */ import type { SessionEntry } from './types.js'; /** Coarse persisted-progress classification consumed by reconciliation. */ export type SubmissionInspection = 'absent' | 'completed' | 'continuable' | 'uncertain'; /** Deterministic canonical settlement entry id for a submission. */ export declare function submissionSettlementEntryId(submissionId: string): string; /** Index of the last canonical user or signal input carrying the submission id, or -1. */ export declare function findSubmissionInputIndex(path: readonly SessionEntry[], submissionId: string): number; /** True when the path carries a canonical `submission_settled` entry for the id. */ export declare function hasSubmissionSettledEntry(path: readonly SessionEntry[], submissionId: string): boolean; /** * Classify how far a persisted submission input progressed. * * - `absent` — the input entry never landed in session history: the attempt * crashed before applying it. Safe to requeue for a clean first attempt. * - `completed` — finished work: a canonical settlement entry exists, an * assistant response follows the input with no unresolved trailing tool * batch, or a later user input shows the conversation moved on. Settle as * success; never retry (retrying completed work is the one unrecoverable * corruption). * - `continuable` — the trailing turn carries unresolved tool calls. The * next `session.prompt()` repairs them with explicit interrupted-outcome * markers (never re-executes a tool) and resumes. * - `uncertain` — the input is durable but nothing observable was persisted * after it. The one accepted provider-redispatch window: a single retry is * safe under the at-least-once execution contract. */ export declare function classifySubmissionState(path: readonly SessionEntry[], submissionId: string): SubmissionInspection; //# sourceMappingURL=submission-state.d.ts.map