@fabricorg/platform-host 7.2.3 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ declare const PLATFORM_HOST_METRIC_NAMES: {
12
12
  readonly workerCyclesCompleted: "fabric.platform.worker.cycles.completed";
13
13
  readonly workerCyclesFailed: "fabric.platform.worker.cycles.failed";
14
14
  readonly invocationSubmitted: "fabric.platform.invocation.submitted";
15
+ readonly invocationAdmissionRefused: "fabric.platform.invocation.admission_refused";
15
16
  readonly invocationExecutionStarted: "fabric.platform.invocation.execution_started";
16
17
  readonly invocationLeaseClaimed: "fabric.platform.invocation.lease_claimed";
17
18
  readonly invocationCompleted: "fabric.platform.invocation.completed";
@@ -27,6 +28,8 @@ declare const PLATFORM_HOST_METRIC_NAMES: {
27
28
  readonly outboxPublished: "fabric.platform.outbox.published";
28
29
  readonly outboxFailed: "fabric.platform.outbox.failed";
29
30
  readonly outboxDeadLettered: "fabric.platform.outbox.dead_lettered";
31
+ readonly outboxRequeued: "fabric.platform.outbox.requeued";
32
+ readonly outboxRequeueRefused: "fabric.platform.outbox.requeue_refused";
30
33
  readonly invocationBacklog: "fabric.platform.invocation.backlog";
31
34
  readonly invocationRunning: "fabric.platform.invocation.running";
32
35
  readonly invocationExpiredLeases: "fabric.platform.invocation.expired_leases";
@@ -37,7 +40,7 @@ declare const PLATFORM_HOST_METRIC_NAMES: {
37
40
  readonly outboxDeadLetters: "fabric.platform.outbox.dead_letters";
38
41
  };
39
42
  type PlatformHostMetricName = (typeof PLATFORM_HOST_METRIC_NAMES)[keyof typeof PLATFORM_HOST_METRIC_NAMES];
40
- type PlatformHostTelemetryEventName = "worker.cycle.started" | "worker.cycle.completed" | "worker.cycle.failed" | "invocation.submitted" | "invocation.execution_started" | "invocation.lease_claimed" | "invocation.completed" | "invocation.failed" | "invocation.policy_blocked" | "invocation.validation_failed" | "invocation.approval_waited" | "invocation.reconciliation_required" | "outbox.relay.started" | "outbox.relay.completed" | "outbox.relay.failed" | "outbox.lease_claimed" | "outbox.published" | "outbox.failed" | "outbox.dead_lettered";
43
+ type PlatformHostTelemetryEventName = "worker.cycle.started" | "worker.cycle.completed" | "worker.cycle.failed" | "invocation.submitted" | "invocation.admission_refused" | "invocation.execution_started" | "invocation.lease_claimed" | "invocation.completed" | "invocation.failed" | "invocation.policy_blocked" | "invocation.validation_failed" | "invocation.approval_waited" | "invocation.reconciliation_required" | "outbox.relay.started" | "outbox.relay.completed" | "outbox.relay.failed" | "outbox.lease_claimed" | "outbox.published" | "outbox.failed" | "outbox.dead_lettered" | "outbox.requeued" | "outbox.requeue_refused";
41
44
  type PlatformHostMetricType = "counter" | "gauge";
42
45
  type PlatformHostTelemetryAttribute = string | number | boolean;
43
46
  interface PlatformHostLifecycleTelemetry {
@@ -185,6 +188,34 @@ declare class IdempotencyConflictError extends Error {
185
188
  readonly code: "IDEMPOTENCY_CONFLICT";
186
189
  constructor(conflict: IdempotencyConflict);
187
190
  }
191
+ /**
192
+ * Why `submitAction` did not admit a submission of an action that declares
193
+ * `admitSubmission`: `refused`, the check answered `{ admitted: false, code }`
194
+ * with a well-formed code; `failed`, it threw or is not a function;
195
+ * `timed_out`, its answer did not settle within `admissionTimeoutMs`;
196
+ * `invalid_decision`, it answered anything other than `{ admitted: true }`
197
+ * or a well-formed refusal; `invalid_parameters`, the parameters are not a
198
+ * JSON-data object Host could copy at submission (a Proxy, a function, a
199
+ * Date, a typed array or SharedArrayBuffer, a cycle, a getter that throws).
200
+ */
201
+ type ActionAdmissionRefusal = "refused" | "failed" | "timed_out" | "invalid_decision" | "invalid_parameters";
202
+ /**
203
+ * Thrown by `submitAction` when a declared admission check did not admit the
204
+ * submission. Host wrote nothing for it: no invocation, idempotency key,
205
+ * event, policy record or error. The message holds the action id, the
206
+ * refusal and, for `refused`, the check's code; never a submitted value or
207
+ * anything the check threw.
208
+ */
209
+ declare class ActionAdmissionError extends Error {
210
+ readonly actionId: string;
211
+ readonly refusal: ActionAdmissionRefusal;
212
+ /** The check's own code, present only for `refused`. */
213
+ readonly refusalCode?: string | undefined;
214
+ readonly code: "ACTION_ADMISSION_REFUSED";
215
+ constructor(actionId: string, refusal: ActionAdmissionRefusal,
216
+ /** The check's own code, present only for `refused`. */
217
+ refusalCode?: string | undefined);
218
+ }
188
219
  type ExternalCompletionRefusal = "still_executing" | "not_found" | "not_awaiting" | "immediate_contract" | "reference_mismatch" | "provider_mismatch" | "invalid_completion" | "result_invalid";
189
220
  /**
190
221
  * Why a completion was not applied, typed so a webhook handler can answer
@@ -253,6 +284,13 @@ interface ActionInvocationRecord {
253
284
  mutationFootprint?: MutationFootprint;
254
285
  executionPrincipal?: ExecutionPrincipal;
255
286
  runtimeEvidence?: GovernanceRuntimeEvidence;
287
+ /**
288
+ * When `submitAction` admitted the submission through the action's
289
+ * `admitSubmission` check, set on creation and never patched. Host refuses
290
+ * to execute an invocation of an action that declares the check when this
291
+ * is absent, and passes it to the handler as `ActionContext.admittedAt`.
292
+ */
293
+ admittedAt?: Date;
256
294
  error?: string;
257
295
  createdAt: Date;
258
296
  updatedAt: Date;
@@ -447,7 +485,24 @@ interface OutboxEventMetadata {
447
485
  payloadClassification: EventPayloadClassification;
448
486
  traceContext?: Record<string, string>;
449
487
  includeProvenance?: boolean;
488
+ /**
489
+ * Only `true` puts the event's `actorId` and `actorType` on the outbox envelope. Absent or any
490
+ * other value leaves them off, and the outbox record says the actor was `suppressed`.
491
+ */
492
+ includeActor?: boolean;
450
493
  }
494
+ /**
495
+ * Whether Host put actor identity on an outbox record's envelope, decided by `includeActor` when
496
+ * the record was written. A record has no value when it predates the decision (`legacy`).
497
+ */
498
+ type OutboxActorDisclosure = "included" | "suppressed";
499
+ /**
500
+ * What the relay tells a publisher about an envelope's actor identity: the record's
501
+ * `OutboxActorDisclosure`, or `legacy` for a record with none. The memory and PostgreSQL stores
502
+ * hydrate actor identity only for `included` records, so their legacy and suppressed envelopes carry
503
+ * none; a consumer that needs it reads the canonical event.
504
+ */
505
+ type EnterpriseEventActorDisclosure = OutboxActorDisclosure | "legacy";
451
506
  interface EnterpriseEventEnvelope {
452
507
  eventId: string;
453
508
  eventType: string;
@@ -460,6 +515,10 @@ interface EnterpriseEventEnvelope {
460
515
  actionInvocationId?: string;
461
516
  correlationId: string;
462
517
  causationId?: string;
518
+ /** Present only when `includeActor` opted this event in; the key is absent otherwise. */
519
+ actorId?: string;
520
+ /** Present only when `includeActor` opted this event in; the key is absent otherwise. */
521
+ actorType?: string;
463
522
  occurredAt: Date;
464
523
  recordedAt: Date;
465
524
  producerModuleVersion: string;
@@ -478,6 +537,8 @@ interface OutboxRecord {
478
537
  tenantId: string;
479
538
  spaceId: string;
480
539
  event: EnterpriseEventEnvelope;
540
+ /** Absent for a record written before Host recorded the `includeActor` decision. */
541
+ actorDisclosure?: OutboxActorDisclosure;
481
542
  status: OutboxStatus;
482
543
  attemptCount: number;
483
544
  availableAt: Date;
@@ -523,6 +584,125 @@ interface OutboxPlatformHostStore<TDb> extends PlatformHostStore<TDb> {
523
584
  statuses?: OutboxStatus[];
524
585
  }): Promise<OutboxRecord[]>;
525
586
  }
587
+ /**
588
+ * Append-only evidence of one operator requeue of a dead-lettered outbox
589
+ * record. The `prior*` fields are the dead-letter state the requeue replaced,
590
+ * so the failure that exhausted the record stays readable after its attempt
591
+ * budget is reset.
592
+ */
593
+ interface OutboxRequeueRecord {
594
+ id: string;
595
+ outboxId: string;
596
+ tenantId: string;
597
+ spaceId: string;
598
+ eventId: string;
599
+ actorId: string;
600
+ actorType: ActorType;
601
+ /** Operator-supplied justification, persisted as audit evidence. Must not carry secrets. */
602
+ reason: string;
603
+ requeuedAt: Date;
604
+ /** When the requeued record became claimable again. */
605
+ availableAt: Date;
606
+ priorAttemptCount: number;
607
+ priorLastError?: string;
608
+ priorAvailableAt: Date;
609
+ priorLeaseToken: number;
610
+ }
611
+ interface RequeueOutboxDeadLetterStoreInput {
612
+ id: string;
613
+ tenantId: string;
614
+ spaceId: string;
615
+ /** Identity of the evidence row written with the transition. */
616
+ requeueId: string;
617
+ actorId: string;
618
+ actorType: ActorType;
619
+ reason: string;
620
+ requeuedAt: Date;
621
+ availableAt: Date;
622
+ /**
623
+ * The lease token of the dead letter the caller read and authorized. Every
624
+ * claim increments the token and a requeue never lowers it, so a record
625
+ * that was requeued, claimed and dead-lettered again carries a higher token
626
+ * than the one observed, and the requeue is refused as `stale`.
627
+ */
628
+ expectedLeaseToken: number;
629
+ }
630
+ /**
631
+ * `not_found`: no record with this id in the tenant and space, including a
632
+ * record that exists under another tenant or space. `not_dead_letter`: the
633
+ * record exists but is pending or published, for example because another
634
+ * requeue won the compare-and-set. `stale`: the record is a dead letter
635
+ * again, but not the one the caller observed; read and authorize it afresh.
636
+ */
637
+ type OutboxRequeueRefusal = "not_found" | "not_dead_letter" | "stale";
638
+ type RequeueOutboxDeadLetterStoreResult = {
639
+ applied: true;
640
+ record: OutboxRecord;
641
+ requeue: OutboxRequeueRecord;
642
+ } | {
643
+ applied: false;
644
+ refusal: OutboxRequeueRefusal;
645
+ currentStatus?: OutboxStatus;
646
+ };
647
+ /**
648
+ * Optional outbox capability that moves a dead-lettered record back to
649
+ * pending. Kept apart from `OutboxPlatformHostStore` so a custom outbox store
650
+ * that predates it still satisfies that interface.
651
+ */
652
+ interface OutboxRequeuePlatformHostStore<TDb> extends OutboxPlatformHostStore<TDb> {
653
+ getOutboxRecord(id: string, tenantId: string, spaceId: string): Promise<OutboxRecord | undefined>;
654
+ /**
655
+ * Compare-and-set from `dead_letter` at `expectedLeaseToken` to `pending`
656
+ * within the tenant and space: resets `attemptCount` to 0, sets
657
+ * `availableAt`, clears any lease owner while keeping the lease token,
658
+ * keeps `lastError`, and appends one `OutboxRequeueRecord` in the same
659
+ * atomic step. A record in any other state, at another lease token, or in
660
+ * another scope is refused and nothing is written. The returned requeue
661
+ * evidence shares nothing with stored history. The returned outbox record
662
+ * has its own Date fields; its event payload and provenance are shallow.
663
+ */
664
+ requeueOutboxDeadLetter(input: RequeueOutboxDeadLetterStoreInput): Promise<RequeueOutboxDeadLetterStoreResult>;
665
+ /** Requeue evidence for a scope, oldest first; `outboxId` narrows it to one record. */
666
+ listOutboxRequeues(input: {
667
+ tenantId: string;
668
+ spaceId: string;
669
+ outboxId?: string;
670
+ }): Promise<OutboxRequeueRecord[]>;
671
+ }
672
+ interface RequeueOutboxDeadLetterInput {
673
+ outboxId: string;
674
+ tenantId: string;
675
+ spaceId: string;
676
+ /** Trusted operator identity from the caller's authenticated session, never from request input. */
677
+ actorId: string;
678
+ actorType: ActorType;
679
+ /** Required justification, at most 1,000 characters, persisted as audit evidence. */
680
+ reason: string;
681
+ /** When the record becomes claimable again; defaults to the host clock. */
682
+ availableAt?: Date;
683
+ }
684
+ type RequeueOutboxDeadLetterRefusal = OutboxRequeueRefusal | "not_authorized";
685
+ type RequeueOutboxDeadLetterResult = {
686
+ status: "requeued";
687
+ record: OutboxRecord;
688
+ requeue: OutboxRequeueRecord;
689
+ } | {
690
+ status: "refused";
691
+ refusal: RequeueOutboxDeadLetterRefusal;
692
+ /** Present for `not_dead_letter` and `stale`: the state the record was found in. */
693
+ currentStatus?: OutboxStatus;
694
+ message: string;
695
+ };
696
+ /** Facts given to `authorizeOutboxRequeue`. `record` is absent when no record with this id exists in the scope. */
697
+ interface OutboxRequeueAuthorizationInput {
698
+ tenantId: string;
699
+ spaceId: string;
700
+ actorId: string;
701
+ actorType: ActorType;
702
+ outboxId: string;
703
+ reason: string;
704
+ record?: Pick<OutboxRecord["event"], "eventId" | "eventType" | "payloadClassification"> & Pick<OutboxRecord, "status" | "attemptCount">;
705
+ }
526
706
  /**
527
707
  * Optional production capability for atomic domain/event persistence.
528
708
  *
@@ -648,6 +828,16 @@ interface ActionExecutionAuthorizationInput extends ActionAuthorizationInput {
648
828
  invocation: Readonly<ActionInvocationRecord>;
649
829
  executionReason: ActionExecutionReason;
650
830
  }
831
+ /**
832
+ * Input to `resolvePolicies`. Carries the invocation identity and the
833
+ * schema-parsed durable (post-redaction) parameters so a resolver can choose
834
+ * the policy snapshot pinned to this specific invocation. Host keeps the first
835
+ * persisted evaluation per invocation and policy, so return the same snapshot
836
+ * for an `actionInvocationId` on every attempt.
837
+ */
838
+ interface ResolvePoliciesInput extends ActionExecutionAuthorizationInput {
839
+ declaredPolicyIds: readonly string[];
840
+ }
651
841
  interface PlatformHostAuthorization {
652
842
  checkEntitlement(input: ActionAuthorizationInput): Promise<boolean>;
653
843
  authorize(input: ActionAuthorizationInput): Promise<boolean>;
@@ -660,6 +850,12 @@ interface PlatformHostAuthorization {
660
850
  authorizeApproval?(input: ActionAuthorizationInput & {
661
851
  decision: ActionApprovalDecision;
662
852
  }): Promise<boolean>;
853
+ /**
854
+ * Authorization for `requeueOutboxDeadLetter`. There is no action to fall
855
+ * back to, so when this is absent every requeue is refused as
856
+ * `not_authorized`. A throw propagates and nothing is requeued.
857
+ */
858
+ authorizeOutboxRequeue?(input: OutboxRequeueAuthorizationInput): Promise<boolean>;
663
859
  }
664
860
  interface DispatchActionInput {
665
861
  actionInvocationId: string;
@@ -675,6 +871,18 @@ interface DispatchActionResult {
675
871
  interface PlatformActionDispatcher {
676
872
  dispatch(input: DispatchActionInput): Promise<DispatchActionResult>;
677
873
  }
874
+ /**
875
+ * One submission. `submitAction` reads the scalar fields (`actionId`, scope,
876
+ * actor, correlation and causation ids, `executionReason`, `idempotencyKey`,
877
+ * `authorizationBindingId`) exactly once, before its first await, and uses
878
+ * only those values afterwards, so changing them while the call is pending
879
+ * changes no action, scope, actor or key Host authorizes, persists or
880
+ * executes. For an action that declares `admitSubmission`, `parameters`,
881
+ * `provenance` and `authorizationBinding` are also read once there and
882
+ * replaced by Host's own copies. For any other action Host uses those three
883
+ * as the caller's objects, read where and as often as before (README,
884
+ * "Submission snapshot").
885
+ */
678
886
  interface SubmitActionInput {
679
887
  actionId: ActionId;
680
888
  parameters: Record<string, unknown>;
@@ -782,6 +990,12 @@ interface PlatformHostOptions<TDb> {
782
990
  producerModuleVersion(actionId: ActionId, actionVersion: number): string;
783
991
  classifyPayload(event: AssetEventEnvelope): EventPayloadClassification;
784
992
  includeProvenance?(event: AssetEventEnvelope, classification: EventPayloadClassification): boolean;
993
+ /**
994
+ * Opt an event's `actorId` and `actorType` into its outbox envelope. Absent, the actor is
995
+ * excluded for every classification. Only `true` includes it. An included actor reaches every
996
+ * sink of every relay reading this outbox.
997
+ */
998
+ includeActor?(event: AssetEventEnvelope, classification: EventPayloadClassification): boolean;
785
999
  traceContext?(event: AssetEventEnvelope): Record<string, string> | undefined;
786
1000
  /** Host lifecycle events are excluded by default; opt in only after making their payload audit-safe. */
787
1001
  shouldPublish?(event: AssetEventEnvelope): boolean;
@@ -816,15 +1030,38 @@ interface PlatformHostOptions<TDb> {
816
1030
  */
817
1031
  composition?: {
818
1032
  assembly: AssemblyLockfile;
1033
+ /**
1034
+ * Receives a fresh object whose action, scope, actor, correlation,
1035
+ * causation, idempotency key, binding id and execution reason are the
1036
+ * ones Host read at submission and persists, whatever the caller
1037
+ * changed on its own object since. For an action without
1038
+ * `admitSubmission`, its `parameters`, `provenance` and
1039
+ * `authorizationBinding` read and assign the caller's input, as when
1040
+ * the callback was handed that input itself; for an action that
1041
+ * declares it, they are fresh copies of Host's snapshot.
1042
+ */
819
1043
  resolveInitiatingReleaseDigest?(input: SubmitActionInput): Promise<string | undefined> | string | undefined;
820
1044
  };
821
1045
  /** Lease held while an approved invocation resumes; defaults to five minutes. */
822
1046
  approvalResumeLeaseDurationMs?: number;
823
- /** Remove forbidden/sensitive fields before durable invocation persistence. */
1047
+ /**
1048
+ * Remove forbidden/sensitive fields before durable invocation persistence.
1049
+ * For an action without `admitSubmission`, receives the caller's
1050
+ * parameters object, before provenance normalization and the composition
1051
+ * callback, as before. For an action that declares it, receives Host's
1052
+ * copy, after the check admitted the submission.
1053
+ */
824
1054
  redactActionParameters?: (actionId: ActionId, parameters: Record<string, unknown>) => Record<string, unknown>;
825
- resolvePolicies?: (input: ActionAuthorizationInput & {
826
- declaredPolicyIds: readonly string[];
827
- }) => Promise<RuntimePolicyDefinition[]>;
1055
+ /**
1056
+ * The bound on an action's `admitSubmission` check. An answer that
1057
+ * settles this many milliseconds or more after the check was called,
1058
+ * measured on the monotonic clock when its promise settles, is refused as
1059
+ * `timed_out` and the check's signal is aborted. A whole number from 1 to
1060
+ * 2 147 483 647 (the timer maximum), or `createGovernedActionHost` throws;
1061
+ * default 10 000.
1062
+ */
1063
+ admissionTimeoutMs?: number;
1064
+ resolvePolicies?: (input: ResolvePoliciesInput) => Promise<RuntimePolicyDefinition[]>;
828
1065
  extractEvents?: (data: Record<string, unknown>) => PendingAssetEvent[];
829
1066
  /** Handler-result fields consumed by extractEvents and omitted from the durable result. */
830
1067
  eventResultFields?: readonly string[];
@@ -863,14 +1100,30 @@ interface GovernedActionHost {
863
1100
  overdue: string[];
864
1101
  }>;
865
1102
  }
1103
+ /**
1104
+ * Host operator operations kept outside `GovernedActionHost`, so an existing
1105
+ * hand-written `GovernedActionHost` still satisfies that interface.
1106
+ * `createGovernedActionHost()` returns both.
1107
+ */
1108
+ interface OutboxRequeueHost {
1109
+ /**
1110
+ * Operator replay of a dead-lettered outbox record: authorize the trusted
1111
+ * actor for the tenant and space against the record as read, then move
1112
+ * that same dead letter back to pending with a fresh attempt budget and
1113
+ * append who, when, and why beside the earlier failure. The relay
1114
+ * republishes it under the same `eventId`. Requires an
1115
+ * `OutboxRequeuePlatformHostStore`; refusals are returned, not thrown.
1116
+ */
1117
+ requeueOutboxDeadLetter(input: RequeueOutboxDeadLetterInput): Promise<RequeueOutboxDeadLetterResult>;
1118
+ }
866
1119
 
867
- declare function createGovernedActionHost<TDb>(options: PlatformHostOptions<TDb>): GovernedActionHost;
1120
+ declare function createGovernedActionHost<TDb>(options: PlatformHostOptions<TDb>): GovernedActionHost & OutboxRequeueHost;
868
1121
 
869
1122
  interface MemoryPlatformHostTransactionProvider<TDb> {
870
1123
  snapshot(db: TDb): TDb;
871
1124
  restore(db: TDb, snapshot: TDb): void;
872
1125
  }
873
- declare class MemoryPlatformHostStore<TDb> implements RecoverablePlatformHostStore<TDb>, ApprovalPlatformHostStore<TDb>, GovernancePlatformHostStore<TDb>, OutboxPlatformHostStore<TDb> {
1126
+ declare class MemoryPlatformHostStore<TDb> implements RecoverablePlatformHostStore<TDb>, ApprovalPlatformHostStore<TDb>, GovernancePlatformHostStore<TDb>, OutboxPlatformHostStore<TDb>, OutboxRequeuePlatformHostStore<TDb> {
874
1127
  readonly db: TDb;
875
1128
  readonly transactionalOutbox: boolean;
876
1129
  transactionWithEvents?: <TResult>(run: (transaction: PlatformHostMutationTransaction<TDb>) => Promise<TResult>) => Promise<TResult>;
@@ -883,6 +1136,13 @@ declare class MemoryPlatformHostStore<TDb> implements RecoverablePlatformHostSto
883
1136
  readonly executionAttestations: ExecutionAttestationRecord[];
884
1137
  readonly externalReconciliations: ExternalReconciliationRecord[];
885
1138
  readonly outbox: OutboxRecord[];
1139
+ /**
1140
+ * Requeue evidence is append-only audit history, so unlike the ledger
1141
+ * arrays above, which tests have always inspected and seeded directly, it
1142
+ * is not public: `listOutboxRequeues` returns copies with their own Dates. TypeScript
1143
+ * `private`, as for the store's other internals, is a compile-time guard.
1144
+ */
1145
+ private readonly outboxRequeues;
886
1146
  constructor(db: TDb, transactionProvider?: MemoryPlatformHostTransactionProvider<TDb>);
887
1147
  transaction<TResult>(run: (db: TDb) => Promise<TResult>): Promise<TResult>;
888
1148
  private runTransactionWithEvents;
@@ -929,6 +1189,13 @@ declare class MemoryPlatformHostStore<TDb> implements RecoverablePlatformHostSto
929
1189
  spaceId?: string;
930
1190
  statuses?: OutboxStatus[];
931
1191
  }): Promise<OutboxRecord[]>;
1192
+ getOutboxRecord(id: string, tenantId: string, spaceId: string): Promise<OutboxRecord | undefined>;
1193
+ requeueOutboxDeadLetter(input: RequeueOutboxDeadLetterStoreInput): Promise<RequeueOutboxDeadLetterStoreResult>;
1194
+ listOutboxRequeues(input: {
1195
+ tenantId: string;
1196
+ spaceId: string;
1197
+ outboxId?: string;
1198
+ }): Promise<OutboxRequeueRecord[]>;
932
1199
  private requireLeasedOutbox;
933
1200
  nextEventSequence(tenantId: string, spaceId: string): Promise<number>;
934
1201
  getEntityState(tenantId: string, spaceId: string, entityType: string, entityId: string): Promise<string | undefined>;
@@ -941,10 +1208,18 @@ declare class MemoryPlatformHostStore<TDb> implements RecoverablePlatformHostSto
941
1208
  }
942
1209
 
943
1210
  declare function toEnterpriseEventEnvelope(event: AssetEventEnvelope, metadata: OutboxEventMetadata): EnterpriseEventEnvelope;
1211
+ /** The `includeActor` decision a store records with the outbox record it writes from `metadata`. */
1212
+ declare function outboxActorDisclosure(metadata: OutboxEventMetadata): OutboxActorDisclosure;
1213
+ interface EnterpriseEventPublishContext {
1214
+ signal: AbortSignal;
1215
+ /**
1216
+ * Why the envelope does or does not carry `actorId`/`actorType`. `runOutboxRelayCycle()` always
1217
+ * sets it; a caller other than the relay may omit it, which a consumer should treat like `legacy`.
1218
+ */
1219
+ actorDisclosure?: EnterpriseEventActorDisclosure;
1220
+ }
944
1221
  interface EnterpriseEventPublisher {
945
- publish(event: EnterpriseEventEnvelope, context?: {
946
- signal: AbortSignal;
947
- }): Promise<void>;
1222
+ publish(event: EnterpriseEventEnvelope, context?: EnterpriseEventPublishContext): Promise<void>;
948
1223
  }
949
1224
  interface OutboxRelayOptions<TDb> {
950
1225
  store: OutboxPlatformHostStore<TDb>;
@@ -966,6 +1241,10 @@ interface OutboxRelayResult {
966
1241
  deadLettered: number;
967
1242
  }
968
1243
  declare function runOutboxRelayCycle<TDb>(options: OutboxRelayOptions<TDb>): Promise<OutboxRelayResult>;
1244
+ /**
1245
+ * A copy with its own Date fields and trace context. The event payload and
1246
+ * provenance are shallow: the copy shares them with the record, as before.
1247
+ */
969
1248
  declare function cloneOutboxRecord(record: OutboxRecord): OutboxRecord;
970
1249
 
971
1250
  interface PlatformHostSqlResult<Row = Record<string, unknown>> {
@@ -990,7 +1269,7 @@ interface PostgresPlatformHostTransactionProvider<TDb> {
990
1269
  run<TResult>(run: (context: PostgresPlatformHostTransactionContext<TDb>) => Promise<TResult>): Promise<TResult>;
991
1270
  }
992
1271
  /** Durable mutation-pipeline ledger for Databricks Lakebase or standard Postgres. */
993
- declare class PostgresPlatformHostStore<TDb> implements RecoverablePlatformHostStore<TDb>, ApprovalPlatformHostStore<TDb>, GovernancePlatformHostStore<TDb>, OutboxPlatformHostStore<TDb> {
1272
+ declare class PostgresPlatformHostStore<TDb> implements RecoverablePlatformHostStore<TDb>, ApprovalPlatformHostStore<TDb>, GovernancePlatformHostStore<TDb>, OutboxPlatformHostStore<TDb>, OutboxRequeuePlatformHostStore<TDb> {
994
1273
  readonly db: TDb;
995
1274
  private readonly sql;
996
1275
  readonly transactionWithEvents?: AtomicMutationPlatformHostStore<TDb>["transactionWithEvents"];
@@ -1041,6 +1320,13 @@ declare class PostgresPlatformHostStore<TDb> implements RecoverablePlatformHostS
1041
1320
  spaceId?: string;
1042
1321
  statuses?: OutboxStatus[];
1043
1322
  }): Promise<OutboxRecord[]>;
1323
+ getOutboxRecord(id: string, tenantId: string, spaceId: string): Promise<OutboxRecord | undefined>;
1324
+ requeueOutboxDeadLetter(input: RequeueOutboxDeadLetterStoreInput): Promise<RequeueOutboxDeadLetterStoreResult>;
1325
+ listOutboxRequeues(input: {
1326
+ tenantId: string;
1327
+ spaceId: string;
1328
+ outboxId?: string;
1329
+ }): Promise<OutboxRequeueRecord[]>;
1044
1330
  nextEventSequence(tenantId: string, spaceId: string): Promise<number>;
1045
1331
  getEntityState(tenantId: string, spaceId: string, entityType: string, entityId: string): Promise<string | undefined>;
1046
1332
  listActionInvocations(input?: ListActionInvocationsInput): Promise<ActionInvocationRecord[]>;
@@ -1229,4 +1515,4 @@ declare function tenantIsolationChecks(): readonly TenantIsolationCheck[];
1229
1515
  /** Run every check, returning each result rather than throwing on the first. */
1230
1516
  declare function runTenantIsolationChecks(subject: TenantIsolationSubject): Promise<TenantIsolationResult>;
1231
1517
 
1232
- export { type ActionApprovalDecision, type ActionAuthorizationInput, type ActionExecutionAuthorizationInput, type ActionExecutionReason, type ActionInvocationPatch, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type AdapterReconciliationOutcome, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type AtomicMutationPlatformHostStore, type AuthorizationBinding, type AuthorizationGoverningMoment, type AuthorizationReconciliationOutcome, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type ClaimOutboxInput, type CreateActionInvocationInput, type CreateDurableSagaParentLifecycleOptions, type DispatchActionInput, type DispatchActionResult, type EnterpriseEventEnvelope, type EnterpriseEventPublisher, type EventPayloadClassification, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalCompletion, ExternalCompletionError, type ExternalCompletionRefusal, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type HostCompensationRecord, type HostSagaParentApprovalInput, type HostSagaParentCancellationInput, type HostSagaParentCompletionInput, type HostSagaParentFailureInput, type HostSagaParentLifecycle, type HostSagaParentProgressInput, type HostSagaParentProgressRecord, type IdempotencyConflict, IdempotencyConflictError, type InvocationProvenance, type InvocationSource, type KnownActionExecutionReason, type ListActionInvocationsInput, MemoryPlatformHostStore, type MemoryPlatformHostTransactionProvider, type NamespacedAttributes, type OutboxEventMetadata, type OutboxPlatformHostStore, type OutboxRecord, type OutboxRelayOptions, type OutboxRelayResult, type OutboxStatus, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, type PendingAssetEvent, type PendingExternalCompletion, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostHealthCounts, type PlatformHostHealthOptions, type PlatformHostHealthQuery, type PlatformHostHealthSnapshot, type PlatformHostHealthStatus, type PlatformHostHealthStore, type PlatformHostLifecycleTelemetry, type PlatformHostMetricName, type PlatformHostMetricTelemetry, type PlatformHostMetricType, type PlatformHostMutationTransaction, type PlatformHostOptions, type PlatformHostReadinessReason, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PlatformHostTelemetry, type PlatformHostTelemetryAttribute, type PlatformHostTelemetryEventName, type PlatformHostTelemetryHook, type PlatformHostTelemetryInput, type PlatformHostTelemetryRecord, type PlatformHostWorkerHealthInput, type PolicyEvaluationRecord, type PolicyObligationRecord, type PostgresMigration, PostgresPlatformHostStore, type PostgresPlatformHostTransactionContext, type PostgresPlatformHostTransactionProvider, type ReconcileOverdueCompletionsInput, type RecordedExternalCompletion, type RecoverablePlatformHostStore, type RenewActionInvocationLeaseInput, type SubmitActionInput, type SubmitActionResult, type TenantIsolationCheck, type TenantIsolationResult, type TenantIsolationScope, type TenantIsolationSubject, type UpdateLeasedActionInvocationInput, applyPostgresMigrations, canonicalJson, cloneOutboxRecord, createDurableSagaParentLifecycle, createGovernedActionHost, createStoreBackedActionDispatcher, digestParameters, emitPlatformHostTelemetry, getPlatformHostHealthSnapshot, runOutboxRelayCycle, runPlatformActionWorker, runPlatformActionWorkerCycle, runTenantIsolationChecks, tenantIsolationChecks, toEnterpriseEventEnvelope };
1518
+ export { ActionAdmissionError, type ActionAdmissionRefusal, type ActionApprovalDecision, type ActionAuthorizationInput, type ActionExecutionAuthorizationInput, type ActionExecutionReason, type ActionInvocationPatch, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type AdapterReconciliationOutcome, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type AtomicMutationPlatformHostStore, type AuthorizationBinding, type AuthorizationGoverningMoment, type AuthorizationReconciliationOutcome, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type ClaimOutboxInput, type CreateActionInvocationInput, type CreateDurableSagaParentLifecycleOptions, type DispatchActionInput, type DispatchActionResult, type EnterpriseEventActorDisclosure, type EnterpriseEventEnvelope, type EnterpriseEventPublishContext, type EnterpriseEventPublisher, type EventPayloadClassification, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalCompletion, ExternalCompletionError, type ExternalCompletionRefusal, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type HostCompensationRecord, type HostSagaParentApprovalInput, type HostSagaParentCancellationInput, type HostSagaParentCompletionInput, type HostSagaParentFailureInput, type HostSagaParentLifecycle, type HostSagaParentProgressInput, type HostSagaParentProgressRecord, type IdempotencyConflict, IdempotencyConflictError, type InvocationProvenance, type InvocationSource, type KnownActionExecutionReason, type ListActionInvocationsInput, MemoryPlatformHostStore, type MemoryPlatformHostTransactionProvider, type NamespacedAttributes, type OutboxActorDisclosure, type OutboxEventMetadata, type OutboxPlatformHostStore, type OutboxRecord, type OutboxRelayOptions, type OutboxRelayResult, type OutboxRequeueAuthorizationInput, type OutboxRequeueHost, type OutboxRequeuePlatformHostStore, type OutboxRequeueRecord, type OutboxRequeueRefusal, type OutboxStatus, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, type PendingAssetEvent, type PendingExternalCompletion, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostHealthCounts, type PlatformHostHealthOptions, type PlatformHostHealthQuery, type PlatformHostHealthSnapshot, type PlatformHostHealthStatus, type PlatformHostHealthStore, type PlatformHostLifecycleTelemetry, type PlatformHostMetricName, type PlatformHostMetricTelemetry, type PlatformHostMetricType, type PlatformHostMutationTransaction, type PlatformHostOptions, type PlatformHostReadinessReason, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PlatformHostTelemetry, type PlatformHostTelemetryAttribute, type PlatformHostTelemetryEventName, type PlatformHostTelemetryHook, type PlatformHostTelemetryInput, type PlatformHostTelemetryRecord, type PlatformHostWorkerHealthInput, type PolicyEvaluationRecord, type PolicyObligationRecord, type PostgresMigration, PostgresPlatformHostStore, type PostgresPlatformHostTransactionContext, type PostgresPlatformHostTransactionProvider, type ReconcileOverdueCompletionsInput, type RecordedExternalCompletion, type RecoverablePlatformHostStore, type RenewActionInvocationLeaseInput, type RequeueOutboxDeadLetterInput, type RequeueOutboxDeadLetterRefusal, type RequeueOutboxDeadLetterResult, type RequeueOutboxDeadLetterStoreInput, type RequeueOutboxDeadLetterStoreResult, type ResolvePoliciesInput, type SubmitActionInput, type SubmitActionResult, type TenantIsolationCheck, type TenantIsolationResult, type TenantIsolationScope, type TenantIsolationSubject, type UpdateLeasedActionInvocationInput, applyPostgresMigrations, canonicalJson, cloneOutboxRecord, createDurableSagaParentLifecycle, createGovernedActionHost, createStoreBackedActionDispatcher, digestParameters, emitPlatformHostTelemetry, getPlatformHostHealthSnapshot, outboxActorDisclosure, runOutboxRelayCycle, runPlatformActionWorker, runPlatformActionWorkerCycle, runTenantIsolationChecks, tenantIsolationChecks, toEnterpriseEventEnvelope };