/** Fixed refusal vocabulary for the interim fallback; never native text. */ export type CodexCorpusRefusal = "native-lock-present" | "executable-unverified" | "probe-inconclusive" | "command-present" | "writer-busy" | "skills-lock-unavailable" | "lease-changed"; export interface CodexCorpusWriteOptions { /** The selected native executable; never a shell command. */ codexCommand?: string; /** Existing callers with a reviewed executable binding retain that binding. */ codexSha256?: string; } /** The probe behind a fallback write. `executable`, `sha256` and `size` identify the * selected executable file (for an npm install, the launcher script), not the vendor * binary it starts. Never contains native output. */ export interface CodexAdmissionProbe { kind: "help-unrecognized-subcommand"; executable: string; sha256: string; size: number; version: string; probeExitCode: 2; controlExitCode: 0; } export interface CodexCorpusAdmission { nativeAdmission: "verified" | "unavailable"; probe?: CodexAdmissionProbe; } export interface CodexAdmissionReceipt { nativeAdmission?: "unavailable"; nativeAdmissionProbe?: CodexAdmissionProbe; } export interface CodexCorpusLease { assertCurrent(): void; close(): void; admission: CodexCorpusAdmission; } /** Boolean writers have no receipt: they use the fallback only when the caller takes this record. */ export interface CodexAdmissionRecordOptions { onCodexAdmission?: (admission: CodexCorpusAdmission) => void; } /** Gate policy for one transaction; writers without a receipt disable the fallback. */ export interface CodexCorpusWritePolicy { fallback?: boolean; } /** Reads `onCodexAdmission` once. Only a synchronous function enables the fallback and * receives the record; any other defined value refuses before anything happens, and a * callback that returns a thenable refuses before anything is removed. */ export declare function codexAdmissionRecord(options: CodexAdmissionRecordOptions): { policy: CodexCorpusWritePolicy; deliver(admission: CodexCorpusAdmission | undefined): void; }; /** Receipt fields for a write made under the interim fallback; native-path receipts are unchanged. */ export declare function codexAdmissionReceipt(admission: CodexCorpusAdmission | undefined): CodexAdmissionReceipt; /** Protected aliases fail closed; unrelated project paths remain usable. */ export declare function codexCorpusRootForPath(path: string): string | undefined; export declare function acquireCodexCorpusWrite(roots: readonly string[], options: CodexCorpusWriteOptions, policy?: CodexCorpusWritePolicy): CodexCorpusLease; /** Keep the descriptor through preimage checks, writes, rollback and readback. */ export declare function withCodexCorpusWrite(roots: readonly string[], run: (assertCurrent: () => void, admission?: CodexCorpusAdmission) => T, options?: CodexCorpusWriteOptions, policy?: CodexCorpusWritePolicy): T; /** The callback must await every native child's close before settling. */ export declare function withCodexCorpusWriteAsync(roots: readonly string[], run: (assertCurrent: () => void, admission?: CodexCorpusAdmission) => Promise, options?: CodexCorpusWriteOptions, policy?: CodexCorpusWritePolicy): Promise;