@workflow/world-testing 5.0.0-beta.54 → 5.0.0-beta.56

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.
@@ -412,7 +412,7 @@ function buildFramedDetails(hint2, slug) {
412
412
  });
413
413
  return out;
414
414
  }
415
- var BASE_URL, ERROR_SLUGS, WorkflowError, WorkflowWorldError, WorkflowRunFailedError, WorkflowRunNotCompletedError, WorkflowRuntimeError, RuntimeDecryptionError, SerializationError, StepNotRegisteredError, WorkflowNotRegisteredError, WorkflowRunNotFoundError, HookConflictError, HookNotFoundError, EntityConflictError, RunExpiredError, StreamError, StreamExpiredError, ThrottleError, WorkflowRunCancelledError, FatalError, RetryableError, FATAL_ERROR_KEY, RETRYABLE_ERROR_KEY, HOOK_CONFLICT_ERROR_KEY, RUNTIME_DECRYPTION_ERROR_KEY, STREAM_ERROR_KEY;
415
+ var BASE_URL, ERROR_SLUGS, WorkflowError, WorkflowWorldError, WorkflowRunFailedError, WorkflowRunNotCompletedError, WorkflowRuntimeError, RuntimeDecryptionError, SerializationError, StepNotRegisteredError, WorkflowNotRegisteredError, WorkflowRunNotFoundError, HookConflictError, HookForceClaimedError, HookNotFoundError, EntityConflictError, RunExpiredError, StreamError, StreamExpiredError, ThrottleError, WorkflowRunCancelledError, FatalError, RetryableError, FATAL_ERROR_KEY, RETRYABLE_ERROR_KEY, HOOK_CONFLICT_ERROR_KEY, HOOK_FORCE_CLAIMED_ERROR_KEY, RUNTIME_DECRYPTION_ERROR_KEY, STREAM_ERROR_KEY;
416
416
  var init_dist2 = __esm({
417
417
  "../errors/dist/index.js"() {
418
418
  "use strict";
@@ -432,6 +432,7 @@ var init_dist2 = __esm({
432
432
  FETCH_IN_WORKFLOW_FUNCTION: "fetch-in-workflow",
433
433
  TIMEOUT_FUNCTIONS_IN_WORKFLOW: "timeout-in-workflow",
434
434
  HOOK_CONFLICT: "hook-conflict",
435
+ HOOK_FORCE_CLAIMED: "hook-force-claimed",
435
436
  CORRUPTED_EVENT_LOG: "corrupted-event-log",
436
437
  REPLAY_DIVERGENCE: "replay-divergence",
437
438
  STEP_NOT_REGISTERED: "step-not-registered",
@@ -658,6 +659,30 @@ Caused by: ${options.cause.stack}`;
658
659
  return isError(value) && value.name === "HookConflictError";
659
660
  }
660
661
  };
662
+ HookForceClaimedError = class extends WorkflowError {
663
+ static {
664
+ __name(this, "HookForceClaimedError");
665
+ }
666
+ token;
667
+ /** The run that took the token. */
668
+ claimedByRunId;
669
+ /** The hook (in `claimedByRunId`) the token now belongs to. */
670
+ claimedByHookId;
671
+ constructor(token, claimedByRunId, claimedByHookId) {
672
+ super(`Hook token "${token}" was force-claimed by another workflow (run "${claimedByRunId}")`, {
673
+ slug: ERROR_SLUGS.HOOK_FORCE_CLAIMED
674
+ });
675
+ this.name = "HookForceClaimedError";
676
+ this.token = token;
677
+ this.claimedByRunId = claimedByRunId;
678
+ if (claimedByHookId !== void 0) {
679
+ this.claimedByHookId = claimedByHookId;
680
+ }
681
+ }
682
+ static is(value) {
683
+ return isError(value) && value.name === "HookForceClaimedError";
684
+ }
685
+ };
661
686
  HookNotFoundError = class extends WorkflowError {
662
687
  static {
663
688
  __name(this, "HookNotFoundError");
@@ -810,6 +835,7 @@ Caused by: ${options.cause.stack}`;
810
835
  FATAL_ERROR_KEY = /* @__PURE__ */ Symbol.for("@workflow/errors//FatalError");
811
836
  RETRYABLE_ERROR_KEY = /* @__PURE__ */ Symbol.for("@workflow/errors//RetryableError");
812
837
  HOOK_CONFLICT_ERROR_KEY = /* @__PURE__ */ Symbol.for("@workflow/errors//HookConflictError");
838
+ HOOK_FORCE_CLAIMED_ERROR_KEY = /* @__PURE__ */ Symbol.for("@workflow/errors//HookForceClaimedError");
813
839
  RUNTIME_DECRYPTION_ERROR_KEY = /* @__PURE__ */ Symbol.for("@workflow/errors//RuntimeDecryptionError");
814
840
  STREAM_ERROR_KEY = /* @__PURE__ */ Symbol.for("@workflow/errors//StreamError");
815
841
  if (typeof globalThis !== "undefined") {
@@ -837,6 +863,14 @@ Caused by: ${options.cause.stack}`;
837
863
  configurable: false
838
864
  });
839
865
  }
866
+ if (!Object.hasOwn(globalThis, HOOK_FORCE_CLAIMED_ERROR_KEY)) {
867
+ Object.defineProperty(globalThis, HOOK_FORCE_CLAIMED_ERROR_KEY, {
868
+ value: HookForceClaimedError,
869
+ writable: false,
870
+ enumerable: false,
871
+ configurable: false
872
+ });
873
+ }
840
874
  if (!Object.hasOwn(globalThis, RUNTIME_DECRYPTION_ERROR_KEY)) {
841
875
  Object.defineProperty(globalThis, RUNTIME_DECRYPTION_ERROR_KEY, {
842
876
  value: RuntimeDecryptionError,
@@ -908,7 +942,7 @@ var init_env_config = __esm({
908
942
  function isLegacySpecVersion(v) {
909
943
  return v === void 0 || v === null || v <= SPEC_VERSION_LEGACY;
910
944
  }
911
- 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_SUPPORTS_SEALED_LOG, SPEC_VERSION_CURRENT, SPEC_VERSION_MAX_SUPPORTED;
945
+ 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_SUPPORTS_HOOK_FORCE_CLAIM, SPEC_VERSION_CURRENT, SPEC_VERSION_MAX_SUPPORTED;
912
946
  var init_spec_version = __esm({
913
947
  "../world/dist/spec-version.js"() {
914
948
  "use strict";
@@ -918,9 +952,9 @@ var init_spec_version = __esm({
918
952
  SPEC_VERSION_SUPPORTS_ATTRIBUTES = 4;
919
953
  SPEC_VERSION_SUPPORTS_COMPRESSION = 5;
920
954
  SPEC_VERSION_SUPPORTS_SLOT_IDENTITY = 6;
921
- SPEC_VERSION_SUPPORTS_SEALED_LOG = 7;
922
- SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_SEALED_LOG;
923
- SPEC_VERSION_MAX_SUPPORTED = SPEC_VERSION_SUPPORTS_SEALED_LOG;
955
+ SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM = 8;
956
+ SPEC_VERSION_CURRENT = SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM;
957
+ SPEC_VERSION_MAX_SUPPORTED = SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM;
924
958
  __name(isLegacySpecVersion, "isLegacySpecVersion");
925
959
  }
926
960
  });
@@ -24904,7 +24938,30 @@ var init_events = __esm({
24904
24938
  tokenRetentionUntil: external_exports.coerce.date().optional(),
24905
24939
  metadata: SerializedDataSchema.optional(),
24906
24940
  isWebhook: external_exports.boolean().optional(),
24907
- isSystem: external_exports.boolean().optional()
24941
+ isSystem: external_exports.boolean().optional(),
24942
+ /**
24943
+ * `createHook({ experimental_force: true })`: when the token belongs to
24944
+ * another live run, the World takes it over — journaling
24945
+ * `hook_disposed{forceClaimedBy}` in that run's log and re-pointing the
24946
+ * token — instead of answering `hook_conflict`. Requires the
24947
+ * `hookForceClaim` capability.
24948
+ */
24949
+ force: external_exports.boolean().optional(),
24950
+ /**
24951
+ * World-written on a forced creation that did take a token over: the
24952
+ * run and hook it was taken from, plus what a queue message to that run
24953
+ * needs (`workflowName`, `deploymentId`, `runSpecVersion`). Absent when
24954
+ * the token was free. The wake-targeting fields are in the LOG, not only
24955
+ * on the hook entity, so a replay can republish the victim's wake from
24956
+ * the row alone; see `publishForceClaimVictimWake` in @workflow/core.
24957
+ */
24958
+ forceClaimedFrom: external_exports.object({
24959
+ runId: external_exports.string(),
24960
+ hookId: external_exports.string(),
24961
+ workflowName: external_exports.string().optional(),
24962
+ deploymentId: external_exports.string().optional(),
24963
+ runSpecVersion: external_exports.number().optional()
24964
+ }).optional()
24908
24965
  })
24909
24966
  }));
24910
24967
  HookReceivedEventSchema = external_exports.compile(BaseEventSchema.extend({
@@ -24919,7 +24976,17 @@ var init_events = __esm({
24919
24976
  eventType: external_exports.literal("hook_disposed"),
24920
24977
  correlationId: external_exports.string(),
24921
24978
  eventData: external_exports.object({
24922
- token: external_exports.string().optional()
24979
+ token: external_exports.string().optional(),
24980
+ /**
24981
+ * World-written: this disposal was not the run's own. Another run
24982
+ * took the hook's token with `experimental_force`, and this names
24983
+ * it. The hook consumer rejects the hook's awaiters with
24984
+ * `HookForceClaimedError` when it reads this row.
24985
+ */
24986
+ forceClaimedBy: external_exports.object({
24987
+ runId: external_exports.string(),
24988
+ hookId: external_exports.string()
24989
+ }).optional()
24923
24990
  }).optional()
24924
24991
  }));
24925
24992
  HookConflictEventSchema = external_exports.compile(BaseEventSchema.extend({
@@ -24929,7 +24996,18 @@ var init_events = __esm({
24929
24996
  token: external_exports.string(),
24930
24997
  // TODO: Make this required once all persisted hook_conflict events and
24931
24998
  // remote World implementations always include the active hook owner's run ID.
24932
- conflictingRunId: external_exports.string().optional()
24999
+ conflictingRunId: external_exports.string().optional(),
25000
+ /**
25001
+ * Set when the creation asked for `force` and the World declined to take
25002
+ * the token over. `victim-spec-version`: the run holding the token was
25003
+ * started at a spec version below
25004
+ * `SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM`, so its runtime would not
25005
+ * understand the involuntary disposal — the forced hook gets the
25006
+ * ordinary `HookConflictError` it opted out of instead of stranding
25007
+ * that run. Absent on a conflict answered by a World that does not
25008
+ * implement forcing at all.
25009
+ */
25010
+ forceRefusedReason: external_exports.literal("victim-spec-version").optional()
24933
25011
  })
24934
25012
  }));
24935
25013
  NoopEventSchema = external_exports.compile(BaseEventSchema.extend({
@@ -25790,7 +25868,7 @@ var init_queue = __esm({
25790
25868
  });
25791
25869
 
25792
25870
  // ../world/dist/hooks.js
25793
- var HookResumeContextSchema, HOOK_RESUME_INPUT_VERSION, HOOK_RESUME_DEDUP_VERSION, HookResumeCapabilitiesSchema, HookSchema;
25871
+ var HookResumeContextSchema, HOOK_RESUME_INPUT_VERSION, HOOK_RESUME_DEDUP_VERSION, HookResumeCapabilitiesSchema, HookClaimedFromSchema, HookSchema;
25794
25872
  var init_hooks = __esm({
25795
25873
  "../world/dist/hooks.js"() {
25796
25874
  "use strict";
@@ -25831,6 +25909,13 @@ var init_hooks = __esm({
25831
25909
  // is engaged.
25832
25910
  hookResumeDedupVersion: external_exports.number()
25833
25911
  }));
25912
+ HookClaimedFromSchema = external_exports.compile(external_exports.object({
25913
+ runId: external_exports.string(),
25914
+ hookId: external_exports.string(),
25915
+ workflowName: external_exports.string().optional(),
25916
+ deploymentId: external_exports.string().optional(),
25917
+ runSpecVersion: external_exports.number().optional()
25918
+ }));
25834
25919
  HookSchema = external_exports.compile(external_exports.object({
25835
25920
  runId: external_exports.string(),
25836
25921
  hookId: external_exports.string(),
@@ -25858,7 +25943,12 @@ var init_hooks = __esm({
25858
25943
  // `resumeHook()` gates its lazy path on this being present and
25859
25944
  // current. Absent against an older/rolled-back server or when the kill switch
25860
25945
  // is active.
25861
- resumeCapabilities: HookResumeCapabilitiesSchema.optional()
25946
+ resumeCapabilities: HookResumeCapabilitiesSchema.optional(),
25947
+ // Set when this hook took its token from another run
25948
+ // (`experimental_force`). The wake-targeting fields are the victim run's,
25949
+ // so the claimer's runtime can publish the victim's wake without reading
25950
+ // a run it may not be able to reach; see `HookClaimedFromSchema`.
25951
+ claimedFrom: HookClaimedFromSchema.optional()
25862
25952
  }));
25863
25953
  }
25864
25954
  });
@@ -26549,6 +26639,20 @@ function getCommonReducers(_global = globalThis) {
26549
26639
  }
26550
26640
  return reduced;
26551
26641
  }, "HookConflictError"),
26642
+ HookForceClaimedError: /* @__PURE__ */ __name((value) => {
26643
+ const base = reduceNamedErrorSubclassBase("HookForceClaimedError", value);
26644
+ if (!base) return false;
26645
+ const reduced = {
26646
+ ...base,
26647
+ token: readProperty(value, "token"),
26648
+ claimedByRunId: readProperty(value, "claimedByRunId")
26649
+ };
26650
+ const claimedByHookId = readProperty(value, "claimedByHookId");
26651
+ if (claimedByHookId !== void 0) {
26652
+ reduced.claimedByHookId = claimedByHookId;
26653
+ }
26654
+ return reduced;
26655
+ }, "HookForceClaimedError"),
26552
26656
  RangeError: makeErrorSubclassReducer("RangeError"),
26553
26657
  ReferenceError: makeErrorSubclassReducer("ReferenceError"),
26554
26658
  // RetryableError carries an extra `retryAfter` Date that we serialize as
@@ -26723,6 +26827,15 @@ function getCommonRevivers(global2 = globalThis) {
26723
26827
  }
26724
26828
  return error61;
26725
26829
  }, "HookConflictError"),
26830
+ HookForceClaimedError: /* @__PURE__ */ __name((value) => {
26831
+ const Ctor = global2[/* @__PURE__ */ Symbol.for("@workflow/errors//HookForceClaimedError")] ?? HookForceClaimedError;
26832
+ const error61 = new Ctor(value.token, value.claimedByRunId, value.claimedByHookId);
26833
+ if (value.stack !== void 0) error61.stack = value.stack;
26834
+ if ("cause" in value) {
26835
+ error61.cause = value.cause;
26836
+ }
26837
+ return error61;
26838
+ }, "HookForceClaimedError"),
26726
26839
  RangeError: makeErrorSubclassReviver(global2, "RangeError"),
26727
26840
  ReferenceError: makeErrorSubclassReviver(global2, "ReferenceError"),
26728
26841
  RetryableError: /* @__PURE__ */ __name((value) => {
@@ -32182,7 +32295,7 @@ var version2;
32182
32295
  var init_version = __esm({
32183
32296
  "../core/dist/version.js"() {
32184
32297
  "use strict";
32185
- version2 = "5.0.0-beta.54";
32298
+ version2 = "5.0.0-beta.56";
32186
32299
  }
32187
32300
  });
32188
32301
 
@@ -32361,6 +32474,56 @@ var init_helpers = __esm({
32361
32474
  }
32362
32475
  });
32363
32476
 
32477
+ // ../core/dist/runtime/hook-wake.js
32478
+ function isRetryableWakeError(error61, isDeploymentUnavailableError) {
32479
+ if (isDeploymentUnavailableError?.(error61)) return false;
32480
+ const status = error61 ?? {};
32481
+ const code2 = status.status ?? status.statusCode;
32482
+ if (typeof code2 === "number") {
32483
+ return code2 >= 500 || code2 === 408 || code2 === 429;
32484
+ }
32485
+ const name = error61?.name;
32486
+ return name !== "BadRequestError" && name !== "UnauthorizedError" && name !== "ForbiddenError";
32487
+ }
32488
+ async function publishHookWakeWithRetry(publish, isDeploymentUnavailableError) {
32489
+ let lastError;
32490
+ for (let attempt = 0; attempt <= HOOK_WAKE_RETRY_DELAYS_MS.length; attempt++) {
32491
+ try {
32492
+ await publish();
32493
+ return;
32494
+ } catch (error61) {
32495
+ lastError = error61;
32496
+ if (!isRetryableWakeError(error61, isDeploymentUnavailableError)) break;
32497
+ const delayMs = HOOK_WAKE_RETRY_DELAYS_MS[attempt];
32498
+ if (delayMs !== void 0) {
32499
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
32500
+ }
32501
+ }
32502
+ }
32503
+ if (HookNotFoundError.is(lastError)) {
32504
+ throw new WorkflowRuntimeError("The hook resume was committed, but its workflow wake could not be published", {
32505
+ cause: lastError
32506
+ });
32507
+ }
32508
+ throw lastError;
32509
+ }
32510
+ var HOOK_WAKE_RETRY_DELAYS_MS;
32511
+ var init_hook_wake = __esm({
32512
+ "../core/dist/runtime/hook-wake.js"() {
32513
+ "use strict";
32514
+ init_dist2();
32515
+ init_dist4();
32516
+ init_logger();
32517
+ init_helpers();
32518
+ HOOK_WAKE_RETRY_DELAYS_MS = [
32519
+ 25,
32520
+ 100
32521
+ ];
32522
+ __name(isRetryableWakeError, "isRetryableWakeError");
32523
+ __name(publishHookWakeWithRetry, "publishHookWakeWithRetry");
32524
+ }
32525
+ });
32526
+
32364
32527
  // ../core/dist/runtime/invocations.js
32365
32528
  var HookInvocationSchema, HookInvocationResultSchema;
32366
32529
  var init_invocations = __esm({
@@ -37356,38 +37519,6 @@ async function computeResumePayloadDigest(bytes) {
37356
37519
  }
37357
37520
  return hex3;
37358
37521
  }
37359
- function isRetryableWakeError(error61, isDeploymentUnavailableError) {
37360
- if (isDeploymentUnavailableError?.(error61)) return false;
37361
- const status = error61 ?? {};
37362
- const code2 = status.status ?? status.statusCode;
37363
- if (typeof code2 === "number") {
37364
- return code2 >= 500 || code2 === 408 || code2 === 429;
37365
- }
37366
- const name = error61?.name;
37367
- return name !== "BadRequestError" && name !== "UnauthorizedError" && name !== "ForbiddenError";
37368
- }
37369
- async function publishHookWakeWithRetry(publish, isDeploymentUnavailableError) {
37370
- let lastError;
37371
- for (let attempt = 0; attempt <= HOOK_WAKE_RETRY_DELAYS_MS.length; attempt++) {
37372
- try {
37373
- await publish();
37374
- return;
37375
- } catch (error61) {
37376
- lastError = error61;
37377
- if (!isRetryableWakeError(error61, isDeploymentUnavailableError)) break;
37378
- const delayMs = HOOK_WAKE_RETRY_DELAYS_MS[attempt];
37379
- if (delayMs !== void 0) {
37380
- await new Promise((resolve) => setTimeout(resolve, delayMs));
37381
- }
37382
- }
37383
- }
37384
- if (HookNotFoundError.is(lastError)) {
37385
- throw new WorkflowRuntimeError("The hook resume was committed, but its workflow wake could not be published", {
37386
- cause: lastError
37387
- });
37388
- }
37389
- throw lastError;
37390
- }
37391
37522
  function resumeContextFromRun(run2) {
37392
37523
  const coreVersion = run2.executionContext?.workflowCoreVersion;
37393
37524
  const traceCarrier = run2.executionContext?.traceCarrier;
@@ -37469,163 +37600,267 @@ async function getHookByToken(token) {
37469
37600
  async function resumeHook(tokenOrHook, payload, encryptionKeyOverride) {
37470
37601
  return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now());
37471
37602
  }
37472
- async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs) {
37603
+ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs, webhookOnly = false) {
37473
37604
  return await waitedUntil(() => {
37474
37605
  return trace("hook.resume", async (span) => {
37475
37606
  const world = await getWorldLazy();
37476
- try {
37477
- const suppliedToken = typeof tokenOrHook === "string";
37478
- const hook = suppliedToken ? await world.hooks.getByToken(tokenOrHook) : tokenOrHook;
37479
- const hookResumeCapabilitiesAreFresh = suppliedToken || hookFreshlyLookedUp;
37480
- const info = await resolveHookResumeInfo(hook);
37481
- const { resumeContext } = info;
37482
- span?.setAttributes({
37483
- ...HookToken(hook.token),
37484
- ...HookId(hook.hookId),
37485
- ...WorkflowRunId(hook.runId),
37486
- "workflow.hook.resume_context_source": info.source
37487
- });
37488
- if (info.run && isTerminalWorkflowRunStatus(info.run.status)) {
37489
- throw new HookNotFoundError(hook.token);
37490
- }
37491
- const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion);
37492
- let payloadKey;
37493
- const runPublicKey = encryptionKeyOverride ? (
37494
- // hydrate hook metadata), so sealing would add an ECDH for no
37495
- // saved round trip. Reuse what it resolved.
37496
- void 0
37497
- ) : decodeRunPublicKey(resumeContext.encryptionPublicKey);
37498
- if (runPublicKey) {
37499
- payloadKey = sealTo(runPublicKey);
37500
- } else {
37501
- let encryptionKey = encryptionKeyOverride ?? await resolveHookEncryptionKey(hook, info);
37502
- if (!capabilities.supportedFormats.has(SerializationFormat.ENCRYPTED)) {
37503
- encryptionKey = void 0;
37504
- }
37505
- payloadKey = encryptionKey;
37506
- }
37507
- const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat.GZIP);
37508
- const ops = [];
37509
- const readbackOps = [];
37510
- const v1Compat = isLegacySpecVersion(hook.specVersion);
37511
- const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression, void 0, readbackOps);
37512
- await Promise.all(ops.map((op) => op.catch((error61) => {
37513
- if (error61 !== void 0) throw error61;
37514
- })));
37515
- safeWaitUntil(Promise.all(readbackOps), (err) => {
37516
- if (err === void 0) return;
37517
- runtimeLogger.warn("Background readback of hook payload failed", {
37518
- workflowRunId: hook.runId,
37519
- hookId: hook.hookId,
37520
- error: err instanceof Error ? err.message : String(err)
37521
- });
37522
- });
37523
- span?.setAttributes({
37524
- ...WorkflowName(resumeContext.workflowName)
37525
- });
37526
- const originLink = await linkToTraceCarrier(resumeContext.traceCarrier);
37527
- if (originLink) {
37528
- span?.addLink?.(originLink);
37529
- }
37530
- if (world.capabilities?.invoke === true && !v1Compat && dehydratedPayload instanceof Uint8Array) {
37531
- if (!world.invoke) {
37532
- throw new WorkflowRuntimeError("World advertises invoke without implementing it");
37533
- }
37607
+ const token = typeof tokenOrHook === "string" ? tokenOrHook : tokenOrHook.token;
37608
+ let target = tokenOrHook;
37609
+ let fresh = hookFreshlyLookedUp;
37610
+ let keyOverride = encryptionKeyOverride;
37611
+ let redirects = 0;
37612
+ let lookupsAfterRedirect = 0;
37613
+ const MAX_LOOKUPS_AFTER_REDIRECT = 5;
37614
+ const resumeId = generateResumeId();
37615
+ const assertResendable = /* @__PURE__ */ __name((cause) => {
37616
+ if (payload instanceof Request && payload.body !== null && payload.bodyUsed) {
37534
37617
  span?.setAttributes({
37535
- "workflow.hook.resume_strategy": "invoke"
37618
+ "workflow.hook.resume_redirect_unresendable": true
37536
37619
  });
37537
- const result = HookInvocationResultSchema.parse(await world.invoke(hook.runId, {
37538
- type: "hook_resume",
37539
- version: 1,
37540
- hookId: hook.hookId,
37541
- token: hook.token,
37542
- payload: dehydratedPayload
37543
- }, {
37544
- idempotencyKey: generateResumeId()
37545
- }));
37546
- if (result.status === "rejected") {
37547
- if (result.code === "HOOK_NOT_FOUND") throw new HookNotFoundError(hook.token);
37548
- throw new WorkflowRuntimeError("Executor rejected the hook invocation input");
37549
- }
37550
- span?.setAttributes(HookResumeCommitted(true));
37551
- return asLazyMetadataHook(hook);
37552
- }
37553
- const queueName = getWorkflowQueueName(resumeContext.workflowName);
37554
- const queueOptions = {
37555
- deploymentId: resumeContext.deploymentId,
37556
- specVersion: resumeContext.runSpecVersion ?? SPEC_VERSION_LEGACY
37557
- };
37558
- const backendDedupSupported = (hookResumeCapabilitiesAreFresh ? hook.resumeCapabilities?.hookResumeDedupVersion ?? 0 : 0) >= HOOK_RESUME_DEDUP_VERSION || world.capabilities?.hookResumeDedup === true;
37559
- const canClaimResume = backendDedupSupported && !v1Compat && dehydratedPayload instanceof Uint8Array;
37560
- span?.setAttributes({
37561
- "workflow.hook.resume_strategy": "sequential"
37562
- });
37563
- const resumeId = canClaimResume ? generateResumeId() : void 0;
37564
- const payloadDigest = canClaimResume ? await computeResumePayloadDigest(dehydratedPayload) : void 0;
37565
- if (resumeId) {
37566
- span?.setAttributes({
37567
- "workflow.hook.resume_id": resumeId
37620
+ throw new WorkflowRuntimeError(`Hook token "${token}" changed owner while this webhook request was being delivered; a request body can be sent only once and it was not delivered anywhere \u2014 retry the request, which will reach the token's new owner`, {
37621
+ cause
37568
37622
  });
37569
37623
  }
37570
- const isHookGoneError = /* @__PURE__ */ __name((err) => HookNotFoundError.is(err) || RunExpiredError.is(err), "isHookGoneError");
37624
+ }, "assertResendable");
37625
+ for (; ; ) {
37571
37626
  try {
37572
- await world.events.create(hook.runId, {
37573
- eventType: "hook_received",
37574
- specVersion: SPEC_VERSION_CURRENT,
37575
- correlationId: hook.hookId,
37576
- eventData: {
37577
- ...v1Compat ? {} : {
37578
- token: hook.token
37579
- },
37580
- payload: dehydratedPayload
37581
- }
37582
- }, {
37583
- v1Compat,
37584
- ...resumeId && payloadDigest ? {
37585
- resumeId,
37586
- resumePayloadDigest: payloadDigest
37587
- } : {}
37588
- });
37627
+ return await resumeHookAttempt(world, span, target, payload, keyOverride, fresh, resumeRequestedAtMs, resumeId, webhookOnly);
37589
37628
  } catch (err) {
37590
- if (isHookGoneError(err)) {
37591
- throw new HookNotFoundError(hook.token);
37629
+ if (err !== null && typeof err === "object" && notFoundReasons.get(err) === "not-webhook") {
37630
+ throw err;
37631
+ }
37632
+ if (redirects >= MAX_FORCE_CLAIM_REDIRECTS) {
37633
+ if (HookForceClaimedError.is(err)) {
37634
+ span?.setAttributes({
37635
+ "workflow.hook.resume_redirects_exhausted": true
37636
+ });
37637
+ throw new WorkflowRuntimeError(`Hook token "${token}" changed owner ${redirects} times while this resume was in flight; nothing was delivered \u2014 retry the resume`, {
37638
+ cause: err
37639
+ });
37640
+ }
37641
+ throw err;
37642
+ }
37643
+ if (HookForceClaimedError.is(err)) {
37644
+ assertResendable(err);
37645
+ redirects++;
37646
+ span?.setAttributes({
37647
+ "workflow.hook.resume_redirects": redirects,
37648
+ "workflow.hook.resume_redirect_to_run": err.claimedByRunId
37649
+ });
37650
+ target = token;
37651
+ fresh = true;
37652
+ keyOverride = void 0;
37653
+ lookupsAfterRedirect = 0;
37654
+ continue;
37655
+ }
37656
+ if (HookNotFoundError.is(err) && redirects > 0 && typeof target === "string" && lookupsAfterRedirect < MAX_LOOKUPS_AFTER_REDIRECT) {
37657
+ assertResendable(err);
37658
+ lookupsAfterRedirect++;
37659
+ await new Promise((resolve) => setTimeout(resolve, 50));
37660
+ continue;
37661
+ }
37662
+ if (HookNotFoundError.is(err) && notFoundReasons.get(err) !== "lookup") {
37663
+ const attemptedHookId = typeof target === "string" ? void 0 : target.hookId;
37664
+ let relocated;
37665
+ try {
37666
+ relocated = await world.hooks.getByToken(token);
37667
+ } catch (lookupError) {
37668
+ if (!HookNotFoundError.is(lookupError)) {
37669
+ runtimeLogger.warn("Hook resume: re-resolving the token after a not-found failed; surfacing the original error", {
37670
+ token,
37671
+ error: lookupError instanceof Error ? lookupError.message : String(lookupError)
37672
+ });
37673
+ }
37674
+ }
37675
+ if (relocated?.claimedFrom !== void 0 && relocated.hookId !== attemptedHookId && (attemptedHookId === void 0 || relocated.claimedFrom.hookId === attemptedHookId) && !(webhookOnly && relocated.isWebhook === false)) {
37676
+ assertResendable(err);
37677
+ redirects++;
37678
+ span?.setAttributes({
37679
+ "workflow.hook.resume_redirects": redirects,
37680
+ "workflow.hook.resume_redirect_to_run": relocated.runId
37681
+ });
37682
+ target = relocated;
37683
+ fresh = true;
37684
+ keyOverride = void 0;
37685
+ continue;
37686
+ }
37592
37687
  }
37593
37688
  throw err;
37594
37689
  }
37595
- span?.setAttributes(HookResumeCommitted(true));
37596
- const queuePublishRequestedAtMs = Date.now();
37597
- await publishHookWakeWithRetry(() => world.queue(queueName, {
37598
- runId: hook.runId,
37599
- traceCarrier: resumeContext.traceCarrier ?? void 0,
37600
- hookResumeTiming: {
37601
- resumeRequestedAtMs,
37602
- queuePublishRequestedAtMs,
37603
- strategy: "sequential"
37604
- }
37605
- }, {
37606
- ...queueOptions,
37607
- // Dedup retried publishes whose response was lost: a
37608
- // duplicate wake is harmless for correctness (deterministic
37609
- // replay) but costs a full replay of the run, and the queue
37610
- // accepts a repeated idempotency key by delivering only one
37611
- // of the messages. Claim-less writes have no resumeId and
37612
- // keep the previous behavior.
37613
- ...resumeId ? {
37614
- idempotencyKey: `hook-${resumeId}`
37615
- } : {}
37616
- }), world.isDeploymentUnavailableError?.bind(world));
37617
- span?.setAttributes(HookWakePublished(true));
37618
- return asLazyMetadataHook(hook);
37619
- } catch (err) {
37620
- span?.setAttributes({
37621
- ...HookToken(typeof tokenOrHook === "string" ? tokenOrHook : tokenOrHook.token),
37622
- ...HookFound(false)
37623
- });
37624
- throw err;
37625
37690
  }
37626
37691
  });
