import { type AcquiredLock, type RecoveredLock } from "../runtime/lock.js"; declare const OUTBOX_STORE: unique symbol; declare const CERTIFICATION_WRITER: unique symbol; declare const CERTIFICATION_RESOLVER: unique symbol; declare const CERTIFICATION_REFERENCE: unique symbol; declare const CERTIFICATION_CONSUMER_ID = "run-ledger-authority"; export interface OutboxEvent { schema_version: 1; event_id: string; event_kind: string; source_id: string; source_version: number; dedupe_key: string; occurred_at: string; payload: Record; } export interface OutboxReceipt { schema_version: 1; receipt_id: string; event_id: string; consumer_id: string; operation_nonce: string; processed_at: string; result: Record; } export interface PublishOutboxEventInput { eventKind: string; sourceId: string; sourceVersion: number; dedupeKey: string; occurredAt: string; payload: Record; } export interface CommitOutboxReceiptInput { eventId: string; consumerId: string; processedAt: string; result: Record; } export interface OutboxStore { readonly [OUTBOX_STORE]: true; publish(input: PublishOutboxEventInput): Readonly<{ status: "created" | "replayed"; event: OutboxEvent; }>; readEvent(eventId: string): OutboxEvent; readReceipt(eventId: string, consumerId: string): OutboxReceipt | undefined; listEvents(): readonly OutboxEvent[]; listPending(consumerId: string): readonly OutboxEvent[]; acquireProcessingLock(eventId: string, consumerId: string): AcquiredLock; recoverProcessingLock(input: { eventId: string; consumerId: string; recoveredBy: string; reason: string; expectedGenerationId: string; }): RecoveredLock; commitReceipt(input: CommitOutboxReceiptInput): Readonly<{ status: "created" | "replayed"; receipt: OutboxReceipt; }>; } export interface CanonicalRunHeadReference { readonly entry_id: string; readonly run_id: string; readonly sequence: number; readonly sha256: string; readonly file_name: string; } export interface CanonicalRunCertificationReference { readonly run_id: string; readonly head: CanonicalRunHeadReference; readonly metrics_sha256: string; } export type RunCertificationAuthorityAction = "start" | "heartbeat" | "process-restart" | "complete"; export interface RunCertificationAuthorityBinding { readonly schema_version: 1; readonly action: RunCertificationAuthorityAction; readonly completion_semantics: "begin-run" | "append-heartbeat" | "record-process-restart" | "terminal-run-completed"; readonly run_id: string; readonly operation_id: string; readonly run_kind: "12h" | "24h"; readonly policy_sha256: string; readonly ticket_set_digest: string; readonly service_plan_digest: string; readonly expected_head: CanonicalRunHeadReference | null; readonly previous_canary: CanonicalRunCertificationReference | null; } export interface AuthorizeRunCertificationInput { readonly action: RunCertificationAuthorityAction; readonly decisionId: string; readonly authorizedBy: string; readonly runId: string; readonly operationId: string; readonly runKind: "12h" | "24h"; readonly policyDigest: string; readonly ticketSetDigest: string; readonly servicePlanDigest: string; readonly expectedHead: CanonicalRunHeadReference | null; readonly previousCanary: CanonicalRunCertificationReference | null; } export interface RunCertificationAuthorityReference { readonly [CERTIFICATION_REFERENCE]: true; readonly eventId: string; readonly consumerId: typeof CERTIFICATION_CONSUMER_ID; } export interface ResolvedRunCertificationAuthority { readonly reference: { readonly event_id: string; readonly consumer_id: typeof CERTIFICATION_CONSUMER_ID; }; readonly binding: RunCertificationAuthorityBinding; readonly decision_id: string; readonly authorized_by: string; readonly event_sha256: string; readonly receipt_sha256: string; readonly occurred_at: string; readonly processed_at: string; } export interface RunCertificationAuthorityWriter { readonly [CERTIFICATION_WRITER]: true; authorize(input: AuthorizeRunCertificationInput): RunCertificationAuthorityReference; } export interface RunCertificationAuthorityResolver { readonly [CERTIFICATION_RESOLVER]: true; resolve(reference: RunCertificationAuthorityReference): ResolvedRunCertificationAuthority; hydrate(reference: { readonly eventId: string; readonly consumerId: string; }): RunCertificationAuthorityReference; resolveStored(reference: { readonly event_id: string; readonly consumer_id: string; }): ResolvedRunCertificationAuthority; } export interface RunCertificationAuthority { readonly writer: RunCertificationAuthorityWriter; readonly resolver: RunCertificationAuthorityResolver; } export declare class ImmutableOutboxConflictError extends Error { constructor(kind: "event" | "receipt", id: string); } export declare function createOutboxStore(options: { eventsRoot: string; receiptsRoot: string; locksRoot: string; }): OutboxStore; export declare function assertOutboxStore(value: unknown): asserts value is OutboxStore; export declare function createRunCertificationAuthority(outbox: OutboxStore): RunCertificationAuthority; export declare function assertRunCertificationAuthorityWriter(value: unknown): asserts value is RunCertificationAuthorityWriter; export declare function assertRunCertificationAuthorityResolver(value: unknown): asserts value is RunCertificationAuthorityResolver; export declare function assertRunCertificationAuthorityReference(value: unknown): asserts value is RunCertificationAuthorityReference; export declare function deriveEventId(input: Pick): string; export declare function deriveReceiptId(eventId: string, consumerId: string): string; export declare function deriveOperationNonce(eventId: string, consumerId: string): string; export declare function deriveProcessingLockId(eventId: string, consumerId: string): string; export declare function assertOutboxTimestamp(value: string, label: string): string; export {};