@workflow/web 4.1.5 → 4.1.6

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.
@@ -14,7 +14,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
16
16
  var _a2, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _reader;
17
- import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-fdUHF124.js";
17
+ import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-DZ5lj7U4.js";
18
18
  import require$$0$4, { PassThrough } from "node:stream";
19
19
  import require$$0 from "util";
20
20
  import require$$1 from "crypto";
@@ -48510,6 +48510,7 @@ const StepCompletedEventSchema = BaseEventSchema.extend({
48510
48510
  eventType: literal("step_completed"),
48511
48511
  correlationId: string$3(),
48512
48512
  eventData: object$1({
48513
+ stepName: string$3().optional(),
48513
48514
  result: SerializedDataSchema
48514
48515
  })
48515
48516
  });
@@ -48517,6 +48518,7 @@ const StepFailedEventSchema = BaseEventSchema.extend({
48517
48518
  eventType: literal("step_failed"),
48518
48519
  correlationId: string$3(),
48519
48520
  eventData: object$1({
48521
+ stepName: string$3().optional(),
48520
48522
  error: any(),
48521
48523
  stack: string$3().optional()
48522
48524
  })
@@ -48525,6 +48527,7 @@ const StepRetryingEventSchema = BaseEventSchema.extend({
48525
48527
  eventType: literal("step_retrying"),
48526
48528
  correlationId: string$3(),
48527
48529
  eventData: object$1({
48530
+ stepName: string$3().optional(),
48528
48531
  error: any(),
48529
48532
  stack: string$3().optional(),
48530
48533
  retryAfter: date$2().optional()
@@ -48534,6 +48537,7 @@ const StepStartedEventSchema = BaseEventSchema.extend({
48534
48537
  eventType: literal("step_started"),
48535
48538
  correlationId: string$3(),
48536
48539
  eventData: object$1({
48540
+ stepName: string$3().optional(),
48537
48541
  attempt: number$3().optional()
48538
48542
  }).optional()
48539
48543
  });
@@ -48557,12 +48561,16 @@ const HookReceivedEventSchema = BaseEventSchema.extend({
48557
48561
  eventType: literal("hook_received"),
48558
48562
  correlationId: string$3(),
48559
48563
  eventData: object$1({
48564
+ token: string$3().optional(),
48560
48565
  payload: SerializedDataSchema
48561
48566
  })
48562
48567
  });
48563
48568
  const HookDisposedEventSchema = BaseEventSchema.extend({
48564
48569
  eventType: literal("hook_disposed"),
48565
- correlationId: string$3()
48570
+ correlationId: string$3(),
48571
+ eventData: object$1({
48572
+ token: string$3().optional()
48573
+ }).optional()
48566
48574
  });
48567
48575
  const HookConflictEventSchema = BaseEventSchema.extend({
48568
48576
  eventType: literal("hook_conflict"),
@@ -48580,7 +48588,10 @@ const WaitCreatedEventSchema = BaseEventSchema.extend({
48580
48588
  });
48581
48589
  const WaitCompletedEventSchema = BaseEventSchema.extend({
48582
48590
  eventType: literal("wait_completed"),
48583
- correlationId: string$3()
48591
+ correlationId: string$3(),
48592
+ eventData: object$1({
48593
+ resumeAt: date$2().optional()
48594
+ }).optional()
48584
48595
  });
48585
48596
  const RunCreatedEventSchema = BaseEventSchema.extend({
48586
48597
  eventType: literal("run_created"),
@@ -48766,7 +48777,7 @@ const StructuredErrorSchema = object$1({
48766
48777
  message: string$3(),
48767
48778
  stack: string$3().optional(),
48768
48779
  code: string$3().optional()
48769
- // Populated with RunErrorCode values (USER_ERROR, RUNTIME_ERROR) for run_failed events
48780
+ // Populated with RunErrorCode values (USER_ERROR, RUNTIME_ERROR, etc.) for run_failed events
48770
48781
  });
48771
48782
  const WorkflowRunStatusSchema = _enum([
48772
48783
  "pending",
@@ -48816,28 +48827,28 @@ const WorkflowRunSchema = discriminatedUnion("status", [
48816
48827
  // Non-final states
48817
48828
  WorkflowRunBaseSchema.extend({
48818
48829
  status: _enum(["pending", "running"]),
48819
- output: _undefined(),
48820
- error: _undefined(),
48821
- completedAt: _undefined()
48830
+ output: _undefined().optional(),
48831
+ error: _undefined().optional(),
48832
+ completedAt: _undefined().optional()
48822
48833
  }),
48823
48834
  // Cancelled state
48824
48835
  WorkflowRunBaseSchema.extend({
48825
48836
  status: literal("cancelled"),
48826
- output: _undefined(),
48827
- error: _undefined(),
48837
+ output: _undefined().optional(),
48838
+ error: _undefined().optional(),
48828
48839
  completedAt: date$2()
48829
48840
  }),
48830
48841
  // Completed state - output can be v1 or v2 format
48831
48842
  WorkflowRunBaseSchema.extend({
48832
48843
  status: literal("completed"),
48833
48844
  output: SerializedDataSchema,
48834
- error: _undefined(),
48845
+ error: _undefined().optional(),
48835
48846
  completedAt: date$2()
48836
48847
  }),
48837
48848
  // Failed state
48838
48849
  WorkflowRunBaseSchema.extend({
48839
48850
  status: literal("failed"),
48840
- output: _undefined(),
48851
+ output: _undefined().optional(),
48841
48852
  error: StructuredErrorSchema,
48842
48853
  completedAt: date$2()
48843
48854
  })
@@ -51819,27 +51830,34 @@ function buildNameMaps(events2, run) {
51819
51830
  return { correlationNameMap, workflowName };
51820
51831
  }
51821
51832
  function buildDurationMap(events2) {
51833
+ const chronological = [...events2].sort((a2, b2) => new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime());
51822
51834
  const createdTimes = /* @__PURE__ */ new Map();
51835
+ const firstStartedTimes = /* @__PURE__ */ new Map();
51823
51836
  const startedTimes = /* @__PURE__ */ new Map();
51824
51837
  const durations = /* @__PURE__ */ new Map();
51825
- for (const event of events2) {
51838
+ for (const event of chronological) {
51826
51839
  const ts = new Date(event.createdAt).getTime();
51827
51840
  const key = event.correlationId ?? "__run__";
51828
51841
  const type = event.eventType;
51829
51842
  if (type === "step_created" || type === "run_created") {
51830
- createdTimes.set(key, ts);
51831
- }
51832
- if (type === "step_started" || type === "run_started" || type === "workflow_started") {
51833
- startedTimes.set(key, ts);
51834
51843
  if (!createdTimes.has(key)) {
51835
51844
  createdTimes.set(key, ts);
51836
51845
  }
51837
- const createdAt = createdTimes.get(key);
51838
- const info = durations.get(key) ?? {};
51839
- if (createdAt !== void 0) {
51840
- info.queued = ts - createdAt;
51846
+ }
51847
+ if (type === "step_started" || type === "run_started" || type === "workflow_started") {
51848
+ startedTimes.set(key, ts);
51849
+ if (!firstStartedTimes.has(key)) {
51850
+ firstStartedTimes.set(key, ts);
51851
+ if (!createdTimes.has(key)) {
51852
+ createdTimes.set(key, ts);
51853
+ }
51854
+ const createdAt = createdTimes.get(key);
51855
+ const info = durations.get(key) ?? {};
51856
+ if (createdAt !== void 0) {
51857
+ info.queued = ts - createdAt;
51858
+ }
51859
+ durations.set(key, info);
51841
51860
  }
51842
- durations.set(key, info);
51843
51861
  }
51844
51862
  if (type === "step_completed" || type === "step_failed" || type === "run_completed" || type === "run_failed" || type === "run_cancelled" || type === "workflow_completed" || type === "workflow_failed" || type === "wait_completed" || type === "hook_disposed") {
51845
51863
  const startedAt = startedTimes.get(key);
@@ -79284,7 +79302,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
79284
79302
  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 });
79285
79303
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
79286
79304
  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 }) });
79287
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-2WxWqSYU.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
79305
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-ByO-v0q1.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
79288
79306
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
79289
79307
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
79290
79308
  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 }) })] }) });
@@ -79606,7 +79624,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
79606
79624
  }, []), 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] });
79607
79625
  };
79608
79626
  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 }) })] });
79609
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-FF5ZIJp-.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
79627
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CJpvg6rz.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
79610
79628
  function ke(e, t) {
79611
79629
  if (!(e != null && e.position || t != null && t.position)) return true;
79612
79630
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -84110,18 +84128,18 @@ const waitEventsToWaitEntity = (events2) => {
84110
84128
  };
84111
84129
  };
84112
84130
  function waitToSpan(events2, maxEndTime) {
84113
- const wait = waitEventsToWaitEntity(events2);
84114
- if (!wait) {
84131
+ const wait2 = waitEventsToWaitEntity(events2);
84132
+ if (!wait2) {
84115
84133
  return null;
84116
84134
  }
84117
- const startTime = wait.createdAt;
84118
- const endTime = wait.completedAt ?? maxEndTime;
84135
+ const startTime = wait2.createdAt;
84136
+ const endTime = wait2.completedAt ?? maxEndTime;
84119
84137
  const start2 = dateToOtelTime(startTime);
84120
84138
  const end = dateToOtelTime(endTime);
84121
84139
  const duration2 = calculateDuration(startTime, endTime);
84122
84140
  const spanEvents = convertEventsToSpanEvents(events2, false);
84123
84141
  return {
84124
- spanId: wait.waitId,
84142
+ spanId: wait2.waitId,
84125
84143
  name: "sleep",
84126
84144
  kind: 1,
84127
84145
  // INTERNAL span kind
@@ -84131,7 +84149,7 @@ function waitToSpan(events2, maxEndTime) {
84131
84149
  traceFlags: 1,
84132
84150
  attributes: {
84133
84151
  resource: "sleep",
84134
- data: wait
84152
+ data: wait2
84135
84153
  // wait is a plain object built from events, no non-cloneable types
84136
84154
  },
84137
84155
  links: [],
@@ -84257,7 +84275,7 @@ function hookToSpan(hookEvents, maxEndTime) {
84257
84275
  const endTime = hook.disposedAt || maxEndTime;
84258
84276
  return {
84259
84277
  spanId: String(hook.hookId),
84260
- name: String(hook.hookId),
84278
+ name: hook.token ?? String(hook.hookId),
84261
84279
  kind: 1,
84262
84280
  // INTERNAL span kind
84263
84281
  resource: "hook",
@@ -84923,7 +84941,7 @@ const WorkflowTraceViewer = ({ run, events: events2, isLoading, error: error2, s
84923
84941
  if (!trace2) {
84924
84942
  return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full", children: [jsxRuntimeExports.jsx("div", { className: "border-b border-gray-alpha-400 w-full" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-full ml-2 mt-1 mb-1 h-[56px]" }), jsxRuntimeExports.jsxs("div", { className: "p-2 relative w-full", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "w-full mt-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[10%] mt-2 ml-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[10%] mt-2 ml-12 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[20%] mt-2 ml-16 h-[20px]" })] })] });
84925
84943
  }
