import type { RuntimePromotionJournal } from './runtime-promotion-journal-schema.js'; import type { RuntimeExclusiveLease } from '@opensip-cli/core'; declare const ALLOCATION_BRAND: unique symbol; declare const OPEN_RECEIPT_BRAND: unique symbol; declare const CLOSED_RECEIPT_BRAND: unique symbol; declare const RUNTIME_STAGE_AUTHORITY_BRAND: unique symbol; declare const AUTHORED_STATE_AUTHORITY_BRAND: unique symbol; export interface PromotionJournalIdentity { readonly operationId: string; readonly recoveryOwnerToken: string; readonly createdAt: number; } export interface RecoveryOwnerHandoffIdentity { readonly recoveryOwnerToken: string; readonly claimedAt: number; } /** An in-memory allocation is not proof that the journal is durable. */ export interface PromotionJournalAllocation extends PromotionJournalIdentity { readonly [ALLOCATION_BRAND]: never; } interface DurablePromotionJournalReceipt extends PromotionJournalIdentity { readonly coordinationKey: string; readonly revision: number; readonly sha256: string; } /** Exact-object proof that a matching open journal was durably observed. */ export interface DurableOpenPromotionJournal extends DurablePromotionJournalReceipt { readonly state: 'open'; readonly [OPEN_RECEIPT_BRAND]: never; } /** Exact-object proof that a matching closed journal was durably observed. */ export interface DurableClosedPromotionJournal extends DurablePromotionJournalReceipt { readonly state: 'closed'; readonly [CLOSED_RECEIPT_BRAND]: never; } export type DurablePromotionJournal = DurableOpenPromotionJournal | DurableClosedPromotionJournal; /** * Path-neutral, exact-object authority for Task 3.2 stage materialization. * It is useful only with the controller instance that issued it. */ export interface RuntimeStageMaterializationAuthority { readonly coordinationKey: string; readonly operationId: string; readonly revision: number; readonly stageBasename: string; readonly ownershipId: string; readonly [RUNTIME_STAGE_AUTHORITY_BRAND]: never; } export interface RuntimeStageMaterializationIdentity { readonly operationId: string; readonly stageBasename: string; readonly ownershipId: string; } export interface AuthoredStateMaterializationAuthority { readonly coordinationKey: string; readonly operationId: string; readonly revision: number; readonly [AUTHORED_STATE_AUTHORITY_BRAND]: never; } export interface AuthoredStateOwnedBasenames { readonly authoredStage: string; readonly authoredBackup: string; readonly replayManifest: string; } export interface PromotionJournalReceiptExpectation { readonly state?: 'open' | 'closed'; readonly allowedPhases?: readonly RuntimePromotionJournal['progress']['phase'][]; readonly ownedSlot?: { readonly name: keyof RuntimePromotionJournal['owned']; readonly basename: string; }; } type OpenJournalTransition = (receipt: DurableOpenPromotionJournal, desired: RuntimePromotionJournal) => Promise; type ClosedJournalTransition = (receipt: DurableClosedPromotionJournal, desired: RuntimePromotionJournal) => Promise; export interface RuntimePromotionJournalController { readonly allocate: (build: (identity: PromotionJournalIdentity) => RuntimePromotionJournal) => PromotionJournalAllocation; readonly create: (allocation: PromotionJournalAllocation) => Promise; readonly claim: (expectedOperationId?: string) => Promise; readonly verifyOpen: (receipt: DurableOpenPromotionJournal) => Promise; readonly verifyReceipt: (receipt: DurablePromotionJournal, expectation?: PromotionJournalReceiptExpectation) => Promise; readonly replace: (receipt: DurablePromotionJournal, desired: RuntimePromotionJournal) => Promise; readonly handoffRecoveryOwner: (receipt: DurablePromotionJournal, build: (current: RuntimePromotionJournal, identity: RecoveryOwnerHandoffIdentity) => RuntimePromotionJournal) => Promise; readonly recordIntent: OpenJournalTransition; readonly recordPostcondition: OpenJournalTransition; readonly beginRollback: OpenJournalTransition; readonly sealCommitted: OpenJournalTransition; readonly sealRolledBack: OpenJournalTransition; readonly close: (receipt: DurableOpenPromotionJournal, desired: RuntimePromotionJournal) => Promise; readonly recordCleanupIntent: ClosedJournalTransition; readonly recordCleanupPostcondition: ClosedJournalTransition; readonly unlinkClosed: (receipt: DurableClosedPromotionJournal) => Promise; readonly authorizeRuntimeStage: (receipt: DurableOpenPromotionJournal, stageBasename: string) => Promise; readonly assertRuntimeStageAuthority: (authority: RuntimeStageMaterializationAuthority, stageBasename: string) => RuntimeStageMaterializationIdentity; readonly assertBoundLease: (lease: RuntimeExclusiveLease) => void; readonly authorizeAuthoredState: (receipt: DurableOpenPromotionJournal, lease: RuntimeExclusiveLease) => Promise; readonly assertAuthoredStateAuthority: (authority: AuthoredStateMaterializationAuthority, basenames: AuthoredStateOwnedBasenames) => void; } export interface AllocationMetadata { readonly kind: 'allocation'; readonly record: RuntimePromotionJournal; readonly content: string; } export interface ReceiptMetadata { readonly kind: 'receipt'; readonly record: RuntimePromotionJournal; readonly content: string; readonly sha256: string; } type JournalErrorFactory = (message: string) => Error; export declare class PromotionJournalCapabilityRegistry { #private; constructor(journalError: JournalErrorFactory); allocate(identity: PromotionJournalIdentity, record: RuntimePromotionJournal, content: string): PromotionJournalAllocation; /** @throws {Error} When the allocation capability is stale or foreign. */ takeAllocation(allocation: PromotionJournalAllocation): AllocationMetadata; issueReceipt(record: RuntimePromotionJournal, content: string, sha256: string): DurablePromotionJournal; /** @throws {Error} When the receipt capability is stale, foreign, or altered. */ receipt(receipt: DurablePromotionJournal): ReceiptMetadata; retire(receipt: DurablePromotionJournal): void; issueRuntimeStageAuthority(receipt: DurableOpenPromotionJournal, record: RuntimePromotionJournal, stageBasename: string): RuntimeStageMaterializationAuthority; /** @throws {Error} When runtime-stage materialization authority is stale or foreign. */ consumeRuntimeStageAuthority(authority: RuntimeStageMaterializationAuthority, stageBasename: string): RuntimeStageMaterializationIdentity; issueAuthoredStateAuthority(receipt: DurableOpenPromotionJournal, record: RuntimePromotionJournal): AuthoredStateMaterializationAuthority; /** @throws {Error} When authored-state materialization authority is stale or foreign. */ consumeAuthoredStateAuthority(authority: AuthoredStateMaterializationAuthority, basenames: AuthoredStateOwnedBasenames): void; } export {}; //# sourceMappingURL=runtime-promotion-journal-controller-internal.d.ts.map