@workflow/world-testing 5.0.0-beta.40 → 5.0.0-beta.41

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.
@@ -17467,7 +17467,17 @@ var init_queue = __esm({
17467
17467
  * `(runId, resumeId)` constraint — required because the v4 payload ref is not
17468
17468
  * content-stable server-side.
17469
17469
  */
17470
- payloadDigest: external_exports.string()
17470
+ payloadDigest: external_exports.string(),
17471
+ /**
17472
+ * The deployment the run is pinned to, from the producer's resume context.
17473
+ * Lets the consumer detect a misrouted delivery with a cheap ambient
17474
+ * deployment-id comparison BEFORE its hoisted `hook_received` replay-preload
17475
+ * write — only a detected mismatch pays for the authoritative run fetch and
17476
+ * the deployment-affinity guard. Optional for queued-message compatibility:
17477
+ * messages from older producers omit it and simply skip the pre-write
17478
+ * check (the authoritative guard before replay still protects them).
17479
+ */
17480
+ deploymentId: external_exports.string().optional()
17471
17481
  });
17472
17482
  WorkflowInvokePayloadSchema = external_exports.object({
17473
17483
  runId: external_exports.string(),
@@ -17637,11 +17647,20 @@ var init_shared = __esm({
17637
17647
  }
17638
17648
  });
17639
17649
 
17650
+ // ../world/dist/slot-identity.js
17651
+ var MAX_EVENT_SLOT;
17652
+ var init_slot_identity = __esm({
17653
+ "../world/dist/slot-identity.js"() {
17654
+ "use strict";
17655
+ MAX_EVENT_SLOT = Number.MAX_SAFE_INTEGER;
17656
+ }
17657
+ });
17658
+
17640
17659
  // ../world/dist/spec-version.js
17641
17660
  function isLegacySpecVersion(v) {
17642
17661
  return v === void 0 || v === null || v <= SPEC_VERSION_LEGACY;
17643
17662
  }
17644
- var SPEC_VERSION_LEGACY, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_ATTRIBUTES, SPEC_VERSION_SUPPORTS_COMPRESSION, SPEC_VERSION_CURRENT;
17663
+ var SPEC_VERSION_LEGACY, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_ATTRIBUTES, SPEC_VERSION_SUPPORTS_COMPRESSION, SPEC_VERSION_SUPPORTS_SLOT_IDENTITY, SPEC_VERSION_CURRENT, SPEC_VERSION_MAX_SUPPORTED;
17645
17664
  var init_spec_version = __esm({
17646
17665
  "../world/dist/spec-version.js"() {
17647
17666
  "use strict";
@@ -17649,7 +17668,9 @@ var init_spec_version = __esm({
17649
17668
  SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
17650
17669
  SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
17651
17670
  SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
17671
+ SPEC_VERSION_SUPPORTS_SLOT_IDENTITY = 6;
17652
17672
  SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_COMPRESSION;
17673
+ SPEC_VERSION_MAX_SUPPORTED = SPEC_VERSION_SUPPORTS_SLOT_IDENTITY;
17653
17674
  __name(isLegacySpecVersion, "isLegacySpecVersion");
17654
17675
  }
17655
17676
  });
@@ -17806,6 +17827,7 @@ var init_ulid = __esm({
17806
17827
  "../world/dist/ulid.js"() {
17807
17828
  "use strict";
17808
17829
  init_zod();
17830
+ init_slot_identity();
17809
17831
  UlidSchema = external_exports.string().ulid();
17810
17832
  workflowRunIdSchema = external_exports.templateLiteral([
17811
17833
  "wrun_",
@@ -17830,6 +17852,7 @@ var init_dist4 = __esm({
17830
17852
  init_runs();
17831
17853
  init_serialization();
17832
17854
  init_shared();
17855
+ init_slot_identity();
17833
17856
  init_spec_version();
17834
17857
  init_steps();
17835
17858
  init_ulid();
@@ -19537,11 +19560,12 @@ var init_private = __esm({
19537
19560
 
19538
19561
  // ../core/dist/runtime/world-compatibility.js
19539
19562
  function assertWorldSupportsRuntimeProtocol(world) {
19540
- if (world.specVersion === SPEC_VERSION_CURRENT) {
19563
+ const declared = world.specVersion;
19564
+ if (declared !== void 0 && declared !== null && declared >= SPEC_VERSION_CURRENT && declared <= SPEC_VERSION_MAX_SUPPORTED) {
19541
19565
  return;
19542
19566
  }
19543
- const supportedVersion = world.specVersion ?? "none";
19544
- throw new WorkflowRuntimeError(`This Workflow runtime requires a World with matching spec version ${SPEC_VERSION_CURRENT}, but the configured World declares spec version ${supportedVersion}. Install a World package version compatible with the current Workflow runtime.`);
19567
+ const supportedVersion = declared ?? "none";
19568
+ throw new WorkflowRuntimeError(`This Workflow runtime supports Worlds with spec version ${SPEC_VERSION_CURRENT} through ${SPEC_VERSION_MAX_SUPPORTED}, but the configured World declares spec version ${supportedVersion}. Install a World package version compatible with the current Workflow runtime.`);
19545
19569
  }
19546
19570
  var init_world_compatibility = __esm({
19547
19571
  "../core/dist/runtime/world-compatibility.js"() {
@@ -21035,7 +21059,7 @@ function SemanticConvention(...names) {
21035
21059
  value
21036
21060
  ]));
21037
21061
  }
21038
- var WorkflowName, WorkflowOperation, WorkflowRunId, WorkflowRunStatus, WorkflowStartedAt, WorkflowEventsCount, WorkflowExecutionMode, WorkflowArgumentsCount, WorkflowResultType, WorkflowTracePropagated, WorkflowVm, QuickJSOutcome, QuickJSEventsPreloaded, QuickJSEventsFetchedCount, QuickJSEventsFetchedPages, QuickJSPendingOpsCount, QuickJSInlineSteps, WorkflowTraceMode, WorkflowTurbo, WorkflowErrorName, WorkflowErrorMessage, WorkflowErrorCode, WorkflowStepsCreated, WorkflowHooksCreated, WorkflowWaitsCreated, WorkflowOwnedRecoverySteps, WorkflowBackstopWakesArmed, WorkflowRouteType, WorkflowRouteHandlerCached, WorkflowRouteInvocationCount, WorkflowRouteEntrypointAgeMs, WorkflowRouteModuleBodyInitMs, FaasInstance, StepName, StepId, StepAttempt, StepStatus, StepMaxRetries, StepTracePropagated, StepTtfsMs, StepStsoMs, StepRsfsMs, StepFinalSchedulingReplayMs, StepLatencyOptimizations, StepSkipped, StepSkipReason, StepArgumentsCount, StepResultType, StepErrorName, StepErrorMessage, StepFatalError, StepRetryExhausted, StepRetryTimeoutSeconds, StepRetryWillRetry, MessagingSystem, MessagingDestinationName, MessagingMessageId, MessagingOperationType, QueueOverheadMs, DeploymentId, WorkflowRunPinnedDeploymentId, WorkflowDeploymentMismatchRetryCount, WorkflowDeploymentMismatchRecovered, HookToken, HookId, HookFound, HookResilientResume, HookResilientResumeMaterialized, HookResumeSetupSource, WebhookHandlersTriggered, WorkflowSuspensionState, WorkflowSuspensionHookCount, WorkflowSuspensionStepCount, WorkflowSuspensionWaitCount, HttpRequestMethod, HttpRoute, UrlFull, ServerAddress, ServerPort, HttpResponseStatusCode, ErrorType, WorldParseFormat, WorkflowEventsPagesLoaded, QueueDeserializeTimeMs, QueueExecutionTimeMs, QueueSerializeTimeMs, SerializationOperation, SerializationCompressed, SerializationCodec, SerializationUncompressedBytes, SerializationStoredBytes, SerializationCompressionRatio, SerializationGuestCodeExecutions, SerializationGuestCodeDetails, PeerService, RpcSystem, RpcService, RpcMethod, ErrorRetryable, ErrorCategory;
21062
+ var WorkflowName, WorkflowOperation, WorkflowRunId, WorkflowRunStatus, WorkflowStartedAt, WorkflowEventsCount, WorkflowExecutionMode, WorkflowParkedEventsCount, WorkflowParkedEventId, WorkflowParkedEventType, WorkflowArgumentsCount, WorkflowResultType, WorkflowTracePropagated, WorkflowVm, QuickJSOutcome, QuickJSEventsPreloaded, QuickJSEventsFetchedCount, QuickJSEventsFetchedPages, QuickJSPendingOpsCount, QuickJSInlineSteps, WorkflowTraceMode, WorkflowTurbo, WorkflowErrorName, WorkflowErrorMessage, WorkflowErrorCode, WorkflowStepsCreated, WorkflowHooksCreated, WorkflowWaitsCreated, WorkflowOwnedRecoverySteps, WorkflowBackstopWakesArmed, WorkflowRouteType, WorkflowRouteHandlerCached, WorkflowRouteInvocationCount, WorkflowRouteEntrypointAgeMs, WorkflowRouteModuleBodyInitMs, FaasInstance, StepName, StepId, StepAttempt, StepStatus, StepMaxRetries, StepTracePropagated, StepTtfsMs, StepStsoMs, StepRsfsMs, StepFinalSchedulingReplayMs, StepLatencyOptimizations, StepSkipped, StepSkipReason, StepArgumentsCount, StepResultType, StepErrorName, StepErrorMessage, StepFatalError, StepRetryExhausted, StepRetryTimeoutSeconds, StepRetryWillRetry, MessagingSystem, MessagingDestinationName, MessagingMessageId, MessagingOperationType, QueueOverheadMs, DeploymentId, WorkflowRunPinnedDeploymentId, WorkflowDeploymentMismatchRetryCount, WorkflowDeploymentMismatchRecovered, HookToken, HookId, HookFound, HookResilientResume, HookResilientResumeMaterialized, HookResumeSetupSource, WebhookHandlersTriggered, WorkflowSuspensionState, WorkflowSuspensionHookCount, WorkflowSuspensionStepCount, WorkflowSuspensionWaitCount, HttpRequestMethod, HttpRoute, UrlFull, ServerAddress, ServerPort, HttpResponseStatusCode, ErrorType, WorldParseFormat, WorkflowEventsPagesLoaded, QueueDeserializeTimeMs, QueueExecutionTimeMs, QueueSerializeTimeMs, SerializationOperation, SerializationCompressed, SerializationCodec, SerializationUncompressedBytes, SerializationStoredBytes, SerializationCompressionRatio, SerializationGuestCodeExecutions, SerializationGuestCodeDetails, PeerService, RpcSystem, RpcService, RpcMethod, ErrorRetryable, ErrorCategory;
21039
21063
  var init_semantic_conventions = __esm({
21040
21064
  "../core/dist/telemetry/semantic-conventions.js"() {
21041
21065
  "use strict";
@@ -21047,6 +21071,9 @@ var init_semantic_conventions = __esm({
21047
21071
  WorkflowStartedAt = SemanticConvention("workflow.started_at");
21048
21072
  WorkflowEventsCount = SemanticConvention("workflow.events.count");
21049
21073
  WorkflowExecutionMode = SemanticConvention("workflow.execution.mode");
21074
+ WorkflowParkedEventsCount = SemanticConvention("workflow.events.parked.count");
21075
+ WorkflowParkedEventId = SemanticConvention("workflow.events.parked.event_id");
21076
+ WorkflowParkedEventType = SemanticConvention("workflow.events.parked.event_type");
21050
21077
  WorkflowArgumentsCount = SemanticConvention("workflow.arguments.count");
21051
21078
  WorkflowResultType = SemanticConvention("workflow.result.type");
21052
21079
  WorkflowTracePropagated = SemanticConvention("workflow.trace.propagated");
@@ -25783,7 +25810,7 @@ var version2;
25783
25810
  var init_version = __esm({
25784
25811
  "../core/dist/version.js"() {
25785
25812
  "use strict";
25786
- version2 = "5.0.0-beta.40";
25813
+ version2 = "5.0.0-beta.41";
25787
25814
  }
25788
25815
  });
25789
25816
 
@@ -31106,7 +31133,11 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
31106
31133
  hookId: hook.hookId,
31107
31134
  token: hook.token,
31108
31135
  payload: dehydratedPayload,
31109
- payloadDigest
31136
+ payloadDigest,
31137
+ // Deployment affinity for the consumer's cheap pre-write
31138
+ // check: lets a misrouted delivery re-route before its
31139
+ // hoisted hook_received write instead of after.
31140
+ deploymentId: resumeContext.deploymentId
31110
31141
  }
31111
31142
  }, queueOptions)
31112
31143
  ]);
@@ -33318,9 +33349,6 @@ async function start(workflow, argsOrOptions, options) {
33318
33349
  }
33319
33350
  } else {
33320
33351
  const result = runCreatedResult.value;
33321
- if (!result.run) {
33322
- throw new WorkflowRuntimeError("Missing 'run' in server response for 'run_created' event");
33323
- }
33324
33352
  if (!v1Compat && result.run.runId !== runId) {
33325
33353
  throw new WorkflowRuntimeError(`Server returned different runId than requested: expected ${runId}, got ${result.run.runId}`);
33326
33354
  }
@@ -33334,7 +33362,7 @@ async function start(workflow, argsOrOptions, options) {
33334
33362
  span?.setAttributes({
33335
33363
  ...WorkflowRunId(runId),
33336
33364
  ...DeploymentId(deploymentId),
33337
- ...runCreatedResult.status === "fulfilled" && runCreatedResult.value.run ? WorkflowRunStatus(runCreatedResult.value.run.status) : {}
33365
+ ...runCreatedResult.status === "fulfilled" ? WorkflowRunStatus(runCreatedResult.value.run.status) : {}
33338
33366
  });
33339
33367
  return new Run(runId, {
33340
33368
  resilientStart
@@ -33351,7 +33379,7 @@ __name(start, "start");
33351
33379
  value: "start",
33352
33380
  configurable: true
33353
33381
  });
33354
- })(start, "step//@workflow/core/runtime/start@5.0.0-beta.40//start");
33382
+ })(start, "step//@workflow/core/runtime/start@5.0.0-beta.41//start");
33355
33383
 
33356
33384
  // ../core/dist/runtime/runs.js
33357
33385
  async function wakeUpRun(world, runId, options) {
@@ -33366,7 +33394,7 @@ async function wakeUpRun(world, runId, options) {
33366
33394
  const eventsResult = await world.events.list({
33367
33395
  runId,
33368
33396
  pagination: {
33369
- limit: 1e3,
33397
+ sortOrder: "asc",
33370
33398
  ...cursor ? {
33371
33399
  cursor
33372
33400
  } : {}
@@ -33695,7 +33723,7 @@ var Run = class _Run {
33695
33723
  value: "wakeUp",
33696
33724
  configurable: true
33697
33725
  });
33698
- })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#wakeUp");
33726
+ })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#wakeUp");
33699
33727
  (function(__wf_fn, __wf_id) {
33700
33728
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33701
33729
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33704,7 +33732,7 @@ var Run = class _Run {
33704
33732
  value: "cancel",
33705
33733
  configurable: true
33706
33734
  });
33707
- })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#cancel");
33735
+ })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#cancel");
33708
33736
  (function(__wf_fn, __wf_id) {
33709
33737
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33710
33738
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33713,7 +33741,7 @@ var Run = class _Run {
33713
33741
  value: "getReadable",
33714
33742
  configurable: true
33715
33743
  });
33716
- })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#getReadable");
33744
+ })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#getReadable");
33717
33745
  (function(__wf_fn, __wf_id) {
33718
33746
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33719
33747
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33722,7 +33750,7 @@ var Run = class _Run {
33722
33750
  value: "exists",
33723
33751
  configurable: true
33724
33752
  });
33725
- })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#exists");
33753
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#exists");
33726
33754
  (function(__wf_fn, __wf_id) {
33727
33755
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33728
33756
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33731,7 +33759,7 @@ var Run = class _Run {
33731
33759
  value: "status",
33732
33760
  configurable: true
33733
33761
  });
33734
- })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#status");
33762
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#status");
33735
33763
  (function(__wf_fn, __wf_id) {
33736
33764
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33737
33765
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33740,7 +33768,7 @@ var Run = class _Run {
33740
33768
  value: "returnValue",
33741
33769
  configurable: true
33742
33770
  });
33743
- })(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#returnValue");
33771
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#returnValue");
33744
33772
  (function(__wf_fn, __wf_id) {
33745
33773
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33746
33774
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33749,7 +33777,7 @@ var Run = class _Run {
33749
33777
  value: "workflowName",
33750
33778
  configurable: true
33751
33779
  });
33752
- })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#workflowName");
33780
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#workflowName");
33753
33781
  (function(__wf_fn, __wf_id) {
33754
33782
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33755
33783
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33758,7 +33786,7 @@ var Run = class _Run {
33758
33786
  value: "createdAt",
33759
33787
  configurable: true
33760
33788
  });
33761
- })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#createdAt");
33789
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#createdAt");
33762
33790
  (function(__wf_fn, __wf_id) {
33763
33791
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33764
33792
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33767,7 +33795,7 @@ var Run = class _Run {
33767
33795
  value: "startedAt",
33768
33796
  configurable: true
33769
33797
  });
33770
- })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#startedAt");
33798
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#startedAt");
33771
33799
  (function(__wf_fn, __wf_id) {
33772
33800
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33773
33801
  __wf_reg.set(__wf_id, __wf_fn);
@@ -33776,7 +33804,7 @@ var Run = class _Run {
33776
33804
  value: "completedAt",
33777
33805
  configurable: true
33778
33806
  });
33779
- })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.40//Run#completedAt");
33807
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.41//Run#completedAt");
33780
33808
  (function(__wf_cls, __wf_id) {
33781
33809
  var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
33782
33810
  __wf_reg.set(__wf_id, __wf_cls);
@@ -33786,7 +33814,7 @@ var Run = class _Run {
33786
33814
  enumerable: false,
33787
33815
  configurable: false
33788
33816
  });
33789
- })(Run, "class//@workflow/core/runtime/run@5.0.0-beta.40//Run");
33817
+ })(Run, "class//@workflow/core/runtime/run@5.0.0-beta.41//Run");
33790
33818
 
33791
33819
  // ../workflow/dist/stdlib.js
33792
33820
  async function fetch2(...args) {