37627
37692
  });
37628
37693
  }
37694
+ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs, logicalResumeId, webhookOnly) {
37695
+ try {
37696
+ const suppliedToken = typeof tokenOrHook === "string";
37697
+ let hook;
37698
+ if (suppliedToken) {
37699
+ try {
37700
+ hook = await world.hooks.getByToken(tokenOrHook);
37701
+ } catch (lookupError) {
37702
+ if (HookNotFoundError.is(lookupError)) {
37703
+ notFoundReasons.set(lookupError, "lookup");
37704
+ }
37705
+ throw lookupError;
37706
+ }
37707
+ } else {
37708
+ hook = tokenOrHook;
37709
+ }
37710
+ if (webhookOnly && hook.isWebhook === false) {
37711
+ const notWebhook = new HookNotFoundError(hook.token);
37712
+ notFoundReasons.set(notWebhook, "not-webhook");
37713
+ throw notWebhook;
37714
+ }
37715
+ const hookResumeCapabilitiesAreFresh = suppliedToken || hookFreshlyLookedUp;
37716
+ const info = await resolveHookResumeInfo(hook);
37717
+ const { resumeContext } = info;
37718
+ span?.setAttributes({
37719
+ ...HookToken(hook.token),
37720
+ ...HookId(hook.hookId),
37721
+ ...WorkflowRunId(hook.runId),
37722
+ "workflow.hook.resume_context_source": info.source
37723
+ });
37724
+ if (info.run && isTerminalWorkflowRunStatus(info.run.status)) {
37725
+ throw new HookNotFoundError(hook.token);
37726
+ }
37727
+ const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion);
37728
+ let payloadKey;
37729
+ const runPublicKey = encryptionKeyOverride ? (
37730
+ // hydrate hook metadata), so sealing would add an ECDH for no
37731
+ // saved round trip. Reuse what it resolved.
37732
+ void 0
37733
+ ) : decodeRunPublicKey(resumeContext.encryptionPublicKey);
37734
+ if (runPublicKey) {
37735
+ payloadKey = sealTo(runPublicKey);
37736
+ } else {
37737
+ let encryptionKey = encryptionKeyOverride ?? await resolveHookEncryptionKey(hook, info);
37738
+ if (!capabilities.supportedFormats.has(SerializationFormat.ENCRYPTED)) {
37739
+ encryptionKey = void 0;
37740
+ }
37741
+ payloadKey = encryptionKey;
37742
+ }
37743
+ const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat.GZIP);
37744
+ const ops = [];
37745
+ const readbackOps = [];
37746
+ const v1Compat = isLegacySpecVersion(hook.specVersion);
37747
+ const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression, void 0, readbackOps);
37748
+ await Promise.all(ops.map((op) => op.catch((error61) => {
37749
+ if (error61 !== void 0) throw error61;
37750
+ })));
37751
+ safeWaitUntil(Promise.all(readbackOps), (err) => {
37752
+ if (err === void 0) return;
37753
+ runtimeLogger.warn("Background readback of hook payload failed", {
37754
+ workflowRunId: hook.runId,
37755
+ hookId: hook.hookId,
37756
+ error: err instanceof Error ? err.message : String(err)
37757
+ });
37758
+ });
37759
+ if (world.capabilities?.invoke === true && !v1Compat && dehydratedPayload instanceof Uint8Array) {
37760
+ if (!world.invoke) {
37761
+ throw new WorkflowRuntimeError("World advertises invoke without implementing it");
37762
+ }
37763
+ span?.setAttributes({
37764
+ "workflow.hook.resume_strategy": "invoke"
37765
+ });
37766
+ const result = HookInvocationResultSchema.parse(await world.invoke(hook.runId, {
37767
+ type: "hook_resume",
37768
+ version: 1,
37769
+ hookId: hook.hookId,
37770
+ token: hook.token,
37771
+ payload: dehydratedPayload
37772
+ }, {
37773
+ idempotencyKey: logicalResumeId
37774
+ }));
37775
+ if (result.status === "rejected") {
37776
+ if (result.code === "HOOK_NOT_FOUND") throw new HookNotFoundError(hook.token);
37777
+ throw new WorkflowRuntimeError("Executor rejected the hook invocation input");
37778
+ }
37779
+ span?.setAttributes(HookResumeCommitted(true));
37780
+ return asLazyMetadataHook(hook);
37781
+ }
37782
+ span?.setAttributes({
37783
+ ...WorkflowName(resumeContext.workflowName)
37784
+ });
37785
+ const originLink = await linkToTraceCarrier(resumeContext.traceCarrier);
37786
+ if (originLink) {
37787
+ span?.addLink?.(originLink);
37788
+ }
37789
+ const queueName = getWorkflowQueueName(resumeContext.workflowName);
37790
+ const queueOptions = {
37791
+ deploymentId: resumeContext.deploymentId,
37792
+ specVersion: resumeContext.runSpecVersion ?? SPEC_VERSION_LEGACY
37793
+ };
37794
+ const backendDedupSupported = (hookResumeCapabilitiesAreFresh ? hook.resumeCapabilities?.hookResumeDedupVersion ?? 0 : 0) >= HOOK_RESUME_DEDUP_VERSION || world.capabilities?.hookResumeDedup === true;
37795
+ const canClaimResume = backendDedupSupported && !v1Compat && dehydratedPayload instanceof Uint8Array;
37796
+ span?.setAttributes({
37797
+ "workflow.hook.resume_strategy": "sequential"
37798
+ });
37799
+ const resumeId = canClaimResume ? logicalResumeId : void 0;
37800
+ const payloadDigest = canClaimResume ? await computeResumePayloadDigest(dehydratedPayload) : void 0;
37801
+ if (resumeId) {
37802
+ span?.setAttributes({
37803
+ "workflow.hook.resume_id": resumeId
37804
+ });
37805
+ }
37806
+ const isHookGoneError = /* @__PURE__ */ __name((err) => HookNotFoundError.is(err) || RunExpiredError.is(err), "isHookGoneError");
37807
+ try {
37808
+ await world.events.create(hook.runId, {
37809
+ eventType: "hook_received",
37810
+ specVersion: SPEC_VERSION_CURRENT,
37811
+ correlationId: hook.hookId,
37812
+ eventData: {
37813
+ ...v1Compat ? {} : {
37814
+ token: hook.token
37815
+ },
37816
+ payload: dehydratedPayload
37817
+ }
37818
+ }, {
37819
+ v1Compat,
37820
+ ...resumeId && payloadDigest ? {
37821
+ resumeId,
37822
+ resumePayloadDigest: payloadDigest
37823
+ } : {}
37824
+ });
37825
+ } catch (err) {
37826
+ if (HookForceClaimedError.is(err)) throw err;
37827
+ if (isHookGoneError(err)) {
37828
+ throw new HookNotFoundError(hook.token);
37829
+ }
37830
+ throw err;
37831
+ }
37832
+ span?.setAttributes(HookResumeCommitted(true));
37833
+ const queuePublishRequestedAtMs = Date.now();
37834
+ await publishHookWakeWithRetry(() => world.queue(queueName, {
37835
+ runId: hook.runId,
37836
+ traceCarrier: resumeContext.traceCarrier ?? void 0,
37837
+ hookResumeTiming: {
37838
+ resumeRequestedAtMs,
37839
+ queuePublishRequestedAtMs,
37840
+ strategy: "sequential"
37841
+ }
37842
+ }, {
37843
+ ...queueOptions,
37844
+ // Dedup retried publishes whose response was lost: a
37845
+ // duplicate wake is harmless for correctness (deterministic
37846
+ // replay) but costs a full replay of the run, and the queue
37847
+ // accepts a repeated idempotency key by delivering only one
37848
+ // of the messages. Claim-less writes have no resumeId and
37849
+ // keep the previous behavior.
37850
+ ...resumeId ? {
37851
+ idempotencyKey: `hook-${resumeId}`
37852
+ } : {}
37853
+ }), world.isDeploymentUnavailableError?.bind(world));
37854
+ span?.setAttributes(HookWakePublished(true));
37855
+ return asLazyMetadataHook(hook);
37856
+ } catch (err) {
37857
+ span?.setAttributes({
37858
+ ...HookToken(typeof tokenOrHook === "string" ? tokenOrHook : tokenOrHook.token),
37859
+ ...HookFound(false)
37860
+ });
37861
+ throw err;
37862
+ }
37863
+ }
37629
37864
  async function resumeWebhook(token, request) {
37630
37865
  const resumeRequestedAtMs = Date.now();
37631
37866
  const world = await getWorldLazy();
@@ -37653,7 +37888,7 @@ async function resumeWebhook(token, request) {
37653
37888
  status: 202
37654
37889
  });