84926
- return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace: trace2, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace: trace2, knownDurationMs: traceWithMeta == null ? void 0 : traceWithMeta.knownDurationMs, hasMoreData: hasMoreSpans || Boolean(isLoading), footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive, isInitialLoading: Boolean(isLoading) }) }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
84944
+ return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex flex-row", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace: trace2, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace: trace2, knownDurationMs: traceWithMeta == null ? void 0 : traceWithMeta.knownDurationMs, hasMoreData: hasMoreSpans || Boolean(isLoading), footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive, isInitialLoading: Boolean(isLoading) }) }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
84927
84945
  width: panelWidth,
84928
84946
  borderColor: "var(--ds-gray-200)",
84929
84947
  backgroundColor: "var(--ds-background-100)"
@@ -89396,7 +89414,7 @@ createLogger("webhook");
89396
89414
  createLogger("events");
89397
89415
  createLogger("adapter");
89398
89416
  const MAX_QUEUE_DELIVERIES = 48;
89399
- const version$1 = "4.2.4";
89417
+ const version$1 = "4.2.5";
89400
89418
  const execFileAsync = promisify(execFile);
89401
89419
  function parsePort$1(value, radix = 10) {
89402
89420
  const port = parseInt(value, radix);
@@ -89407,6 +89425,27 @@ function parsePort$1(value, radix = 10) {
89407
89425
  }
89408
89426
  const join = (arr, sep2) => arr.join(sep2);
89409
89427
  const PROC_ROOT = join(["", "proc"], "/");
89428
+ function getReportedPorts() {
89429
+ var _a3, _b, _c;
89430
+ const report = (_b = (_a3 = process.report) == null ? void 0 : _a3.getReport) == null ? void 0 : _b.call(_a3);
89431
+ const handles = report == null ? void 0 : report.libuv;
89432
+ if (!handles) {
89433
+ return [];
89434
+ }
89435
+ const ports = [];
89436
+ const seen = /* @__PURE__ */ new Set();
89437
+ for (const handle2 of handles) {
89438
+ if (handle2.type !== "tcp" || handle2.is_active !== true || handle2.remoteEndpoint !== null) {
89439
+ continue;
89440
+ }
89441
+ const port = parsePort$1(String((_c = handle2.localEndpoint) == null ? void 0 : _c.port));
89442
+ if (port !== void 0 && !seen.has(port)) {
89443
+ ports.push(port);
89444
+ seen.add(port);
89445
+ }
89446
+ }
89447
+ return ports;
89448
+ }
89410
89449
  async function getLinuxPorts(pid) {
89411
89450
  const listenState = "0A";
89412
89451
  const tcpFiles = [`${PROC_ROOT}/net/tcp`, `${PROC_ROOT}/net/tcp6`];
@@ -89538,6 +89577,10 @@ async function getWindowsPorts(pid) {
89538
89577
  async function getAllPorts() {
89539
89578
  const { pid, platform: platform2 } = process;
89540
89579
  try {
89580
+ const reportedPorts = getReportedPorts();
89581
+ if (reportedPorts.length > 0) {
89582
+ return reportedPorts;
89583
+ }
89541
89584
  switch (platform2) {
89542
89585
  case "linux":
89543
89586
  return await getLinuxPorts(pid);
@@ -89640,6 +89683,33 @@ async function resolveBaseUrl$1(config2) {
89640
89683
  throw new Error("Unable to resolve base URL for workflow queue.");
89641
89684
  }
89642
89685
  const ulid$1 = monotonicFactory(() => Math.random());
89686
+ function truncateForError(value) {
89687
+ const s2 = typeof value === "string" ? value : String(value);
89688
+ const MAX = 48;
89689
+ return s2.length > MAX ? `${s2.slice(0, MAX)}…` : s2;
89690
+ }
89691
+ class UnsafeEntityIdError extends WorkflowWorldError {
89692
+ constructor(kind, value) {
89693
+ super(`Unsafe ${kind} "${truncateForError(value)}": must not be empty, contain ".", "/", "\\", or null bytes`);
89694
+ this.name = "UnsafeEntityIdError";
89695
+ }
89696
+ static is(value) {
89697
+ return value instanceof Error && value.name === "UnsafeEntityIdError";
89698
+ }
89699
+ }
89700
+ function assertSafeEntityId(kind, value) {
89701
+ if (value.length === 0 || value.startsWith(".") || value.includes("/") || value.includes("\\") || value.includes("\0") || value.includes(".")) {
89702
+ throw new UnsafeEntityIdError(kind, value);
89703
+ }
89704
+ }
89705
+ function resolveWithinBase(basedir, ...segments) {
89706
+ const resolvedBase = path$3.resolve(basedir);
89707
+ const joined = path$3.resolve(basedir, ...segments);
89708
+ if (joined !== resolvedBase && !joined.startsWith(resolvedBase + path$3.sep)) {
89709
+ throw new UnsafeEntityIdError("path", segments.join("/"));
89710
+ }
89711
+ return joined;
89712
+ }
89643
89713
  const isWindows = process.platform === "win32";
89644
89714
  async function withWindowsRetry(fn2, maxRetries = 5) {
89645
89715
  if (!isWindows)
@@ -89667,17 +89737,26 @@ const TAG_PATTERN = /\.[a-zA-Z][a-zA-Z0-9-]*$/;
89667
89737
  function stripTag(fileId) {
89668
89738
  return fileId.replace(TAG_PATTERN, "");
89669
89739
  }
89740
+ function hasTag(fileId, tag) {
89741
+ return fileId.endsWith(`.${tag}`);
89742
+ }
89670
89743
  function taggedPath(basedir, entityDir, fileId, tag) {
89744
+ assertSafeEntityId("fileId", fileId);
89745
+ if (tag !== void 0)
89746
+ assertSafeEntityId("tag", tag);
89671
89747
  const filename = tag ? `${fileId}.${tag}.json` : `${fileId}.json`;
89672
- return path$3.join(basedir, entityDir, filename);
89748
+ return resolveWithinBase(basedir, entityDir, filename);
89673
89749
  }
89674
89750
  async function readJSONWithFallback(basedir, entityDir, fileId, schema, tag) {
89751
+ assertSafeEntityId("fileId", fileId);
89752
+ if (tag !== void 0)
89753
+ assertSafeEntityId("tag", tag);
89675
89754
  if (tag) {
89676
- const result = await readJSON(path$3.join(basedir, entityDir, `${fileId}.${tag}.json`), schema);
89755
+ const result = await readJSON(resolveWithinBase(basedir, entityDir, `${fileId}.${tag}.json`), schema);
89677
89756
  if (result !== null)
89678
89757
  return result;
89679
89758
  }
89680
- return readJSON(path$3.join(basedir, entityDir, `${fileId}.json`), schema);
89759
+ return readJSON(resolveWithinBase(basedir, entityDir, `${fileId}.json`), schema);
89681
89760
  }
89682
89761
  async function listTaggedFiles(dirPath, tag) {
89683
89762
  const suffix = `.${tag}.json`;
@@ -89816,13 +89895,17 @@ function createCursor(timestamp, id2) {
89816
89895
  return id2 ? `${timestamp.toISOString()}|${id2}` : timestamp.toISOString();
89817
89896
  }
89818
89897
  async function paginatedFileSystemQuery(config2) {
89819
- const { directory, schema, filePrefix, filter: filter2, sortOrder = "desc", limit = 20, cursor, getCreatedAt, getId } = config2;
89898
+ const { directory, schema, filePrefix, fileIdFilter, filter: filter2, sortOrder = "desc", limit = 20, cursor, getCreatedAt, getId } = config2;
89899
+ if (filePrefix !== void 0) {
89900
+ assertSafeEntityId("filePrefix", filePrefix);
89901
+ }
89820
89902
  const fileIds = await listJSONFiles(directory);
89821
89903
  const relevantFileIds = filePrefix ? fileIds.filter((fileId) => fileId.startsWith(filePrefix)) : fileIds;
89904
+ const filteredFileIds = fileIdFilter ? relevantFileIds.filter(fileIdFilter) : relevantFileIds;
89822
89905
  const parsedCursor = parseCursor(cursor);
89823
- let candidateFileIds = relevantFileIds;
89906
+ let candidateFileIds = filteredFileIds;
89824
89907
  if (parsedCursor) {
89825
- candidateFileIds = relevantFileIds.filter((fileId) => {
89908
+ candidateFileIds = filteredFileIds.filter((fileId) => {
89826
89909
  const filenameDate = getCreatedAt(`${fileId}.json`);
89827
89910
  if (filenameDate) {
89828
89911
  const cursorTime = parsedCursor.timestamp.getTime();
@@ -114376,6 +114459,20 @@ const LOCAL_QUEUE_MAX_VISIBILITY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_MAX
114376
114459
  const MAX_SAFE_TIMEOUT_MS = 2147483647;
114377
114460
  const DEFAULT_CONCURRENCY_LIMIT = 1e3;
114378
114461
  const WORKFLOW_LOCAL_QUEUE_CONCURRENCY = parseInt(process.env.WORKFLOW_LOCAL_QUEUE_CONCURRENCY ?? "0", 10) || DEFAULT_CONCURRENCY_LIMIT;
114462
+ const DETACHED_ARRAYBUFFER_ERROR = "Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer";
114463
+ const PROXY_HANDLER_DOCS_URL = "https://workflow-sdk.dev/docs/getting-started/next#configure-proxy-handler";
114464
+ function isDetachedArrayBufferQueueError(error2) {
114465
+ let current = error2;
114466
+ const visited = /* @__PURE__ */ new Set();
114467
+ while (current && typeof current === "object" && !visited.has(current)) {
114468
+ visited.add(current);
114469
+ if ("message" in current && typeof current.message === "string" && current.message.includes(DETACHED_ARRAYBUFFER_ERROR)) {
114470
+ return true;
114471
+ }
114472
+ current = "cause" in current ? current.cause : void 0;
114473
+ }
114474
+ return false;
114475
+ }
114379
114476
  function getQueueRoute(queueName) {
114380
114477
  if (queueName.startsWith("__wkf_step_")) {
114381
114478
  return { pathname: "step", prefix: "__wkf_step_" };
@@ -114488,7 +114585,17 @@ function createQueue$2(config2) {
114488
114585
  })().catch((err) => {
114489
114586
  const isAbortError = (err == null ? void 0 : err.name) === "AbortError" || (err == null ? void 0 : err.name) === "ResponseAborted";
114490
114587
  if (!isAbortError) {
114491
- console.error("[local world] Queue operation failed:", err);
114588
+ if (isDetachedArrayBufferQueueError(err)) {
114589
+ console.error(`[local world] Queue operation failed: detected "${DETACHED_ARRAYBUFFER_ERROR}". This usually means a Next.js proxy/middleware consumed Workflow's internal request before the executor could read it. Exclude \`/.well-known/workflow/*\` from your matcher. See ${PROXY_HANDLER_DOCS_URL}`, {
114590
+ queueName,
114591
+ messageId,
114592
+ ...runId && { runId },
114593
+ ...stepId && { stepId },
114594
+ originalError: err
114595
+ });
114596
+ } else {
114597
+ console.error("[local world] Queue operation failed:", err);
114598
+ }
114492
114599
  }
114493
114600
  }).finally(() => {
114494
114601
  for (const fn2 of cleanup) {
@@ -114608,6 +114715,7 @@ function createHooksStorage(basedir, tag) {
114608
114715
  return null;
114609
114716
  }
114610
114717
  async function get2(hookId, params) {
114718
+ assertSafeEntityId("hookId", hookId);
114611
114719
  const hook = await readJSONWithFallback(basedir, "hooks", hookId, HookSchema, tag);
114612
114720
  if (!hook) {
114613
114721
  throw new HookNotFoundError(hookId);
@@ -114666,6 +114774,7 @@ async function deleteAllHooksForRun(basedir, runId) {
114666
114774
  }
114667
114775
  }
114668
114776
  async function handleLegacyEvent(basedir, runId, data, currentRun, params) {
114777
+ assertSafeEntityId("runId", runId);
114669
114778
  const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
114670
114779
  switch (data.eventType) {
114671
114780
  case "run_cancelled": {
@@ -114686,7 +114795,7 @@ async function handleLegacyEvent(basedir, runId, data, currentRun, params) {
114686
114795
  completedAt: now2,
114687
114796
  updatedAt: now2
114688
114797
  };
114689
- const runPath = path$3.join(basedir, "runs", `${runId}.json`);
114798
+ const runPath = resolveWithinBase(basedir, "runs", `${runId}.json`);
114690
114799
  await writeJSON(runPath, run, { overwrite: true });
114691
114800
  await deleteAllHooksForRun(basedir, runId);
114692
114801
  return {
@@ -114706,7 +114815,7 @@ async function handleLegacyEvent(basedir, runId, data, currentRun, params) {
114706
114815
  specVersion: SPEC_VERSION_CURRENT
114707
114816
  };
114708
114817
  const compositeKey = `${runId}-${eventId}`;
114709
- const eventPath = path$3.join(basedir, "events", `${compositeKey}.json`);
114818
+ const eventPath = resolveWithinBase(basedir, "events", `${compositeKey}.json`);
114710
114819
  await writeJSON(eventPath, event);
114711
114820
  return { event: stripEventDataRefs(event, resolveData) };
114712
114821
  }
@@ -114730,6 +114839,12 @@ function createEventsStorage(basedir, tag) {
114730
114839
  var _a3, _b, _c, _d;
114731
114840
  const eventId = `evnt_${monotonicUlid$1()}`;
114732
114841
  const now2 = /* @__PURE__ */ new Date();
114842
+ if (runId != null && runId !== "") {
114843
+ assertSafeEntityId("runId", runId);
114844
+ }
114845
+ if ("correlationId" in data && typeof data.correlationId === "string") {
114846
+ assertSafeEntityId("correlationId", data.correlationId);
114847
+ }
114733
114848
  let effectiveRunId;
114734
114849
  if (data.eventType === "run_created" && (!runId || runId === "")) {
114735
114850
  effectiveRunId = `wrun_${monotonicUlid$1()}`;
@@ -114877,7 +114992,7 @@ function createEventsStorage(basedir, tag) {
114877
114992
  let run;
114878
114993
  let step;
114879
114994
  let hook;
114880
- let wait;
114995
+ let wait2;
114881
114996
  if (data.eventType === "run_created" && "eventData" in data) {
114882
114997
  const runData = data.eventData;
114883
114998
  run = {
@@ -115055,7 +115170,7 @@ function createEventsStorage(basedir, tag) {
115055
115170
  if (validatedStep) {
115056
115171
  const stepCompositeKey = `${effectiveRunId}-${data.correlationId}`;
115057
115172
  const lockName = tag ? `${stepCompositeKey}.terminal.${tag}` : `${stepCompositeKey}.terminal`;
115058
- const terminalLockPath = path$3.join(basedir, ".locks", "steps", lockName);
115173
+ const terminalLockPath = resolveWithinBase(basedir, ".locks", "steps", lockName);
115059
115174
  const claimed = await writeExclusive(terminalLockPath, "");
115060
115175
  if (!claimed) {
115061
115176
  throw new EntityConflictError("Cannot modify step in terminal state");
@@ -115074,7 +115189,7 @@ function createEventsStorage(basedir, tag) {
115074
115189
  if (validatedStep) {
115075
115190
  const stepCompositeKey = `${effectiveRunId}-${data.correlationId}`;
115076
115191
  const lockName = tag ? `${stepCompositeKey}.terminal.${tag}` : `${stepCompositeKey}.terminal`;
115077
- const terminalLockPath = path$3.join(basedir, ".locks", "steps", lockName);
115192
+ const terminalLockPath = resolveWithinBase(basedir, ".locks", "steps", lockName);
115078
115193
  const claimed = await writeExclusive(terminalLockPath, "");
115079
115194
  if (!claimed) {
115080
115195
  throw new EntityConflictError("Cannot modify step in terminal state");
@@ -115158,7 +115273,7 @@ function createEventsStorage(basedir, tag) {
115158
115273
  await writeJSON(taggedPath(basedir, "hooks", data.correlationId, tag), hook);
115159
115274
  } else if (data.eventType === "hook_disposed") {
115160
115275
  const hookLockName = tag ? `${data.correlationId}.disposed.${tag}` : `${data.correlationId}.disposed`;
115161
- const lockPath = path$3.join(basedir, ".locks", "hooks", hookLockName);
115276
+ const lockPath = resolveWithinBase(basedir, ".locks", "hooks", hookLockName);
115162
115277
  const claimed = await writeExclusive(lockPath, "");
115163
115278
  if (!claimed) {
115164
115279
  throw new EntityConflictError(`Hook "${data.correlationId}" already disposed`);
@@ -115177,7 +115292,7 @@ function createEventsStorage(basedir, tag) {
115177
115292
  if (existingWait) {
115178
115293
  throw new EntityConflictError(`Wait "${data.correlationId}" already exists`);
115179
115294
  }
115180
- wait = {
115295
+ wait2 = {
115181
115296
  waitId: waitCompositeKey,
115182
115297
  runId: effectiveRunId,
115183
115298
  status: "waiting",
@@ -115187,11 +115302,11 @@ function createEventsStorage(basedir, tag) {
115187
115302
  updatedAt: now2,
115188
115303
  specVersion: effectiveSpecVersion
115189
115304
  };
115190
- await writeJSON(taggedPath(basedir, "waits", waitCompositeKey, tag), wait);
115305
+ await writeJSON(taggedPath(basedir, "waits", waitCompositeKey, tag), wait2);
115191
115306
  } else if (data.eventType === "wait_completed") {
115192
115307
  const waitCompositeKey = `${effectiveRunId}-${data.correlationId}`;
115193
115308
  const waitLockName = tag ? `${waitCompositeKey}.completed.${tag}` : `${waitCompositeKey}.completed`;
115194
- const lockPath = path$3.join(basedir, ".locks", "waits", waitLockName);
115309
+ const lockPath = resolveWithinBase(basedir, ".locks", "waits", waitLockName);
115195
115310
  const claimed = await writeExclusive(lockPath, "");
115196
115311
  if (!claimed) {
115197
115312
  throw new EntityConflictError(`Wait "${data.correlationId}" already completed`);
@@ -115202,40 +115317,49 @@ function createEventsStorage(basedir, tag) {
115202
115317
  });
115203
115318
  throw new WorkflowWorldError(`Wait "${data.correlationId}" not found`);
115204
115319
  }
115205
- wait = {
115320
+ wait2 = {
115206
115321
  ...existingWait,
115207
115322
  status: "completed",
115208
115323
  completedAt: now2,
115209
115324
  updatedAt: now2
115210
115325
  };
115211
- await writeJSON(taggedPath(basedir, "waits", waitCompositeKey, tag), wait, { overwrite: true });
115326
+ await writeJSON(taggedPath(basedir, "waits", waitCompositeKey, tag), wait2, { overwrite: true });
115212
115327
  }
115213
115328
  const compositeKey = `${effectiveRunId}-${eventId}`;
115214
115329
  await writeJSON(taggedPath(basedir, "events", compositeKey, tag), event);
115215
115330
  const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
115216
115331
  const filteredEvent = stripEventDataRefs(event, resolveData);
115217
115332
  let events2;
115333
+ let cursor;
115334
+ let hasMore;
115218
115335
  if (data.eventType === "run_started" && run) {
115219
115336
  const allEvents = await paginatedFileSystemQuery({
115220
115337
  directory: path$3.join(basedir, "events"),
115221
115338
  schema: EventSchema,
115222
115339
  filePrefix: `${effectiveRunId}-`,
115223
115340
  sortOrder: "asc",
115341
+ limit: 1e3,
115224
115342
  getCreatedAt: getObjectCreatedAt("evnt"),
115225
115343
  getId: (e) => e.eventId
115226
115344
  });
115227
115345
  events2 = allEvents.data;
115346
+ cursor = allEvents.cursor;
115347
+ hasMore = allEvents.hasMore;
115228
115348
  }
115229
115349
  return {
115230
115350
  event: filteredEvent,
115231
115351
  run,
115232
115352
  step,
115233
115353
  hook,
115234
- wait,
115235
- events: events2
115354
+ wait: wait2,
115355
+ events: events2,
115356
+ cursor,
115357
+ hasMore
115236
115358
  };
115237
115359
  },
115238
115360
  async get(runId, eventId, params) {
115361
+ assertSafeEntityId("runId", runId);
115362
+ assertSafeEntityId("eventId", eventId);
115239
115363
  const compositeKey = `${runId}-${eventId}`;
115240
115364
  const event = await readJSONWithFallback(basedir, "events", compositeKey, EventSchema, tag);
115241
115365
  if (!event) {
@@ -115247,6 +115371,7 @@ function createEventsStorage(basedir, tag) {
115247
115371
  async list(params) {
115248
115372
  var _a3, _b, _c;
115249
115373
  const { runId } = params;
115374
+ assertSafeEntityId("runId", runId);
115250
115375
  const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION$1;
115251
115376
  const result = await paginatedFileSystemQuery({
115252
115377
  directory: path$3.join(basedir, "events"),
@@ -115271,6 +115396,7 @@ function createEventsStorage(basedir, tag) {
115271
115396
  async listByCorrelationId(params) {
115272
115397
  var _a3, _b, _c;
115273
115398
  const correlationId = params.correlationId;
115399
+ assertSafeEntityId("correlationId", correlationId);
115274
115400
  const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION$1;
115275
115401
  const result = await paginatedFileSystemQuery({
115276
115402
  directory: path$3.join(basedir, "events"),
@@ -115298,6 +115424,7 @@ function createEventsStorage(basedir, tag) {
115298
115424
  function createRunsStorage(basedir, tag) {
115299
115425
  return {
115300
115426
  get: (async (id2, params) => {
115427
+ assertSafeEntityId("runId", id2);
115301
115428
  const run = await readJSONWithFallback(basedir, "runs", id2, WorkflowRunSchema, tag);
115302
115429
  if (!run) {
115303
115430
  throw new WorkflowRunNotFoundError(id2);
@@ -115311,6 +115438,7 @@ function createRunsStorage(basedir, tag) {
115311
115438
  const result = await paginatedFileSystemQuery({
115312
115439
  directory: path$3.join(basedir, "runs"),
115313
115440
  schema: WorkflowRunSchema,
115441
+ fileIdFilter: params == null ? void 0 : params.fileIdFilter,
115314
115442
  filter: (run) => {
115315
115443
  if ((params == null ? void 0 : params.workflowName) && run.workflowName !== params.workflowName) {
115316
115444
  return false;
@@ -115343,6 +115471,7 @@ function createRunsStorage(basedir, tag) {
115343
115471
  function createStepsStorage(basedir, tag) {
115344
115472
  return {
115345
115473
  get: (async (runId, stepId, params) => {
115474
+ assertSafeEntityId("stepId", stepId);
115346
115475
  if (!runId) {
115347
115476
  const fileIds = await listJSONFiles(path$3.join(basedir, "steps"));
115348
115477
  const fileId = fileIds.find((fid) => stripTag(fid).endsWith(`-${stepId}`));
@@ -115350,6 +115479,8 @@ function createStepsStorage(basedir, tag) {
115350
115479
  throw new Error(`Step ${stepId} not found`);
115351
115480
  }
115352
115481
  runId = stripTag(fileId).split("-")[0];
115482
+ } else {
115483
+ assertSafeEntityId("runId", runId);
115353
115484
  }
115354
115485
  const compositeKey = `${runId}-${stepId}`;
115355
115486
  const step = await readJSONWithFallback(basedir, "steps", compositeKey, StepSchema, tag);
@@ -115361,6 +115492,7 @@ function createStepsStorage(basedir, tag) {
115361
115492
  }),
115362
115493
  list: (async (params) => {
115363
115494
  var _a3, _b, _c;
115495
+ assertSafeEntityId("runId", params.runId);
115364
115496
  const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION$1;
115365
115497
  const result = await paginatedFileSystemQuery({
115366
115498
  directory: path$3.join(basedir, "steps"),
@@ -115387,17 +115519,15 @@ function createStepsStorage(basedir, tag) {
115387
115519
  };
115388
115520
  }
115389
115521
  function createStorage$1(basedir, tag) {
115390
- const storage = {
115391
- runs: createRunsStorage(basedir, tag),
115392
- steps: createStepsStorage(basedir, tag),
115393
- events: createEventsStorage(basedir, tag),
115394
- hooks: createHooksStorage(basedir, tag)
115395
- };
115522
+ const runs = createRunsStorage(basedir, tag);
115523
+ const steps = createStepsStorage(basedir, tag);
115524
+ const events2 = createEventsStorage(basedir, tag);
115525
+ const hooks = createHooksStorage(basedir, tag);
115396
115526
  return {
115397
- runs: instrumentObject$1("world.runs", storage.runs),
115398
- steps: instrumentObject$1("world.steps", storage.steps),
115399
- events: instrumentObject$1("world.events", storage.events),
115400
- hooks: instrumentObject$1("world.hooks", storage.hooks)
115527
+ runs: instrumentObject$1("world.runs", runs),
115528
+ steps: instrumentObject$1("world.steps", steps),
115529
+ events: instrumentObject$1("world.events", events2),
115530
+ hooks: instrumentObject$1("world.hooks", hooks)
115401
115531
  };
115402
115532
  }
115403
115533
  const monotonicUlid = monotonicFactory(() => Math.random());
@@ -115417,6 +115547,7 @@ function deserializeChunk(serialized) {
115417
115547
  return { eof, chunk };
115418
115548
  }
115419
115549
  async function listChunkFilesForStream(chunksDir, name2, tag) {
115550
+ assertSafeEntityId("streamName", name2);
115420
115551
  const listPromises = [
115421
115552
  listFilesByExtension(chunksDir, ".bin"),
115422
115553
  listFilesByExtension(chunksDir, ".json")
@@ -115445,6 +115576,8 @@ function createStreamer$1(basedir, tag) {
115445
115576
  const streamEmitter = new EventEmitter();
115446
115577
  const registeredStreams = /* @__PURE__ */ new Set();
115447
115578
  async function registerStreamForRun(runId, streamName) {
115579
+ assertSafeEntityId("runId", runId);
115580
+ assertSafeEntityId("streamName", streamName);
115448
115581
  const cacheKey = `${runId}:${streamName}`;
115449
115582
  if (registeredStreams.has(cacheKey)) {
115450
115583
  return;
@@ -115524,6 +115657,7 @@ function createStreamer$1(basedir, tag) {
115524
115657
  streamEmitter.emit(`close:${name2}`, { streamName: name2 });
115525
115658
  },
115526
115659
  async listStreamsByRunId(runId) {
115660
+ assertSafeEntityId("runId", runId);
115527
115661
  const data = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
115528
115662
  return (data == null ? void 0 : data.streams) ?? [];
115529
115663
  },
@@ -115765,10 +115899,11 @@ function createLocalWorld(args) {
115765
115899
  const tag = mergedConfig.tag;
115766
115900
  const queue = createQueue$2(mergedConfig);
115767
115901
  const storage = createStorage$1(mergedConfig.dataDir, tag);
115902
+ const recoverActiveRuns = mergedConfig.recoverActiveRuns ?? true;
115768
115903
  return {
115769
115904
  specVersion: SPEC_VERSION_CURRENT,
115770
115905
  ...queue,
115771
- ...createStorage$1(mergedConfig.dataDir, tag),
115906
+ ...storage,
115772
115907
  ...instrumentObject$1("world.streams", {
115773
115908
  ...createStreamer$1(mergedConfig.dataDir, tag),
115774
115909
  ...mergedConfig.streamFlushIntervalMs !== void 0 && {
@@ -115777,7 +115912,17 @@ function createLocalWorld(args) {
115777
115912
  }),
115778
115913
  async start() {
115779
115914
  await initDataDir(mergedConfig.dataDir);
115780
- await reenqueueActiveRuns(storage.runs, queue.queue, "world-local");
115915
+ if (!recoverActiveRuns) {
115916
+ return;
115917
+ }
115918
+ const recoveryRuns = tag ? {
115919
+ ...storage.runs,
115920
+ list: ((params) => storage.runs.list({
115921
+ ...params,
115922
+ fileIdFilter: (fileId) => hasTag(fileId, tag)
115923
+ }))
115924
+ } : storage.runs;
115925
+ await reenqueueActiveRuns(recoveryRuns, queue.queue, "world-local");
115781
115926
  },
115782
115927
  async close() {
115783
115928
  await queue.close();
@@ -115787,7 +115932,7 @@ function createLocalWorld(args) {
115787
115932
  const basedir = mergedConfig.dataDir;
115788
115933
  const hooksDir = path$3.join(basedir, "hooks");
115789
115934
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
115790
- const { HookSchema: HookSchema2 } = await import("./index-C64kz8oy.js");
115935
+ const { HookSchema: HookSchema2 } = await import("./index-6XpyP-Zw.js");
115791
115936
  await Promise.all(taggedHookFiles.map(async (hookFile) => {
115792
115937
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
115793
115938
  if (hook == null ? void 0 : hook.token) {
@@ -115939,8 +116084,8 @@ function requireGetVercelOidcToken() {
115939
116084
  }
115940
116085
  try {
115941
116086
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
115942
- await import("./token-util-BAhz4ocz.js").then((n) => n.t),
115943
- await import("./token-D_Q6dhhy.js").then((n) => n.t)
116087
+ await import("./token-util-Cv4v93wd.js").then((n) => n.t),
116088
+ await import("./token-DLJYtB0F.js").then((n) => n.t)
115944
116089
  ]);
115945
116090
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
115946
116091
  await refreshToken(options);
@@ -116562,7 +116707,7 @@ async function fetchRunKey(deploymentId, projectId, runId, options) {
116562
116707
  const response2 = await fetch(`https://api.vercel.com/v1/workflow/run-key/${deploymentId}?${params}`, {
116563
116708
  method: "GET",
116564
116709
  headers: {
116565
- authorization: `Bearer ${token}`
116710
+ Authorization: `Bearer ${token}`
116566
116711
  },
116567
116712
  // @ts-expect-error -- undici dispatcher is accepted by Node.js fetch but not in @types/node's RequestInit
116568
116713
  dispatcher: getDispatcher()
@@ -116982,16 +117127,22 @@ var StreamingMultipartParser = class {
116982
117127
  let index2 = 0;
116983
117128
  let chunkLength = chunk.length;
116984
117129
  if (this.buffer !== null) {
116985
- const newSize = this.buffer.length + chunkLength;
116986
- const maxAllowedSize = this.state === 2 ? this.maxHeaderSize : this.maxBoundaryBuffer;
116987
- if (newSize > maxAllowedSize) {
117130
+ const bufferLength = this.buffer.length;
117131
+ const newSize = bufferLength + chunkLength;
117132
+ if (this.state === 2) {
117133
+ if (newSize > this.maxHeaderSize) {
117134
+ throw new MultipartParseError(
117135
+ `Buffer size limit exceeded: ${newSize} bytes > ${this.maxHeaderSize} bytes. This may indicate malformed multipart data with oversized headers.`
117136
+ );
117137
+ }
117138
+ } else if (bufferLength > this.maxBoundaryBuffer) {
116988
117139
  throw new MultipartParseError(
116989
- `Buffer size limit exceeded: ${newSize} bytes > ${maxAllowedSize} bytes. This may indicate malformed multipart data with ${this.state === 2 ? "oversized headers" : "invalid boundaries"}.`
117140
+ `Boundary buffer limit exceeded: ${bufferLength} bytes > ${this.maxBoundaryBuffer} bytes. This may indicate malformed multipart data with invalid boundaries.`
116990
117141
  );
116991
117142
  }
116992
117143
  const newChunk = new Uint8Array(newSize);
116993
117144
  newChunk.set(this.buffer, 0);
116994
- newChunk.set(chunk, this.buffer.length);
117145
+ newChunk.set(chunk, bufferLength);
116995
117146
  chunk = newChunk;
116996
117147
  chunkLength = chunk.length;
116997
117148
  this.buffer = null;
@@ -120563,7 +120714,7 @@ Cause: ${cause}`
120563
120714
  }
120564
120715
  console.debug("[VQS Debug] Request:", JSON.stringify(logData, null, 2));
120565
120716
  }
120566
- init2.headers.set("User-Agent", `@vercel/queue/${"0.1.4"}`);
120717
+ init2.headers.set("User-Agent", `@vercel/queue/${"0.1.7"}`);
120567
120718
  init2.headers.set("Vqs-Client-Ts", (/* @__PURE__ */ new Date()).toISOString());
120568
120719
  const fetchInit = this.dispatcher ? { ...init2, dispatcher: this.dispatcher } : init2;
120569
120720
  const response2 = await fetch(url2, fetchInit);
@@ -121105,13 +121256,14 @@ var QueueClient = class {
121105
121256
  setApi(this, new ApiClient({ ...options, region }));
121106
121257
  }
121107
121258
  };
121108
- const version = "4.1.2";
121259
+ const version = "4.2.0";
121109
121260
  const HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
121110
121261
  function httpLog(method, endpoint, status, ms2) {
121111
121262
  if (HTTP_DEBUG_ENABLED) {
121112
121263
  console.debug(`[workflow:world-vercel:http] ${method} ${endpoint} -> ${status} (${ms2}ms)`);
121113
121264
  }
121114
121265
  }
121266
+ const getWorkflowServerUrlOverride = () => process.env.VERCEL_WORKFLOW_SERVER_URL || "";
121115
121267
  const DEFAULT_RESOLVE_DATA_OPTION = "all";
121116
121268
  function deserializeError(obj) {
121117
121269
  const { error: error2, errorCode, ...rest } = obj;
@@ -121163,7 +121315,7 @@ const getUserAgent = () => {
121163
121315
  };
121164
121316
  const getHttpUrl = (config2) => {
121165
121317
  const projectConfig = config2 == null ? void 0 : config2.projectConfig;
121166
- const defaultHost = "https://vercel-workflow.com";
121318
+ const defaultHost = getWorkflowServerUrlOverride() || "https://vercel-workflow.com";
121167
121319
  const customProxyUrl = process.env.WORKFLOW_VERCEL_BACKEND_URL;
121168
121320
  const defaultProxyUrl = "https://api.vercel.com/v1/workflow";
121169
121321
  const usingProxy = Boolean((projectConfig == null ? void 0 : projectConfig.projectId) && (projectConfig == null ? void 0 : projectConfig.teamId));
@@ -121183,14 +121335,33 @@ const getHeaders = (config2, options) => {
121183
121335
  headers2.set("x-vercel-team-id", projectConfig.teamId);
121184
121336
  }
121185
121337
  }
121338
+ const workflowServerUrlOverride = getWorkflowServerUrlOverride();
121339
+ if (workflowServerUrlOverride && options.usingProxy) {
121340
+ headers2.set("x-vercel-workflow-api-url", workflowServerUrlOverride);
121341
+ }
121186
121342
  return headers2;
121187
121343
  };
121188
121344
  async function getHttpConfig(config2) {
121189
121345
  const { baseUrl, usingProxy } = getHttpUrl(config2);
121190
- const headers2 = getHeaders(config2);
121191
- const token = (config2 == null ? void 0 : config2.token) ?? await distExports.getVercelOidcToken();
121192
- if (token) {
121193
- headers2.set("Authorization", `Bearer ${token}`);
121346
+ const headers2 = getHeaders(config2, { usingProxy });
121347
+ if (usingProxy) {
121348
+ if (!(config2 == null ? void 0 : config2.token)) {
121349
+ throw new Error(`world-vercel: api-workflow proxy requested (${baseUrl}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);
121350
+ }
121351
+ headers2.set("Authorization", `Bearer ${config2.token}`);
121352
+ } else {
121353
+ let oidcToken;
121354
+ try {
121355
+ oidcToken = await distExports.getVercelOidcToken();
121356
+ } catch {
121357
+ }
121358
+ const authToken = (config2 == null ? void 0 : config2.token) ?? oidcToken;
121359
+ if (authToken) {
121360
+ headers2.set("Authorization", `Bearer ${authToken}`);
121361
+ }
121362
+ if (oidcToken) {
121363
+ headers2.set("x-vercel-trusted-oidc-idp-token", oidcToken);
121364
+ }
121194
121365
  }
121195
121366
  return { baseUrl, headers: headers2, usingProxy };
121196
121367
  }
@@ -121297,7 +121468,7 @@ curl -X ${request2.method} ${stringifiedHeaders} "${url2}"`);
121297
121468
  const contentType = response2.headers.get("Content-Type") || "unknown";
121298
121469
  throw new WorkflowWorldError(`Failed to parse response body for ${request2.method} ${endpoint} (Content-Type: ${contentType}):
121299
121470
 
121300
- ${error2}`, { url: url2, cause: error2 });
121471
+ ${error2}`, { url: url2, code: "PARSE_ERROR", cause: error2 });
121301
121472
  }
121302
121473
  const result = await trace("world.validate", async () => {
121303
121474
  const validationResult = schema.safeParse(parseResult.data);
@@ -121307,7 +121478,7 @@ ${error2}`, { url: url2, cause: error2 });
121307
121478
 
121308
121479
  Response context: ${parseResult.getDebugContext()}` : "";
121309
121480
  throw new WorkflowWorldError(`Schema validation failed for ${method} ${endpoint}:
121310
- ${issues}${debugContext}`, { url: url2, cause: validationResult.error });
121481
+ ${issues}${debugContext}`, { url: url2, code: "SCHEMA_VALIDATION", cause: validationResult.error });
121311
121482
  }
121312
121483
  return validationResult.data;
121313
121484
  });
@@ -121415,6 +121586,14 @@ const MAX_DELAY_SECONDS = Number(
121415
121586
  process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || 82800
121416
121587
  // 23 hours - leave 1h buffer before 24h retention limit
121417
121588
  );
121589
+ const HANDLER_ERROR_RETRY_AFTER_SECONDS = 1;
121590
+ const HANDLER_ERROR_MAX_RETRY_AFTER_SECONDS = 60;
121591
+ const HANDLER_ERROR_RETRY_JITTER_RATIO = 0.25;
121592
+ function getHandlerErrorRetryAfterSeconds(deliveryCount) {
121593
+ const backoffSeconds = Math.min(Math.max(HANDLER_ERROR_RETRY_AFTER_SECONDS, 2 ** (deliveryCount - 1)), HANDLER_ERROR_MAX_RETRY_AFTER_SECONDS);
121594
+ const jitterSeconds = Math.floor(Math.random() * (Math.ceil(backoffSeconds * HANDLER_ERROR_RETRY_JITTER_RATIO) + 1));
121595
+ return Math.max(HANDLER_ERROR_RETRY_AFTER_SECONDS, backoffSeconds - jitterSeconds);
121596
+ }
121418
121597
  function getHeadersFromPayload(payload) {
121419
121598
  const headers2 = {};
121420
121599
  if ("runId" in payload && typeof payload.runId === "string") {
@@ -121430,7 +121609,7 @@ function getHeadersFromPayload(payload) {
121430
121609
  }
121431
121610
  function createQueue$1(config2) {
121432
121611
  const { baseUrl, usingProxy } = getHttpUrl(config2);
121433
- const headers2 = getHeaders(config2);
121612
+ const headers2 = getHeaders(config2, { usingProxy });
121434
121613
  const region = "iad1";
121435
121614
  const cborTransport = new CborTransport();
121436
121615
  const jsonTransport = new JsonTransport2();
@@ -121507,6 +121686,16 @@ function createQueue$1(config2) {
121507
121686
  const delaySeconds = result.timeoutSeconds > 0 ? Math.min(result.timeoutSeconds, MAX_DELAY_SECONDS) : void 0;
121508
121687
  await queue(queueName, payload, { deploymentId, delaySeconds });
121509
121688
  }
121689
+ }, {
121690
+ // Without an explicit retry directive, @vercel/queue leaves failed
121691
+ // handler messages invisible until the default 300s visibility timeout
121692
+ // expires. Start retrying quickly, then back off by delivery count
121693
+ // with jitter so an outage or poison message cannot hot-loop or
121694
+ // redrive in lockstep. Workflow handlers are event-sourced and must
121695
+ // remain idempotent because queue retries can happen close together.
121696
+ retry: (_error, { deliveryCount }) => ({
121697
+ afterSeconds: getHandlerErrorRetryAfterSeconds(deliveryCount)
121698
+ })
121510
121699
  });
121511
121700
  return async (req) => {
121512
121701
  const rawId = req.headers.get("x-vercel-id");
@@ -121540,7 +121729,7 @@ function createResolveLatestDeploymentId(config2) {
121540
121729
  const response2 = await fetch(url2, {
121541
121730
  method: "GET",
121542
121731
  headers: {
121543
- authorization: `Bearer ${token}`
121732
+ Authorization: `Bearer ${token}`
121544
121733
  },
121545
121734
  // @ts-expect-error -- undici dispatcher is accepted by Node.js fetch but not in @types/node's RequestInit
121546
121735
  dispatcher: getDispatcher()
@@ -121881,14 +122070,18 @@ const EventResultResolveWireSchema = z$2.object({
121881
122070
  run: WorkflowRunSchema.optional(),
121882
122071
  step: StepWireSchema.optional(),
121883
122072
  hook: HookSchema.optional(),
121884
- events: z$2.array(EventSchema).optional()
122073
+ events: z$2.array(EventSchema).optional(),
122074
+ cursor: z$2.string().nullable().optional(),
122075
+ hasMore: z$2.boolean().optional()
121885
122076
  });
121886
122077
  const EventResultLazyWireSchema = z$2.object({
121887
122078
  event: EventSchema.optional(),
121888
122079
  run: WorkflowRunWireBaseSchema.optional(),
121889
122080
  step: StepWireSchema.optional(),
121890
122081
  hook: HookSchema.optional(),
121891
- events: z$2.array(EventSchema).optional()
122082
+ events: z$2.array(EventSchema).optional(),
122083
+ cursor: z$2.string().nullable().optional(),
122084
+ hasMore: z$2.boolean().optional()
121892
122085
  });
121893
122086
  const EventWithRefsSchema = z$2.object({
121894
122087
  eventId: z$2.string(),
@@ -122131,7 +122324,9 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
122131
122324
  run: wireResult2.run,
122132
122325
  step: wireResult2.step ? deserializeStep(wireResult2.step) : void 0,
122133
122326
  hook: wireResult2.hook,
122134
- events: wireResult2.events
122327
+ events: wireResult2.events,
122328
+ cursor: wireResult2.cursor,
122329
+ hasMore: wireResult2.hasMore
122135
122330
  };
122136
122331
  }
122137
122332
  const wireResult = await makeRequest({
@@ -122150,7 +122345,9 @@ async function createWorkflowRunEventInner(id2, data, params, config2) {
122150
122345
  run: wireResult.run ? deserializeError(wireResult.run) : void 0,
122151
122346
  step: wireResult.step ? deserializeStep(wireResult.step) : void 0,
122152
122347
  hook: wireResult.hook,
122153
- events: wireResult.events
122348
+ events: wireResult.events,
122349
+ cursor: wireResult.cursor,
122350
+ hasMore: wireResult.hasMore
122154
122351
  };
122155
122352
  }
122156
122353
  function filterHookData(hook, resolveData) {
@@ -122250,12 +122447,36 @@ function createStorage(config2) {
122250
122447
  };
122251
122448
  }
122252
122449
  const MAX_CHUNKS_PER_REQUEST = 1e3;
122450
+ const DEFAULT_STREAM_MUTATION_TIMEOUT_MS = 3e4;
122253
122451
  function getStreamUrl(name2, runId, httpConfig) {
122254
122452
  if (runId) {
122255
122453
  return new URL(`${httpConfig.baseUrl}/v2/runs/${encodeURIComponent(runId)}/stream/${encodeURIComponent(name2)}`);
122256
122454
  }
122257
122455
  return new URL(`${httpConfig.baseUrl}/v2/stream/${encodeURIComponent(name2)}`);
122258
122456
  }
122457
+ function getStreamMutationTimeoutMs() {
122458
+ const parsed = Number.parseInt(process.env.WORKFLOW_VERCEL_STREAM_TIMEOUT_MS ?? "", 10);
122459
+ if (Number.isFinite(parsed) && parsed > 0) {
122460
+ return parsed;
122461
+ }
122462
+ return DEFAULT_STREAM_MUTATION_TIMEOUT_MS;
122463
+ }
122464
+ async function fetchStreamMutation(url2, init2, operation) {
122465
+ const timeoutMs = getStreamMutationTimeoutMs();
122466
+ try {
122467
+ return await fetch(url2, {
122468
+ ...init2,
122469
+ signal: AbortSignal.timeout(timeoutMs)
122470
+ });
122471
+ } catch (err) {
122472
+ if (err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) {
122473
+ throw new Error(`Stream ${operation} timed out after ${timeoutMs}ms`, {
122474
+ cause: err
122475
+ });
122476
+ }
122477
+ throw err;
122478
+ }
122479
+ }
122259
122480
  function encodeMultiChunks(chunks) {
122260
122481
  const encoder = new TextEncoder();
122261
122482
  const binaryChunks = [];
@@ -122294,11 +122515,11 @@ function createStreamer(config2) {
122294
122515
  async writeToStream(name2, runId, chunk) {
122295
122516
  const resolvedRunId = await runId;
122296
122517
  const httpConfig = await getHttpConfig(config2);
122297
- const response2 = await fetch(getStreamUrl(name2, resolvedRunId, httpConfig), {
122518
+ const response2 = await fetchStreamMutation(getStreamUrl(name2, resolvedRunId, httpConfig), {
122298
122519
  method: "PUT",
122299
122520
  body: chunk,
122300
122521
  headers: httpConfig.headers
122301
- });
122522
+ }, "write");
122302
122523
  const text2 = await response2.text();
122303
122524
  if (!response2.ok) {
122304
122525
  throw new Error(`Stream write failed: HTTP ${response2.status}: ${text2}`);
@@ -122313,11 +122534,11 @@ function createStreamer(config2) {
122313
122534
  for (let i = 0; i < chunks.length; i += MAX_CHUNKS_PER_REQUEST) {
122314
122535
  const batch = chunks.slice(i, i + MAX_CHUNKS_PER_REQUEST);
122315
122536
  const body2 = encodeMultiChunks(batch);
122316
- const response2 = await fetch(getStreamUrl(name2, resolvedRunId, httpConfig), {
122537
+ const response2 = await fetchStreamMutation(getStreamUrl(name2, resolvedRunId, httpConfig), {
122317
122538
  method: "PUT",
122318
122539
  body: body2,
122319
122540
  headers: httpConfig.headers
122320
- });
122541
+ }, "write");
122321
122542
  const text2 = await response2.text();
122322
122543
  if (!response2.ok) {
122323
122544
  throw new Error(`Stream write failed: HTTP ${response2.status}: ${text2}`);
@@ -122328,10 +122549,10 @@ function createStreamer(config2) {
122328
122549
  const resolvedRunId = await runId;
122329
122550
  const httpConfig = await getHttpConfig(config2);
122330
122551
  httpConfig.headers.set("X-Stream-Done", "true");
122331
- const response2 = await fetch(getStreamUrl(name2, resolvedRunId, httpConfig), {
122552
+ const response2 = await fetchStreamMutation(getStreamUrl(name2, resolvedRunId, httpConfig), {
122332
122553
  method: "PUT",
122333
122554
  headers: httpConfig.headers
122334
- });
122555
+ }, "close");
122335
122556
  const text2 = await response2.text();
122336
122557
  if (!response2.ok) {
122337
122558
  throw new Error(`Stream close failed: HTTP ${response2.status}: ${text2}`);
@@ -122493,6 +122714,43 @@ async function handleHealthCheckMessage(healthCheck2, endpoint, worldSpecVersion
122493
122714
  }
122494
122715
  const HEALTH_CHECK_POLL_INTERVAL = 100;
122495
122716
  const HEALTH_CHECK_READ_TIMEOUT = 500;
122717
+ class HealthCheckTimeoutError extends Error {
122718
+ constructor(timeout2) {
122719
+ super(`Health check timed out after ${timeout2}ms`);
122720
+ }
122721
+ }
122722
+ function getHealthCheckTimeRemaining(startTime, timeout2) {
122723
+ return timeout2 - (Date.now() - startTime);
122724
+ }
122725
+ async function withHealthCheckTimeout(promise2, startTime, timeout2) {
122726
+ const remaining = getHealthCheckTimeRemaining(startTime, timeout2);
122727
+ if (remaining <= 0) {
122728
+ throw new HealthCheckTimeoutError(timeout2);
122729
+ }
122730
+ let timeoutId;
122731
+ try {
122732
+ return await Promise.race([
122733
+ promise2,
122734
+ new Promise((_2, reject) => {
122735
+ timeoutId = setTimeout(() => reject(new HealthCheckTimeoutError(timeout2)), remaining);
122736
+ })
122737
+ ]);
122738
+ } finally {
122739
+ if (timeoutId) {
122740
+ clearTimeout(timeoutId);
122741
+ }
122742
+ }
122743
+ }
122744
+ function wait(ms2) {
122745
+ return new Promise((resolve2) => setTimeout(resolve2, ms2));
122746
+ }
122747
+ async function waitForNextHealthCheckPoll(startTime, timeout2) {
122748
+ const remaining = getHealthCheckTimeRemaining(startTime, timeout2);
122749
+ if (remaining <= 0) {
122750
+ return;
122751
+ }
122752
+ await wait(Math.min(HEALTH_CHECK_POLL_INTERVAL, remaining));
122753
+ }
122496
122754
  async function readStreamWithTimeout(reader, readTimeout) {
122497
122755
  const chunks = [];
122498
122756
  let done = false;
@@ -122542,6 +122800,18 @@ function parseHealthCheckResponse(chunks) {
122542
122800
  }
122543
122801
  return parsed;
122544
122802
  }
122803
+ async function readHealthCheckResponse(world, streamName, startTime, timeout2) {
122804
+ const stream = await withHealthCheckTimeout(world.readFromStream(streamName), startTime, timeout2);
122805
+ const reader = stream.getReader();
122806
+ const readTimeout = Math.min(HEALTH_CHECK_READ_TIMEOUT, Math.max(1, getHealthCheckTimeRemaining(startTime, timeout2)));
122807
+ const { chunks, timedOut } = await readStreamWithTimeout(reader, readTimeout);
122808
+ if (timedOut) {
122809
+ await reader.cancel().catch(() => {
122810
+ });
122811
+ return null;
122812
+ }
122813
+ return parseHealthCheckResponse(chunks);
122814
+ }
122545
122815
  async function healthCheck(world, endpoint, options) {
122546
122816
  const timeout2 = (options == null ? void 0 : options.timeout) ?? DEFAULT_HEALTH_CHECK_TIMEOUT;
122547
122817
  const correlationId = generateId();
@@ -122549,36 +122819,27 @@ async function healthCheck(world, endpoint, options) {
122549
122819
  const queueName = endpoint === "workflow" ? "__wkf_workflow_health_check" : "__wkf_step_health_check";
122550
122820
  const startTime = Date.now();
122551
122821
  try {
122552
- await world.queue(queueName, { __healthCheck: true, correlationId }, {
122822
+ await withHealthCheckTimeout(world.queue(queueName, { __healthCheck: true, correlationId }, {
122553
122823
  // Use JSON transport so the health check works against both
122554
122824
  // old (JSON-only) and new (dual) deployments.
122555
122825
  specVersion: SPEC_VERSION_LEGACY,
122556
122826
  deploymentId: options == null ? void 0 : options.deploymentId
122557
- });
122558
- while (Date.now() - startTime < timeout2) {
122827
+ }), startTime, timeout2);
122828
+ while (getHealthCheckTimeRemaining(startTime, timeout2) > 0) {
122559
122829
  try {
122560
- const stream = await world.readFromStream(streamName);
122561
- const reader = stream.getReader();
122562
- const { chunks, timedOut } = await readStreamWithTimeout(reader, HEALTH_CHECK_READ_TIMEOUT);
122563
- if (timedOut) {
122564
- try {
122565
- reader.cancel();
122566
- } catch {
122567
- }
122568
- await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
122569
- continue;
122570
- }
122571
- const response2 = parseHealthCheckResponse(chunks);
122830
+ const response2 = await readHealthCheckResponse(world, streamName, startTime, timeout2);
122572
122831
  if (response2) {
122573
122832
  return {
122574
122833
  ...response2,
122575
122834
  latencyMs: Date.now() - startTime
122576
122835
  };
122577
122836
  }
122578
- await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
122579
- } catch {
122580
- await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
122837
+ } catch (error2) {
122838
+ if (error2 instanceof HealthCheckTimeoutError) {
122839
+ throw error2;
122840
+ }
122581
122841
  }
122842
+ await waitForNextHealthCheckPoll(startTime, timeout2);
122582
122843
  }
122583
122844
  return {
122584
122845
  healthy: false,
@@ -124351,11 +124612,19 @@ function getCommonReducers(global2 = globalThis) {
124351
124612
  if (typeof stepId !== "string")
124352
124613
  return false;
124353
124614
  const closureVarsFn = value.__closureVarsFn;
124354
- if (closureVarsFn && typeof closureVarsFn === "function") {
124355
- const closureVars = closureVarsFn();
124356
- return { stepId, closureVars };
124615
+ const closureVars = closureVarsFn && typeof closureVarsFn === "function" ? closureVarsFn() : void 0;
124616
+ const hasBoundThis = "__boundThis" in value;
124617
+ const boundThis = hasBoundThis ? value.__boundThis : void 0;
124618
+ const boundArgs = value.__boundArgs;
124619
+ const payload = { stepId };
124620
+ if (closureVars !== void 0)
124621
+ payload.closureVars = closureVars;
124622
+ if (hasBoundThis)
124623
+ payload.boundThis = boundThis;
124624
+ if (Array.isArray(boundArgs) && boundArgs.length > 0) {
124625
+ payload.boundArgs = boundArgs;
124357
124626
  }
124358
- return { stepId };
124627
+ return payload;
124359
124628
  },
124360
124629
  URL: (value) => value instanceof global2.URL && value.href,
124361
124630
  URLSearchParams: (value) => {
@@ -124617,10 +124886,12 @@ function getWorkflowRevivers(global2 = globalThis) {
124617
124886
  if (!useStep) {
124618
124887
  throw new Error("WORKFLOW_USE_STEP not found on global object. Step functions cannot be deserialized outside workflow context.");
124619
124888
  }
124620
- if (closureVars) {
124621
- return useStep(stepId, () => closureVars);
124889
+ const proxy = closureVars ? useStep(stepId, () => closureVars) : useStep(stepId);
124890
+ if ("boundThis" in value) {
124891
+ const boundArgs = Array.isArray(value.boundArgs) ? value.boundArgs : [];
124892
+ return proxy.bind(value.boundThis, ...boundArgs);
124622
124893
  }
124623
- return useStep(stepId);
124894
+ return proxy;
124624
124895
  },
124625
124896
  Request: (value) => {
124626
124897
  Object.setPrototypeOf(value, global2.Request.prototype);
@@ -124672,16 +124943,40 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey) {
124672
124943
  return {
124673
124944
  ...getCommonRevivers(global2),
124674
124945
  // StepFunction reviver for step context - returns raw step function
124675
- // with closure variable support via AsyncLocalStorage
124946
+ // with closure variable support via AsyncLocalStorage.
124947
+ //
124948
+ // Handles four independent flags from the serialized payload:
124949
+ // - `closureVars`: invoke the body inside an AsyncLocalStorage frame
124950
+ // so the SWC-emitted `WORKFLOW_STEP_CONTEXT_STORAGE` IIFE in the
124951
+ // hoisted body can pull the closure variables back out.
124952
+ // - `boundThis`: a `this` value captured by
124953
+ // `useStep(...).bind(this)` in the workflow bundle (lexical-`this`
124954
+ // arrow steps). The wrapper invokes the body via
124955
+ // `stepFn.apply(boundThis, args)` so the body sees the same
124956
+ // `this` it would have had in the workflow bundle. Property
124957
+ // presence — not truthiness — is significant because
124958
+ // `bind(null)` and `bind(undefined)` are both legal and should
124959
+ // round-trip faithfully.
124960
+ // - `boundArgs`: prefilled args from
124961
+ // `useStep(...).bind(thisArg, x, y)`. Prepended to the call args
124962
+ // so partial application survives serialization.
124676
124963
  StepFunction: (value) => {
124677
124964
  const stepId = value.stepId;
124678
124965
  const closureVars = value.closureVars;
124966
+ const hasBoundThis = "boundThis" in value;
124967
+ const boundThis = hasBoundThis ? value.boundThis : void 0;
124968
+ const boundArgs = Array.isArray(value.boundArgs) ? value.boundArgs : [];
124679
124969
  const stepFn = getStepFunction(stepId);
124680
124970
  if (!stepFn) {
124681
124971
  throw new Error(`Step function "${stepId}" not found. Make sure the step function is registered.`);
124682
124972
  }
124683
- if (closureVars) {
124684
- const wrappedStepFn = ((...args) => {
124973
+ if (!closureVars && !hasBoundThis && boundArgs.length === 0) {
124974
+ return stepFn;
124975
+ }
124976
+ const wrappedStepFn = function(...args) {
124977
+ const callThis = hasBoundThis ? boundThis : this;
124978
+ const callArgs = boundArgs.length > 0 ? [...boundArgs, ...args] : args;
124979
+ if (closureVars) {
124685
124980
  const currentContext = contextStorage.getStore();
124686
124981
  if (!currentContext) {
124687
124982
  throw new Error("Cannot call step function with closure variables outside step context");
@@ -124690,23 +124985,23 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey) {
124690
124985
  ...currentContext,
124691
124986
  closureVars
124692
124987
  };
124693
- return contextStorage.run(newContext, () => stepFn(...args));
124694
- });
124695
- Object.defineProperty(wrappedStepFn, "name", {
124696
- value: stepFn.name
124697
- });
124698
- Object.defineProperty(wrappedStepFn, "stepId", {
124699
- value: stepId,
124700
- writable: false,
124701
- enumerable: false,
124702
- configurable: false
124703
- });
124704
- if (stepFn.maxRetries !== void 0) {
124705
- wrappedStepFn.maxRetries = stepFn.maxRetries;
124988
+ return contextStorage.run(newContext, () => stepFn.apply(callThis, callArgs));
124706
124989
  }
124707
- return wrappedStepFn;
124990
+ return stepFn.apply(callThis, callArgs);
124991
+ };
124992
+ Object.defineProperty(wrappedStepFn, "name", {
124993
+ value: stepFn.name
124994
+ });
124995
+ Object.defineProperty(wrappedStepFn, "stepId", {
124996
+ value: stepId,
124997
+ writable: false,
124998
+ enumerable: false,
124999
+ configurable: false
125000
+ });
125001
+ if (stepFn.maxRetries !== void 0) {
125002
+ wrappedStepFn.maxRetries = stepFn.maxRetries;
124708
125003
  }
124709
- return stepFn;
125004
+ return wrappedStepFn;
124710
125005
  },
124711
125006
  Request: (value) => {
124712
125007
  const responseWritable = value.responseWritable;
@@ -127651,6 +127946,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
127651
127946
  specVersion: SPEC_VERSION_CURRENT,
127652
127947
  correlationId: hook.hookId,
127653
127948
  eventData: {
127949
+ ...v1Compat ? {} : { token: hook.token },
127654
127950
  payload: dehydratedPayload
127655
127951
  }
127656
127952
  }, { v1Compat });
@@ -127883,7 +128179,10 @@ async function wakeUpRun$2(world, runId, options) {
127883
128179
  } : {
127884
128180
  eventType: "wait_completed",
127885
128181
  correlationId: waitEvent.correlationId,
127886
- specVersion: run.specVersion
128182
+ specVersion: run.specVersion,
128183
+ eventData: {
128184
+ resumeAt: waitEvent.eventData.resumeAt
128185
+ }
127887
128186
  };
127888
128187
  try {
127889
128188
  await world.events.create(runId, eventData, { v1Compat: compatMode });
@@ -128114,11 +128413,12 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128114
128413
  }
128115
128414
  const { workflowName, workflowRunId, workflowStartedAt, stepId, traceCarrier: traceContext, requestedAt } = StepInvokePayloadSchema.parse(message_);
128116
128415
  const { requestId } = metadata;
128416
+ const stepNameFromQueue = metadata.queueName.slice("__wkf_step_".length);
128117
128417
  if (metadata.attempt > MAX_QUEUE_DELIVERIES) {
128118
128418
  runtimeLogger.error(`Step handler exceeded max deliveries (${metadata.attempt}/${MAX_QUEUE_DELIVERIES})`, {
128119
128419
  workflowRunId,
128120
128420
  stepId,
128121
- stepName: metadata.queueName.slice("__wkf_step_".length),
128421
+ stepName: stepNameFromQueue,
128122
128422
  attempt: metadata.attempt
128123
128423
  });
128124
128424
  try {
@@ -128128,6 +128428,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128128
128428
  specVersion: SPEC_VERSION_CURRENT,
128129
128429
  correlationId: stepId,
128130
128430
  eventData: {
128431
+ stepName: stepNameFromQueue,
128131
128432
  error: `Step exceeded maximum queue deliveries (${metadata.attempt}/${MAX_QUEUE_DELIVERIES})`
128132
128433
  }
128133
128434
  }, { requestId });
@@ -128182,7 +128483,8 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128182
128483
  const startResult = await world.events.create(workflowRunId, {
128183
128484
  eventType: "step_started",
128184
128485
  specVersion: SPEC_VERSION_CURRENT,
128185
- correlationId: stepId
128486
+ correlationId: stepId,
128487
+ eventData: { stepName }
128186
128488
  }, { requestId });
128187
128489
  if (!startResult.step) {
128188
128490
  throw new WorkflowRuntimeError(`step_started event for "${stepId}" did not return step entity`);
@@ -128265,6 +128567,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128265
128567
  specVersion: SPEC_VERSION_CURRENT,
128266
128568
  correlationId: stepId,
128267
128569
  eventData: {
128570
+ stepName,
128268
128571
  error: err.message,
128269
128572
  stack: err.stack
128270
128573
  }
@@ -128311,6 +128614,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128311
128614
  specVersion: SPEC_VERSION_CURRENT,
128312
128615
  correlationId: stepId,
128313
128616
  eventData: {
128617
+ stepName,
128314
128618
  error: errorMessage,
128315
128619
  stack: (_c = step.error) == null ? void 0 : _c.stack
128316
128620
  }
@@ -128352,6 +128656,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128352
128656
  specVersion: SPEC_VERSION_CURRENT,
128353
128657
  correlationId: stepId,
128354
128658
  eventData: {
128659
+ stepName,
128355
128660
  error: errorMessage,
128356
128661
  stack: new Error(errorMessage).stack ?? ""
128357
128662
  }
@@ -128460,6 +128765,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128460
128765
  specVersion: SPEC_VERSION_CURRENT,
128461
128766
  correlationId: stepId,
128462
128767
  eventData: {
128768
+ stepName,
128463
128769
  error: normalizedError.message,
128464
128770
  stack: normalizedStack
128465
128771
  }
@@ -128503,6 +128809,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128503
128809
  specVersion: SPEC_VERSION_CURRENT,
128504
128810
  correlationId: stepId,
128505
128811
  eventData: {
128812
+ stepName,
128506
128813
  error: errorMessage,
128507
128814
  stack: normalizedStack
128508
128815
  }
@@ -128545,6 +128852,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128545
128852
  specVersion: SPEC_VERSION_CURRENT,
128546
128853
  correlationId: stepId,
128547
128854
  eventData: {
128855
+ stepName,
128548
128856
  error: normalizedError.message,
128549
128857
  stack: normalizedStack,
128550
128858
  ...RetryableError.is(err) && {
@@ -128586,7 +128894,9 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128586
128894
  }
128587
128895
  result = await trace$2("step.dehydrate", {}, async (dehydrateSpan) => {
128588
128896
  const startTime = Date.now();
128897
+ const returnValueOpsStart = ops.length;
128589
128898
  const dehydrated = await dehydrateStepReturnValue(result, workflowRunId, encryptionKey, ops);
128899
+ await Promise.all(ops.slice(returnValueOpsStart));
128590
128900
  const durationMs = Date.now() - startTime;
128591
128901
  dehydrateSpan == null ? void 0 : dehydrateSpan.setAttributes({
128592
128902
  ...QueueSerializeTimeMs(durationMs),
@@ -128606,6 +128916,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
128606
128916
  specVersion: SPEC_VERSION_CURRENT,
128607
128917
  correlationId: stepId,
128608
128918
  eventData: {
128919
+ stepName,
128609
128920
  result
128610
128921
  }
128611
128922
  }, { requestId }).catch((err) => {
@@ -151384,7 +151695,6 @@ function RunDetailView({
151384
151695
  return;
151385
151696
  }
151386
151697
  setEncryptionKey(keyResult);
151387
- toast.success("Run data decrypted successfully");
151388
151698
  } finally {
151389
151699
  setIsDecrypting(false);
151390
151700
  }
@@ -151916,7 +152226,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
151916
152226
  __proto__: null,
151917
152227
  loader
151918
152228
  }, Symbol.toStringTag, { value: "Module" }));
151919
- const serverManifest = { "entry": { "module": "/assets/entry.client-BWsSsWQm.js", "imports": ["/assets/index-DQa-BExo.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-CLs7COa2.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/mermaid-3ZIDBTTL-B_qZU5zW.js"], "css": ["/assets/root-aMfmV5uh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-BMWyCqWy.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-D5yEggTb.js", "/assets/mermaid-3ZIDBTTL-B_qZU5zW.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-D7xkVxzE.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-D5yEggTb.js", "/assets/mermaid-3ZIDBTTL-B_qZU5zW.js", "/assets/encryption-80GMP4r0.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-c0697365.js", "version": "c0697365", "sri": void 0 };
152229
+ const serverManifest = { "entry": { "module": "/assets/entry.client-BWsSsWQm.js", "imports": ["/assets/index-DQa-BExo.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-Cr0bUIN7.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/mermaid-3ZIDBTTL-BE1h5qUK.js"], "css": ["/assets/root-aMfmV5uh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-CI2sZzZZ.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-fudq4EvS.js", "/assets/mermaid-3ZIDBTTL-BE1h5qUK.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-gIcQ-2KJ.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-fudq4EvS.js", "/assets/mermaid-3ZIDBTTL-BE1h5qUK.js", "/assets/encryption-80GMP4r0.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.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-c3c3f64e.js", "version": "c3c3f64e", "sri": void 0 };
151920
152230
  const assetsBuildDirectory = "build/client";
151921
152231
  const basename = "/";
151922
152232
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
@@ -152000,33 +152310,33 @@ export {
152000
152310
  PaginatedResponseSchema as P,
152001
152311
  QueuePayloadSchema as Q,
152002
152312
  RunInputSchema as R,
152003
- StepInvokePayloadSchema as S,
152313
+ SPEC_VERSION_CURRENT as S,
152004
152314
  ValidQueueName as V,
152005
- WorkflowInvokePayloadSchema as W,
152006
- EventSchema as a,
152007
- EventTypeSchema as b,
152008
- HealthCheckPayloadSchema as c,
152009
- QueuePrefix as d,
152010
- WorkflowRunBaseSchema as e,
152011
- WorkflowRunSchema as f,
152012
- WorkflowRunStatusSchema as g,
152013
- SerializedDataSchema as h,
152014
- StructuredErrorSchema as i,
152015
- isLegacySpecVersion as j,
152016
- requiresNewerWorld as k,
152017
- SPEC_VERSION_CURRENT as l,
152018
- SPEC_VERSION_LEGACY as m,
152019
- SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as n,
152020
- SPEC_VERSION_SUPPORTS_EVENT_SOURCING as o,
152021
- StepSchema as p,
152022
- StepStatusSchema as q,
152023
- reenqueueActiveRuns as r,
152024
- stripEventDataRefs as s,
152025
- DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as t,
152026
- ulidToDate as u,
152027
- validateUlidTimestamp as v,
152028
- WaitSchema as w,
152029
- WaitStatusSchema as x,
152315
+ WaitSchema as W,
152316
+ DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as a,
152317
+ EventSchema as b,
152318
+ EventTypeSchema as c,
152319
+ HealthCheckPayloadSchema as d,
152320
+ QueuePrefix as e,
152321
+ SPEC_VERSION_LEGACY as f,
152322
+ SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as g,
152323
+ SPEC_VERSION_SUPPORTS_EVENT_SOURCING as h,
152324
+ SerializedDataSchema as i,
152325
+ StepInvokePayloadSchema as j,
152326
+ StepSchema as k,
152327
+ StepStatusSchema as l,
152328
+ StructuredErrorSchema as m,
152329
+ WaitStatusSchema as n,
152330
+ WorkflowInvokePayloadSchema as o,
152331
+ WorkflowRunBaseSchema as p,
152332
+ WorkflowRunSchema as q,
152333
+ WorkflowRunStatusSchema as r,
152334
+ isLegacySpecVersion as s,
152335
+ reenqueueActiveRuns as t,
152336
+ requiresNewerWorld as u,
152337
+ stripEventDataRefs as v,
152338
+ ulidToDate as w,
152339
+ validateUlidTimestamp as x,
152030
152340
  R as y,
152031
152341
  jsxRuntimeExports as z
152032
152342
  };