@workflow/web 5.0.0-beta.46 → 5.0.0-beta.47

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.
Files changed (23) hide show
  1. package/build/client/assets/{arrow-up-right-UOc2WcaC.js → arrow-up-right-C52N96YH.js} +1 -1
  2. package/build/client/assets/{highlighted-body-B3W2YXNL-D78gcP7S.js → highlighted-body-B3W2YXNL-BzCKp954.js} +1 -1
  3. package/build/client/assets/{home-DYB1uz9w.js → home-CXFjRmpa.js} +3 -3
  4. package/build/client/assets/{loader-circle-oscnpy3L.js → loader-circle-BQzzSKVU.js} +1 -1
  5. package/build/client/assets/{manifest-a701502a.js → manifest-9ff1658d.js} +1 -1
  6. package/build/client/assets/{mermaid-3ZIDBTTL-BKGEyEYb.js → mermaid-3ZIDBTTL-BrUzeGHN.js} +212 -120
  7. package/build/client/assets/{root-Zvnb602n.js → root-DBp4o4Ap.js} +3 -3
  8. package/build/client/assets/{run-detail-CedyZW9h.js → run-detail-7tPGLWpY.js} +58 -37
  9. package/build/client/assets/{workflow-graph-viewer-Du0ztkb8.js → workflow-graph-viewer-BI72rVK-.js} +1 -1
  10. package/build/client/assets/{zstd-browser-decoder-DafWVuEG.js → zstd-browser-decoder-C5OUdy0l.js} +1 -1
  11. package/build/server/assets/{app-BpmEMaiu.js → app-z0qVD1ZU.js} +681 -371
  12. package/build/server/assets/{highlighted-body-B3W2YXNL-C6ES2Pzm.js → highlighted-body-B3W2YXNL-BRzynHFv.js} +1 -1
  13. package/build/server/assets/{index-BtQfiVUN.js → index-DDMGTwh_.js} +70 -67
  14. package/build/server/assets/{index-QOlZC9D-.js → index-jQkBA81b.js} +1 -1
  15. package/build/server/assets/{mermaid-3ZIDBTTL-X6IEJ8gj.js → mermaid-3ZIDBTTL-CNWRBcN0.js} +1 -1
  16. package/build/server/assets/{token-CrxXUTBD.js → token-BSEhy2T4.js} +1 -1
  17. package/build/server/assets/{token-util-DuToe55u.js → token-util-D_gzpVW2.js} +1 -1
  18. package/build/server/assets/{websocket-server-CTnzV_B7.js → websocket-server-CDTVQU5X.js} +1 -1
  19. package/build/server/assets/{wrapper-Bjff6YRz.js → wrapper-BxieYZVg.js} +3 -3
  20. package/build/server/assets/{ws-transport-ByYax88V.js → ws-transport-DbDOLT7f.js} +5 -5
  21. package/build/server/assets/{zstd-browser-decoder-Bfk1d5vU.js → zstd-browser-decoder-CtzWlfs5.js} +1 -1
  22. package/build/server/index.js +3 -3
  23. package/package.json +8 -8
@@ -56977,6 +56977,7 @@ function isSealedNoopEvent$1(event) {
56977
56977
  return event.eventType === "noop";
56978
56978
  }
