@fabricorg/platform-host 8.1.2 → 8.2.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.cts CHANGED
@@ -241,6 +241,25 @@ export interface PendingAssetEvent {
241
241
  payload: unknown;
242
242
  eventSchemaVersion?: number;
243
243
  }
244
+ /** JSON preparation committed with the handler before adapter execution. */
245
+ export interface FinalizationCheckpoint {
246
+ protocol: "atomic-after-adapters-v1";
247
+ actionVersion: number;
248
+ steps: {
249
+ adapterType: string;
250
+ operation: string;
251
+ }[];
252
+ params: import("@fabricorg/platform").FinalizationJson;
253
+ handlerData: import("@fabricorg/platform").FinalizationRecord;
254
+ handlerEvents: (Omit<PendingAssetEvent, "payload"> & {
255
+ payload: import("@fabricorg/platform").FinalizationJson;
256
+ })[];
257
+ result: import("@fabricorg/platform").FinalizationRecord;
258
+ stateTransition?: Omit<PendingAssetEvent, "payload"> & {
259
+ payload: import("@fabricorg/platform").FinalizationJson;
260
+ };
261
+ skipped: number[];
262
+ }
244
263
  export interface ActionInvocationRecord {
245
264
  id: string;
246
265
  tenantId: string;
@@ -265,6 +284,8 @@ export interface ActionInvocationRecord {
265
284
  authorizationReconciliation?: AuthorizationReconciliationOutcome;
266
285
  /** Durable evidence when an adapter returned an ambiguous outcome requiring reconciliation. */
267
286
  adapterReconciliation?: AdapterReconciliationOutcome;
287
+ /** Durable normalized preparation; absent for invocations prepared by older Hosts. */
288
+ finalizationCheckpoint?: FinalizationCheckpoint;
268
289
  /**
269
290
  * Transition Host validated for an idempotent after_adapters action, saved
270
291
  * after handler/result/event validation inside a mutation transaction, or before
@@ -289,6 +310,8 @@ export interface ActionInvocationRecord {
289
310
  authorizationBindingId?: string;
290
311
  /** Worker claims including the first; approval acceptance sets a minimum of 1. */
291
312
  attemptCount: number;
313
+ /** Latest claim durably deferred in pre-effect governance; permits only the immediately next claim. */
314
+ deferredBeforeEffectAttempt?: number;
292
315
  leaseOwner?: string;
293
316
  leaseExpiresAt?: Date;
294
317
  /** Monotonic claim generation used to reject writes from expired workers. */
@@ -954,7 +977,7 @@ export interface ClaimActionInvocationsInput {
954
977
  * - `claimActionInvocations` must never claim a running invocation without a
955
978
  * lease, which is what a parked invocation is.
956
979
  */
957
- export type ActionInvocationPatch = Partial<Pick<ActionInvocationRecord, "status" | "result" | "error" | "authorizationReconciliation" | "adapterReconciliation" | "pendingStateTransition" | "pendingCompletion" | "externalCompletion">>;
980
+ export type ActionInvocationPatch = Partial<Pick<ActionInvocationRecord, "finalizationCheckpoint" | "deferredBeforeEffectAttempt" | "status" | "result" | "error" | "authorizationReconciliation" | "adapterReconciliation" | "pendingStateTransition" | "pendingCompletion" | "externalCompletion">>;
958
981
  export interface UpdateLeasedActionInvocationInput {
959
982
  id: string;
960
983
  tenantId: string;
@@ -1179,10 +1202,12 @@ export interface PlatformHostOptions<TDb> {
1179
1202
  adapterCircuitBreakers?: AdapterCircuitBreakerProvider;
1180
1203
  /**
1181
1204
  * Positive integer attempt cap for RetryableExecutionError during governance,
1182
- * before policy-evaluation persistence (default 5). A leased, idempotent action
1183
- * below the cap is left running for worker reclaim after lease expiry.
1184
- * Inline execution, approval resume, exhausted attempts, and non-idempotent
1185
- * actions fail. Policy persistence, obligation listing/resolution/persistence, state-machine checks,
1205
+ * before policy-evaluation persistence (default 5). A leased action below the cap
1206
+ * is left running for worker reclaim after lease expiry. Non-idempotent actions
1207
+ * require a lease-fenced pre-effect deferral marker for the current claim; only
1208
+ * the immediately next claim may proceed using that marker. Inline execution,
1209
+ * approval resume, exhausted attempts, and marker-write failures are not retried.
1210
+ * Policy persistence, obligation listing/resolution/persistence, state-machine checks,
1186
1211
  * the handler transaction, handlers, adapters, and finalization are excluded;
1187
1212
  * their failure/reconciliation/recovery semantics apply, subject to recoveryMaxAttempts.
1188
1213
  */
@@ -1294,6 +1319,12 @@ export interface PlatformHostOptions<TDb> {
1294
1319
  extractEvents?: (data: Record<string, unknown>) => PendingAssetEvent[];
1295
1320
  /** Handler-result fields consumed by extractEvents and omitted from the durable result. */
1296
1321
  eventResultFields?: readonly string[];
1322
+ /**
1323
+ * Optional name registry for hook-returned events from action.finalize.
1324
+ * Checks eventType and subjectType membership; it does not validate handler events,
1325
+ * eventSchemaVersion compatibility, or payload schemas.
1326
+ */
1327
+ eventContracts?: import("@fabricorg/platform").EventContractRegistry;
1297
1328
  redactAdapterInput?: (actionId: ActionId, adapterType: string, operation: string, input: Record<string, unknown>) => Record<string, unknown>;
1298
1329
  /**
1299
1330
  * Redact successful adapter output before row/event persistence and attestation extraction.
@@ -1330,8 +1361,9 @@ export interface PlatformHostOptions<TDb> {
1330
1361
  /** Vendor-neutral lifecycle and metric sink. Telemetry is best effort. */
1331
1362
  telemetry?: PlatformHostTelemetry;
1332
1363
  /**
1333
- * Epoch-millis deadline delivered to every adapter execution context.
1334
- * When omitted, no deadline is set and adapters receive no AbortSignal.
1364
+ * Duration in milliseconds, measured before the step enters adapter retry execution.
1365
+ * A step deadlineMs overrides this duration. When this is omitted or zero and
1366
+ * the step has no deadlineMs, no deadline or AbortSignal is delivered.
1335
1367
  */
1336
1368
  adapterDeadlineMs?: number;
1337
1369
  }
package/dist/index.d.ts CHANGED
@@ -241,6 +241,25 @@ export interface PendingAssetEvent {
241
241
  payload: unknown;
242
242
  eventSchemaVersion?: number;
243
243
  }
244
+ /** JSON preparation committed with the handler before adapter execution. */
245
+ export interface FinalizationCheckpoint {
246
+ protocol: "atomic-after-adapters-v1";
247
+ actionVersion: number;
248
+ steps: {
249
+ adapterType: string;
250
+ operation: string;
251
+ }[];
252
+ params: import("@fabricorg/platform").FinalizationJson;
253
+ handlerData: import("@fabricorg/platform").FinalizationRecord;
254
+ handlerEvents: (Omit<PendingAssetEvent, "payload"> & {
255
+ payload: import("@fabricorg/platform").FinalizationJson;
256
+ })[];
257
+ result: import("@fabricorg/platform").FinalizationRecord;
258
+ stateTransition?: Omit<PendingAssetEvent, "payload"> & {
259
+ payload: import("@fabricorg/platform").FinalizationJson;
260
+ };
261
+ skipped: number[];
262
+ }
244
263
  export interface ActionInvocationRecord {
245
264
  id: string;
246
265
  tenantId: string;
@@ -265,6 +284,8 @@ export interface ActionInvocationRecord {
265
284
  authorizationReconciliation?: AuthorizationReconciliationOutcome;
266
285
  /** Durable evidence when an adapter returned an ambiguous outcome requiring reconciliation. */
267
286
  adapterReconciliation?: AdapterReconciliationOutcome;
287
+ /** Durable normalized preparation; absent for invocations prepared by older Hosts. */
288
+ finalizationCheckpoint?: FinalizationCheckpoint;
268
289
  /**
269
290
  * Transition Host validated for an idempotent after_adapters action, saved
270
291
  * after handler/result/event validation inside a mutation transaction, or before
@@ -289,6 +310,8 @@ export interface ActionInvocationRecord {
289
310
  authorizationBindingId?: string;
290
311
  /** Worker claims including the first; approval acceptance sets a minimum of 1. */
291
312
  attemptCount: number;
313
+ /** Latest claim durably deferred in pre-effect governance; permits only the immediately next claim. */
314
+ deferredBeforeEffectAttempt?: number;
292
315
  leaseOwner?: string;
293
316
  leaseExpiresAt?: Date;
294
317
  /** Monotonic claim generation used to reject writes from expired workers. */
@@ -954,7 +977,7 @@ export interface ClaimActionInvocationsInput {
954
977
  * - `claimActionInvocations` must never claim a running invocation without a
955
978
  * lease, which is what a parked invocation is.
956
979
  */
957
- export type ActionInvocationPatch = Partial<Pick<ActionInvocationRecord, "status" | "result" | "error" | "authorizationReconciliation" | "adapterReconciliation" | "pendingStateTransition" | "pendingCompletion" | "externalCompletion">>;
980
+ export type ActionInvocationPatch = Partial<Pick<ActionInvocationRecord, "finalizationCheckpoint" | "deferredBeforeEffectAttempt" | "status" | "result" | "error" | "authorizationReconciliation" | "adapterReconciliation" | "pendingStateTransition" | "pendingCompletion" | "externalCompletion">>;
958
981
  export interface UpdateLeasedActionInvocationInput {
959
982
  id: string;
960
983
  tenantId: string;
@@ -1179,10 +1202,12 @@ export interface PlatformHostOptions<TDb> {
1179
1202
  adapterCircuitBreakers?: AdapterCircuitBreakerProvider;
1180
1203
  /**
1181
1204
  * Positive integer attempt cap for RetryableExecutionError during governance,
1182
- * before policy-evaluation persistence (default 5). A leased, idempotent action
1183
- * below the cap is left running for worker reclaim after lease expiry.
1184
- * Inline execution, approval resume, exhausted attempts, and non-idempotent
1185
- * actions fail. Policy persistence, obligation listing/resolution/persistence, state-machine checks,
1205
+ * before policy-evaluation persistence (default 5). A leased action below the cap
1206
+ * is left running for worker reclaim after lease expiry. Non-idempotent actions
1207
+ * require a lease-fenced pre-effect deferral marker for the current claim; only
1208
+ * the immediately next claim may proceed using that marker. Inline execution,
1209
+ * approval resume, exhausted attempts, and marker-write failures are not retried.
1210
+ * Policy persistence, obligation listing/resolution/persistence, state-machine checks,
1186
1211
  * the handler transaction, handlers, adapters, and finalization are excluded;
1187
1212
  * their failure/reconciliation/recovery semantics apply, subject to recoveryMaxAttempts.
1188
1213
  */
@@ -1294,6 +1319,12 @@ export interface PlatformHostOptions<TDb> {
1294
1319
  extractEvents?: (data: Record<string, unknown>) => PendingAssetEvent[];
1295
1320
  /** Handler-result fields consumed by extractEvents and omitted from the durable result. */
1296
1321
  eventResultFields?: readonly string[];
1322
+ /**
1323
+ * Optional name registry for hook-returned events from action.finalize.
1324
+ * Checks eventType and subjectType membership; it does not validate handler events,
1325
+ * eventSchemaVersion compatibility, or payload schemas.
1326
+ */
1327
+ eventContracts?: import("@fabricorg/platform").EventContractRegistry;
1297
1328
  redactAdapterInput?: (actionId: ActionId, adapterType: string, operation: string, input: Record<string, unknown>) => Record<string, unknown>;
1298
1329
  /**
1299
1330
  * Redact successful adapter output before row/event persistence and attestation extraction.
@@ -1330,8 +1361,9 @@ export interface PlatformHostOptions<TDb> {
1330
1361
  /** Vendor-neutral lifecycle and metric sink. Telemetry is best effort. */
1331
1362
  telemetry?: PlatformHostTelemetry;
1332
1363
  /**
1333
- * Epoch-millis deadline delivered to every adapter execution context.
1334
- * When omitted, no deadline is set and adapters receive no AbortSignal.
1364
+ * Duration in milliseconds, measured before the step enters adapter retry execution.
1365
+ * A step deadlineMs overrides this duration. When this is omitted or zero and
1366
+ * the step has no deadlineMs, no deadline or AbortSignal is delivered.
1335
1367
  */
1336
1368
  adapterDeadlineMs?: number;
1337
1369
  }