37655
37890
  }
37656
- await resumeHookImpl(hook, request, metadataEncryptionKey(), true, resumeRequestedAtMs);
37891
+ await resumeHookImpl(hook, request, metadataEncryptionKey(), true, resumeRequestedAtMs, true);
37657
37892
  if (responseReadable) {
37658
37893
  const reader = responseReadable.getReader();
37659
37894
  const chunk = await reader.read();
@@ -37669,7 +37904,7 @@ async function resumeWebhook(token, request) {
37669
37904
  }
37670
37905
  return response;
37671
37906
  }
37672
- var generateResumeId, HOOK_WAKE_RETRY_DELAYS_MS;
37907
+ var generateResumeId, MAX_FORCE_CLAIM_REDIRECTS, notFoundReasons;
37673
37908
  var init_resume_hook = __esm({
37674
37909
  "../core/dist/runtime/resume-hook.js"() {
37675
37910
  "use strict";
@@ -37687,16 +37922,11 @@ var init_resume_hook = __esm({
37687
37922
  init_telemetry();
37688
37923
  init_get_world_lazy();
37689
37924
  init_helpers();
37925
+ init_hook_wake();
37690
37926
  init_invocations();
37691
37927
  init_wait_until();
37692
37928
  generateResumeId = monotonicFactory();
37693
37929
  __name(computeResumePayloadDigest, "computeResumePayloadDigest");
37694
- HOOK_WAKE_RETRY_DELAYS_MS = [
37695
- 25,
37696
- 100
37697
- ];
37698
- __name(isRetryableWakeError, "isRetryableWakeError");
37699
- __name(publishHookWakeWithRetry, "publishHookWakeWithRetry");
37700
37930
  __name(resumeContextFromRun, "resumeContextFromRun");
37701
37931
  __name(resolveHookResumeInfo, "resolveHookResumeInfo");
37702
37932
  __name(resolveHookEncryptionKey, "resolveHookEncryptionKey");
@@ -37705,7 +37935,10 @@ var init_resume_hook = __esm({
37705
37935
  __name(asLazyMetadataHook, "asLazyMetadataHook");
37706
37936
  __name(getHookByToken, "getHookByToken");
37707
37937
  __name(resumeHook, "resumeHook");
37938
+ MAX_FORCE_CLAIM_REDIRECTS = 3;
37939
+ notFoundReasons = /* @__PURE__ */ new WeakMap();
37708
37940
  __name(resumeHookImpl, "resumeHookImpl");
37941
+ __name(resumeHookAttempt, "resumeHookAttempt");
37709
37942
  __name(resumeWebhook, "resumeWebhook");
37710
37943
  }
37711
37944
  });
@@ -40086,7 +40319,7 @@ __name(start, "start");
40086
40319
  value: "start",
40087
40320
  configurable: true
40088
40321
  });
40089
- })(start, "step//@workflow/core/runtime/start@5.0.0-beta.54//start");
40322
+ })(start, "step//@workflow/core/runtime/start@5.0.0-beta.56//start");
40090
40323
 