56979
56979
  const ENTITY_EVENT_CLASS_BY_TYPE = {
56980
+ attr_set: "attr_set",
56980
56981
  step_created: "step_created",
56981
56982
  step_started: "step_started",
56982
56983
  step_retrying: "step_retrying",
@@ -56991,6 +56992,23 @@ const ENTITY_EVENT_CLASS_BY_TYPE = {
56991
56992
  function entityEventClass(eventType) {
56992
56993
  return getOwnProperty$1(ENTITY_EVENT_CLASS_BY_TYPE, eventType);
56993
56994
  }
56995
+ const RUN_ENTITY_KEY = "";
56996
+ const TERMINAL_EVENT_CLASSES = /* @__PURE__ */ new Set([
56997
+ "attr_set",
56998
+ "step_terminal",
56999
+ "wait_completed",
57000
+ "hook_disposed"
57001
+ ]);
57002
+ function classifyEntityEvent(event) {
57003
+ const eventClass = entityEventClass(event.eventType);
57004
+ if (eventClass === void 0) {
57005
+ return void 0;
57006
+ }
57007
+ if (eventClass === "run_started") {
57008
+ return { eventClass, entity: RUN_ENTITY_KEY };
57009
+ }
57010
+ return event.correlationId ? { eventClass, entity: event.correlationId } : void 0;
57011
+ }
56994
57012
  const EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE = {
56995
57013
  run_created: ["input"],
56996
57014
  run_started: ["input"],
@@ -57956,8 +57974,9 @@ const HookResumeTimingSchema = object$1({
57956
57974
  /** Epoch ms immediately before the queue publish was requested. */
57957
57975
  queuePublishRequestedAtMs: number$3(),
57958
57976
  /**
57959
- * Which `resumeHook()` dispatch path ran: `lazy` or `sequential` (`parallel`
57960
- * from producers predating lazy-only resume).
57977
+ * Which `resumeHook()` dispatch path ran. Current producers always report
57978
+ * `sequential` (durable write, then wake); older producers may report
57979
+ * `lazy` or `parallel`.
57961
57980
  */
57962
57981
  strategy: string$3().optional(),
57963
57982
  /** Epoch ms the final consumer's queue handler was entered. */
@@ -58029,9 +58048,9 @@ const WorkflowInvokePayloadSchema = object$1({
58029
58048
  /** Run creation data, only present on the first queue delivery from start() */
58030
58049
  runInput: RunInputSchema.optional(),
58031
58050
  /**
58032
- * Lazy hook resume data, only present when `resumeHook()` takes the parallel
58033
- * fast path. A consumer that understands this field idempotently ensures the
58034
- * `hook_received` event exists (keyed by `resumeId`) before replaying.
58051
+ * Legacy lazy hook resume data. A consumer that understands this field
58052
+ * idempotently ensures the `hook_received` event exists (keyed by `resumeId`)
58053
+ * before replaying.
58035
58054
  */
58036
58055
  hookInput: HookResumeInputSchema.optional(),
58037
58056
  /**
@@ -58043,7 +58062,7 @@ const WorkflowInvokePayloadSchema = object$1({
58043
58062
  stepInput: StepDispatchInputSchema.optional(),
58044
58063
  /**
58045
58064
  * Hook-resume TTR timing. Present on both `resumeHook()` dispatch paths
58046
- * (unlike `hookInput`, which only rides the lazy path), and
58065
+ * (unlike legacy `hookInput`), and
58047
58066
  * forwarded onto a dispatched step message when the resuming invocation
58048
58067
  * hands the next durable step to another invocation. Purely observational.
58049
58068
  * See {@link HookResumeTimingSchema}.
@@ -58090,12 +58109,14 @@ const HookResumeContextSchema = object$1({
58090
58109
  encryptionPublicKey: string$3().optional(),
58091
58110
  // Feature marker: the version of the lazy-hook-resume consumer protocol the
58092
58111
  // run's creating deployment supports. Present (>= 1) means that deployment's
58093
- // `@workflow/core` re-ensures the `hook_received` event from the queue
58094
- // message's `hookInput` on replay, so `resumeHook()`'s lazy path is safe to
58095
- // use. Because a run is pinned to its creating deployment, this
58096
- // marker is a reliable per-run attestation, unlike inferring support from a
58097
- // version compare against a predicted release cutoff. Absent on runs created
58098
- // before the marker existed (fall back to the sequential path).
58112
+ // `@workflow/core` re-ensures the `hook_received` event from a queue
58113
+ // message's `hookInput` on replay. Current producers no longer send
58114
+ // `hookInput` (the durable write happens before the wake is published), so
58115
+ // they never read this marker; it remains stamped so OLDER producers, which
58116
+ // still gate their lazy path on it, keep working against new runs. Because a
58117
+ // run is pinned to its creating deployment, this marker is a reliable
58118
+ // per-run attestation, unlike inferring support from a version compare
58119
+ // against a predicted release cutoff.
58099
58120
  hookResumeInputVersion: number$3().optional()
58100
58121
  });
58101
58122
  const HOOK_RESUME_INPUT_VERSION = 1;
@@ -58166,10 +58187,16 @@ async function reenqueueActiveRuns(runs, enqueue, label, namespace2) {
58166
58187
  cursor = page.cursor ?? void 0;
58167
58188
  }
58168
58189
  }
58169
- if (reenqueued > 0) {
58170
- console.log(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
58190
+ if (reenqueued > 0 && isDebugEnabled$1()) {
58191
+ console.debug(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
58171
58192
  }
58172
58193
  }
58194
+ function isDebugEnabled$1() {
58195
+ const debug = typeof process !== "undefined" ? process.env.DEBUG : void 0;
58196
+ if (typeof debug !== "string")
58197
+ return false;
58198
+ return debug.includes("workflow:") || debug === "*";
58199
+ }
58173
58200
  const zodJsonSchema = lazy(() => {
58174
58201
  return union([
58175
58202
  string$3(),
@@ -58441,15 +58468,9 @@ function validateUlidTimestamp(prefixedUlid, prefix, pastThresholdMs = DEFAULT_T
58441
58468
  const thresholdSeconds = Math.round(thresholdMs / 1e3);
58442
58469
  return `Invalid runId timestamp: embedded timestamp is ${driftSeconds}s in the ${direction} (threshold: ${thresholdSeconds}s)`;
58443
58470
  }
58444
- const TERMINAL_EVENT_CLASSES = /* @__PURE__ */ new Set([
58445
- "step_terminal",
58446
- "wait_completed",
58447
- "hook_disposed"
58448
- ]);
58449
58471
  const SINGLETON_EVENT_CLASSES = /* @__PURE__ */ new Set([
58450
58472
  "run_started"
58451
58473
  ]);
58452
- const RUN_ENTITY_KEY = "";
58453
58474
  const DUPLICATE_EVENT_MESSAGE = "Written by a concurrent replay after an event of the same kind was already recorded and acted on. The run follows the earlier one.";
58454
58475
  function compareEventId(a2, b2) {
58455
58476
  if (a2.eventId.length !== b2.eventId.length) {
@@ -58479,10 +58500,10 @@ function foldDuplicates(ordered) {
58479
58500
  const seenClasses = /* @__PURE__ */ new Set();
58480
58501
  const closedEntities = /* @__PURE__ */ new Set();
58481
58502
  for (const event of ordered) {
58482
- const eventClass = entityEventClass(event.eventType);
58483
- if (eventClass === void 0)
58503
+ const classification = classifyEntityEvent(event);
58504
+ if (classification === void 0)
58484
58505
  continue;
58485
- const entity = event.correlationId ?? RUN_ENTITY_KEY;
58506
+ const { eventClass, entity } = classification;
58486
58507
  const classKey = `${eventClass}:${entity}`;
58487
58508
  const repeatsClass = seenClasses.has(classKey);
58488
58509
  const entityWasClosed = closedEntities.has(entity);
@@ -58536,6 +58557,17 @@ function looksLikeWorkflowIdSearchInput(query) {
58536
58557
  }
58537
58558
  return /\d/.test(trimmed);
58538
58559
  }
58560
+ function isWorkflowDebugEnabled() {
58561
+ const debug = typeof process !== "undefined" ? process.env.DEBUG : void 0;
58562
+ if (typeof debug !== "string")
58563
+ return false;
58564
+ return debug.includes("workflow:") || debug === "*";
58565
+ }
58566
+ function debugLog(...args) {
58567
+ if (!isWorkflowDebugEnabled())
58568
+ return;
58569
+ console.debug(...args);
58570
+ }
58539
58571
  function globalSingleton(name2, shapeVersion, create2) {
58540
58572
  const key = Symbol.for(`${name2}/v${shapeVersion}`);
58541
58573
  const store = globalThis;
@@ -59437,6 +59469,7 @@ const ERROR_SLUGS = {
59437
59469
  WEBHOOK_INVALID_RESPOND_WITH_VALUE: "webhook-invalid-respond-with-value",
59438
59470
  WEBHOOK_RESPONSE_NOT_SENT: "webhook-response-not-sent",
59439
59471
  HOOK_CONFLICT: "hook-conflict",
59472
+ CORRUPTED_EVENT_LOG: "corrupted-event-log",
59440
59473
  RUNTIME_DECRYPTION_FAILED: "runtime-decryption-failed"
59441
59474
  };
59442
59475
  class WorkflowError extends Error {
@@ -59522,6 +59555,18 @@ class WorkflowRuntimeError extends WorkflowError {
59522
59555
  return isError(value) && value.name === "WorkflowRuntimeError";
59523
59556
  }
59524
59557
  }
59558
+ class CorruptedEventLogError extends WorkflowRuntimeError {
59559
+ constructor(message2, options) {
59560
+ super(message2, {
59561
+ ...options,
59562
+ slug: ERROR_SLUGS.CORRUPTED_EVENT_LOG
59563
+ });
59564
+ this.name = "CorruptedEventLogError";
59565
+ }
59566
+ static is(value) {
59567
+ return isError(value) && value.name === "CorruptedEventLogError";
59568
+ }
59569
+ }
59525
59570
  class RuntimeDecryptionError extends WorkflowRuntimeError {
59526
59571
  constructor(message2, options) {
59527
59572
  super(message2, {
@@ -60988,7 +61033,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
60988
61033
  }
60989
61034
  async function hydrateResourceIOAsync(resource, key) {
60990
61035
  const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
60991
- const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-Bfk1d5vU.js");
61036
+ const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-CtzWlfs5.js");
60992
61037
  ensureZstdDecoderRegistered();
60993
61038
  const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
60994
61039
  const revivers = getRevivers();
@@ -62989,8 +63034,28 @@ function BytesDisplayValue({ display }) {
62989
63034
  function formatField(field) {
62990
63035
  return field === "" ? '""' : field;
62991
63036
  }
63037
+ function isGenericIterable(value) {
63038
+ if (value === null || typeof value !== "object" && typeof value !== "function" || Array.isArray(value) || value instanceof Map || value instanceof Set) {
63039
+ return false;
63040
+ }
63041
+ return typeof value[Symbol.iterator] === "function";
63042
+ }
63043
+ function isEntryIterable(value) {
63044
+ return typeof value.entries === "function";
63045
+ }
63046
+ function collectEntries(iterable, asPairs) {
63047
+ return Array.from(iterable, (item, index2) => {
63048
+ if (asPairs && Array.isArray(item) && item.length >= 2) {
63049
+ return [String(item[0]), collapseRefs(item[1]), index2];
63050
+ }
63051
+ return [void 0, collapseRefs(item), index2];
63052
+ });
63053
+ }
63054
+ function isSelfIterableIterator(value) {
63055
+ return Object.is(value[Symbol.iterator](), value);
63056
+ }
62992
63057
  function describeContainer(value) {
62993
- var _a3;
63058
+ var _a3, _b2;
62994
63059
  if (Array.isArray(value)) {
62995
63060
  return {
62996
63061
  entries: value.map((item) => [void 0, item]),
@@ -63017,8 +63082,26 @@ function describeContainer(value) {
63017
63082
  prefix: "Set"
63018
63083
  };
63019
63084
  }
63020
- if (value !== null && typeof value === "object") {
63085
+ if (isGenericIterable(value)) {
63021
63086
  const name2 = (_a3 = value.constructor) == null ? void 0 : _a3.name;
63087
+ const prefix = name2 && name2 !== "Object" ? name2 : void 0;
63088
+ if (isEntryIterable(value)) {
63089
+ return {
63090
+ entries: collectEntries(value.entries(), true),
63091
+ open: "{",
63092
+ close: "}",
63093
+ prefix
63094
+ };
63095
+ }
63096
+ return {
63097
+ entries: collectEntries(value, false),
63098
+ open: "[",
63099
+ close: "]",
63100
+ prefix
63101
+ };
63102
+ }
63103
+ if (value !== null && typeof value === "object") {
63104
+ const name2 = (_b2 = value.constructor) == null ? void 0 : _b2.name;
63022
63105
  return {
63023
63106
  entries: Object.entries(value),
63024
63107
  open: "{",
@@ -63129,7 +63212,7 @@ function ExpandableContainer({ field, entries, open: open2, close, prefix, ctx,
63129
63212
  }
63130
63213
  };
63131
63214
  const lastIndex = entries.length - 1;
63132
- return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded, "aria-controls": expanded ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open2 }), expanded ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
63215
+ return jsxRuntimeExports.jsxs("div", { className: CLS.child, role: "treeitem", "aria-expanded": expanded, "aria-controls": expanded ? contentsId : void 0, "data-json-expander": true, ref: rowRef, tabIndex: level === 0 ? 0 : -1, onClick, onKeyDown, children: [jsxRuntimeExports.jsx("span", { className: expanded ? CLS.collapseIcon : CLS.expandIcon, "aria-hidden": "true" }), field !== void 0 && jsxRuntimeExports.jsx("span", { className: CLS.clickableLabel, children: `${formatField(field)}:` }), prefix ? jsxRuntimeExports.jsx("span", { className: CLS.className, children: prefix }) : null, jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: open2 }), expanded ? jsxRuntimeExports.jsx("ul", { id: contentsId, className: CLS.childFields, role: "group", children: entries.map(([childField, childValue, entryKey], index2) => jsxRuntimeExports.jsx(DataRender, { field: childField, value: childValue, isLast: index2 === lastIndex, ctx: { ...ctx, level: level + 1 } }, entryKey ?? childField ?? index2)) }) : jsxRuntimeExports.jsx("span", { className: CLS.collapsedContent, "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { className: CLS.punctuation, children: close }), jsxRuntimeExports.jsx(Comma, { isLast })] });
63133
63216
  }
63134
63217
  function DataRender({ field, value, isLast, ctx }) {
63135
63218
  if (isBytesDisplay(value)) {
@@ -63257,6 +63340,19 @@ function isSameBytesDisplay(a2, b2) {
63257
63340
  var _a3, _b2, _c2, _d2, _e2, _f;
63258
63341
  return a2.text === b2.text && ((_a3 = a2.decodedFrom) == null ? void 0 : _a3.type) === ((_b2 = b2.decodedFrom) == null ? void 0 : _b2.type) && ((_c2 = a2.decodedFrom) == null ? void 0 : _c2.encoding) === ((_d2 = b2.decodedFrom) == null ? void 0 : _d2.encoding) && ((_e2 = a2.decodedFrom) == null ? void 0 : _e2.rawSummary) === ((_f = b2.decodedFrom) == null ? void 0 : _f.rawSummary);
63259
63342
  }
63343
+ function haveSameIterableValues(a2, b2, seen) {
63344
+ const aIterator = a2[Symbol.iterator]();
63345
+ const bIterator = b2[Symbol.iterator]();
63346
+ while (true) {
63347
+ const aResult = aIterator.next();
63348
+ const bResult = bIterator.next();
63349
+ if (aResult.done || bResult.done) {
63350
+ return aResult.done === bResult.done;
63351
+ }
63352
+ if (!isDeepEqual(aResult.value, bResult.value, seen))
63353
+ return false;
63354
+ }
63355
+ }
63260
63356
  function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
63261
63357
  if (Object.is(a2, b2))
63262
63358
  return true;
@@ -63269,6 +63365,25 @@ function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
63269
63365
  if (a2 instanceof RegExp && b2 instanceof RegExp) {
63270
63366
  return a2.source === b2.source && a2.flags === b2.flags;
63271
63367
  }
63368
+ if (isGenericIterable(a2) || isGenericIterable(b2)) {
63369
+ if (!isGenericIterable(a2) || !isGenericIterable(b2))
63370
+ return false;
63371
+ if (Object.getPrototypeOf(a2) !== Object.getPrototypeOf(b2))
63372
+ return false;
63373
+ if (isSelfIterableIterator(a2) || isSelfIterableIterator(b2))
63374
+ return false;
63375
+ if (seen.get(a2) === b2)
63376
+ return true;
63377
+ seen.set(a2, b2);
63378
+ const aHasEntries = isEntryIterable(a2);
63379
+ const bHasEntries = isEntryIterable(b2);
63380
+ if (aHasEntries !== bHasEntries)
63381
+ return false;
63382
+ if (aHasEntries && bHasEntries) {
63383
+ return haveSameIterableValues(a2.entries(), b2.entries(), seen);
63384
+ }
63385
+ return haveSameIterableValues(a2, b2, seen);
63386
+ }
63272
63387
  if (a2 instanceof Map && b2 instanceof Map) {
63273
63388
  if (a2.size !== b2.size)
63274
63389
  return false;
@@ -64753,7 +64868,6 @@ function EventRow$1({ event, index: index2, isFirst, isLast, isExpanded, onToggl
64753
64868
  }, []);
64754
64869
  reactExports.useEffect(() => {
64755
64870
  if (encryptionKey && hasAttemptedLoad && onLoadEventData) {
64756
- setLoadedEventData(null);
64757
64871
  setHasAttemptedLoad(false);
64758
64872
  onLoadEventData(event).then((data) => {
64759
64873
  if (data !== null && data !== void 0) {
@@ -91858,7 +91972,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
91858
91972
  var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
91859
91973
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
91860
91974
  var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
91861
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-C6ES2Pzm.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
91975
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-BRzynHFv.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
91862
91976
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
91863
91977
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
91864
91978
  return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
@@ -92180,7 +92294,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
92180
92294
  }, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
92181
92295
  };
92182
92296
  var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
92183
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-X6IEJ8gj.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
92297
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CNWRBcN0.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
92184
92298
  function ke(e, t) {
92185
92299
  if (!(e != null && e.position || t != null && t.position)) return true;
92186
92300
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -92933,7 +93047,7 @@ const stepEventsToStepEntity = (events2) => {
92933
93047
  specVersion: anchorEvent.specVersion
92934
93048
  };
92935
93049
  };
92936
- function stepToSpan(stepEvents, maxEndTime) {
93050
+ function stepToSpan(stepEvents, maxEndTime, getStepAttributes) {
92937
93051
  const step = stepEventsToStepEntity(stepEvents);
92938
93052
  if (!step) {
92939
93053
  return null;
@@ -92941,7 +93055,11 @@ function stepToSpan(stepEvents, maxEndTime) {
92941
93055
  const parsedName = parseStepName(String(step.stepName)) ?? parseWorkflowName(String(step.stepName));
92942
93056
  const attributes = {
92943
93057
  resource: "step",
92944
- data: step
93058
+ data: {
93059
+ ...getStepAttributes == null ? void 0 : getStepAttributes(stepEvents),
93060
+ // Canonical event-derived fields cannot be overridden by extensions.
93061
+ ...step
93062
+ }
92945
93063
  };
92946
93064
  const resource = "step";
92947
93065
  const events2 = convertEventsToSpanEvents(stepEvents, false, {
@@ -93119,10 +93237,10 @@ function computeLatestKnownTime(events2, run2) {
93119
93237
  }
93120
93238
  return new Date(latest);
93121
93239
  }
93122
- function buildSpans(run2, groupedEvents, now2, latestKnownTime) {
93240
+ function buildSpans(run2, groupedEvents, now2, latestKnownTime, getStepAttributes) {
93123
93241
  const childMaxEnd = latestKnownTime;
93124
93242
  const runMaxEnd = run2.completedAt ?? now2;
93125
- const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd)).filter((span) => span !== null);
93243
+ const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd, getStepAttributes)).filter((span) => span !== null);
93126
93244
  const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, childMaxEnd)).filter((span) => span !== null);
93127
93245
  const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, childMaxEnd, runMaxEnd)).filter((span) => span !== null);
93128
93246
  return {
@@ -93147,14 +93265,14 @@ function cascadeSpans(runSpan, spans) {
93147
93265
  };
93148
93266
  });
93149
93267
  }
93150
- function buildTrace(run2, events2, now2, { isCompleteHistory = false } = {}) {
93268
+ function buildTrace(run2, events2, now2, { isCompleteHistory = false, getStepAttributes } = {}) {
93151
93269
  const duplicateEventIds = findDuplicateEventIds(events2, {
93152
93270
  isCompleteHistory
93153
93271
  });
93154
93272
  const actedOnEvents = events2.filter((event) => !duplicateEventIds.has(event.eventId) && !isSealedNoopEvent(event));
93155
93273
  const groupedEvents = groupEventsByCorrelation(actedOnEvents);
93156
93274
  const latestKnownTime = computeLatestKnownTime(actedOnEvents, run2);
93157
- const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime);
93275
+ const { runSpan, spans } = buildSpans(run2, groupedEvents, now2, latestKnownTime, getStepAttributes);
93158
93276
  const sortedCascadingSpans = cascadeSpans(runSpan, spans);
93159
93277
  const traceStartMs = otelTimeToMs(runSpan.startTime);
93160
93278
  const knownDurationMs = latestKnownTime.getTime() - traceStartMs;
@@ -97393,6 +97511,42 @@ function TraceShortcutHelper({ hasMultipleSpans, reducedMotion }) {
97393
97511
  };
97394
97512
  return jsxRuntimeExports.jsxs("div", { className: "group pointer-events-auto hidden h-8 w-fit items-center gap-1 text-label-12 leading-none text-gray-900 @min-[480px]:flex", children: [jsxRuntimeExports.jsx("span", { "aria-live": "polite", "aria-atomic": "true", className: "inline-flex items-center whitespace-nowrap", children: reducedMotion ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx("span", { className: `inline-flex items-center ${styles$1.hint}`, children: index2 === 0 ? jsxRuntimeExports.jsx(AltHint, {}) : jsxRuntimeExports.jsx(NavHint, {}) }, index2) }), jsxRuntimeExports.jsx("button", { type: "button", className: "inline-flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none", onClick: dismiss, "aria-label": "Dismiss trace shortcuts helper", children: jsxRuntimeExports.jsx(X$3, { className: "h-3 w-3" }) })] });
97395
97513
  }
97514
+ function isAltModifierKey(key) {
97515
+ return key === "Alt" || key === "AltGraph";
97516
+ }
97517
+ function isTypingTarget(target2) {
97518
+ return target2 instanceof HTMLInputElement || target2 instanceof HTMLTextAreaElement || target2 instanceof HTMLElement && target2.isContentEditable;
97519
+ }
97520
+ function useAltHeld() {
97521
+ const [altHeld, setAltHeld] = reactExports.useState(false);
97522
+ reactExports.useEffect(() => {
97523
+ const onKeyDown = (e) => {
97524
+ if (!isAltModifierKey(e.key))
97525
+ return;
97526
+ if (!isTypingTarget(e.target)) {
97527
+ e.preventDefault();
97528
+ }
97529
+ setAltHeld(true);
97530
+ };
97531
+ const onKeyUp = (e) => {
97532
+ if (isAltModifierKey(e.key))
97533
+ setAltHeld(false);
97534
+ };
97535
+ const onBlur = () => setAltHeld(false);
97536
+ const onPointerMove = (e) => setAltHeld(e.altKey);
97537
+ window.addEventListener("keydown", onKeyDown, true);
97538
+ window.addEventListener("keyup", onKeyUp, true);
97539
+ window.addEventListener("blur", onBlur);
97540
+ window.addEventListener("pointermove", onPointerMove, true);
97541
+ return () => {
97542
+ window.removeEventListener("keydown", onKeyDown, true);
97543
+ window.removeEventListener("keyup", onKeyUp, true);
97544
+ window.removeEventListener("blur", onBlur);
97545
+ window.removeEventListener("pointermove", onPointerMove, true);
97546
+ };
97547
+ }, []);
97548
+ return { altHeld };
97549
+ }
97396
97550
  const MIN_VIEWPORT_MS = 1e-3;
97397
97551
  const ZOOM_DEBOUNCE_MS = 150;
97398
97552
  function useAnimatedViewport(initial) {
@@ -97592,28 +97746,15 @@ function TraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore
97592
97746
  focusViewportOnSpan(spanId);
97593
97747
  }, ZOOM_DEBOUNCE_MS);
97594
97748
  }, [setActiveSpan, scrollSpanIntoView, cancelPendingZoom, focusViewportOnSpan]);
97595
- const [altHeld, setAltHeld] = reactExports.useState(false);
97749
+ const { altHeld } = useAltHeld();
97596
97750
  reactExports.useEffect(() => {
97597
97751
  const onKeyDown = (e) => {
97598
97752
  if (e.key === "Escape") {
97599
97753
  handleClearActiveSpan();
97600
- } else if (e.key === "Alt") {
97601
- setAltHeld(true);
97602
97754
  }
97603
97755
  };
97604
- const onKeyUp = (e) => {
97605
- if (e.key === "Alt")
97606
- setAltHeld(false);
97607
- };
97608
- const onBlur = () => setAltHeld(false);
97609
97756
  window.addEventListener("keydown", onKeyDown);
97610
- window.addEventListener("keyup", onKeyUp);
97611
- window.addEventListener("blur", onBlur);
97612
- return () => {
97613
- window.removeEventListener("keydown", onKeyDown);
97614
- window.removeEventListener("keyup", onKeyUp);
97615
- window.removeEventListener("blur", onBlur);
97616
- };
97757
+ return () => window.removeEventListener("keydown", onKeyDown);
97617
97758
  }, [handleClearActiveSpan]);
97618
97759
  const timelineRef = reactExports.useRef(null);
97619
97760
  const [hover, setHover] = reactExports.useState(null);
@@ -97689,15 +97830,16 @@ function TraceViewerContent({ trace: trace2, onLoadMore, hasMore, isLoadingMore
97689
97830
  }
97690
97831
  }, placeholder: "Search spans...", "aria-label": "Search spans", className: "flex-1 min-w-0 bg-transparent text-label-14 text-gray-1000 placeholder:text-gray-800 outline-none" }), searchQuery && jsxRuntimeExports.jsx("button", { type: "button", "aria-label": "Clear search", onClick: () => setSearchQuery(""), className: "-mr-2 hidden h-full max-w-full shrink-0 cursor-pointer items-center rounded-r-md border-0 bg-transparent px-2.5 font-inherit text-label-16 text-gray-900 no-underline transition-colors duration-150 ease-in hover:text-gray-1000 focus-visible:-outline-offset-1 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ds-focus-color)] min-[961px]:flex", children: jsxRuntimeExports.jsx(Kbd, { variant: "outline", size: "search", children: "Esc" }) })] }), endHeader: jsxRuntimeExports.jsx(TimelineHeader, { markers: timeMarkers, hoverInfo }), children: [jsxRuntimeExports.jsxs("div", { className: "block overflow-visible", children: [jsxRuntimeExports.jsx(EventList, { spans: trace2.spans, activeSpanId, searchResult, onSelectSpan: handleSelectSpan }), jsxRuntimeExports.jsx("div", { ref: loadMoreSentinelRef, className: "flex justify-center", children: isLoadingMore ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-label-14 text-gray-800", children: [jsxRuntimeExports.jsx(Spinner, { size: 14 }), jsxRuntimeExports.jsx("span", { children: "Loading spans…" })] }) : null })] }), jsxRuntimeExports.jsx("div", { ref: timelineRef, id: "trace-timeline", className: "@container block min-h-0 overflow-visible relative", onDoubleClick: resetZoom, onMouseMove: handleTimelineMouseMove, onMouseLeave: handleTimelineMouseLeave, children: jsxRuntimeExports.jsx(Timeline, { spans: trace2.spans, viewStart: viewport.start, viewEnd: viewport.end, markers: timeMarkers, selectedId: activeSpanId, searchResult, onSelect: handleSelectSpan, onRevealTime: handleRevealTime, hover, altHeld }) }), jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TraceShortcutHelper, { hasMultipleSpans: trace2.spans.length > 1, reducedMotion }), jsxRuntimeExports.jsxs("div", { className: "pointer-events-auto flex items-center border border-gray-alpha-400 rounded-md bg-background-100 shadow-sm overflow-hidden divide-x divide-gray-alpha-400", children: [jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomOut, disabled: isAtMinZoom, "aria-label": "Zoom out", children: jsxRuntimeExports.jsx(ZoomOut, { className: "w-4 h-4" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: resetZoom, "aria-label": "Reset zoom", children: jsxRuntimeExports.jsx(RotateCcw, { className: "w-3.5 h-3.5" }) }), jsxRuntimeExports.jsx(IconButton, { variant: "muted", size: "small", onClick: zoomIn, disabled: isAtMaxZoom, "aria-label": "Zoom in", children: jsxRuntimeExports.jsx(ZoomIn, { className: "w-4 h-4" }) })] })] })] })] }), jsxRuntimeExports.jsx(TraceDetailPanel, { containerRef: paneRootRef, onNavigateToSpan: navigateToSpan, onClose: handleClearActiveSpan })] });
97691
97832
  }
97692
- const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false }) => {
97833
+ const TraceViewer = ({ run: run2, events: events2, sidebarData, onLoadMore, hasMore, isLoadingMore, loading = false, getStepAttributes }) => {
97693
97834
  const trace2 = reactExports.useMemo(() => {
97694
97835
  if (!(run2 == null ? void 0 : run2.runId)) {
97695
97836
  return void 0;
97696
97837
  }
97697
97838
  return buildTrace(run2, events2, /* @__PURE__ */ new Date(), {
97698
- isCompleteHistory: !hasMore
97839
+ isCompleteHistory: !hasMore,
97840
+ getStepAttributes
97699
97841
  });
97700
- }, [run2, events2, hasMore]);
97842
+ }, [run2, events2, hasMore, getStepAttributes]);
97701
97843
  const sidebarValue = reactExports.useMemo(() => ({ ...sidebarData, duplicateEventIds: trace2 == null ? void 0 : trace2.duplicateEventIds }), [sidebarData, trace2]);
97702
97844
  if (!trace2 || loading && events2.length === 0) {
97703
97845
  return jsxRuntimeExports.jsx(TraceViewerSkeleton, {});
@@ -100873,6 +101015,8 @@ const DeploymentId = SemanticConvention$2("deployment.id");
100873
101015
  const HookToken = SemanticConvention$2("workflow.hook.token");
100874
101016
  const HookId = SemanticConvention$2("workflow.hook.id");
100875
101017
  const HookFound = SemanticConvention$2("workflow.hook.found");
101018
+ const HookResumeCommitted = SemanticConvention$2("workflow.hook.resume_committed");
101019
+ const HookWakePublished = SemanticConvention$2("workflow.hook.wake_published");
100876
101020
  const WorkflowSuspensionState = SemanticConvention$2("workflow.suspension.state");
100877
101021
  const WorkflowSuspensionHookCount = SemanticConvention$2("workflow.suspension.hook_count");
100878
101022
  const WorkflowSuspensionStepCount = SemanticConvention$2("workflow.suspension.step_count");
@@ -100917,6 +101061,16 @@ const Tracer = once$1(async () => {
100917
101061
  return tracer;
100918
101062
  });
100919
101063
  let otelDiagLogged$1 = false;
101064
+ function describeThrownValue(value) {
101065
+ try {
101066
+ if (typeof value === "object" && value !== null && "message" in value && typeof value.message === "string") {
101067
+ return value.message;
101068
+ }
101069
+ return String(value);
101070
+ } catch {
101071
+ return "Unknown error";
101072
+ }
101073
+ }
100920
101074
  function logOtelDiagnosticOnce$1(otel2, tracer) {
100921
101075
  var _a3, _b2, _c2, _d2, _e2;
100922
101076
  const debugEnabled = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
@@ -100961,7 +101115,7 @@ async function trace$2(spanName, ...args) {
100961
101115
  } else {
100962
101116
  span.setStatus({
100963
101117
  code: otel2.SpanStatusCode.ERROR,
100964
- message: e.message
101118
+ message: describeThrownValue(e)
100965
101119
  });
100966
101120
  }
100967
101121
  throw e;
@@ -103412,7 +103566,7 @@ function attachAbortListenerOnce(signal, streamName, runId, cryptoKey, ops) {
103412
103566
  })());
103413
103567
  }, { once: true });
103414
103568
  }
103415
- function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
103569
+ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier, readbackOps = ops) {
103416
103570
  return {
103417
103571
  ...getAllBaseReducers(global2),
103418
103572
  ReadableStream: (value) => {
@@ -103434,7 +103588,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
103434
103588
  ops.push(value.pipeTo(writable));
103435
103589
  }
103436
103590
  } else {
103437
- ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
103591
+ ops.push(value.pipeThrough(getSerializeStream(getExternalReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier, readbackOps), cryptoKey)).pipeTo(writable));
103438
103592
  }
103439
103593
  const s2 = { name: name2 };
103440
103594
  if (type)
@@ -103466,7 +103620,7 @@ function getExternalReducers(global2 = globalThis, ops, runId, cryptoKey, framed
103466
103620
  const streamId = (global2[STABLE_ULID] || defaultUlid)();
103467
103621
  const name2 = `strm_${streamId}`;
103468
103622
  const readable2 = new WorkflowServerReadableStream(runId, name2);
103469
- ops.push(readable2.pipeTo(value));
103623
+ readbackOps.push(readable2.pipeTo(value));
103470
103624
  return { name: name2 };
103471
103625
  },
103472
103626
  AbortController: (value) => {
@@ -103569,7 +103723,7 @@ function getWorkflowReducers(global2 = globalThis) {
103569
103723
  }
103570
103724
  };
103571
103725
  }
103572
- function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier) {
103726
+ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByteStreams = false, runReadyBarrier, readbackOps = ops) {
103573
103727
  return {
103574
103728
  ...getAllBaseReducers(global2),
103575
103729
  ReadableStream: (value) => {
@@ -103596,7 +103750,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
103596
103750
  ops.push(value.pipeTo(writable));
103597
103751
  }
103598
103752
  } else {
103599
- ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier), cryptoKey)).pipeTo(writable));
103753
+ ops.push(value.pipeThrough(getSerializeStream(getStepReducers(global2, ops, runId, cryptoKey, framedByteStreams, runReadyBarrier, readbackOps), cryptoKey)).pipeTo(writable));
103600
103754
  }
103601
103755
  }
103602
103756
  const s2 = { name: name2 };
@@ -103614,7 +103768,7 @@ function getStepReducers(global2 = globalThis, ops, runId, cryptoKey, framedByte
103614
103768
  if (!name2) {
103615
103769
  const streamId = (global2[STABLE_ULID] || defaultUlid)();
103616
103770
  name2 = `strm_${streamId}`;
103617
- ops.push(new WorkflowServerReadableStream(runId, name2).pipeThrough(getDeserializeStream(getStepRevivers(global2, ops, runId, cryptoKey), cryptoKey)).pipeTo(value));
103771
+ readbackOps.push(new WorkflowServerReadableStream(runId, name2).pipeThrough(getDeserializeStream(getStepRevivers(global2, readbackOps, runId, cryptoKey), cryptoKey)).pipeTo(value));
103618
103772
  }
103619
103773
  const s2 = { name: name2 };
103620
103774
  if (typeof foreignRunId === "string")
@@ -103734,8 +103888,8 @@ function reviveAbortController(value, ops, runId) {
103734
103888
  if (value.hookToken) {
103735
103889
  const hookResume = (async () => {
103736
103890
  try {
103737
- const { resumeHookDurable: resumeHookDurable2 } = await Promise.resolve().then(() => resumeHook$3);
103738
- await resumeHookDurable2(value.hookToken, {
103891
+ const { resumeHook: resumeHook2 } = await Promise.resolve().then(() => resumeHook$3);
103892
+ await resumeHook2(value.hookToken, {
103739
103893
  aborted: true,
103740
103894
  reason
103741
103895
  });
@@ -104171,16 +104325,16 @@ function deserializePreparedReplayPayload(prepared, global2 = globalThis, extraR
104171
104325
  }
104172
104326
  });
104173
104327
  }
104174
- async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false) {
104328
+ async function dehydrateWorkflowArguments(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, readbackOps = ops) {
104175
104329
  if (v1Compat) {
104176
- const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams));
104330
+ const str = stringify$2(value, getExternalReducers(global2, ops, runId, key, framedByteStreams, void 0, readbackOps));
104177
104331
  return revive(str);
104178
104332
  }
104179
104333
  try {
104180
104334
  const compressionStats = {};
104181
104335
  const result = await serialize$3(value, key, {
104182
104336
  global: global2,
104183
- extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams)),
104337
+ extraReducers: getStreamAndRequestReducers(getExternalReducers(global2, ops, runId, key, framedByteStreams, void 0, readbackOps)),
104184
104338
  compression,
104185
104339
  compressionStats
104186
104340
  });
@@ -104247,16 +104401,16 @@ async function hydrateStepArguments(value, runId, key, ops = [], global2 = globa
104247
104401
  await recordCompression(compressionStats, "deserialize");
104248
104402
  return result;
104249
104403
  }
104250
- async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier) {
104404
+ async function dehydrateStepReturnValue(value, runId, key, ops = [], global2 = globalThis, v1Compat = false, framedByteStreams = false, compression = false, runReadyBarrier, readbackOps = ops) {
104251
104405
  if (v1Compat) {
104252
- const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier));
104406
+ const str = stringify$2(value, getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier, readbackOps));
104253
104407
  return revive(str);
104254
104408
  }
104255
104409
  try {
104256
104410
  const compressionStats = {};
104257
104411
  const result = await serialize$2(value, key, {
104258
104412
  global: global2,
104259
- extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier)),
104413
+ extraReducers: getStreamAndRequestReducers(getStepReducers(global2, ops, runId, key, framedByteStreams, runReadyBarrier, readbackOps)),
104260
104414
  compression,
104261
104415
  compressionStats
104262
104416
  });
@@ -104325,7 +104479,7 @@ globalSingleton("@workflow/core//envWarnings", 1, () => ({
104325
104479
  maxInlineStepsValues: /* @__PURE__ */ new Set(),
104326
104480
  maxEventsValues: /* @__PURE__ */ new Set()
104327
104481
  }));
104328
- const version$1 = "5.0.0-beta.46";
104482
+ const version$1 = "5.0.0-beta.47";
104329
104483
  const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
104330
104484
  const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
104331
104485
  function getWorkflowQueueName(workflowName, namespace2) {
@@ -104664,9 +104818,7 @@ async function getAllPorts() {
104664
104818
  return [];
104665
104819
  }
104666
104820
  } catch (error2) {
104667
- if (process.env.NODE_ENV === "development") {
104668
- console.debug("[getAllPorts] Detection failed:", error2);
104669
- }
104821
+ debugLog("[getAllPorts] Detection failed:", error2);
104670
104822
  return [];
104671
104823
  }
104672
104824
  }
@@ -104704,9 +104856,7 @@ async function getWorkflowPort(options) {
104704
104856
  if (workflowPort) {
104705
104857
  return workflowPort.port;
104706
104858
  }
104707
- if (process.env.NODE_ENV === "development") {
104708
- console.debug("[getWorkflowPort] Probing failed, falling back to first port:", ports[0]);
104709
- }
104859
+ debugLog("[getWorkflowPort] Probing failed, falling back to first port:", ports[0]);
104710
104860
  return ports[0];
104711
104861
  }
104712
104862
  function once(fn2) {
@@ -107822,7 +107972,7 @@ function requireDiagnostics() {
107822
107972
  proxyConnected: diagnosticsChannel.channel("undici:proxy:connected")
107823
107973
  };
107824
107974
  let isTrackingClientEvents = false;
107825
- function trackClientEvents(debugLog = undiciDebugLog) {
107975
+ function trackClientEvents(debugLog2 = undiciDebugLog) {
107826
107976
  if (isTrackingClientEvents) {
107827
107977
  return;
107828
107978
  }
@@ -107837,7 +107987,7 @@ function requireDiagnostics() {
107837
107987
  const {
107838
107988
  connectParams: { version: version2, protocol, port, host }
107839
107989
  } = evt;
107840
- debugLog(
107990
+ debugLog2(
107841
107991
  "connecting to %s%s using %s%s",
107842
107992
  host,
107843
107993
  port ? `:${port}` : "",
@@ -107852,7 +108002,7 @@ function requireDiagnostics() {
107852
108002
  const {
107853
108003
  connectParams: { version: version2, protocol, port, host }
107854
108004
  } = evt;
107855
- debugLog(
108005
+ debugLog2(
107856
108006
  "connected to %s%s using %s%s",
107857
108007
  host,
107858
108008
  port ? `:${port}` : "",
@@ -107868,7 +108018,7 @@ function requireDiagnostics() {
107868
108018
  connectParams: { version: version2, protocol, port, host },
107869
108019
  error: error2
107870
108020
  } = evt;
107871
- debugLog(
108021
+ debugLog2(
107872
108022
  "connection to %s%s using %s%s errored - %s",
107873
108023
  host,
107874
108024
  port ? `:${port}` : "",
@@ -107884,12 +108034,12 @@ function requireDiagnostics() {
107884
108034
  const {
107885
108035
  request: { method, path: path2, origin }
107886
108036
  } = evt;
107887
- debugLog("sending request to %s %s%s", method, origin, path2);
108037
+ debugLog2("sending request to %s %s%s", method, origin, path2);
107888
108038
  }
107889
108039
  );
107890
108040
  }
107891
108041
  let isTrackingRequestEvents = false;
107892
- function trackRequestEvents(debugLog = undiciDebugLog) {
108042
+ function trackRequestEvents(debugLog2 = undiciDebugLog) {
107893
108043
  if (isTrackingRequestEvents) {
107894
108044
  return;
107895
108045
  }
@@ -107905,7 +108055,7 @@ function requireDiagnostics() {
107905
108055
  request: { method, path: path2, origin },
107906
108056
  response: { statusCode }
107907
108057
  } = evt;
107908
- debugLog(
108058
+ debugLog2(
107909
108059
  "received response to %s %s%s - HTTP %d",
107910
108060
  method,
107911
108061
  origin,
@@ -107920,7 +108070,7 @@ function requireDiagnostics() {
107920
108070
  const {
107921
108071
  request: { method, path: path2, origin }
107922
108072
  } = evt;
107923
- debugLog("trailers received from %s %s%s", method, origin, path2);
108073
+ debugLog2("trailers received from %s %s%s", method, origin, path2);
107924
108074
  }
107925
108075
  );
107926
108076
  diagnosticsChannel.subscribe(
@@ -107930,7 +108080,7 @@ function requireDiagnostics() {
107930
108080
  request: { method, path: path2, origin },
107931
108081
  error: error2
107932
108082
  } = evt;
107933
- debugLog(
108083
+ debugLog2(
107934
108084
  "request to %s %s%s errored - %s",
107935
108085
  method,
107936
108086
  origin,
@@ -107941,7 +108091,7 @@ function requireDiagnostics() {
107941
108091
  );
107942
108092
  }
107943
108093
  let isTrackingWebSocketEvents = false;
107944
- function trackWebSocketEvents(debugLog = websocketDebuglog) {
108094
+ function trackWebSocketEvents(debugLog2 = websocketDebuglog) {
107945
108095
  if (isTrackingWebSocketEvents) {
107946
108096
  return;
107947
108097
  }
@@ -107955,9 +108105,9 @@ function requireDiagnostics() {
107955
108105
  (evt) => {
107956
108106
  if (evt.address != null) {
107957
108107
  const { address, port } = evt.address;
107958
- debugLog("connection opened %s%s", address, port ? `:${port}` : "");
108108
+ debugLog2("connection opened %s%s", address, port ? `:${port}` : "");
107959
108109
  } else {
107960
- debugLog("connection opened");
108110
+ debugLog2("connection opened");
107961
108111
  }
107962
108112
  }
107963
108113
  );
@@ -107965,7 +108115,7 @@ function requireDiagnostics() {
107965
108115
  "undici:websocket:close",
107966
108116
  (evt) => {
107967
108117
  const { websocket: websocket2, code: code2, reason } = evt;
107968
- debugLog(
108118
+ debugLog2(
107969
108119
  "closed connection to %s - %s %s",
107970
108120
  websocket2.url,
107971
108121
  code2,
@@ -107976,19 +108126,19 @@ function requireDiagnostics() {
107976
108126
  diagnosticsChannel.subscribe(
107977
108127
  "undici:websocket:socket_error",
107978
108128
  (err) => {
107979
- debugLog("connection errored - %s", err.message);
108129
+ debugLog2("connection errored - %s", err.message);
107980
108130
  }
107981
108131
  );
107982
108132
  diagnosticsChannel.subscribe(
107983
108133
  "undici:websocket:ping",
107984
108134
  (evt) => {
107985
- debugLog("ping received");
108135
+ debugLog2("ping received");
107986
108136
  }
107987
108137
  );
107988
108138
  diagnosticsChannel.subscribe(
107989
108139
  "undici:websocket:pong",
107990
108140
  (evt) => {
107991
- debugLog("pong received");
108141
+ debugLog2("pong received");
107992
108142
  }
107993
108143
  );
107994
108144
  }
@@ -131970,7 +132120,7 @@ function createQueue$2(config2) {
131970
132120
  }
131971
132121
  const token = semaphore.tryAcquire();
131972
132122
  if (!token) {
131973
- console.warn(`[world-local]: concurrency limit (${WORKFLOW_LOCAL_QUEUE_CONCURRENCY}) reached, waiting for queue to free up`);
132123
+ debugLog(`[world-local]: concurrency limit (${WORKFLOW_LOCAL_QUEUE_CONCURRENCY}) reached, waiting for queue to free up`);
131974
132124
  await semaphore.acquire();
131975
132125
  }
131976
132126
  const MAX_LOCAL_SAFETY_LIMIT = 256;
@@ -132001,6 +132151,7 @@ function createQueue$2(config2) {
132001
132151
  headers: new Headers(headers2),
132002
132152
  body: body2,
132003
132153
  agents: nodeHttpAgents,
132154
+ signal: closeSignal,
132004
132155
  headersTimeoutMs: agentOptions.headersTimeout,
132005
132156
  bodyTimeoutMs: agentOptions.bodyTimeout
132006
132157
  }) : (
@@ -132010,7 +132161,8 @@ function createQueue$2(config2) {
132010
132161
  duplex: "half",
132011
132162
  dispatcher: httpAgent,
132012
132163
  headers: headers2,
132013
- body: body2
132164
+ body: body2,
132165
+ signal: closeSignal
132014
132166
  })
132015
132167
  );
132016
132168
  }
@@ -136394,7 +136546,7 @@ function createWorld$2(args) {
136394
136546
  const basedir = mergedConfig.dataDir;
136395
136547
  const hooksDir = path$3.join(basedir, "hooks");
136396
136548
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
136397
- const { HookSchema: HookSchema2 } = await import("./index-BtQfiVUN.js");
136549
+ const { HookSchema: HookSchema2 } = await import("./index-DDMGTwh_.js");
136398
136550
  await Promise.all(taggedHookFiles.map(async (hookFile) => {
136399
136551
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
136400
136552
  if (hook == null ? void 0 : hook.token) {
@@ -136577,8 +136729,8 @@ function requireGetVercelOidcToken() {
136577
136729
  }
136578
136730
  try {
136579
136731
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
136580
- await import("./token-util-DuToe55u.js").then((n) => n.t),
136581
- await import("./token-CrxXUTBD.js").then((n) => n.t)
136732
+ await import("./token-util-D_gzpVW2.js").then((n) => n.t),
136733
+ await import("./token-BSEhy2T4.js").then((n) => n.t)
136582
136734
  ]);
136583
136735
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
136584
136736
  await refreshToken(options);
@@ -137141,7 +137293,7 @@ function requireDist() {
137141
137293
  return dist;
137142
137294
  }
137143
137295
  var distExports = requireDist();
137144
- const version = "5.0.0-beta.42";
137296
+ const version = "5.0.0-beta.43";
137145
137297
  const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
137146
137298
  dispatcher: void 0,
137147
137299
  streamDispatcher: void 0,
@@ -138502,7 +138654,7 @@ function createGetEncryptionKeyForRun(projectId, teamId, token, dispatcher2) {
138502
138654
  };
138503
138655
  }
138504
138656
  async function getDeadline() {
138505
- const { getDeadline: getDeadline2 } = await import("./index-QOlZC9D-.js").then((n) => n.i);
138657
+ const { getDeadline: getDeadline2 } = await import("./index-jQkBA81b.js").then((n) => n.i);
138506
138658
  return getDeadline2();
138507
138659
  }
138508
138660
  const WORKFLOW_SERVER_SERVICE = {
@@ -143455,7 +143607,7 @@ const wsEventsChannelForInvocation = (runId, config2) => {
143455
143607
  open() {
143456
143608
  if (!runId || !isWsEventsTransportEnabled())
143457
143609
  return;
143458
- claim = import("./ws-transport-ByYax88V.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
143610
+ claim = import("./ws-transport-DbDOLT7f.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
143459
143611
  },
143460
143612
  /**
143461
143613
  * Awaited, unlike the open: work scheduled after the handler returns is not
@@ -143661,17 +143813,30 @@ function createQueue$1(config2) {
143661
143813
  const ResolveLatestDeploymentResponseSchema = object$1({
143662
143814
  id: string$3()
143663
143815
  });
143816
+ async function resolveDeploymentIdentityToken(config2) {
143817
+ if (config2 == null ? void 0 : config2.token)
143818
+ return config2.token;
143819
+ if (process.env.VERCEL === "1") {
143820
+ const oidcToken = await distExports.getVercelOidcToken().catch(() => null);
143821
+ if (oidcToken)
143822
+ return oidcToken;
143823
+ }
143824
+ return resolveVercelApiToken(config2);
143825
+ }
143664
143826
  function createResolveLatestDeploymentId(config2) {
143665
143827
  return async function resolveLatestDeploymentId() {
143828
+ var _a3;
143666
143829
  const currentDeploymentId = process.env.VERCEL_DEPLOYMENT_ID;
143667
143830
  if (!currentDeploymentId) {
143668
143831
  throw new Error(missingDeploymentIdMessage("Resolving the latest deployment for deploymentId: 'latest'"));
143669
143832
  }
143670
- const token = await resolveVercelApiToken(config2);
143833
+ const token = await resolveDeploymentIdentityToken(config2);
143671
143834
  if (!token) {
143672
143835
  throw new Error("Cannot resolve latest deployment: no OIDC token or VERCEL_TOKEN available");
143673
143836
  }
143674
- const url2 = `https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(currentDeploymentId)}`;
143837
+ const teamId = (_a3 = config2 == null ? void 0 : config2.projectConfig) == null ? void 0 : _a3.teamId;
143838
+ const query = teamId ? `?${new URLSearchParams({ teamId })}` : "";
143839
+ const url2 = `https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(currentDeploymentId)}${query}`;
143675
143840
  const response2 = await instrumentedFetch({
143676
143841
  method: "GET",
143677
143842
  url: url2,
@@ -143688,7 +143853,8 @@ function createResolveLatestDeploymentId(config2) {
143688
143853
  } catch {
143689
143854
  body2 = "<unable to read response body>";
143690
143855
  }
143691
- return new Error(`Failed to resolve latest deployment for ${currentDeploymentId}: HTTP ${res.status} ${res.statusText}${body2 ? ` ${body2}` : ""}`);
143856
+ const hint2 = res.status === 404 ? ". The deployment exists but was not visible to the identity this request authenticated as, which means the request resolved to a different team. Set the World's `projectConfig.teamId` to scope it explicitly." : "";
143857
+ return new Error(`Failed to resolve latest deployment for ${currentDeploymentId}: HTTP ${res.status} ${res.statusText}${body2 ? ` — ${body2}` : ""}${hint2}`);
143692
143858
  }
143693
143859
  });
143694
143860
  const data = await response2.json();
@@ -143699,6 +143865,14 @@ function createResolveLatestDeploymentId(config2) {
143699
143865
  return result.data.id;
143700
143866
  };
143701
143867
  }
143868
+ class ReplayEventObserverError extends Error {
143869
+ constructor(error2) {
143870
+ super("Replay event observer failed", { cause: error2 });
143871
+ __publicField(this, "error");
143872
+ this.error = error2;
143873
+ this.name = "ReplayEventObserverError";
143874
+ }
143875
+ }
143702
143876
  const EVENT_RETRY_ELIGIBILITY = {
143703
143877
  // Creates: conditional create → 409 EntityConflictError if it already exists.
143704
143878
  run_created: {
@@ -143826,6 +144000,8 @@ function collectErrorMarkers(err, depth = 0) {
143826
144000
  return markers;
143827
144001
  }
143828
144002
  function isRetryableEventPostError(err) {
144003
+ if (err instanceof ReplayEventObserverError)
144004
+ return false;
143829
144005
  if (EntityConflictError.is(err) || RunExpiredError.is(err) || TooEarlyError.is(err) || ThrottleError.is(err)) {
143830
144006
  return false;
143831
144007
  }
@@ -143913,6 +144089,8 @@ async function withEventPostRetry(fn2, eventType, options) {
143913
144089
  }
143914
144090
  }
143915
144091
  const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
144092
+ class IncompleteFrameError extends Error {
144093
+ }
143916
144094
  const CborObjectSchema = record(string$3(), unknown$1());
143917
144095
  function encodeFrame(meta2, body2) {
143918
144096
  const metaBytes = new Uint8Array(encode$1(meta2));
@@ -143933,7 +144111,14 @@ async function* decodeFrames(source) {
143933
144111
  const parts = [buffer2];
143934
144112
  let byteLength = buffer2.byteLength;
143935
144113
  while (byteLength < needed) {
143936
- const chunk = await chunks.next();
144114
+ let chunk;
144115
+ try {
144116
+ chunk = await chunks.next();
144117
+ } catch (cause) {
144118
+ throw new IncompleteFrameError("decodeFrames: source stream failed", {
144119
+ cause
144120
+ });
144121
+ }
143937
144122
  if (chunk.done)
143938
144123
  return false;
143939
144124
  if (chunk.value.byteLength === 0)
@@ -143961,16 +144146,16 @@ async function* decodeFrames(source) {
143961
144146
  const metaLen = new DataView(buffer2.buffer, buffer2.byteOffset, 4).getUint32(0, false);
143962
144147
  take(4);
143963
144148
  if (!await refill(metaLen)) {
143964
- throw new Error("decodeFrames: truncated meta block");
144149
+ throw new IncompleteFrameError("decodeFrames: truncated meta block");
143965
144150
  }
143966
144151
  const meta2 = CborObjectSchema.parse(decode$1(take(metaLen)));
143967
144152
  if (!await refill(4)) {
143968
- throw new Error("decodeFrames: truncated body length");
144153
+ throw new IncompleteFrameError("decodeFrames: truncated body length");
143969
144154
  }
143970
144155
  const bodyLen = new DataView(buffer2.buffer, buffer2.byteOffset, 4).getUint32(0, false);
143971
144156
  take(4);
143972
144157
  if (bodyLen > 0 && !await refill(bodyLen)) {
143973
- throw new Error("decodeFrames: truncated body bytes");
144158
+ throw new IncompleteFrameError("decodeFrames: truncated body bytes");
143974
144159
  }
143975
144160
  yield { meta: meta2, body: buffer2.slice(0, bodyLen) };
143976
144161
  take(bodyLen);
@@ -144235,6 +144420,12 @@ const EventStreamEndSchema = object$1({
144235
144420
  next: string$3().optional(),
144236
144421
  hasMore: boolean$3()
144237
144422
  });
144423
+ const EventStreamErrorSchema = object$1({
144424
+ _error: literal(1),
144425
+ code: string$3(),
144426
+ message: string$3().optional()
144427
+ });
144428
+ const PAYLOAD_MISSING_ERROR_CODE = "payload-missing";
144238
144429
  const legacyStructuredErrorEventTypes = /* @__PURE__ */ new Set([
144239
144430
  "run_failed",
144240
144431
  "step_failed",
@@ -144476,17 +144667,35 @@ async function createWorkflowRunEventV4(input, config2) {
144476
144667
  const response2 = await postWorkflowRunEventV4(input, "materialized", config2);
144477
144668
  const contentType = response2.headers.get("content-type");
144478
144669
  if (contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE)) {
144479
- throw new Error("v4 createEvent: unexpected event page");
144670
+ throw new WorkflowWorldError("v4 createEvent: unexpected event page", {
144671
+ code: "SCHEMA_VALIDATION"
144672
+ });
144480
144673
  }
144481
144674
  return decodeCreateEventResponse(response2, input.eventType);
144482
144675
  }
144483
144676
  async function decodeCreateEventResponse(response2, eventType) {
144484
- const bodyBytes = new Uint8Array(await response2.arrayBuffer());
144677
+ let bodyBytes;
144678
+ try {
144679
+ bodyBytes = new Uint8Array(await response2.arrayBuffer());
144680
+ } catch (cause) {
144681
+ throw new WorkflowWorldError("v4 createEvent: failed to read response body", { code: "TRANSPORT", cause });
144682
+ }
144485
144683
  if (bodyBytes.byteLength === 0) {
144486
- throw new Error("v4 createEvent: empty response body");
144684
+ throw new WorkflowWorldError("v4 createEvent: empty response body", {
144685
+ code: "PARSE_ERROR"
144686
+ });
144487
144687
  }
144488
144688
  const schema = CreateEventV4BodySchemas[eventType].refine(({ event }) => event.eventType === eventType || eventType === "hook_created" && event.eventType === "hook_conflict", { path: ["event", "eventType"] });
144489
- const parsedBody = schema.safeParse(decode$1(bodyBytes));
144689
+ let decoded;
144690
+ try {
144691
+ decoded = decode$1(bodyBytes);
144692
+ } catch (cause) {
144693
+ throw new WorkflowWorldError("v4 createEvent: invalid CBOR response body", {
144694
+ code: "PARSE_ERROR",
144695
+ cause
144696
+ });
144697
+ }
144698
+ const parsedBody = schema.safeParse(decoded);
144490
144699
  if (!parsedBody.success) {
144491
144700
  throw new WorkflowWorldError("v4 createEvent: invalid response body", {
144492
144701
  code: "SCHEMA_VALIDATION",
@@ -144495,11 +144704,12 @@ async function decodeCreateEventResponse(response2, eventType) {
144495
144704
  }
144496
144705
  return parsedBody.data;
144497
144706
  }
144498
- async function createWorkflowRunStartedEventV4(input, config2) {
144707
+ async function createWorkflowRunStartedEventV4(input, config2, replayEventObserver) {
144499
144708
  const response2 = await postWorkflowRunEventV4({ ...input, eventType: "run_started" }, "event-stream", config2);
144500
- const events2 = [];
144501
- const page = await consumeEventFrameStream(response2, "createEvent", events2);
144502
- assert$1(page.cursor, "v4 createEvent: event stream missing cursor");
144709
+ const page = await consumeReplayLogResponse(response2, input.runId, config2, replayEventObserver);
144710
+ if (!page.cursor) {
144711
+ throw new WorkflowWorldError("v4 createEvent: event stream missing cursor", { code: "SCHEMA_VALIDATION" });
144712
+ }
144503
144713
  const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
144504
144714
  if (!maxEvents.success) {
144505
144715
  throw new WorkflowWorldError("v4 createEvent: invalid max-events header", {
@@ -144507,7 +144717,7 @@ async function createWorkflowRunStartedEventV4(input, config2) {
144507
144717
  cause: maxEvents.error
144508
144718
  });
144509
144719
  }
144510
- return { events: events2, ...page, maxEvents: maxEvents.data };
144720
+ return { ...page, maxEvents: maxEvents.data };
144511
144721
  }
144512
144722
  const BatchItemFailureSchema = object$1({
144513
144723
  status: number$3().int(),
@@ -144577,7 +144787,7 @@ function wsReplyStatus(reply, endpoint) {
144577
144787
  return status;
144578
144788
  }
144579
144789
  async function postEventFrameOverWs(input, config2) {
144580
- const { resolveWsTransport } = await import("./ws-transport-ByYax88V.js");
144790
+ const { resolveWsTransport } = await import("./ws-transport-DbDOLT7f.js");
144581
144791
  const { runId } = input;
144582
144792
  const resolved = resolveWsTransport(runId, config2);
144583
144793
  if (!resolved)
@@ -144631,7 +144841,7 @@ async function postEventFrameOverWs(input, config2) {
144631
144841
  };
144632
144842
  });
144633
144843
  }
144634
- async function createHookReceivedPreloadEventV4(input, config2) {
144844
+ async function createHookReceivedPreloadEventV4(input, config2, replayEventObserver) {
144635
144845
  const response2 = await postWorkflowRunEventV4({ ...input, eventType: "hook_received" }, "event-stream", config2);
144636
144846
  const contentType = response2.headers.get("content-type");
144637
144847
  if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
@@ -144640,12 +144850,10 @@ async function createHookReceivedPreloadEventV4(input, config2) {
144640
144850
  result: await decodeCreateEventResponse(response2, "hook_received")
144641
144851
  };
144642
144852
  }
144643
- const events2 = [];
144644
- const page = await consumeEventFrameStream(response2, "createEvent", events2);
144853
+ const page = await consumeReplayLogResponse(response2, input.runId, config2, replayEventObserver);
144645
144854
  const maxEvents = MaxEventsHeaderSchema.safeParse(response2.headers.get(MAX_EVENTS_HEADER));
144646
144855
  return {
144647
144856
  kind: "stream",
144648
- events: events2,
144649
144857
  ...page,
144650
144858
  canonicalEventId: response2.headers.get(EVENT_ID_HEADER) ?? void 0,
144651
144859
  maxEvents: maxEvents.success ? maxEvents.data : void 0
@@ -144669,31 +144877,117 @@ async function getEventV4(runId, eventId, remoteRefBehavior, config2) {
144669
144877
  }
144670
144878
  const chunks = response2.body;
144671
144879
  for await (const frame2 of decodeFrames(chunks)) {
144880
+ if (frame2.meta._error === 1) {
144881
+ throw streamErrorFrameToError(frame2.meta, "getEvent");
144882
+ }
144883
+ if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
144884
+ throw new Error("v4 getEvent: unexpected control frame");
144885
+ }
144672
144886
  return decodeEventFrame(frame2);
144673
144887
  }
144674
144888
  throw new Error(`v4 getEvent: empty frame stream for ${eventId}`);
144675
144889
  }
144676
- async function consumeEventFrameStream(response2, opName, events2) {
144890
+ function streamErrorFrameToError(meta2, opName) {
144891
+ const parsed = EventStreamErrorSchema.safeParse(meta2);
144892
+ if (!parsed.success) {
144893
+ return new WorkflowWorldError(`v4 ${opName}: malformed terminal error frame`, { code: "SCHEMA_VALIDATION", cause: parsed.error });
144894
+ }
144895
+ const { code: code2, message: message2 } = parsed.data;
144896
+ const detail = message2 ?? "(no detail)";
144897
+ if (code2 === PAYLOAD_MISSING_ERROR_CODE) {
144898
+ return new CorruptedEventLogError(`the event log references a payload that no longer exists in storage: ${detail}`);
144899
+ }
144900
+ return new WorkflowWorldError(`v4 ${opName}: stream ended with terminal error "${code2}": ${detail}`, { code: "WORLD_CONTRACT_ERROR" });
144901
+ }
144902
+ const MAX_PARTIAL_STREAM_RETRIES = 2;
144903
+ function partialEventFrameStream(events2, error2) {
144904
+ var _a3;
144905
+ const eventId = (_a3 = events2.at(-1)) == null ? void 0 : _a3.eventId;
144906
+ if (!eventId)
144907
+ throw error2;
144908
+ return {
144909
+ kind: "partial",
144910
+ events: events2,
144911
+ cursor: `eid:${eventId}`,
144912
+ hasMore: true,
144913
+ error: error2
144914
+ };
144915
+ }
144916
+ async function consumeEventFrameStream(response2, opName, replayEventObserver) {
144677
144917
  const contentType = response2.headers.get("content-type");
144678
144918
  if (!(contentType == null ? void 0 : contentType.startsWith(V4_FRAME_CONTENT_TYPE))) {
144679
- throw new Error(`v4 ${opName}: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`);
144919
+ throw new WorkflowWorldError(`v4 ${opName}: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`, { code: "SCHEMA_VALIDATION" });
144680
144920
  }
144681
- const chunks = response2.body;
144682
- for await (const frame2 of decodeFrames(chunks)) {
144683
- if (frame2.meta._end === 1) {
144684
- const end = EventStreamEndSchema.parse(frame2.meta);
144685
- return { cursor: end.next ?? null, hasMore: end.hasMore };
144921
+ if (!response2.body) {
144922
+ throw new WorkflowWorldError(`v4 ${opName}: response body is missing`, {
144923
+ code: "TRANSPORT"
144924
+ });
144925
+ }
144926
+ const events2 = [];
144927
+ try {
144928
+ for await (const frame2 of decodeFrames(response2.body)) {
144929
+ if (frame2.meta._end === 1) {
144930
+ const end = EventStreamEndSchema.parse(frame2.meta);
144931
+ return {
144932
+ kind: "complete",
144933
+ events: events2,
144934
+ cursor: end.next ?? null,
144935
+ hasMore: end.hasMore
144936
+ };
144937
+ }
144938
+ if (frame2.meta._error === 1) {
144939
+ throw streamErrorFrameToError(frame2.meta, opName);
144940
+ }
144941
+ if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
144942
+ throw new Error(`v4 ${opName}: unexpected control frame`);
144943
+ }
144944
+ const event = decodeEventFrame(frame2);
144945
+ events2.push(event);
144946
+ try {
144947
+ replayEventObserver == null ? void 0 : replayEventObserver(event);
144948
+ } catch (error2) {
144949
+ throw new ReplayEventObserverError(error2);
144950
+ }
144686
144951
  }
144687
- if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
144688
- throw new Error(`v4 ${opName}: unexpected control frame`);
144952
+ } catch (cause) {
144953
+ if (cause instanceof ReplayEventObserverError || CorruptedEventLogError.is(cause) || WorkflowWorldError.is(cause)) {
144954
+ throw cause;
144689
144955
  }
144690
- events2.push(decodeEventFrame(frame2));
144956
+ if (!(cause instanceof IncompleteFrameError)) {
144957
+ throw new WorkflowWorldError(`v4 ${opName}: invalid event frame stream`, {
144958
+ code: "SCHEMA_VALIDATION",
144959
+ cause
144960
+ });
144961
+ }
144962
+ return partialEventFrameStream(events2, new WorkflowWorldError(`v4 ${opName}: incomplete event frame stream`, {
144963
+ code: "TRANSPORT",
144964
+ cause
144965
+ }));
144691
144966
  }
144692
- throw new Error(`v4 ${opName}: frame stream ended without the end-of-stream sentinel (${events2.length} events read) truncated response?`);
144967
+ return partialEventFrameStream(events2, new WorkflowWorldError(`v4 ${opName}: frame stream ended without the end-of-stream sentinel (${events2.length} events read)`, { code: "TRANSPORT" }));
144968
+ }
144969
+ async function consumeReplayLogResponse(response2, runId, config2, replayEventObserver) {
144970
+ const page = await consumeEventFrameStream(response2, "createEvent", replayEventObserver);
144971
+ if (!page.hasMore) {
144972
+ return {
144973
+ events: page.events,
144974
+ cursor: page.cursor,
144975
+ hasMore: false
144976
+ };
144977
+ }
144978
+ if (!page.cursor) {
144979
+ throw new WorkflowWorldError("v4 createEvent: partial event stream missing cursor", { code: "SCHEMA_VALIDATION" });
144980
+ }
144981
+ const suffix = await getWorkflowRunEventsV4(runId, { cursor: page.cursor, remoteRefBehavior: "resolve" }, config2, replayEventObserver);
144982
+ return {
144983
+ events: [...page.events, ...suffix.events],
144984
+ cursor: suffix.cursor ?? page.cursor,
144985
+ hasMore: suffix.hasMore
144986
+ };
144693
144987
  }
144694
- async function consumeListFrameStream(url2, headers2, config2, opName, events2) {
144988
+ async function consumeListFrameStream(url2, headers2, config2, opName, replayEventObserver) {
144695
144989
  const response2 = await fetchV4(url2, { method: "GET", headers: headers2 }, config2, opName);
144696
- return consumeEventFrameStream(response2, opName, events2);
144990
+ return consumeEventFrameStream(response2, opName, replayEventObserver);
144697
144991
  }
144698
144992
  function appendListParams(sp, params) {
144699
144993
  if (params.cursor)
@@ -144713,23 +145007,34 @@ function paginationToQuery(params) {
144713
145007
  appendListParams(sp, params);
144714
145008
  return `?${sp.toString()}`;
144715
145009
  }
144716
- async function getWorkflowRunEventsV4(runId, params = {}, config2) {
145010
+ async function getWorkflowRunEventsV4(runId, params = {}, config2, replayEventObserver) {
144717
145011
  const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
144718
145012
  const events2 = [];
144719
- let cursor = params.cursor;
144720
- while (true) {
144721
- const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({ ...params, cursor });
144722
- try {
144723
- const page = await consumeListFrameStream(url2, headers2, config2, "listEvents", events2);
144724
- return { events: events2, ...page };
144725
- } catch (error2) {
144726
- const lastEvent = events2.at(-1);
144727
- if (params.limit !== void 0 || !lastEvent || `eid:${lastEvent.eventId}` === cursor) {
144728
- throw error2;
144729
- }
144730
- cursor = `eid:${lastEvent.eventId}`;
144731
- }
144732
- }
145013
+ let cursor = params.cursor ?? null;
145014
+ let partialStreamRetries = 0;
145015
+ let consumed;
145016
+ do {
145017
+ const url2 = `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({ ...params, cursor: cursor ?? void 0 });
145018
+ consumed = await consumeListFrameStream(url2, headers2, config2, "listEvents", replayEventObserver);
145019
+ const cursorAdvanced = !!consumed.cursor && consumed.cursor !== cursor;
145020
+ if (consumed.kind === "partial") {
145021
+ if (params.limit !== void 0 || !cursorAdvanced || partialStreamRetries === MAX_PARTIAL_STREAM_RETRIES) {
145022
+ throw consumed.error;
145023
+ }
145024
+ partialStreamRetries++;
145025
+ cursor = consumed.cursor;
145026
+ } else if (!cursorAdvanced && (consumed.events.length > 0 || consumed.hasMore)) {
145027
+ throw new WorkflowWorldError("v4 listEvents: response did not advance cursor", { code: "SCHEMA_VALIDATION" });
145028
+ }
145029
+ for (const event of consumed.events) {
145030
+ events2.push(event);
145031
+ }
145032
+ } while (consumed.kind === "partial");
145033
+ return {
145034
+ events: events2,
145035
+ cursor: consumed.cursor || (partialStreamRetries > 0 ? cursor : null),
145036
+ hasMore: consumed.hasMore
145037
+ };
144733
145038
  }
144734
145039
  async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, config2) {
144735
145040
  const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
@@ -144738,9 +145043,14 @@ async function getEventsByCorrelationIdV4(correlationId, runId, params = {}, con
144738
145043
  sp.set("runId", runId);
144739
145044
  appendListParams(sp, params);
144740
145045
  const url2 = `${baseUrl}/v4/events?${sp.toString()}`;
144741
- const events2 = [];
144742
- const page = await consumeListFrameStream(url2, headers2, config2, "listEventsByCorrelationId", events2);
144743
- return { events: events2, ...page };
145046
+ const consumed = await consumeListFrameStream(url2, headers2, config2, "listEventsByCorrelationId");
145047
+ if (consumed.kind === "partial")
145048
+ throw consumed.error;
145049
+ return {
145050
+ events: consumed.events,
145051
+ cursor: consumed.cursor,
145052
+ hasMore: consumed.hasMore
145053
+ };
144744
145054
  }
144745
145055
  const WorkflowRunWireBaseSchema = WorkflowRunBaseSchema.omit({
144746
145056
  error: true,
@@ -145166,6 +145476,8 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
145166
145476
  }
145167
145477
  return result;
145168
145478
  } catch (err) {
145479
+ if (err instanceof ReplayEventObserverError)
145480
+ throw err.error;
145169
145481
  if (isHookEventRequiringExistence(data.eventType) && WorkflowWorldError.is(err) && err.status === 404 && data.correlationId) {
145170
145482
  throw new HookNotFoundError(data.correlationId);
145171
145483
  }
@@ -145237,39 +145549,14 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
145237
145549
  ...meta2
145238
145550
  };
145239
145551
  if (data.eventType === "run_started" && !(params == null ? void 0 : params.skipPreload)) {
145240
- const result = await createWorkflowRunStartedEventV4(input, config2);
145241
- const runCreated = result.events.find((event) => event.eventType === "run_created");
145242
- const runStarted = result.events.find((event) => event.eventType === "run_started");
145243
- if (!runCreated) {
145244
- throw new Error("v4 createEvent: run_started stream is missing run_created");
145245
- }
145246
- if (!runStarted) {
145247
- throw new Error("v4 createEvent: run_started stream is missing run_started");
145248
- }
145249
- let attributes = runCreated.eventData.attributes ?? {};
145250
- let updatedAt = runStarted.createdAt;
145251
- for (const event of result.events) {
145252
- if (event.eventType === "attr_set") {
145253
- attributes = applyAttributeChanges(attributes, event.eventData.changes);
145254
- updatedAt = event.createdAt;
145255
- }
145552
+ const result = await createWorkflowRunStartedEventV4(input, config2, params == null ? void 0 : params.replayEventObserver);
145553
+ const replayRun = reconstructRunFromReplayEvents(result.events);
145554
+ if (!replayRun) {
145555
+ throw new WorkflowWorldError("v4 createEvent: run_started stream is missing lifecycle events", { code: "SCHEMA_VALIDATION" });
145256
145556
  }
145257
145557
  return {
145258
- event: runStarted,
145259
- run: {
145260
- runId: runCreated.runId,
145261
- status: "running",
145262
- deploymentId: runCreated.eventData.deploymentId,
145263
- workflowName: runCreated.eventData.workflowName,
145264
- specVersion: runCreated.specVersion,
145265
- executionContext: runCreated.eventData.executionContext,
145266
- input: runCreated.eventData.input,
145267
- attributes,
145268
- encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
145269
- startedAt: runStarted.createdAt,
145270
- createdAt: runCreated.createdAt,
145271
- updatedAt
145272
- },
145558
+ event: replayRun.event,
145559
+ run: replayRun.run,
145273
145560
  events: result.events,
145274
145561
  cursor: result.cursor,
145275
145562
  hasMore: result.hasMore,
@@ -145277,16 +145564,16 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
145277
145564
  };
145278
145565
  }
145279
145566
  if (data.eventType === "hook_received" && (params == null ? void 0 : params.preloadEvents) === true && params.resumeId !== void 0 && params.resumePayloadDigest !== void 0) {
145280
- const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2);
145567
+ const outcome = await createHookReceivedPreloadEventV4({ ...input, remoteRefBehavior: "lazy" }, config2, params.replayEventObserver);
145281
145568
  if (outcome.kind === "materialized") {
145282
145569
  return outcome.result;
145283
145570
  }
145284
145571
  const { canonicalEventId, maxEvents, events: events2, cursor, hasMore } = outcome;
145285
145572
  const canonicalEvent = events2.find((event) => event.eventId === canonicalEventId);
145286
- const run2 = reconstructRunFromReplayEvents(events2);
145573
+ const replayRun = reconstructRunFromReplayEvents(events2);
145287
145574
  return {
145288
145575
  ...canonicalEvent ? { event: canonicalEvent } : {},
145289
- ...run2 ? { run: run2 } : {},
145576
+ ...replayRun ? { run: replayRun.run } : {},
145290
145577
  events: events2,
145291
145578
  cursor,
145292
145579
  hasMore,
@@ -145298,9 +145585,8 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
145298
145585
  function reconstructRunFromReplayEvents(events2) {
145299
145586
  const runCreated = events2.find((event) => event.eventType === "run_created");
145300
145587
  const runStarted = events2.find((event) => event.eventType === "run_started");
145301
- if (!runCreated || !runStarted) {
145302
- return void 0;
145303
- }
145588
+ if (!runCreated || !runStarted)
145589
+ return;
145304
145590
  let attributes = runCreated.eventData.attributes ?? {};
145305
145591
  let updatedAt = runStarted.createdAt;
145306
145592
  for (const event of events2) {
@@ -145310,18 +145596,21 @@ function reconstructRunFromReplayEvents(events2) {
145310
145596
  }
145311
145597
  }
145312
145598
  return {
145313
- runId: runCreated.runId,
145314
- status: "running",
145315
- deploymentId: runCreated.eventData.deploymentId,
145316
- workflowName: runCreated.eventData.workflowName,
145317
- specVersion: runCreated.specVersion,
145318
- executionContext: runCreated.eventData.executionContext,
145319
- input: runCreated.eventData.input,
145320
- attributes,
145321
- encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
145322
- startedAt: runStarted.createdAt,
145323
- createdAt: runCreated.createdAt,
145324
- updatedAt
145599
+ event: runStarted,
145600
+ run: {
145601
+ runId: runCreated.runId,
145602
+ status: "running",
145603
+ deploymentId: runCreated.eventData.deploymentId,
145604
+ workflowName: runCreated.eventData.workflowName,
145605
+ specVersion: runCreated.specVersion,
145606
+ executionContext: runCreated.eventData.executionContext,
145607
+ input: runCreated.eventData.input,
145608
+ attributes,
145609
+ encryptionPublicKey: runCreated.eventData.encryptionPublicKey,
145610
+ startedAt: runStarted.createdAt,
145611
+ createdAt: runCreated.createdAt,
145612
+ updatedAt
145613
+ }
145325
145614
  };
145326
145615
  }
145327
145616
  function filterHookData(hook, resolveData) {
@@ -145826,7 +146115,7 @@ globalSingleton("@workflow/core//devServerPort", 1, () => ({
145826
146115
  inFlight: void 0
145827
146116
  }));
145828
146117
  function waitUntil(promise2) {
145829
- void import("./index-QOlZC9D-.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
146118
+ void import("./index-jQkBA81b.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
145830
146119
  waitUntil2(promise2);
145831
146120
  });
145832
146121
  }
@@ -148510,12 +148799,13 @@ const CAPABILITY_VERSION_TABLE = [
148510
148799
  // consumers that cannot unframe them (silent corruption); too-high merely
148511
148800
  // delays the optimization (safe).
148512
148801
  { capability: "framedByteStreams", minVersion: "5.0.0-beta.15" }
148513
- // NOTE: lazy hook resume ("does the consumer re-ensure `hook_received` from
148514
- // the queue message's `hookInput`?") is intentionally NOT gated here. A
148515
- // version-compare against a predicted release cutoff is a guess; instead the
148516
- // run's creating deployment stamps an explicit `hookResumeInputVersion`
148517
- // marker into its execution context, which the server mirrors onto the hook's
148518
- // resumeContext. `resumeHook()` gates the lazy path on that marker.
148802
+ // NOTE: the hook-resume consumer protocol ("does the consumer re-ensure
148803
+ // `hook_received` from the queue message's `hookInput`?") is intentionally
148804
+ // NOT gated here. A version-compare against a predicted release cutoff is a
148805
+ // guess; instead the run's creating deployment stamps an explicit
148806
+ // `hookResumeInputVersion` marker into its execution context, which the
148807
+ // server mirrors onto the hook's resumeContext. Older producers gate their
148808
+ // lazy path on that marker.
148519
148809
  ];
148520
148810
  const BASELINE_FORMATS = /* @__PURE__ */ new Set([
148521
148811
  SerializationFormat$1.DEVALUE_V1
@@ -148545,7 +148835,6 @@ function getRunCapabilities(workflowCoreVersion) {
148545
148835
  return result;
148546
148836
  }
148547
148837
  const generateResumeId = monotonicFactory();
148548
- const MAX_INLINE_RESUME_PAYLOAD_BYTES = 128 * 1024;
148549
148838
  async function computeResumePayloadDigest(bytes) {
148550
148839
  const digest = await crypto.subtle.digest("SHA-256", bytes);
148551
148840
  const view = new Uint8Array(digest);
@@ -148555,6 +148844,39 @@ async function computeResumePayloadDigest(bytes) {
148555
148844
  }
148556
148845
  return hex2;
148557
148846
  }
148847
+ const HOOK_WAKE_RETRY_DELAYS_MS = [25, 100];
148848
+ function isRetryableWakeError(error2, isDeploymentUnavailableError) {
148849
+ if (isDeploymentUnavailableError == null ? void 0 : isDeploymentUnavailableError(error2))
148850
+ return false;
148851
+ const status = error2 ?? {};
148852
+ const code2 = status.status ?? status.statusCode;
148853
+ if (typeof code2 === "number") {
148854
+ return code2 >= 500 || code2 === 408 || code2 === 429;
148855
+ }
148856
+ const name2 = error2 == null ? void 0 : error2.name;
148857
+ return name2 !== "BadRequestError" && name2 !== "UnauthorizedError" && name2 !== "ForbiddenError";
148858
+ }
148859
+ async function publishHookWakeWithRetry(publish, isDeploymentUnavailableError) {
148860
+ let lastError;
148861
+ for (let attempt = 0; attempt <= HOOK_WAKE_RETRY_DELAYS_MS.length; attempt++) {
148862
+ try {
148863
+ await publish();
148864
+ return;
148865
+ } catch (error2) {
148866
+ lastError = error2;
148867
+ if (!isRetryableWakeError(error2, isDeploymentUnavailableError))
148868
+ break;
148869
+ const delayMs = HOOK_WAKE_RETRY_DELAYS_MS[attempt];
148870
+ if (delayMs !== void 0) {
148871
+ await new Promise((resolve2) => setTimeout(resolve2, delayMs));
148872
+ }
148873
+ }
148874
+ }
148875
+ if (HookNotFoundError.is(lastError)) {
148876
+ throw new WorkflowRuntimeError("The hook resume was committed, but its workflow wake could not be published", { cause: lastError });
148877
+ }
148878
+ throw lastError;
148879
+ }
148558
148880
  function resumeContextFromRun(run2) {
148559
148881
  var _a3, _b2, _c2;
148560
148882
  const coreVersion = (_a3 = run2.executionContext) == null ? void 0 : _a3.workflowCoreVersion;
@@ -148609,15 +148931,12 @@ async function getHookByToken(token) {
148609
148931
  return hook;
148610
148932
  }
148611
148933
  async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
148612
- return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now(), false);
148934
+ return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now());
148613
148935
  }
148614
- async function resumeHookDurable(tokenOrHook, payload, encryptionKeyOverride) {
148615
- return resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, false, Date.now(), true);
148616
- }
148617
- async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs, requireDurableWrite) {
148936
+ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs) {
148618
148937
  return await waitedUntil(() => {
148619
148938
  return trace$2("hook.resume", async (span) => {
148620
- var _a3, _b2, _c2;
148939
+ var _a3, _b2, _c2, _d2;
148621
148940
  const world = await getWorldLazy();
148622
148941
  try {
148623
148942
  const suppliedToken = typeof tokenOrHook === "string";
@@ -148653,12 +148972,17 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
148653
148972
  }
148654
148973
  const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION && capabilities.supportedFormats.has(SerializationFormat$1.GZIP);
148655
148974
  const ops = [];
148975
+ const readbackOps = [];
148656
148976
  const v1Compat = isLegacySpecVersion(hook.specVersion);
148657
- const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression);
148658
- safeWaitUntil(Promise.all(ops), (err) => {
148977
+ const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, payloadKey, ops, globalThis, v1Compat, capabilities.framedByteStreams, compression, void 0, readbackOps);
148978
+ await Promise.all(ops.map((op) => op.catch((error2) => {
148979
+ if (error2 !== void 0)
148980
+ throw error2;
148981
+ })));
148982
+ safeWaitUntil(Promise.all(readbackOps), (err) => {
148659
148983
  if (err === void 0)
148660
148984
  return;
148661
- runtimeLogger.warn("Background flush of hook payload ops failed", {
148985
+ runtimeLogger.warn("Background readback of hook payload failed", {
148662
148986
  workflowRunId: hook.runId,
148663
148987
  hookId: hook.hookId,
148664
148988
  error: err instanceof Error ? err.message : String(err)
@@ -148676,74 +149000,57 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
148676
149000
  deploymentId: resumeContext.deploymentId,
148677
149001
  specVersion: resumeContext.runSpecVersion ?? SPEC_VERSION_LEGACY
148678
149002
  };
148679
- const lazyResumeDisabled = process.env.WORKFLOW_DISABLE_LAZY_HOOK_RESUME === "1";
148680
149003
  const backendDedupSupported = (hookResumeCapabilitiesAreFresh ? ((_b2 = hook.resumeCapabilities) == null ? void 0 : _b2.hookResumeDedupVersion) ?? 0 : 0) >= HOOK_RESUME_DEDUP_VERSION || ((_c2 = world.capabilities) == null ? void 0 : _c2.hookResumeDedup) === true;
148681
- const fallbackReason = requireDurableWrite ? (
148682
- // An internal caller needs the event committed before this
148683
- // resolves (an ordering barrier), which only the eager write
148684
- // provides. Checked first so the span names the real reason
148685
- // rather than whichever gate happens to fail alongside it.
148686
- "durable_required"
148687
- ) : lazyResumeDisabled ? "disabled" : !backendDedupSupported ? "backend_unsupported" : (resumeContext.hookResumeInputVersion ?? 0) < HOOK_RESUME_INPUT_VERSION ? "consumer_unsupported" : v1Compat ? "legacy" : (resumeContext.runSpecVersion ?? 0) < SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT ? "non_cbor_transport" : !(dehydratedPayload instanceof Uint8Array) ? "non_bytes" : dehydratedPayload.byteLength > MAX_INLINE_RESUME_PAYLOAD_BYTES ? "oversized" : null;
148688
- const useLazyResume = fallbackReason === null;
149004
+ const canClaimResume = backendDedupSupported && !v1Compat && dehydratedPayload instanceof Uint8Array;
148689
149005
  span == null ? void 0 : span.setAttributes({
148690
- "workflow.hook.resume_strategy": useLazyResume ? "lazy" : "sequential",
148691
- ...fallbackReason ? { "workflow.hook.resume_fallback_reason": fallbackReason } : {}
149006
+ "workflow.hook.resume_strategy": "sequential"
148692
149007
  });
148693
- if (!useLazyResume) {
148694
- const isHookGoneError = (err) => HookNotFoundError.is(err) || EntityConflictError.is(err) || RunExpiredError.is(err);
148695
- try {
148696
- await world.events.create(hook.runId, {
148697
- eventType: "hook_received",
148698
- specVersion: SPEC_VERSION_CURRENT,
148699
- correlationId: hook.hookId,
148700
- eventData: {
148701
- ...v1Compat ? {} : { token: hook.token },
148702
- payload: dehydratedPayload
148703
- }
148704
- }, { v1Compat });
148705
- } catch (err) {
148706
- if (isHookGoneError(err)) {
148707
- throw new HookNotFoundError(hook.token);
149008
+ const resumeId = canClaimResume ? generateResumeId() : void 0;
149009
+ const payloadDigest = canClaimResume ? await computeResumePayloadDigest(dehydratedPayload) : void 0;
149010
+ if (resumeId) {
149011
+ span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
149012
+ }
149013
+ const isHookGoneError = (err) => HookNotFoundError.is(err) || RunExpiredError.is(err);
149014
+ try {
149015
+ await world.events.create(hook.runId, {
149016
+ eventType: "hook_received",
149017
+ specVersion: SPEC_VERSION_CURRENT,
149018
+ correlationId: hook.hookId,
149019
+ eventData: {
149020
+ ...v1Compat ? {} : { token: hook.token },
149021
+ payload: dehydratedPayload
148708
149022
  }
148709
- throw err;
149023
+ }, {
149024
+ v1Compat,
149025
+ ...resumeId && payloadDigest ? { resumeId, resumePayloadDigest: payloadDigest } : {}
149026
+ });
149027
+ } catch (err) {
149028
+ if (isHookGoneError(err)) {
149029
+ throw new HookNotFoundError(hook.token);
148710
149030
  }
148711
- const queuePublishRequestedAtMs2 = Date.now();
148712
- await world.queue(queueName, {
148713
- runId: hook.runId,
148714
- traceCarrier: resumeContext.traceCarrier ?? void 0,
148715
- hookResumeTiming: {
148716
- resumeRequestedAtMs,
148717
- queuePublishRequestedAtMs: queuePublishRequestedAtMs2,
148718
- strategy: "sequential"
148719
- }
148720
- }, queueOptions);
148721
- return hook;
149031
+ throw err;
148722
149032
  }
148723
- const resumeId = generateResumeId();
148724
- const payloadDigest = await computeResumePayloadDigest(dehydratedPayload);
148725
- span == null ? void 0 : span.setAttributes({ "workflow.hook.resume_id": resumeId });
149033
+ span == null ? void 0 : span.setAttributes(HookResumeCommitted(true));
148726
149034
  const queuePublishRequestedAtMs = Date.now();
148727
- await world.queue(queueName, {
149035
+ await publishHookWakeWithRetry(() => world.queue(queueName, {
148728
149036
  runId: hook.runId,
148729
149037
  traceCarrier: resumeContext.traceCarrier ?? void 0,
148730
- hookInput: {
148731
- resumeId,
148732
- hookId: hook.hookId,
148733
- token: hook.token,
148734
- payload: dehydratedPayload,
148735
- payloadDigest,
148736
- // Deployment affinity for the consumer's cheap pre-write
148737
- // check: lets a misrouted delivery re-route before its
148738
- // hoisted hook_received write instead of after.
148739
- deploymentId: resumeContext.deploymentId
148740
- },
148741
149038
  hookResumeTiming: {
148742
149039
  resumeRequestedAtMs,
148743
149040
  queuePublishRequestedAtMs,
148744
- strategy: "lazy"
149041
+ strategy: "sequential"
148745
149042
  }
148746
- }, queueOptions);
149043
+ }, {
149044
+ ...queueOptions,
149045
+ // Dedup retried publishes whose response was lost: a
149046
+ // duplicate wake is harmless for correctness (deterministic
149047
+ // replay) but costs a full replay of the run, and the queue
149048
+ // accepts a repeated idempotency key by delivering only one
149049
+ // of the messages. Claim-less writes have no resumeId and
149050
+ // keep the previous behavior.
149051
+ ...resumeId ? { idempotencyKey: `hook-${resumeId}` } : {}
149052
+ }), (_d2 = world.isDeploymentUnavailableError) == null ? void 0 : _d2.bind(world));
149053
+ span == null ? void 0 : span.setAttributes(HookWakePublished(true));
148747
149054
  return hook;
148748
149055
  } catch (err) {
148749
149056
  span == null ? void 0 : span.setAttributes({
@@ -148776,7 +149083,7 @@ async function resumeWebhook(token, request2) {
148776
149083
  } else {
148777
149084
  response2 = new Response(null, { status: 202 });
148778
149085
  }
148779
- await resumeHookImpl(hook, request2, encryptionKey, true, resumeRequestedAtMs, false);
149086
+ await resumeHookImpl(hook, request2, encryptionKey, true, resumeRequestedAtMs);
148780
149087
  if (responseReadable) {
148781
149088
  const reader = responseReadable.getReader();
148782
149089
  const chunk = await reader.read();
@@ -148796,7 +149103,6 @@ const resumeHook$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
148796
149103
  __proto__: null,
148797
149104
  getHookByToken,
148798
149105
  resumeHook: resumeHook$2,
148799
- resumeHookDurable,
148800
149106
  resumeWebhook
148801
149107
  }, Symbol.toStringTag, { value: "Module" }));
148802
149108
  function normalizeAttributeChanges(attrs, options = {}) {
@@ -148952,9 +149258,9 @@ async function start$1(workflow, argsOrOptions, options) {
148952
149258
  features: { encryption: !!encryptionKey },
148953
149259
  // Attest that the *consumer* deployment's runtime re-ensures a
148954
149260
  // `hook_received` event from a queue message's `hookInput` on replay.
148955
- // A resume of this run reads the marker (mirrored onto the hook's
148956
- // resumeContext by the server) to decide whether the parallel fast
148957
- // path is safe. For a cross-deployment start the consumer is the
149261
+ // An OLDER producer resuming this run reads the marker (mirrored onto
149262
+ // the hook's resumeContext by the server) to decide whether its lazy
149263
+ // fast path is safe. For a cross-deployment start the consumer is the
148958
149264
  // target deployment, so we stamp the *target's* value carried back on
148959
149265
  // the health-check probe, never the caller's. Omitted when we could
148960
149266
  // not attest the target (older target, timeout, or no probe channel),
@@ -172722,7 +173028,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
172722
173028
  __proto__: null,
172723
173029
  loader
172724
173030
  }, Symbol.toStringTag, { value: "Module" }));
172725
- const serverManifest = { "entry": { "module": "/assets/entry.client-LwI3HNYl.js", "imports": ["/assets/index-PFjW8YjQ.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-Zvnb602n.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-BKGEyEYb.js", "/assets/loader-circle-oscnpy3L.js", "/assets/arrow-up-right-UOc2WcaC.js"], "css": ["/assets/root-Bl5xphvU.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-DYB1uz9w.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-Du0ztkb8.js", "/assets/mermaid-3ZIDBTTL-BKGEyEYb.js", "/assets/loader-circle-oscnpy3L.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-CedyZW9h.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-Du0ztkb8.js", "/assets/mermaid-3ZIDBTTL-BKGEyEYb.js", "/assets/arrow-up-right-UOc2WcaC.js"], "css": ["/assets/run-detail-CWoGxu_0.css", "/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-a701502a.js", "version": "a701502a", "sri": void 0 };
173031
+ const serverManifest = { "entry": { "module": "/assets/entry.client-LwI3HNYl.js", "imports": ["/assets/index-PFjW8YjQ.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-DBp4o4Ap.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-BrUzeGHN.js", "/assets/loader-circle-BQzzSKVU.js", "/assets/arrow-up-right-C52N96YH.js"], "css": ["/assets/root-Bl5xphvU.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-CXFjRmpa.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-BI72rVK-.js", "/assets/mermaid-3ZIDBTTL-BrUzeGHN.js", "/assets/loader-circle-BQzzSKVU.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-7tPGLWpY.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-BI72rVK-.js", "/assets/mermaid-3ZIDBTTL-BrUzeGHN.js", "/assets/arrow-up-right-C52N96YH.js"], "css": ["/assets/run-detail-CWoGxu_0.css", "/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-9ff1658d.js", "version": "9ff1658d", "sri": void 0 };
172726
173032
  const assetsBuildDirectory = "build/client";
172727
173033
  const basename = "/";
172728
173034
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
@@ -172931,7 +173237,7 @@ function createFetchHandler(basename2 = "/") {
172931
173237
  return (request2) => handler(request2, loadContext);
172932
173238
  }
172933
173239
  export {
172934
- SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as $,
173240
+ SPEC_VERSION_SUPPORTS_ATTRIBUTES as $,
172935
173241
  ANALYTICS_EVENTS_GET_MANY_LIMIT as A,
172936
173242
  BULK_CANCEL_MAX_RUN_IDS as B,
172937
173243
  CHILD_ENTITY_CREATION_EVENT_TYPES as C,
@@ -172953,99 +173259,103 @@ export {
172953
173259
  QueuePrefix as S,
172954
173260
  RESERVED_ATTRIBUTE_KEY_PREFIX as T,
172955
173261
  ROOT_RUN_ID_ATTRIBUTE as U,
172956
- RunInputSchema as V,
172957
- SEALED_LOG_ENV_VAR as W,
172958
- SPEC_VERSION_CURRENT as X,
172959
- SPEC_VERSION_LEGACY as Y,
172960
- SPEC_VERSION_MAX_SUPPORTED as Z,
172961
- SPEC_VERSION_SUPPORTS_ATTRIBUTES as _,
173262
+ RUN_ENTITY_KEY as V,
173263
+ RunInputSchema as W,
173264
+ SEALED_LOG_ENV_VAR as X,
173265
+ SPEC_VERSION_CURRENT as Y,
173266
+ SPEC_VERSION_LEGACY as Z,
173267
+ SPEC_VERSION_MAX_SUPPORTED as _,
172962
173268
  ATTRIBUTE_KEY_MAX_LENGTH as a,
172963
- registerZstdDecoder as a$,
172964
- SPEC_VERSION_SUPPORTS_COMPRESSION as a0,
172965
- SPEC_VERSION_SUPPORTS_SEALED_LOG as a1,
172966
- SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as a2,
172967
- STEP_EVENT_TYPES as a3,
172968
- SerializedDataSchema as a4,
172969
- StepSchema as a5,
172970
- StepStatusSchema as a6,
172971
- StructuredErrorSchema as a7,
172972
- TERMINAL_RUN_EVENT_TYPES as a8,
172973
- TERMINAL_STEP_EVENT_TYPES as a9,
172974
- isLegacySpecVersion as aA,
172975
- isNodeHttpEnabled as aB,
172976
- isSealedNoopEvent$1 as aC,
172977
- isSlotBody as aD,
172978
- isSlotEventId as aE,
172979
- isStepEventType as aF,
172980
- isTerminalRunEventType as aG,
172981
- isTerminalStepEventType as aH,
172982
- isTerminalStepStatus as aI,
172983
- isTerminalWorkflowRunStatus as aJ,
172984
- isWaitEventType as aK,
172985
- mintedSpecVersion as aL,
172986
- parseQueueName as aM,
172987
- reenqueueActiveRuns as aN,
172988
- requiresNewerWorld as aO,
172989
- resolveQueueNamespace as aP,
172990
- slotToEventId as aQ,
172991
- stripEventDataRefs as aR,
172992
- ulidToDate as aS,
172993
- validateAttributeChanges as aT,
172994
- validateUlidTimestamp as aU,
172995
- workflowRunIdSchema as aV,
172996
- reactExports as aW,
172997
- R as aX,
172998
- Ks as aY,
172999
- jsxRuntimeExports as aZ,
173000
- Qe as a_,
173001
- TERMINAL_STEP_STATUSES as aa,
173002
- TERMINAL_WORKFLOW_RUN_STATUSES as ab,
173003
- TerminalRunEventTypeSchema as ac,
173004
- TerminalStepStatusSchema as ad,
173005
- TerminalWorkflowRunStatusSchema as ae,
173006
- ValidQueueName as af,
173007
- WAIT_EVENT_TYPES as ag,
173008
- WaitSchema as ah,
173009
- WaitStatusSchema as ai,
173010
- WorkflowInvokePayloadSchema as aj,
173011
- WorkflowRunBaseSchema as ak,
173012
- WorkflowRunSchema as al,
173013
- WorkflowRunStatusSchema as am,
173014
- applyAttributeChanges as an,
173015
- entityEventClass as ao,
173016
- envFlag as ap,
173017
- envNumber as aq,
173018
- eventIdToSlot as ar,
173019
- getEventDataPayloadField as as,
173020
- getEventDataRefFields as at,
173021
- getMaxEventsPerRun as au,
173022
- getQueueTopicPrefix as av,
173023
- isChildEntityCreationEvent as aw,
173024
- isChildEntityCreationEventType as ax,
173025
- isHookEventRequiringExistence as ay,
173026
- isHookLifecycleEventType as az,
173269
+ Ks as a$,
173270
+ SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as a0,
173271
+ SPEC_VERSION_SUPPORTS_COMPRESSION as a1,
173272
+ SPEC_VERSION_SUPPORTS_SEALED_LOG as a2,
173273
+ SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as a3,
173274
+ STEP_EVENT_TYPES as a4,
173275
+ SerializedDataSchema as a5,
173276
+ StepSchema as a6,
173277
+ StepStatusSchema as a7,
173278
+ StructuredErrorSchema as a8,
173279
+ TERMINAL_EVENT_CLASSES as a9,
173280
+ isChildEntityCreationEventType as aA,
173281
+ isHookEventRequiringExistence as aB,
173282
+ isHookLifecycleEventType as aC,
173283
+ isLegacySpecVersion as aD,
173284
+ isNodeHttpEnabled as aE,
173285
+ isSealedNoopEvent$1 as aF,
173286
+ isSlotBody as aG,
173287
+ isSlotEventId as aH,
173288
+ isStepEventType as aI,
173289
+ isTerminalRunEventType as aJ,
173290
+ isTerminalStepEventType as aK,
173291
+ isTerminalStepStatus as aL,
173292
+ isTerminalWorkflowRunStatus as aM,
173293
+ isWaitEventType as aN,
173294
+ mintedSpecVersion as aO,
173295
+ parseQueueName as aP,
173296
+ reenqueueActiveRuns as aQ,
173297
+ requiresNewerWorld as aR,
173298
+ resolveQueueNamespace as aS,
173299
+ slotToEventId as aT,
173300
+ stripEventDataRefs as aU,
173301
+ ulidToDate as aV,
173302
+ validateAttributeChanges as aW,
173303
+ validateUlidTimestamp as aX,
173304
+ workflowRunIdSchema as aY,
173305
+ reactExports as aZ,
173306
+ R as a_,
173307
+ TERMINAL_RUN_EVENT_TYPES as aa,
173308
+ TERMINAL_STEP_EVENT_TYPES as ab,
173309
+ TERMINAL_STEP_STATUSES as ac,
173310
+ TERMINAL_WORKFLOW_RUN_STATUSES as ad,
173311
+ TerminalRunEventTypeSchema as ae,
173312
+ TerminalStepStatusSchema as af,
173313
+ TerminalWorkflowRunStatusSchema as ag,
173314
+ ValidQueueName as ah,
173315
+ WAIT_EVENT_TYPES as ai,
173316
+ WaitSchema as aj,
173317
+ WaitStatusSchema as ak,
173318
+ WorkflowInvokePayloadSchema as al,
173319
+ WorkflowRunBaseSchema as am,
173320
+ WorkflowRunSchema as an,
173321
+ WorkflowRunStatusSchema as ao,
173322
+ applyAttributeChanges as ap,
173323
+ classifyEntityEvent as aq,
173324
+ entityEventClass as ar,
173325
+ envFlag as as,
173326
+ envNumber as at,
173327
+ eventIdToSlot as au,
173328
+ getEventDataPayloadField as av,
173329
+ getEventDataRefFields as aw,
173330
+ getMaxEventsPerRun as ax,
173331
+ getQueueTopicPrefix as ay,
173332
+ isChildEntityCreationEvent as az,
173027
173333
  ATTRIBUTE_MAX_PER_RUN as b,
173028
- isWsEventsTransportEnabled as b0,
173029
- getHttpUrl as b1,
173030
- globalSingleton as b2,
173031
- version as b3,
173032
- getHttpConfig as b4,
173033
- headersToRecord as b5,
173034
- getRequestTimeoutMs as b6,
173035
- injectTraceContextIntoHeaders as b7,
173036
- withHttpClientSpan as b8,
173037
- ErrorType as b9,
173038
- WorkflowWsReconnectAttempt as ba,
173039
- NetworkProtocolName as bb,
173040
- WorkflowEventsTransport as bc,
173041
- distExports as bd,
173042
- decodeFrames as be,
173043
- getDefaultExportFromCjs as bf,
173044
- requireTokenUtil as bg,
173045
- requireTokenError as bh,
173046
- getAugmentedNamespace as bi,
173047
- app as bj,
173048
- createFetchHandler as bk,
173334
+ jsxRuntimeExports as b0,
173335
+ Qe as b1,
173336
+ registerZstdDecoder as b2,
173337
+ isWsEventsTransportEnabled as b3,
173338
+ debugLog as b4,
173339
+ getHttpUrl as b5,
173340
+ globalSingleton as b6,
173341
+ version as b7,
173342
+ getHttpConfig as b8,
173343
+ headersToRecord as b9,
173344
+ getRequestTimeoutMs as ba,
173345
+ injectTraceContextIntoHeaders as bb,
173346
+ withHttpClientSpan as bc,
173347
+ ErrorType as bd,
173348
+ WorkflowWsReconnectAttempt as be,
173349
+ NetworkProtocolName as bf,
173350
+ WorkflowEventsTransport as bg,
173351
+ distExports as bh,
173352
+ decodeFrames as bi,
173353
+ getDefaultExportFromCjs as bj,
173354
+ requireTokenUtil as bk,
173355
+ requireTokenError as bl,
173356
+ getAugmentedNamespace as bm,
173357
+ app as bn,
173358
+ createFetchHandler as bo,
173049
173359
  ATTRIBUTE_VALUE_MAX_BYTES as c,
173050
173360
  AnalyticsAttributeKeySchema as d,
173051
173361
  AnalyticsEventSchema as e,