/** * The RUN PROGRAM record: the source a run was started from, beside its spec. * * A run used to store no source, so every `resume` and every takeover had to be handed the same * file again, and a daemon that hosts drivers had nowhere to read it from after a restart. The * source is written here by the driver that pins the run, create-only, and read back by whoever * drives the run next. A resume handed DIFFERENT source is a fork (SPEC 14.5); the recorded source * is what that comparison is made against, and the hash the language pins each step to is derived * from the same bytes. * * Atomic and create-only: what a run was started from is one fact, decided once. It carries no hash * of its own on purpose: the language owns `programHashOf`, core does not depend on the language, * and a second hash function here would be a different answer wearing the same name. */ import type { KV } from "@nats-io/kv"; export interface RunProgramValue { readonly v: 1; readonly run: string; /** The program, verbatim. */ readonly source: string; /** The file name the source came from, when it came from one. Diagnostic only. */ readonly file?: string; readonly at: number; } /** * Record a run's source, create-only. * * A retry with the SAME source is this driver's own earlier attempt and succeeds. A different source * under a run that already has one is refused: a run is started from one program, and moving it onto * another is a migration, which files its own record. */ export declare function recordRunProgram(kv: KV, endpoint: string, value: RunProgramValue): Promise<{ key: string; created: boolean; }>; /** The source a run was started from. `undefined` = none recorded (a run started before this * record existed, or one whose start crashed between the activation and the pin). */ export declare function readRunProgram(kv: KV, endpoint: string, runId: string): Promise; //# sourceMappingURL=run-program.d.ts.map