40091
40324
  // ../core/dist/runtime/runs.js
40092
40325
  async function wakeUpRun(world, runId, options) {
@@ -40557,7 +40790,7 @@ var Run = class _Run {
40557
40790
  value: "wakeUp",
40558
40791
  configurable: true
40559
40792
  });
40560
- })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#wakeUp");
40793
+ })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#wakeUp");
40561
40794
  (function(__wf_fn, __wf_id) {
40562
40795
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40563
40796
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40566,7 +40799,7 @@ var Run = class _Run {
40566
40799
  value: "cancel",
40567
40800
  configurable: true
40568
40801
  });
40569
- })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#cancel");
40802
+ })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#cancel");
40570
40803
  (function(__wf_fn, __wf_id) {
40571
40804
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40572
40805
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40575,7 +40808,7 @@ var Run = class _Run {
40575
40808
  value: "getReadable",
40576
40809
  configurable: true
40577
40810
  });
40578
- })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#getReadable");
40811
+ })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#getReadable");
40579
40812
  (function(__wf_fn, __wf_id) {
40580
40813
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40581
40814
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40584,7 +40817,7 @@ var Run = class _Run {
40584
40817
  value: "getWritable",
40585
40818
  configurable: true
40586
40819
  });
40587
- })(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#getWritable");
40820
+ })(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#getWritable");
40588
40821
  (function(__wf_fn, __wf_id) {
40589
40822
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40590
40823
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40593,7 +40826,7 @@ var Run = class _Run {
40593
40826
  value: "exists",
40594
40827
  configurable: true
40595
40828
  });
40596
- })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#exists");
40829
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#exists");
40597
40830
  (function(__wf_fn, __wf_id) {
40598
40831
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40599
40832
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40602,7 +40835,7 @@ var Run = class _Run {
40602
40835
  value: "status",
40603
40836
  configurable: true
40604
40837
  });
40605
- })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#status");
40838
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#status");
40606
40839
  (function(__wf_fn, __wf_id) {
40607
40840
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40608
40841
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40611,7 +40844,7 @@ var Run = class _Run {
40611
40844
  value: "returnValue",
40612
40845
  configurable: true
40613
40846
  });
40614
- })(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#returnValue");
40847
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "returnValue").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#returnValue");
40615
40848
  (function(__wf_fn, __wf_id) {
40616
40849
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40617
40850
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40620,7 +40853,7 @@ var Run = class _Run {
40620
40853
  value: "workflowName",
40621
40854
  configurable: true
40622
40855
  });
40623
- })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#workflowName");
40856
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#workflowName");
40624
40857
  (function(__wf_fn, __wf_id) {
40625
40858
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40626
40859
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40629,7 +40862,7 @@ var Run = class _Run {
40629
40862
  value: "createdAt",
40630
40863
  configurable: true
40631
40864
  });
40632
- })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#createdAt");
40865
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#createdAt");
40633
40866
  (function(__wf_fn, __wf_id) {
40634
40867
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40635
40868
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40638,7 +40871,7 @@ var Run = class _Run {
40638
40871
  value: "startedAt",
40639
40872
  configurable: true
40640
40873
  });
40641
- })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#startedAt");
40874
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#startedAt");
40642
40875
  (function(__wf_fn, __wf_id) {
40643
40876
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40644
40877
  __wf_reg.set(__wf_id, __wf_fn);
@@ -40647,7 +40880,7 @@ var Run = class _Run {
40647
40880
  value: "completedAt",
40648
40881
  configurable: true
40649
40882
  });
40650
- })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.54//Run#completedAt");
40883
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.0.0-beta.56//Run#completedAt");
40651
40884
  (function(__wf_cls, __wf_id) {
40652
40885
  var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
40653
40886
  __wf_reg.set(__wf_id, __wf_cls);
@@ -40657,7 +40890,7 @@ var Run = class _Run {
40657
40890
  enumerable: false,
40658
40891
  configurable: false
40659
40892
  });
40660
- })(Run, "class//@workflow/core/runtime/run@5.0.0-beta.54//Run");
40893
+ })(Run, "class//@workflow/core/runtime/run@5.0.0-beta.56//Run");
40661
40894
 
40662
40895
  // ../workflow/dist/stdlib.js
40663
40896
  async function fetch2(...args) {