import type { KV } from "@nats-io/kv"; /** The bounded decision itself. The bound is the language's (L3043) and is enforced before a * notice is ever written; this type is the shape it arrives in. */ export interface RunNoticeFact { readonly decision: string; readonly outcome: string; readonly detail?: Readonly>; } export interface RunNoticeSpecValue { readonly v: 1; readonly run: string; /** The step that decided it, in the journal's own key vocabulary (`/notify:told#0`). */ readonly step: string; /** The addressee's agent NAME, kept in the value because the key holds only its digest. */ readonly addressee: string; readonly fact: RunNoticeFact; readonly at: number; } export interface RunNoticeStatusValue { readonly v: 1; /** When the addressee's turn actually carried it. */ readonly consumedAt: number; /** WHICH turn carried it, so a consumption can be traced to the goal that did it. */ readonly by: string; readonly observedSpecRevision: number; } /** The key token standing for an agent. Derived from the name, never the name itself. */ export declare function noticeAddresseeId(agent: string): string; /** * The id one notice is filed under. * * Derived from the step's own request id and the addressee, so the same `notify` call re-run after * a crash re-derives exactly the same ids and its create-only writes land on their own records. One * call to N agents writes N notices, and the addressee is what separates them. */ export declare function runNoticeId(requestId: string, addressee: string): string; /** * File one notice, create-only. * * A retry of the same notice is not a conflict: the id is derived from the step's request id and * the addressee, so an existing record with identical bytes is this run's own earlier attempt. * Different bytes under the same id would mean two different decisions claiming one identity, which * is refused rather than overwritten — a notice that could be rewritten would be a message. */ export declare function writeRunNotice(kv: KV, endpoint: string, noticeId: string, value: RunNoticeSpecValue): Promise<{ key: string; created: boolean; }>; export interface RunNoticeRead { readonly noticeId: string; readonly spec: RunNoticeSpecValue; readonly specRevision: number; readonly consumed?: RunNoticeStatusValue; } /** Read one notice with its consumption, or `undefined` when nothing was filed under this id. */ export declare function readRunNotice(kv: KV, endpoint: string, runId: string, addressee: string, noticeId: string): Promise; /** * Every notice addressed to one agent on one run, oldest first. * * ORDER IS PART OF THE CONTRACT, because the render is a table a person or an agent reads top to * bottom: `at` first, then the notice id, so two notices filed in the same millisecond still come * back in one fixed order rather than in whatever order the store enumerated its keys. */ export declare function listRunNotices(kv: KV, endpoint: string, runId: string, addressee: string): Promise; /** * Every notice filed on one RUN, whoever it was addressed to, oldest first. * * The migrate rule asks a question the journal cannot answer on its own: a `notify` entry * records an input HASH, not the agents it addressed, so "has this orphaned notify been consumed?" * cannot be asked per addressee. It is asked per RUN, and each notice's own `step` says which entry * it came from — which is why the step is in the value rather than only in the key. */ export declare function listRunNoticesForRun(kv: KV, endpoint: string, runId: string): Promise; /** * Record that a turn carried this notice. * * **The create-only CAS is the arbiter, and it is the only one.** Two turns racing to claim one * notice both read no status and both write; the store decides, and the loser gets a loud conflict. * A "has it been consumed already?" check before the write would be a fast path that lies under * exactly the race it looks like it is preventing, so there is one gate rather than two — which * turn delivered a notice is a fact about something that happened once. */ export declare function markRunNoticeConsumed(kv: KV, endpoint: string, runId: string, addressee: string, noticeId: string, by: string, at: number): Promise; //# sourceMappingURL=run-notice.d.ts.map