import { type SQL } from "drizzle-orm"; import type { Database } from "./database.js"; export declare const CONTEXT_COMPACTION_FAILED_CODE = "context_compaction_failed"; /** * The compaction-failure hold. When the newest finished turn ended with a * terminal `context_compaction_failed`, machine input that was already pending * at that failure saw only the unchanged history and must not start another * inference by itself. Returns the exact `turn.failed` event sequence that * bounds the hold, or null when no hold applies. * * Input whose `system.update.pending` event is newer than that sequence is new * truth: it makes one new attempt and the held backlog rides along with it * (see docs/context-compaction.md). Session event sequences are allocated under * the session row lock that both the failure settlement and every producer * take, so the comparison is exact commit order, unlike row timestamps. */ export declare function compactionFailureHoldSequenceTx(db: Database, workspaceId: string, sessionId: string): Promise; /** * Correlated predicate over `session_system_updates`: the row's own * `system.update.pending` event was appended after `afterSequence`. */ export declare function systemUpdatePendingAfterSequenceSql(db: Database, workspaceId: string, sessionId: string, afterSequence: number): SQL;