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

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 (24) hide show
  1. package/build/client/assets/{arrow-up-right-C52N96YH.js → arrow-up-right-CSovqivK.js} +1 -1
  2. package/build/client/assets/{highlighted-body-B3W2YXNL-BzCKp954.js → highlighted-body-B3W2YXNL-BO5_Ufo-.js} +1 -1
  3. package/build/client/assets/{home-CXFjRmpa.js → home-BbyW_T74.js} +3 -3
  4. package/build/client/assets/{loader-circle-BQzzSKVU.js → loader-circle-BX6ycuOI.js} +1 -1
  5. package/build/client/assets/{manifest-9ff1658d.js → manifest-34c486ef.js} +1 -1
  6. package/build/client/assets/{mermaid-3ZIDBTTL-BrUzeGHN.js → mermaid-3ZIDBTTL-BKwl_LgA.js} +73 -7
  7. package/build/client/assets/{root-DBp4o4Ap.js → root-qx_45_fH.js} +3 -3
  8. package/build/client/assets/{run-detail-7tPGLWpY.js → run-detail-BoGFG1Fe.js} +4 -4
  9. package/build/client/assets/{workflow-graph-viewer-BI72rVK-.js → workflow-graph-viewer-C-1D0sAn.js} +1 -1
  10. package/build/client/assets/{zstd-browser-decoder-C5OUdy0l.js → zstd-browser-decoder-By3hr1F0.js} +1 -1
  11. package/build/server/assets/{app-z0qVD1ZU.js → app-CeZRs20L.js} +708 -341
  12. package/build/server/assets/{highlighted-body-B3W2YXNL-BRzynHFv.js → highlighted-body-B3W2YXNL-jO_hupW2.js} +1 -1
  13. package/build/server/assets/index-DshIaniU.js +169 -0
  14. package/build/server/assets/{index-jQkBA81b.js → index-dJuvq1GP.js} +1 -1
  15. package/build/server/assets/{mermaid-3ZIDBTTL-CNWRBcN0.js → mermaid-3ZIDBTTL-2Pe4e_TP.js} +1 -1
  16. package/build/server/assets/{token-BSEhy2T4.js → token-DAVWictz.js} +1 -1
  17. package/build/server/assets/{token-util-D_gzpVW2.js → token-util-BMRcW3Qd.js} +1 -1
  18. package/build/server/assets/{websocket-server-CDTVQU5X.js → websocket-server-DXnHomzQ.js} +1 -1
  19. package/build/server/assets/{wrapper-BxieYZVg.js → wrapper-Bw3PP1up.js} +3 -3
  20. package/build/server/assets/{ws-transport-DbDOLT7f.js → ws-transport-Dv7yY5un.js} +2 -2
  21. package/build/server/assets/{zstd-browser-decoder-CtzWlfs5.js → zstd-browser-decoder-DJTnP4ZA.js} +1 -1
  22. package/build/server/index.js +3 -3
  23. package/package.json +10 -10
  24. package/build/server/assets/index-DDMGTwh_.js +0 -166
@@ -57594,7 +57594,7 @@ const WorkflowRunSchema = discriminatedUnion("status", [
57594
57594
  // Completed state - output can be v1 or v2 format
57595
57595
  WorkflowRunBaseSchema.extend({
57596
57596
  status: literal("completed"),
57597
- output: SerializedDataSchema,
57597
+ output: SerializedDataSchema.optional(),
57598
57598
  error: _undefined().optional(),
57599
57599
  completedAt: date$2()
57600
57600
  }),
@@ -57602,7 +57602,7 @@ const WorkflowRunSchema = discriminatedUnion("status", [
57602
57602
  WorkflowRunBaseSchema.extend({
57603
57603
  status: literal("failed"),
57604
57604
  output: _undefined().optional(),
57605
- error: SerializedDataSchema,
57605
+ error: SerializedDataSchema.optional(),
57606
57606
  completedAt: date$2()
57607
57607
  })
57608
57608
  ]);
@@ -57812,10 +57812,13 @@ const AnalyticsWaitSchema = object$1({
57812
57812
  const AnalyticsAttributeKeySchema = object$1({
57813
57813
  key: string$3(),
57814
57814
  runCount: number$2(),
57815
- firstSeenAt: date$2(),
57816
- lastSeenAt: date$2()
57815
+ firstSeenAt: UTCDateSchema,
57816
+ lastSeenAt: UTCDateSchema
57817
57817
  });
57818
57818
  const ANALYTICS_EVENTS_GET_MANY_LIMIT = 100;
57819
+ const ANALYTICS_RUN_SCOPED_PAGE_LIMIT = 1e3;
57820
+ const ANALYTICS_PAGE_LIMIT = 100;
57821
+ const ANALYTICS_MAX_ATTRIBUTE_FILTERS = 8;
57819
57822
  const WarnedEnvValuesKey = Symbol.for("@workflow/world//warnedEnvValues/v1");
57820
57823
  const globalStore = globalThis;
57821
57824
  const warnedEnvValues = globalStore[WarnedEnvValuesKey] ?? (globalStore[WarnedEnvValuesKey] = /* @__PURE__ */ new Set());
@@ -58531,10 +58534,10 @@ function findDuplicateEventIds(events2, { isCompleteHistory }) {
58531
58534
  return foldDuplicates(ordered);
58532
58535
  }
58533
58536
  const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
58534
- const STEP_ID_PATTERN = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
58535
- const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
58536
- const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
58537
- const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
58537
+ const STEP_ID_PATTERN$1 = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
58538
+ const WAIT_ID_PATTERN$1 = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
58539
+ const HOOK_ID_PATTERN$1 = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
58540
+ const EVENT_ID_PATTERN$1 = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
58538
58541
  const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
58539
58542
  function matchPrefixedId(pattern2, prefix, kind, query) {
58540
58543
  const match2 = query.match(pattern2);
@@ -58548,7 +58551,7 @@ function parseExactWorkflowSearchId(query) {
58548
58551
  if (!trimmed) {
58549
58552
  return null;
58550
58553
  }
58551
- return matchPrefixedId(STEP_ID_PATTERN, "step", "step", trimmed) ?? matchPrefixedId(WAIT_ID_PATTERN, "wait", "wait", trimmed) ?? matchPrefixedId(HOOK_ID_PATTERN, "hook", "hook", trimmed) ?? matchPrefixedId(EVENT_ID_PATTERN, "evnt", "event", trimmed);
58554
+ return matchPrefixedId(STEP_ID_PATTERN$1, "step", "step", trimmed) ?? matchPrefixedId(WAIT_ID_PATTERN$1, "wait", "wait", trimmed) ?? matchPrefixedId(HOOK_ID_PATTERN$1, "hook", "hook", trimmed) ?? matchPrefixedId(EVENT_ID_PATTERN$1, "evnt", "event", trimmed);
58552
58555
  }
58553
58556
  function looksLikeWorkflowIdSearchInput(query) {
58554
58557
  const trimmed = query.trim();
@@ -59438,6 +59441,10 @@ function stringify_primitive(thing) {
59438
59441
  if (type === "bigint") return `["BigInt","${thing}"]`;
59439
59442
  return String(thing);
59440
59443
  }
59444
+ const RUN_ERROR_CODES = {
59445
+ /** Workflow stream infrastructure failed while reading or writing data */
59446
+ STREAM_ERROR: "STREAM_ERROR"
59447
+ };
59441
59448
  const BASE_URL = "https://workflow-sdk.dev/err";
59442
59449
  function isError(value) {
59443
59450
  return typeof value === "object" && value !== null && "name" in value && "message" in value;
@@ -59499,11 +59506,18 @@ class WorkflowWorldError extends WorkflowError {
59499
59506
  __publicField(this, "url");
59500
59507
  /** Retry-After value in seconds, present on 429 and 425 responses */
59501
59508
  __publicField(this, "retryAfter");
59509
+ /**
59510
+ * The offending argument, present on client-side validation failures
59511
+ * (`code: 'INVALID_ARGUMENT'`). Lets a caller correct the specific
59512
+ * parameter without parsing the message.
59513
+ */
59514
+ __publicField(this, "field");
59502
59515
  this.name = "WorkflowWorldError";
59503
59516
  this.status = options == null ? void 0 : options.status;
59504
59517
  this.code = options == null ? void 0 : options.code;
59505
59518
  this.url = options == null ? void 0 : options.url;
59506
59519
  this.retryAfter = options == null ? void 0 : options.retryAfter;
59520
+ this.field = options == null ? void 0 : options.field;
59507
59521
  }
59508
59522
  static is(value) {
59509
59523
  return isError(value) && value.name === "WorkflowWorldError";
@@ -59662,6 +59676,20 @@ class RunExpiredError extends WorkflowWorldError {
59662
59676
  return isError(value) && value.name === "RunExpiredError";
59663
59677
  }
59664
59678
  }
59679
+ class StreamError extends WorkflowWorldError {
59680
+ constructor(message2, options) {
59681
+ super(message2, {
59682
+ code: RUN_ERROR_CODES.STREAM_ERROR,
59683
+ cause: options == null ? void 0 : options.cause,
59684
+ url: options == null ? void 0 : options.url,
59685
+ status: options == null ? void 0 : options.status
59686
+ });
59687
+ this.name = "StreamError";
59688
+ }
59689
+ static is(value) {
59690
+ return isError(value) && value.name === "StreamError";
59691
+ }
59692
+ }
59665
59693
  class StreamExpiredError extends WorkflowWorldError {
59666
59694
  constructor(message2, runId, streamId, expiredAt) {
59667
59695
  super(message2, { status: 410, code: "stream-expired" });
@@ -59769,6 +59797,7 @@ const FATAL_ERROR_KEY = Symbol.for("@workflow/errors//FatalError");
59769
59797
  const RETRYABLE_ERROR_KEY = Symbol.for("@workflow/errors//RetryableError");
59770
59798
  const HOOK_CONFLICT_ERROR_KEY = Symbol.for("@workflow/errors//HookConflictError");
59771
59799
  const RUNTIME_DECRYPTION_ERROR_KEY = Symbol.for("@workflow/errors//RuntimeDecryptionError");
59800
+ const STREAM_ERROR_KEY = Symbol.for("@workflow/errors//StreamError");
59772
59801
  if (typeof globalThis !== "undefined") {
59773
59802
  if (!Object.hasOwn(globalThis, FATAL_ERROR_KEY)) {
59774
59803
  Object.defineProperty(globalThis, FATAL_ERROR_KEY, {
@@ -59802,6 +59831,14 @@ if (typeof globalThis !== "undefined") {
59802
59831
  configurable: false
59803
59832
  });
59804
59833
  }
59834
+ if (!Object.hasOwn(globalThis, STREAM_ERROR_KEY)) {
59835
+ Object.defineProperty(globalThis, STREAM_ERROR_KEY, {
59836
+ value: StreamError,
59837
+ writable: false,
59838
+ enumerable: false,
59839
+ configurable: false
59840
+ });
59841
+ }
59805
59842
  }
59806
59843
  const NONCE_LENGTH = 12;
59807
59844
  const TAG_LENGTH = 128;
@@ -60883,6 +60920,18 @@ function getWebRevivers() {
60883
60920
  error2.stack = value.stack;
60884
60921
  return error2;
60885
60922
  },
60923
+ StreamError: (value) => {
60924
+ const opts = "cause" in value ? { cause: value.cause } : void 0;
60925
+ const error2 = new Error(value.message, opts);
60926
+ error2.name = "StreamError";
60927
+ if (value.status !== void 0)
60928
+ error2.status = value.status;
60929
+ if (value.url !== void 0)
60930
+ error2.url = value.url;
60931
+ if (value.stack !== void 0)
60932
+ error2.stack = value.stack;
60933
+ return error2;
60934
+ },
60886
60935
  DOMException: (value) => {
60887
60936
  const G2 = globalThis;
60888
60937
  if (typeof G2.DOMException === "function") {
@@ -61033,7 +61082,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
61033
61082
  }
61034
61083
  async function hydrateResourceIOAsync(resource, key) {
61035
61084
  const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
61036
- const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-CtzWlfs5.js");
61085
+ const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-DJTnP4ZA.js");
61037
61086
  ensureZstdDecoderRegistered();
61038
61087
  const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
61039
61088
  const revivers = getRevivers();
@@ -91972,7 +92021,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
91972
92021
  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 });
91973
92022
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
91974
92023
  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 }) });
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 }) => {
92024
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-jO_hupW2.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
91976
92025
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
91977
92026
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
91978
92027
  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 }) })] }) });
@@ -92294,7 +92343,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
92294
92343
  }, []), 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] });
92295
92344
  };
92296
92345
  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 }) })] });
92297
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CNWRBcN0.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
92346
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-2Pe4e_TP.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
92298
92347
  function ke(e, t) {
92299
92348
  if (!(e != null && e.position || t != null && t.position)) return true;
92300
92349
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -100701,11 +100750,18 @@ function Logo({ className } = {}) {
100701
100750
  }
100702
100751
  );
100703
100752
  }
100704
- const RETRYABLE_WORLD_ERROR_CODES = /* @__PURE__ */ new Set(["TRANSPORT", "TIMEOUT"]);
100753
+ const RETRYABLE_WORLD_ERROR_CODES = /* @__PURE__ */ new Set([
100754
+ "TRANSPORT",
100755
+ "TIMEOUT",
100756
+ RUN_ERROR_CODES.STREAM_ERROR
100757
+ ]);
100705
100758
  function isRetryableWorldError(err) {
100706
100759
  if (ThrottleError.is(err)) {
100707
100760
  return true;
100708
100761
  }
100762
+ if (StreamError.is(err)) {
100763
+ return err.status === void 0 || err.status >= 500;
100764
+ }
100709
100765
  if (!WorkflowWorldError.is(err)) {
100710
100766
  return false;
100711
100767
  }
@@ -102096,6 +102152,19 @@ function getCommonReducers(_global = globalThis) {
102096
102152
  }
102097
102153
  return reduced;
102098
102154
  },
102155
+ StreamError: (value) => {
102156
+ const base = reduceNamedErrorSubclassBase("StreamError", value);
102157
+ if (!base)
102158
+ return false;
102159
+ const reduced = { ...base };
102160
+ const status = readProperty(value, "status");
102161
+ const url2 = readProperty(value, "url");
102162
+ if (typeof status === "number")
102163
+ reduced.status = status;
102164
+ if (typeof url2 === "string")
102165
+ reduced.url = url2;
102166
+ return reduced;
102167
+ },
102099
102168
  SyntaxError: makeErrorSubclassReducer("SyntaxError"),
102100
102169
  TypeError: makeErrorSubclassReducer("TypeError"),
102101
102170
  URIError: makeErrorSubclassReducer("URIError"),
@@ -102241,6 +102310,17 @@ function getCommonRevivers$1(global2 = globalThis) {
102241
102310
  error2.stack = value.stack;
102242
102311
  return error2;
102243
102312
  },
102313
+ StreamError: (value) => {
102314
+ const Ctor = global2[Symbol.for("@workflow/errors//StreamError")] ?? StreamError;
102315
+ const error2 = new Ctor(value.message, {
102316
+ ..."cause" in value ? { cause: value.cause } : {},
102317
+ status: value.status,
102318
+ url: value.url
102319
+ });
102320
+ if (value.stack !== void 0)
102321
+ error2.stack = value.stack;
102322
+ return error2;
102323
+ },
102244
102324
  SyntaxError: makeErrorSubclassReviver(global2, "SyntaxError"),
102245
102325
  TypeError: makeErrorSubclassReviver(global2, "TypeError"),
102246
102326
  URIError: makeErrorSubclassReviver(global2, "URIError"),
@@ -102983,6 +103063,18 @@ function recordReadTimeToFirstChunk(startEpochMs, runId, name2, startIndex, conn
102983
103063
  });
102984
103064
  })();
102985
103065
  }
103066
+ function recordStreamReadKeyResolution(startEpochMs, runId, name2, succeeded) {
103067
+ void (async () => {
103068
+ await recordElapsedSpan("workflow.stream.read.resolve_key", startEpochMs, {
103069
+ kind: await getSpanKind$2("CLIENT"),
103070
+ attributes: {
103071
+ "workflow.run.id": runId,
103072
+ "workflow.stream.name": name2,
103073
+ "workflow.stream.read.key_succeeded": succeeded
103074
+ }
103075
+ });
103076
+ })();
103077
+ }
102986
103078
  function recordStreamReadComplete(startEpochMs, runId, name2, chunkCount, byteCount, reconnects) {
102987
103079
  void (async () => {
102988
103080
  await recordElapsedSpan("workflow.stream.read.complete", startEpochMs, {
@@ -103063,27 +103155,50 @@ const getFramedStreamMaxReconnects = () => envNumber("WORKFLOW_FRAMED_STREAM_MAX
103063
103155
  });
103064
103156
  const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1e3;
103065
103157
  const getFramedStreamMaxTotalReconnects = () => envNumber("WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS", FRAMED_STREAM_MAX_TOTAL_RECONNECTS, { integer: true, min: 1 });
103066
- function createReconnectingFramedStream(runId, name2, startIndex) {
103158
+ function createReconnectingFramedStream(runId, name2, startIndex, prefetchEncryptionKey = async () => void 0) {
103067
103159
  const reconnectSupported = startIndex === void 0 || startIndex >= 0;
103068
103160
  let currentStartIndex = startIndex ?? 0;
103069
103161
  let consumedFrames = 0;
103070
103162
  let reconnectCount = 0;
103071
103163
  let totalReconnectCount = 0;
103072
103164
  let reader;
103165
+ let canceled = false;
103166
+ let cancelReason;
103073
103167
  let buffer2 = new Uint8Array(0);
103074
103168
  let readStart;
103075
103169
  let connectMs;
103076
103170
  let firstChunkReported = false;
103077
103171
  let chunksDelivered = 0;
103078
103172
  let bytesDelivered = 0;
103173
+ let keyPrefetched = false;
103174
+ function prefetchKey() {
103175
+ if (keyPrefetched)
103176
+ return;
103177
+ keyPrefetched = true;
103178
+ const keyStart = Date.now();
103179
+ void prefetchEncryptionKey().then((key) => {
103180
+ if (key)
103181
+ recordStreamReadKeyResolution(keyStart, runId, name2, true);
103182
+ }, () => recordStreamReadKeyResolution(keyStart, runId, name2, false));
103183
+ }
103079
103184
  async function connect2() {
103185
+ if (canceled)
103186
+ return false;
103080
103187
  const world = await getWorldLazy();
103188
+ if (canceled)
103189
+ return false;
103081
103190
  const effectiveStartIndex = reconnectSupported ? currentStartIndex + consumedFrames : startIndex;
103082
103191
  const connectStart = Date.now();
103083
103192
  const stream = await world.streams.get(runId, name2, effectiveStartIndex);
103193
+ if (canceled) {
103194
+ await stream.cancel(cancelReason).catch(() => {
103195
+ });
103196
+ return false;
103197
+ }
103084
103198
  if (connectMs === void 0)
103085
103199
  connectMs = Date.now() - connectStart;
103086
103200
  reader = stream.getReader();
103201
+ return true;
103087
103202
  }
103088
103203
  async function isVerifiedComplete() {
103089
103204
  try {
@@ -103095,11 +103210,15 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
103095
103210
  }
103096
103211
  }
103097
103212
  async function reconnect() {
103213
+ if (canceled)
103214
+ return false;
103098
103215
  if (reader) {
103099
103216
  await reader.cancel().catch(() => {
103100
103217
  });
103101
103218
  reader = void 0;
103102
103219
  }
103220
+ if (canceled)
103221
+ return false;
103103
103222
  currentStartIndex += consumedFrames;
103104
103223
  consumedFrames = 0;
103105
103224
  buffer2 = new Uint8Array(0);
@@ -103109,15 +103228,18 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
103109
103228
  reconnectCount++;
103110
103229
  totalReconnectCount++;
103111
103230
  if (reconnectCount > maxReconnects) {
103112
- throw new Error(`Stream "${name2}" exceeded maximum reconnection attempts (${maxReconnects})`);
103231
+ throw new StreamError(`Stream "${name2}" exceeded maximum reconnection attempts (${maxReconnects})`);
103113
103232
  }
103114
103233
  if (totalReconnectCount > maxTotalReconnects) {
103115
- throw new Error(`Stream "${name2}" exceeded maximum total reconnection attempts (${maxTotalReconnects})`);
103234
+ throw new StreamError(`Stream "${name2}" exceeded maximum total reconnection attempts (${maxTotalReconnects})`);
103116
103235
  }
103117
103236
  try {
103118
- await connect2();
103119
- return;
103237
+ if (!await connect2())
103238
+ return false;
103239
+ return true;
103120
103240
  } catch (error2) {
103241
+ if (canceled)
103242
+ return false;
103121
103243
  if (StreamExpiredError.is(error2))
103122
103244
  throw error2;
103123
103245
  }
@@ -103125,13 +103247,19 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
103125
103247
  }
103126
103248
  return new ReadableStream({
103127
103249
  pull: async (controller) => {
103250
+ if (canceled)
103251
+ return;
103128
103252
  if (readStart === void 0)
103129
103253
  readStart = Date.now();
103254
+ prefetchKey();
103130
103255
  for (; ; ) {
103131
103256
  if (!reader) {
103132
103257
  try {
103133
- await connect2();
103258
+ if (!await connect2())
103259
+ return;
103134
103260
  } catch (err) {
103261
+ if (canceled)
103262
+ return;
103135
103263
  controller.error(err);
103136
103264
  return;
103137
103265
  }
@@ -103140,23 +103268,32 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
103140
103268
  try {
103141
103269
  result = await reader.read();
103142
103270
  } catch (err) {
103271
+ if (canceled)
103272
+ return;
103143
103273
  if (!reconnectSupported) {
103144
103274
  controller.error(err);
103145
103275
  return;
103146
103276
  }
103147
103277
  try {
103148
- await reconnect();
103278
+ if (!await reconnect())
103279
+ return;
103149
103280
  } catch (reconnectErr) {
103150
103281
  controller.error(reconnectErr);
103151
103282
  return;
103152
103283
  }
103153
103284
  continue;
103154
103285
  }
103286
+ if (canceled)
103287
+ return;
103155
103288
  if (result.done || !result.value) {
103156
103289
  reader = void 0;
103157
- if (reconnectSupported && !await isVerifiedComplete()) {
103290
+ const verifiedComplete = !reconnectSupported || await isVerifiedComplete();
103291
+ if (canceled)
103292
+ return;
103293
+ if (!verifiedComplete) {
103158
103294
  try {
103159
- await reconnect();
103295
+ if (!await reconnect())
103296
+ return;
103160
103297
  } catch (reconnectErr) {
103161
103298
  controller.error(reconnectErr);
103162
103299
  return;
@@ -103199,12 +103336,15 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
103199
103336
  }
103200
103337
  }
103201
103338
  },
103202
- cancel: async () => {
103203
- if (reader) {
103204
- await reader.cancel().catch((err) => {
103339
+ cancel: async (reason) => {
103340
+ canceled = true;
103341
+ cancelReason = reason;
103342
+ const currentReader = reader;
103343
+ reader = void 0;
103344
+ if (currentReader) {
103345
+ await currentReader.cancel(reason).catch((err) => {
103205
103346
  console.warn("Error closing ReadableStream reader:", err);
103206
103347
  });
103207
- reader = void 0;
103208
103348
  }
103209
103349
  }
103210
103350
  });
@@ -103931,7 +104071,48 @@ async function getForwardedWritableEncryptionKey(runId, deploymentId, encryption
103931
104071
  const rawKey = deploymentId ? await world.getEncryptionKeyForRun(runId, { deploymentId }) : await world.getEncryptionKeyForRun(await world.runs.get(runId));
103932
104072
  return rawKey ? await importKey(rawKey, ["encrypt"]) : void 0;
103933
104073
  }
103934
- function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
104074
+ function getRunReadableStream(global2, ops, runId, name2, startIndex, cryptoKey) {
104075
+ let reader;
104076
+ let lockState;
104077
+ let lockPollingStarted = false;
104078
+ let userReadable;
104079
+ userReadable = new ReadableStream(
104080
+ {
104081
+ async pull(controller) {
104082
+ try {
104083
+ if (!reader) {
104084
+ const stream = getExternalRevivers(global2, ops, runId, cryptoKey, {
104085
+ onReadableState: (state) => {
104086
+ lockState = state;
104087
+ }
104088
+ }).ReadableStream({ name: name2, startIndex });
104089
+ reader = stream.getReader();
104090
+ if (lockState && !lockPollingStarted) {
104091
+ lockPollingStarted = true;
104092
+ pollReadableLock(userReadable, lockState);
104093
+ }
104094
+ }
104095
+ const result = await reader.read();
104096
+ if (result.done)
104097
+ controller.close();
104098
+ else
104099
+ controller.enqueue(result.value);
104100
+ } catch (error2) {
104101
+ controller.error(error2);
104102
+ }
104103
+ },
104104
+ async cancel(reason) {
104105
+ await (reader == null ? void 0 : reader.cancel(reason).catch(() => {
104106
+ }));
104107
+ }
104108
+ },
104109
+ // A positive default high-water mark would run pull at construction to
104110
+ // fill the queue, turning an unread Run.getReadable() into I/O.
104111
+ { highWaterMark: 0 }
104112
+ );
104113
+ return userReadable;
104114
+ }
104115
+ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey, options) {
103935
104116
  return {
103936
104117
  ...getCommonRevivers(global2),
103937
104118
  // StepFunction should not be returned from workflows to clients
@@ -103979,16 +104160,27 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
103979
104160
  const { readable: userReadable, writable } = value.framing === "framed-v1" ? getByteUnframingStream() : new global2.TransformStream();
103980
104161
  flushablePipe(readable2, writable, state).catch(() => {
103981
104162
  });
103982
- pollReadableLock(userReadable, state);
104163
+ if (options == null ? void 0 : options.onReadableState)
104164
+ options.onReadableState(state);
104165
+ else
104166
+ pollReadableLock(userReadable, state);
103983
104167
  return userReadable;
103984
104168
  } else {
103985
- const readable2 = createReconnectingFramedStream(runId, value.name, value.startIndex);
103986
- const transform2 = getDeserializeStream(getExternalRevivers(global2, ops, runId, cryptoKey), cryptoKey);
104169
+ let keyPromise;
104170
+ const resolveKey = () => {
104171
+ keyPromise ?? (keyPromise = resolveEncryptionKey(cryptoKey));
104172
+ return keyPromise;
104173
+ };
104174
+ const readable2 = createReconnectingFramedStream(runId, value.name, value.startIndex, resolveKey);
104175
+ const transform2 = getDeserializeStream(getExternalRevivers(global2, ops, runId, resolveKey), resolveKey);
103987
104176
  const state = createFlushableState();
103988
104177
  ops.push(state.promise);
103989
104178
  flushablePipe(readable2, transform2.writable, state).catch(() => {
103990
104179
  });
103991
- pollReadableLock(transform2.readable, state);
104180
+ if (options == null ? void 0 : options.onReadableState)
104181
+ options.onReadableState(state);
104182
+ else
104183
+ pollReadableLock(transform2.readable, state);
103992
104184
  return transform2.readable;
103993
104185
  }
103994
104186
  },
@@ -104479,7 +104671,7 @@ globalSingleton("@workflow/core//envWarnings", 1, () => ({
104479
104671
  maxInlineStepsValues: /* @__PURE__ */ new Set(),
104480
104672
  maxEventsValues: /* @__PURE__ */ new Set()
104481
104673
  }));
104482
- const version$1 = "5.0.0-beta.47";
104674
+ const version$1 = "5.0.0-beta.48";
104483
104675
  const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
104484
104676
  const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
104485
104677
  function getWorkflowQueueName(workflowName, namespace2) {
@@ -135754,12 +135946,24 @@ function createEventsStorage(basedir, tag) {
135754
135946
  };
135755
135947
  const storedConflict = await storeEvent(conflictEvent);
135756
135948
  const resolveData2 = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
135757
- return {
135949
+ const conflictDelta = typeof (params == null ? void 0 : params.sinceCursor) === "string" ? await queryRunEvents(effectiveRunId, {
135950
+ sortOrder: "asc",
135951
+ cursor: params.sinceCursor
135952
+ }) : void 0;
135953
+ const conflictResult = {
135758
135954
  event: stripEventDataRefs(storedConflict, resolveData2),
135759
135955
  run: run2,
135760
135956
  step,
135761
135957
  hook: void 0
135762
135958
  };
135959
+ if (!conflictDelta)
135960
+ return conflictResult;
135961
+ return {
135962
+ ...conflictResult,
135963
+ events: resolveData2 === "none" ? conflictDelta.data.map((delta) => stripEventDataRefs(delta, resolveData2)) : conflictDelta.data,
135964
+ cursor: conflictDelta.cursor,
135965
+ hasMore: conflictDelta.hasMore
135966
+ };
135763
135967
  }
135764
135968
  const persistedHookData = event.eventData;
135765
135969
  hook = {
@@ -136546,7 +136750,7 @@ function createWorld$2(args) {
136546
136750
  const basedir = mergedConfig.dataDir;
136547
136751
  const hooksDir = path$3.join(basedir, "hooks");
136548
136752
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
136549
- const { HookSchema: HookSchema2 } = await import("./index-DDMGTwh_.js");
136753
+ const { HookSchema: HookSchema2 } = await import("./index-DshIaniU.js");
136550
136754
  await Promise.all(taggedHookFiles.map(async (hookFile) => {
136551
136755
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
136552
136756
  if (hook == null ? void 0 : hook.token) {
@@ -136729,8 +136933,8 @@ function requireGetVercelOidcToken() {
136729
136933
  }
136730
136934
  try {
136731
136935
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
136732
- await import("./token-util-D_gzpVW2.js").then((n) => n.t),
136733
- await import("./token-BSEhy2T4.js").then((n) => n.t)
136936
+ await import("./token-util-BMRcW3Qd.js").then((n) => n.t),
136937
+ await import("./token-DAVWictz.js").then((n) => n.t)
136734
136938
  ]);
136735
136939
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
136736
136940
  await refreshToken(options);
@@ -137293,7 +137497,7 @@ function requireDist() {
137293
137497
  return dist;
137294
137498
  }
137295
137499
  var distExports = requireDist();
137296
- const version = "5.0.0-beta.43";
137500
+ const version = "5.0.0-beta.44";
137297
137501
  const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
137298
137502
  dispatcher: void 0,
137299
137503
  streamDispatcher: void 0,
@@ -137665,6 +137869,33 @@ const WorkflowWsUrl = SemanticConvention("workflow.events.ws.url");
137665
137869
  const WorkflowWsRequestId = SemanticConvention("workflow.events.ws.req_id");
137666
137870
  const WorkflowWsReconnectAttempt = SemanticConvention("workflow.events.ws.reconnect_attempt");
137667
137871
  const REQUEST_TIMEOUT_MS = 6e4;
137872
+ const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
137873
+ "UND_ERR_INFO",
137874
+ "UND_ERR_REQ_RETRY",
137875
+ "UND_ERR_SOCKET",
137876
+ "UND_ERR_CONNECT",
137877
+ "UND_ERR_CONNECT_TIMEOUT",
137878
+ "UND_ERR_HEADERS_TIMEOUT",
137879
+ "UND_ERR_BODY_TIMEOUT",
137880
+ "UND_ERR_CLOSED",
137881
+ "ECONNRESET",
137882
+ "ECONNREFUSED",
137883
+ "ENOTFOUND",
137884
+ "EAI_AGAIN",
137885
+ "EPIPE",
137886
+ "ETIMEDOUT"
137887
+ ]);
137888
+ function getTransientTransportCode(error2) {
137889
+ let current = error2;
137890
+ for (let depth = 0; current && depth < 8; depth++) {
137891
+ const code2 = current.code;
137892
+ if (typeof code2 === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code2)) {
137893
+ return code2;
137894
+ }
137895
+ current = current.cause;
137896
+ }
137897
+ return void 0;
137898
+ }
137668
137899
  const getRequestTimeoutMs = () => envNumber("WORKFLOW_REQUEST_TIMEOUT_MS", REQUEST_TIMEOUT_MS, {
137669
137900
  integer: true,
137670
137901
  min: 1e4,
@@ -137798,10 +138029,10 @@ function recordClientSpanStatus(span, status) {
137798
138029
  }
137799
138030
  }
137800
138031
  async function instrumentedFetch(opts) {
137801
- const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService, timeoutMs = getRequestTimeoutMs(), signal: callerSignal, injectTraceContext: injectTraceContext2 = true, cacheBust = true, logLabel, buildError, spanName, attributes, durationAttribute, onTransportOutcome } = opts;
138032
+ const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService, timeoutMs = getRequestTimeoutMs(), signal: callerSignal, injectTraceContext: injectTraceContext2 = true, cacheBust = true, logLabel, buildError, spanName, attributes, durationAttribute, onTransportOutcome, deferTransportSuccessUntilBody = false, transportErrorCode = "TRANSPORT" } = opts;
137802
138033
  const label = logLabel ?? url2;
137803
138034
  return withHttpClientSpan({ method, url: url2, peerService, spanName, attributes }, async (span) => {
137804
- var _a3, _b2, _c2;
138035
+ var _a3, _b2, _c2, _d2, _e2;
137805
138036
  if (injectTraceContext2)
137806
138037
  await injectTraceContextIntoHeaders(headers2);
137807
138038
  if (cacheBust)
@@ -137839,15 +138070,36 @@ async function instrumentedFetch(opts) {
137839
138070
  const elapsed = Date.now() - start2;
137840
138071
  onTransportOutcome == null ? void 0 : onTransportOutcome(error2);
137841
138072
  if (error2 instanceof Error && (error2.name === "TimeoutError" || error2.name === "AbortError")) {
137842
- const timeoutError = new WorkflowWorldError(`${method} ${label} timed out after ${elapsed}ms`, { url: url2, cause: error2 });
137843
- span == null ? void 0 : span.setAttributes({ ...ErrorType("TIMEOUT") });
138073
+ const message2 = `${method} ${label} timed out after ${elapsed}ms`;
138074
+ const errorCode = transportErrorCode === "STREAM_ERROR" ? "STREAM_ERROR" : "TIMEOUT";
138075
+ const timeoutError = errorCode === "STREAM_ERROR" ? new StreamError(message2, { url: url2, cause: error2 }) : new WorkflowWorldError(message2, {
138076
+ url: url2,
138077
+ code: errorCode,
138078
+ cause: error2
138079
+ });
138080
+ span == null ? void 0 : span.setAttributes({ ...ErrorType(errorCode) });
137844
138081
  (_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, timeoutError);
137845
138082
  throw timeoutError;
137846
138083
  }
138084
+ const transportCode = getTransientTransportCode(error2);
138085
+ if (transportCode) {
138086
+ const message2 = `${method} ${label} transport failure after ${elapsed}ms (${transportCode})`;
138087
+ const errorCode = transportErrorCode === "STREAM_ERROR" ? "STREAM_ERROR" : "TRANSPORT";
138088
+ const transportError2 = errorCode === "STREAM_ERROR" ? new StreamError(message2, { url: url2, cause: error2 }) : new WorkflowWorldError(message2, {
138089
+ url: url2,
138090
+ code: errorCode,
138091
+ cause: error2
138092
+ });
138093
+ span == null ? void 0 : span.setAttributes({ ...ErrorType(errorCode) });
138094
+ (_b2 = span == null ? void 0 : span.recordException) == null ? void 0 : _b2.call(span, transportError2);
138095
+ throw transportError2;
138096
+ }
137847
138097
  throw error2;
137848
138098
  }
137849
138099
  const ms2 = Date.now() - start2;
137850
- onTransportOutcome == null ? void 0 : onTransportOutcome();
138100
+ if (response2.ok && !deferTransportSuccessUntilBody) {
138101
+ onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
138102
+ }
137851
138103
  httpLog(method, label, response2, ms2);
137852
138104
  recordClientSpanStatus(span, response2.status);
137853
138105
  if (durationAttribute)
@@ -137855,16 +138107,42 @@ async function instrumentedFetch(opts) {
137855
138107
  if (!response2.ok) {
137856
138108
  logCurlRepro(method, url2, headers2);
137857
138109
  if (buildError) {
137858
- const error3 = await buildError(response2);
137859
- (_b2 = span == null ? void 0 : span.recordException) == null ? void 0 : _b2.call(span, error3);
138110
+ let error3;
138111
+ try {
138112
+ error3 = await buildError(response2);
138113
+ } catch (cause) {
138114
+ const transportCode = getTransientTransportCode(cause);
138115
+ if (transportCode) {
138116
+ onTransportOutcome == null ? void 0 : onTransportOutcome(cause, response2);
138117
+ const message2 = `${method} ${label} response body transport failure (${transportCode})`;
138118
+ const mappedError = transportErrorCode === "STREAM_ERROR" ? new StreamError(message2, { url: url2, cause }) : new WorkflowWorldError(message2, {
138119
+ url: url2,
138120
+ code: "TRANSPORT",
138121
+ cause
138122
+ });
138123
+ span == null ? void 0 : span.setAttributes({ ...ErrorType(transportErrorCode) });
138124
+ (_c2 = span == null ? void 0 : span.recordException) == null ? void 0 : _c2.call(span, mappedError);
138125
+ throw mappedError;
138126
+ }
138127
+ onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
138128
+ throw cause;
138129
+ }
138130
+ onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
138131
+ (_d2 = span == null ? void 0 : span.recordException) == null ? void 0 : _d2.call(span, error3);
137860
138132
  throw error3;
137861
138133
  }
137862
- const text2 = await response2.text().catch(() => "");
138134
+ let text2 = "";
138135
+ try {
138136
+ text2 = await response2.text();
138137
+ onTransportOutcome == null ? void 0 : onTransportOutcome(void 0, response2);
138138
+ } catch (cause) {
138139
+ onTransportOutcome == null ? void 0 : onTransportOutcome(cause, response2);
138140
+ }
137863
138141
  const error2 = errorForResponse(response2.status, `${method} ${label} -> HTTP ${response2.status}: ${response2.statusText}${text2 ? ` ${text2}` : ""}${formatVercelDiagnostics(response2.headers)}`, {
137864
138142
  url: url2,
137865
138143
  retryAfter: parseRetryAfter(response2.headers.get("Retry-After"))
137866
138144
  });
137867
- (_c2 = span == null ? void 0 : span.recordException) == null ? void 0 : _c2.call(span, error2);
138145
+ (_e2 = span == null ? void 0 : span.recordException) == null ? void 0 : _e2.call(span, error2);
137868
138146
  throw error2;
137869
138147
  }
137870
138148
  return response2;
@@ -137873,34 +138151,6 @@ async function instrumentedFetch(opts) {
137873
138151
  const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
137874
138152
  const MAX_BODY_PARSE_RETRIES = 2;
137875
138153
  const BODY_PARSE_RETRY_BASE_MS = 100;
137876
- const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
137877
- "UND_ERR_REQ_RETRY",
137878
- "UND_ERR_SOCKET",
137879
- "UND_ERR_CONNECT",
137880
- "UND_ERR_CONNECT_TIMEOUT",
137881
- "UND_ERR_HEADERS_TIMEOUT",
137882
- "UND_ERR_BODY_TIMEOUT",
137883
- "UND_ERR_CLOSED",
137884
- "ECONNRESET",
137885
- "ECONNREFUSED",
137886
- "ENOTFOUND",
137887
- "EAI_AGAIN",
137888
- "EPIPE",
137889
- "ETIMEDOUT"
137890
- ]);
137891
- function getTransientTransportCode(error2) {
137892
- let current = error2;
137893
- for (let depth = 0; current != null && depth < 5; depth++) {
137894
- if (typeof current === "object" && "code" in current) {
137895
- const code2 = current.code;
137896
- if (typeof code2 === "string" && TRANSIENT_TRANSPORT_ERROR_CODES.has(code2)) {
137897
- return code2;
137898
- }
137899
- }
137900
- current = current == null ? void 0 : current.cause;
137901
- }
137902
- return void 0;
137903
- }
137904
138154
  const getWorkflowServerUrlOverride = () => process.env.VERCEL_WORKFLOW_SERVER_URL || "";
137905
138155
  const TEST_LIMIT_OVERRIDES_HEADER = "x-workflow-test-limit-overrides";
137906
138156
  const getTestLimitOverridesHeader = () => {
@@ -138146,9 +138396,94 @@ async function parseResponseBody(response2) {
138146
138396
  getDebugContext: () => `Content-Type: ${contentType}, ${text2.length} bytes, preview: ${createPreview(data)}`
138147
138397
  };
138148
138398
  }
138149
- function appendPagination(params, pagination) {
138150
- if (pagination == null ? void 0 : pagination.limit)
138399
+ const INVALID_ARGUMENT = "INVALID_ARGUMENT";
138400
+ function invalidArgument(method, field, detail) {
138401
+ return new WorkflowWorldError(`${method}: ${field} ${detail}`, {
138402
+ code: INVALID_ARGUMENT,
138403
+ field
138404
+ });
138405
+ }
138406
+ const ULID_BODY = "[01234567][0123456789ABCDEFGHJKMNPQRSTVWXYZ]{25}";
138407
+ const RUN_ID_PATTERN = new RegExp(`^wrun_${ULID_BODY}$`);
138408
+ const CORRELATION_ID_PATTERN = new RegExp(`^(?:step|hook|wait|attr)_${ULID_BODY}$`);
138409
+ const EVENT_ID_PATTERN = new RegExp(`^evnt_${ULID_BODY}$`);
138410
+ const STEP_ID_PATTERN = new RegExp(`^step_${ULID_BODY}$`);
138411
+ const HOOK_ID_PATTERN = new RegExp(`^hook_${ULID_BODY}$`);
138412
+ const WAIT_ID_PATTERN = new RegExp(`^wait_${ULID_BODY}$`);
138413
+ function assertPageLimit(method, limit, maxLimit) {
138414
+ if (!Number.isInteger(limit) || limit < 1 || limit > maxLimit) {
138415
+ throw invalidArgument(method, "pagination.limit", `must be an integer between 1 and ${maxLimit} (received ${limit})`);
138416
+ }
138417
+ }
138418
+ function assertRunId(method, runId) {
138419
+ if (!RUN_ID_PATTERN.test(runId)) {
138420
+ throw invalidArgument(method, "runId", `must be a workflow run id ('wrun_' followed by a ULID), received ${JSON.stringify(runId)}`);
138421
+ }
138422
+ }
138423
+ function assertCorrelationId(method, correlationId) {
138424
+ if (!CORRELATION_ID_PATTERN.test(correlationId)) {
138425
+ throw invalidArgument(method, "correlationId", `must be a step, hook, wait, or attribute id, received ${JSON.stringify(correlationId)}`);
138426
+ }
138427
+ }
138428
+ function assertEventId(method, eventId) {
138429
+ if (!EVENT_ID_PATTERN.test(eventId)) {
138430
+ throw invalidArgument(method, "eventId", `must be an event id ('evnt_' followed by a ULID), received ${JSON.stringify(eventId)}`);
138431
+ }
138432
+ }
138433
+ function assertStepId(method, stepId) {
138434
+ if (!STEP_ID_PATTERN.test(stepId)) {
138435
+ throw invalidArgument(method, "stepId", `must be a step id ('step_' followed by a ULID), received ${JSON.stringify(stepId)}`);
138436
+ }
138437
+ }
138438
+ function assertHookId(method, hookId) {
138439
+ if (!HOOK_ID_PATTERN.test(hookId)) {
138440
+ throw invalidArgument(method, "hookId", `must be a hook id ('hook_' followed by a ULID), received ${JSON.stringify(hookId)}`);
138441
+ }
138442
+ }
138443
+ function assertWaitId(method, waitId) {
138444
+ if (!WAIT_ID_PATTERN.test(waitId)) {
138445
+ throw invalidArgument(method, "waitId", `must be a wait id ('wait_' followed by a ULID), received ${JSON.stringify(waitId)}`);
138446
+ }
138447
+ }
138448
+ function assertAttributeFilters(method, attributes) {
138449
+ const entries = Object.entries(attributes);
138450
+ if (entries.length > ANALYTICS_MAX_ATTRIBUTE_FILTERS) {
138451
+ throw invalidArgument(method, "attributes", `may filter by at most ${ANALYTICS_MAX_ATTRIBUTE_FILTERS} pairs (received ${entries.length})`);
138452
+ }
138453
+ for (const [key, value] of entries) {
138454
+ if (!AttributeKeySchema.safeParse(key).success) {
138455
+ throw invalidArgument(method, "attributes", `key must be 1 to ${ATTRIBUTE_KEY_MAX_LENGTH} characters, received ${key.length} in ${JSON.stringify(key)}`);
138456
+ }
138457
+ if (!AttributeValueSchema.safeParse(value).success) {
138458
+ throw invalidArgument(method, "attributes", `value for ${JSON.stringify(key)} must be at most ${ATTRIBUTE_VALUE_MAX_BYTES} UTF-8 bytes (received ${new TextEncoder().encode(value).length})`);
138459
+ }
138460
+ }
138461
+ }
138462
+ function assertDateWindow(method, startTime, endTime) {
138463
+ if (startTime === void 0 && endTime === void 0)
138464
+ return;
138465
+ if (startTime === void 0 || endTime === void 0) {
138466
+ const given = startTime === void 0 ? "endTime" : "startTime";
138467
+ const missing = startTime === void 0 ? "startTime" : "endTime";
138468
+ throw invalidArgument(method, missing, `is required when ${given} is provided; supply both or neither`);
138469
+ }
138470
+ const start2 = new Date(startTime).getTime();
138471
+ const end = new Date(endTime).getTime();
138472
+ if (!Number.isFinite(start2)) {
138473
+ throw invalidArgument(method, "startTime", `must be a parseable datetime, received ${JSON.stringify(startTime)}`);
138474
+ }
138475
+ if (!Number.isFinite(end)) {
138476
+ throw invalidArgument(method, "endTime", `must be a parseable datetime, received ${JSON.stringify(endTime)}`);
138477
+ }
138478
+ if (start2 > end) {
138479
+ throw invalidArgument(method, "startTime", `must be before or equal to endTime (received startTime=${JSON.stringify(startTime)}, endTime=${JSON.stringify(endTime)})`);
138480
+ }
138481
+ }
138482
+ function appendPagination(method, params, pagination, maxLimit) {
138483
+ if ((pagination == null ? void 0 : pagination.limit) !== void 0) {
138484
+ assertPageLimit(method, pagination.limit, maxLimit);
138151
138485
  params.set("limit", pagination.limit.toString());
138486
+ }
138152
138487
  if (pagination == null ? void 0 : pagination.cursor)
138153
138488
  params.set("cursor", pagination.cursor);
138154
138489
  if (pagination == null ? void 0 : pagination.sortOrder)
@@ -138158,30 +138493,34 @@ function createQueryString(params) {
138158
138493
  const query = params.toString();
138159
138494
  return query ? `?${query}` : "";
138160
138495
  }
138161
- function normalizeEventIds(eventIds) {
138496
+ function normalizeEventIds(method, eventIds) {
138162
138497
  const uniqueEventIds = [...new Set(eventIds)];
138163
138498
  if (uniqueEventIds.length === 0) {
138164
- throw new RangeError("eventIds must contain at least one event ID");
138499
+ throw invalidArgument(method, "eventIds", "must contain at least one id");
138165
138500
  }
138166
138501
  if (uniqueEventIds.length > ANALYTICS_EVENTS_GET_MANY_LIMIT) {
138167
- throw new RangeError(`eventIds must contain at most ${ANALYTICS_EVENTS_GET_MANY_LIMIT} unique event IDs`);
138502
+ throw invalidArgument(method, "eventIds", `must contain at most ${ANALYTICS_EVENTS_GET_MANY_LIMIT} unique ids (received ${uniqueEventIds.length})`);
138168
138503
  }
138504
+ for (const eventId of uniqueEventIds)
138505
+ assertEventId(method, eventId);
138169
138506
  return uniqueEventIds;
138170
138507
  }
138171
- function appendAttributeListParams(searchParams, params) {
138172
- if (params.workflowName) {
138508
+ function appendAttributeListParams(method, searchParams, params) {
138509
+ assertDateWindow(method, params.startTime, params.endTime);
138510
+ if (params.workflowName !== void 0) {
138173
138511
  searchParams.set("workflowName", params.workflowName);
138174
138512
  }
138175
- if (params.startTime && params.endTime) {
138513
+ if (params.startTime !== void 0 && params.endTime !== void 0) {
138176
138514
  searchParams.set("startTime", params.startTime);
138177
138515
  searchParams.set("endTime", params.endTime);
138178
138516
  }
138179
- appendPagination(searchParams, params.pagination);
138517
+ appendPagination(method, searchParams, params.pagination, ANALYTICS_PAGE_LIMIT);
138180
138518
  }
138181
138519
  function createAnalytics(config2) {
138182
138520
  return {
138183
138521
  runs: {
138184
138522
  get(runId) {
138523
+ assertRunId("analytics.runs.get", runId);
138185
138524
  return makeRequest({
138186
138525
  endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}`,
138187
138526
  config: config2,
@@ -138189,21 +138528,23 @@ function createAnalytics(config2) {
138189
138528
  });
138190
138529
  },
138191
138530
  list(params = {}) {
138531
+ assertDateWindow("analytics.runs.list", params.startTime, params.endTime);
138192
138532
  const searchParams = new URLSearchParams();
138193
- if (params.workflowName) {
138533
+ if (params.workflowName !== void 0) {
138194
138534
  searchParams.set("workflowName", params.workflowName);
138195
138535
  }
138196
138536
  if (params.status) {
138197
138537
  searchParams.set("status", params.status);
138198
138538
  }
138199
- if (params.startTime && params.endTime) {
138539
+ if (params.startTime !== void 0 && params.endTime !== void 0) {
138200
138540
  searchParams.set("startTime", params.startTime);
138201
138541
  searchParams.set("endTime", params.endTime);
138202
138542
  }
138203
138543
  if (params.attributes && Object.keys(params.attributes).length > 0) {
138544
+ assertAttributeFilters("analytics.runs.list", params.attributes);
138204
138545
  searchParams.set("attributes", JSON.stringify(params.attributes));
138205
138546
  }
138206
- appendPagination(searchParams, params.pagination);
138547
+ appendPagination("analytics.runs.list", searchParams, params.pagination, ANALYTICS_PAGE_LIMIT);
138207
138548
  return makeRequest({
138208
138549
  endpoint: `/v2/analytics/runs${createQueryString(searchParams)}`,
138209
138550
  config: config2,
@@ -138214,7 +138555,7 @@ function createAnalytics(config2) {
138214
138555
  attributes: {
138215
138556
  list(params = {}) {
138216
138557
  const searchParams = new URLSearchParams();
138217
- appendAttributeListParams(searchParams, params);
138558
+ appendAttributeListParams("analytics.attributes.list", searchParams, params);
138218
138559
  return makeRequest({
138219
138560
  endpoint: `/v2/analytics/attributes${createQueryString(searchParams)}`,
138220
138561
  config: config2,
@@ -138224,6 +138565,8 @@ function createAnalytics(config2) {
138224
138565
  },
138225
138566
  steps: {
138226
138567
  get(runId, stepId) {
138568
+ assertRunId("analytics.steps.get", runId);
138569
+ assertStepId("analytics.steps.get", stepId);
138227
138570
  return makeRequest({
138228
138571
  endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/steps/${encodeURIComponent(stepId)}`,
138229
138572
  config: config2,
@@ -138231,8 +138574,9 @@ function createAnalytics(config2) {
138231
138574
  });
138232
138575
  },
138233
138576
  list(params) {
138577
+ assertRunId("analytics.steps.list", params.runId);
138234
138578
  const searchParams = new URLSearchParams();
138235
- appendPagination(searchParams, params.pagination);
138579
+ appendPagination("analytics.steps.list", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
138236
138580
  return makeRequest({
138237
138581
  endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/steps${createQueryString(searchParams)}`,
138238
138582
  config: config2,
@@ -138242,6 +138586,8 @@ function createAnalytics(config2) {
138242
138586
  },
138243
138587
  events: {
138244
138588
  get(runId, eventId) {
138589
+ assertRunId("analytics.events.get", runId);
138590
+ assertEventId("analytics.events.get", eventId);
138245
138591
  return makeRequest({
138246
138592
  endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/events/${encodeURIComponent(eventId)}`,
138247
138593
  config: config2,
@@ -138249,33 +138595,47 @@ function createAnalytics(config2) {
138249
138595
  });
138250
138596
  },
138251
138597
  getMany(runId, eventIds) {
138598
+ assertRunId("analytics.events.getMany", runId);
138252
138599
  return makeRequest({
138253
138600
  endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/events/get-many`,
138254
138601
  options: { method: "POST" },
138255
- data: { eventIds: normalizeEventIds(eventIds) },
138602
+ data: {
138603
+ eventIds: normalizeEventIds("analytics.events.getMany", eventIds)
138604
+ },
138256
138605
  config: config2,
138257
138606
  schema: AnalyticsEventSchema.array()
138258
138607
  });
138259
138608
  },
138260
138609
  list(params) {
138610
+ assertRunId("analytics.events.list", params.runId);
138261
138611
  const searchParams = new URLSearchParams();
138262
138612
  if (params.eventType) {
138263
138613
  searchParams.set("eventType", params.eventType);
138264
138614
  }
138265
- if (params.correlationId) {
138615
+ if (params.correlationId !== void 0) {
138616
+ assertCorrelationId("analytics.events.list", params.correlationId);
138266
138617
  searchParams.set("correlationId", params.correlationId);
138267
138618
  }
138268
- appendPagination(searchParams, params.pagination);
138619
+ appendPagination("analytics.events.list", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
138269
138620
  return makeRequest({
138270
138621
  endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/events${createQueryString(searchParams)}`,
138271
138622
  config: config2,
138272
138623
  schema: PaginatedResponseSchema(AnalyticsEventSchema)
138273
138624
  });
138274
138625
  },
138626
+ /**
138627
+ * @deprecated Use `list({ runId, correlationId })`. Kept as its own
138628
+ * implementation rather than delegating: `list` treats
138629
+ * `correlationId` as optional and skips an empty one, where this
138630
+ * method requires it, so a delegation would turn an empty id into an
138631
+ * unfiltered listing of the run.
138632
+ */
138275
138633
  listByCorrelationId(params) {
138634
+ assertRunId("analytics.events.listByCorrelationId", params.runId);
138635
+ assertCorrelationId("analytics.events.listByCorrelationId", params.correlationId);
138276
138636
  const searchParams = new URLSearchParams();
138277
138637
  searchParams.set("correlationId", params.correlationId);
138278
- appendPagination(searchParams, params.pagination);
138638
+ appendPagination("analytics.events.listByCorrelationId", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
138279
138639
  return makeRequest({
138280
138640
  endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/events${createQueryString(searchParams)}`,
138281
138641
  config: config2,
@@ -138285,8 +138645,10 @@ function createAnalytics(config2) {
138285
138645
  },
138286
138646
  hooks: {
138287
138647
  get(hookId, params) {
138648
+ assertHookId("analytics.hooks.get", hookId);
138288
138649
  const searchParams = new URLSearchParams();
138289
- if (params == null ? void 0 : params.runId) {
138650
+ if ((params == null ? void 0 : params.runId) !== void 0) {
138651
+ assertRunId("analytics.hooks.get", params.runId);
138290
138652
  searchParams.set("runId", params.runId);
138291
138653
  }
138292
138654
  return makeRequest({
@@ -138296,9 +138658,10 @@ function createAnalytics(config2) {
138296
138658
  });
138297
138659
  },
138298
138660
  list(params) {
138661
+ assertRunId("analytics.hooks.list", params.runId);
138299
138662
  const searchParams = new URLSearchParams();
138300
138663
  searchParams.set("runId", params.runId);
138301
- appendPagination(searchParams, params.pagination);
138664
+ appendPagination("analytics.hooks.list", searchParams, params.pagination, ANALYTICS_PAGE_LIMIT);
138302
138665
  return makeRequest({
138303
138666
  endpoint: `/v2/analytics/hooks${createQueryString(searchParams)}`,
138304
138667
  config: config2,
@@ -138308,6 +138671,8 @@ function createAnalytics(config2) {
138308
138671
  },
138309
138672
  waits: {
138310
138673
  get(runId, waitId) {
138674
+ assertRunId("analytics.waits.get", runId);
138675
+ assertWaitId("analytics.waits.get", waitId);
138311
138676
  return makeRequest({
138312
138677
  endpoint: `/v2/analytics/runs/${encodeURIComponent(runId)}/waits/${encodeURIComponent(waitId)}`,
138313
138678
  config: config2,
@@ -138315,11 +138680,12 @@ function createAnalytics(config2) {
138315
138680
  });
138316
138681
  },
138317
138682
  list(params) {
138683
+ assertRunId("analytics.waits.list", params.runId);
138318
138684
  const searchParams = new URLSearchParams();
138319
138685
  if (params.status) {
138320
138686
  searchParams.set("status", params.status);
138321
138687
  }
138322
- appendPagination(searchParams, params.pagination);
138688
+ appendPagination("analytics.waits.list", searchParams, params.pagination, ANALYTICS_RUN_SCOPED_PAGE_LIMIT);
138323
138689
  return makeRequest({
138324
138690
  endpoint: `/v2/analytics/runs/${encodeURIComponent(params.runId)}/waits${createQueryString(searchParams)}`,
138325
138691
  config: config2,
@@ -138654,7 +139020,7 @@ function createGetEncryptionKeyForRun(projectId, teamId, token, dispatcher2) {
138654
139020
  };
138655
139021
  }
138656
139022
  async function getDeadline() {
138657
- const { getDeadline: getDeadline2 } = await import("./index-jQkBA81b.js").then((n) => n.i);
139023
+ const { getDeadline: getDeadline2 } = await import("./index-dJuvq1GP.js").then((n) => n.i);
138658
139024
  return getDeadline2();
138659
139025
  }
138660
139026
  const WORKFLOW_SERVER_SERVICE = {
@@ -143607,7 +143973,7 @@ const wsEventsChannelForInvocation = (runId, config2) => {
143607
143973
  open() {
143608
143974
  if (!runId || !isWsEventsTransportEnabled())
143609
143975
  return;
143610
- claim = import("./ws-transport-DbDOLT7f.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
143976
+ claim = import("./ws-transport-Dv7yY5un.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
143611
143977
  },
143612
143978
  /**
143613
143979
  * Awaited, unlike the open: work scheduled after the handler returns is not
@@ -144335,7 +144701,7 @@ async function getStep(runId, stepId, params, config2) {
144335
144701
  }
144336
144702
  async function fetchV4(url2, init2, config2, opName, attributes) {
144337
144703
  const dispatcher2 = getEventsDispatcher(config2);
144338
- return instrumentedFetch({
144704
+ const response2 = await instrumentedFetch({
144339
144705
  method: init2.method,
144340
144706
  url: url2,
144341
144707
  headers: init2.headers,
@@ -144347,11 +144713,44 @@ async function fetchV4(url2, init2, config2, opName, attributes) {
144347
144713
  // service indefinitely, so without this every request routed onto it fails
144348
144714
  // until the compute instance is recycled. See noteEventsTransportOutcome.
144349
144715
  onTransportOutcome: (error2) => noteEventsTransportOutcome(dispatcher2, error2),
144716
+ deferTransportSuccessUntilBody: true,
144350
144717
  timeoutMs: null,
144718
+ transportErrorCode: "STREAM_ERROR",
144351
144719
  logLabel: opName,
144352
144720
  // Read the body as bytes, not text: a CBOR error body (the fence 412
144353
144721
  // carries event payloads back) does not survive a UTF-8 decode.
144354
- buildError: async (response2) => errorFromV4Response(response2.status, headersToRecord(response2.headers), new Uint8Array(await response2.arrayBuffer()), opName, url2)
144722
+ buildError: async (response3) => errorFromV4Response(response3.status, headersToRecord(response3.headers), new Uint8Array(await response3.arrayBuffer()), opName, url2)
144723
+ });
144724
+ if (!response2.body) {
144725
+ noteEventsTransportOutcome(dispatcher2);
144726
+ return response2;
144727
+ }
144728
+ const reader = response2.body.getReader();
144729
+ const body2 = new ReadableStream({
144730
+ async pull(controller) {
144731
+ try {
144732
+ const chunk = await reader.read();
144733
+ if (chunk.done) {
144734
+ noteEventsTransportOutcome(dispatcher2);
144735
+ controller.close();
144736
+ } else {
144737
+ controller.enqueue(chunk.value);
144738
+ }
144739
+ } catch (cause) {
144740
+ noteEventsTransportOutcome(dispatcher2, cause);
144741
+ const transportCode = getTransientTransportCode(cause);
144742
+ controller.error(transportCode ? new StreamError(`v4 ${opName}: response stream transport failure (${transportCode})`, { cause, url: url2 }) : cause);
144743
+ }
144744
+ },
144745
+ cancel(reason) {
144746
+ noteEventsTransportOutcome(dispatcher2);
144747
+ return reader.cancel(reason);
144748
+ }
144749
+ });
144750
+ return new Response(body2, {
144751
+ status: response2.status,
144752
+ statusText: response2.statusText,
144753
+ headers: response2.headers
144355
144754
  });
144356
144755
  }
144357
144756
  const EVENT_ID_HEADER = "x-wf-event-id";
@@ -144678,6 +145077,8 @@ async function decodeCreateEventResponse(response2, eventType) {
144678
145077
  try {
144679
145078
  bodyBytes = new Uint8Array(await response2.arrayBuffer());
144680
145079
  } catch (cause) {
145080
+ if (StreamError.is(cause))
145081
+ throw cause;
144681
145082
  throw new WorkflowWorldError("v4 createEvent: failed to read response body", { code: "TRANSPORT", cause });
144682
145083
  }
144683
145084
  if (bodyBytes.byteLength === 0) {
@@ -144787,7 +145188,7 @@ function wsReplyStatus(reply, endpoint) {
144787
145188
  return status;
144788
145189
  }
144789
145190
  async function postEventFrameOverWs(input, config2) {
144790
- const { resolveWsTransport } = await import("./ws-transport-DbDOLT7f.js");
145191
+ const { resolveWsTransport } = await import("./ws-transport-Dv7yY5un.js");
144791
145192
  const { runId } = input;
144792
145193
  const resolved = resolveWsTransport(runId, config2);
144793
145194
  if (!resolved)
@@ -144876,14 +145277,21 @@ async function getEventV4(runId, eventId, remoteRefBehavior, config2) {
144876
145277
  throw new Error(`v4 getEvent: expected ${V4_FRAME_CONTENT_TYPE}, got ${contentType ?? "(none)"}`);
144877
145278
  }
144878
145279
  const chunks = response2.body;
144879
- for await (const frame2 of decodeFrames(chunks)) {
144880
- if (frame2.meta._error === 1) {
144881
- throw streamErrorFrameToError(frame2.meta, "getEvent");
145280
+ try {
145281
+ for await (const frame2 of decodeFrames(chunks)) {
145282
+ if (frame2.meta._error === 1) {
145283
+ throw streamErrorFrameToError(frame2.meta, "getEvent");
145284
+ }
145285
+ if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
145286
+ throw new Error("v4 getEvent: unexpected control frame");
145287
+ }
145288
+ return decodeEventFrame(frame2);
144882
145289
  }
144883
- if (Object.keys(frame2.meta).some((key) => key.startsWith("_"))) {
144884
- throw new Error("v4 getEvent: unexpected control frame");
145290
+ } catch (cause) {
145291
+ if (cause instanceof IncompleteFrameError && StreamError.is(cause.cause)) {
145292
+ throw cause.cause;
144885
145293
  }
144886
- return decodeEventFrame(frame2);
145294
+ throw cause;
144887
145295
  }
144888
145296
  throw new Error(`v4 getEvent: empty frame stream for ${eventId}`);
144889
145297
  }
@@ -144953,6 +145361,9 @@ async function consumeEventFrameStream(response2, opName, replayEventObserver) {
144953
145361
  if (cause instanceof ReplayEventObserverError || CorruptedEventLogError.is(cause) || WorkflowWorldError.is(cause)) {
144954
145362
  throw cause;
144955
145363
  }
145364
+ if (cause instanceof IncompleteFrameError && StreamError.is(cause.cause)) {
145365
+ return partialEventFrameStream(events2, cause.cause);
145366
+ }
144956
145367
  if (!(cause instanceof IncompleteFrameError)) {
144957
145368
  throw new WorkflowWorldError(`v4 ${opName}: invalid event frame stream`, {
144958
145369
  code: "SCHEMA_VALIDATION",
@@ -145735,21 +146146,28 @@ function streamSpanAttributes(args) {
145735
146146
  }
145736
146147
  async function createStreamReadError(response2) {
145737
146148
  const fallback = `Failed to fetch stream: ${response2.status}`;
145738
- if (response2.status !== 410)
145739
- return new Error(fallback);
146149
+ if (response2.status !== 410) {
146150
+ return new StreamError(fallback, { status: response2.status });
146151
+ }
145740
146152
  try {
145741
146153
  const body2 = await response2.json();
145742
146154
  return errorForResponse(response2.status, typeof body2.message === "string" ? body2.message : fallback, { code: body2.error, details: body2.details });
145743
146155
  } catch {
145744
- return new Error(fallback);
146156
+ return new StreamError(fallback, { status: response2.status });
145745
146157
  }
145746
146158
  }
146159
+ function toStreamError(message2, cause) {
146160
+ if (WorkflowWorldError.is(cause) || EntityConflictError.is(cause) || RunExpiredError.is(cause) || StreamError.is(cause) || StreamExpiredError.is(cause) || TooEarlyError.is(cause) || ThrottleError.is(cause) || PreconditionFailedError.is(cause)) {
146161
+ return cause;
146162
+ }
146163
+ return new StreamError(message2, { cause });
146164
+ }
145747
146165
  function createStreamRequestError(operation, url2, response2, text2) {
145748
146166
  const context = [
145749
146167
  `PUT ${url2.origin}${url2.pathname}`,
145750
146168
  ...getVercelDiagnostics(response2.headers)
145751
146169
  ];
145752
- return new Error(`Stream ${operation} failed: HTTP ${response2.status} (${context.join("; ")}): ${text2}`);
146170
+ return new StreamError(`Stream ${operation} failed: HTTP ${response2.status} (${context.join("; ")}): ${text2}`, { url: url2.toString(), status: response2.status });
145753
146171
  }
145754
146172
  function encodeMultiChunks(chunks) {
145755
146173
  const encoder2 = new TextEncoder();
@@ -145798,6 +146216,7 @@ function createStreamer(config2) {
145798
146216
  headers: httpConfig.headers,
145799
146217
  dispatcher: getStreamDispatcher(config2),
145800
146218
  timeoutMs: null,
146219
+ transportErrorCode: "STREAM_ERROR",
145801
146220
  logLabel: url2.pathname,
145802
146221
  spanName: "workflow.stream.write",
145803
146222
  durationAttribute: "workflow.stream.write.chunk_rtt",
@@ -145828,6 +146247,7 @@ function createStreamer(config2) {
145828
146247
  headers: httpConfig.headers,
145829
146248
  dispatcher: getStreamDispatcher(config2),
145830
146249
  timeoutMs: null,
146250
+ transportErrorCode: "STREAM_ERROR",
145831
146251
  logLabel: url2.pathname,
145832
146252
  spanName: "workflow.stream.write",
145833
146253
  durationAttribute: "workflow.stream.write.chunk_rtt",
@@ -145856,6 +146276,7 @@ function createStreamer(config2) {
145856
146276
  // 503s with the stream left durably closing.
145857
146277
  dispatcher: getStreamCloseDispatcher(config2),
145858
146278
  timeoutMs: null,
146279
+ transportErrorCode: "STREAM_ERROR",
145859
146280
  logLabel: url2.pathname,
145860
146281
  spanName: "workflow.stream.write",
145861
146282
  durationAttribute: "workflow.stream.write.chunk_rtt",
@@ -145881,6 +146302,7 @@ function createStreamer(config2) {
145881
146302
  headers: httpConfig.headers,
145882
146303
  dispatcher: void 0,
145883
146304
  timeoutMs: null,
146305
+ transportErrorCode: "STREAM_ERROR",
145884
146306
  logLabel: url2.pathname,
145885
146307
  spanName: "workflow.stream.read.connect",
145886
146308
  attributes: streamSpanAttributes({
@@ -145892,7 +146314,9 @@ function createStreamer(config2) {
145892
146314
  buildError: createStreamReadError
145893
146315
  });
145894
146316
  if (!response2.body) {
145895
- throw new Error("No response body for stream");
146317
+ throw new StreamError("No response body for stream", {
146318
+ url: url2.toString()
146319
+ });
145896
146320
  }
145897
146321
  return response2.body;
145898
146322
  },
@@ -145906,19 +146330,27 @@ function createStreamer(config2) {
145906
146330
  }
145907
146331
  const qs = params.toString();
145908
146332
  const endpoint = `/v2/runs/${encodeURIComponent(runId)}/streams/${encodeURIComponent(name2)}/chunks${qs ? `?${qs}` : ""}`;
145909
- return makeRequest({
145910
- endpoint,
145911
- config: config2,
145912
- schema: StreamChunksResponseSchema
145913
- });
146333
+ try {
146334
+ return await makeRequest({
146335
+ endpoint,
146336
+ config: config2,
146337
+ schema: StreamChunksResponseSchema
146338
+ });
146339
+ } catch (cause) {
146340
+ throw toStreamError(`Failed to read stream chunks for ${name2}`, cause);
146341
+ }
145914
146342
  },
145915
146343
  async getInfo(runId, name2) {
145916
146344
  const endpoint = `/v2/runs/${encodeURIComponent(runId)}/streams/${encodeURIComponent(name2)}/info`;
145917
- return makeRequest({
145918
- endpoint,
145919
- config: config2,
145920
- schema: StreamInfoResponseSchema
145921
- });
146345
+ try {
146346
+ return await makeRequest({
146347
+ endpoint,
146348
+ config: config2,
146349
+ schema: StreamInfoResponseSchema
146350
+ });
146351
+ } catch (cause) {
146352
+ throw toStreamError(`Failed to read stream info for ${name2}`, cause);
146353
+ }
145922
146354
  },
145923
146355
  async list(runId) {
145924
146356
  const httpConfig = await getHttpConfig(config2);
@@ -145929,10 +146361,18 @@ function createStreamer(config2) {
145929
146361
  headers: httpConfig.headers,
145930
146362
  dispatcher: void 0,
145931
146363
  timeoutMs: null,
146364
+ transportErrorCode: "STREAM_ERROR",
145932
146365
  logLabel: url2.pathname,
145933
- buildError: (res) => new Error(`Failed to list streams: ${res.status}`)
146366
+ buildError: (res) => new StreamError(`Failed to list streams: ${res.status}`, {
146367
+ url: url2.toString(),
146368
+ status: res.status
146369
+ })
145934
146370
  });
145935
- return await response2.json();
146371
+ try {
146372
+ return await response2.json();
146373
+ } catch (cause) {
146374
+ throw toStreamError("Failed to parse stream list response", cause);
146375
+ }
145936
146376
  }
145937
146377
  }
145938
146378
  };
@@ -146115,7 +146555,7 @@ globalSingleton("@workflow/core//devServerPort", 1, () => ({
146115
146555
  inFlight: void 0
146116
146556
  }));
146117
146557
  function waitUntil(promise2) {
146118
- void import("./index-jQkBA81b.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
146558
+ void import("./index-dJuvq1GP.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
146119
146559
  waitUntil2(promise2);
146120
146560
  });
146121
146561
  }
@@ -149694,10 +150134,7 @@ const _Run = class _Run {
149694
150134
  const { ops = [], global: global2 = globalThis, startIndex, namespace: namespace2 } = options;
149695
150135
  const name2 = getWorkflowRunStreamId(this.runId, namespace2);
149696
150136
  const encryptionKey = __privateMethod(this, _Run_instances, getEncryptionKeyLazily_fn).call(this);
149697
- const stream = getExternalRevivers(global2, ops, this.runId, encryptionKey).ReadableStream({
149698
- name: name2,
149699
- startIndex
149700
- });
150137
+ const stream = getRunReadableStream(global2, ops, this.runId, name2, startIndex, encryptionKey);
149701
150138
  const worldPromise = __privateGet(this, _Run_instances, lazyWorldPromise_get);
149702
150139
  const runId = this.runId;
149703
150140
  return Object.assign(stream, {
@@ -149737,9 +150174,9 @@ getEncryptionKey_fn = function(run2) {
149737
150174
  return __privateGet(this, _encryptionKeyPromise);
149738
150175
  };
149739
150176
  /**
149740
- * Defer fetching the run and its encryption key until serialized stream data
149741
- * is actually read. An empty or metadata-only stream must not start an
149742
- * unobserved run lookup.
150177
+ * Defers fetching the run and its encryption key until a readable is first
150178
+ * consumed. The first pull prefetches it so an encrypted first frame can join
150179
+ * the lookup; this also applies to an empty consumed stream.
149743
150180
  * @internal
149744
150181
  */
149745
150182
  getEncryptionKeyLazily_fn = function() {
@@ -150312,36 +150749,6 @@ async function fetchRun(worldEnv, runId, resolveData = "all") {
150312
150749
  });
150313
150750
  }
150314
150751
  }
150315
- async function fetchSteps(worldEnv, runId, params) {
150316
- const { cursor, sortOrder = "asc", limit = 100 } = params;
150317
- try {
150318
- const world = await getWorldFromEnv(worldEnv);
150319
- const result = world.analytics ? await world.analytics.steps.list({
150320
- runId,
150321
- pagination: { cursor, limit, sortOrder }
150322
- }) : await world.steps.list({
150323
- runId,
150324
- pagination: { cursor, limit, sortOrder },
150325
- resolveData: "none"
150326
- });
150327
- return createResponse({
150328
- // StepWithoutData has undefined input/output, but after hydration the structure is compatible
150329
- data: result.data,
150330
- cursor: result.cursor ?? void 0,
150331
- hasMore: result.hasMore,
150332
- pageInfo: getPageInfo(result)
150333
- });
150334
- } catch (error2) {
150335
- return createServerActionError(
150336
- error2,
150337
- "world.steps.list",
150338
- {
150339
- runId,
150340
- ...params
150341
- }
150342
- );
150343
- }
150344
- }
150345
150752
  async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
150346
150753
  try {
150347
150754
  const world = await getWorldFromEnv(worldEnv);
@@ -150355,39 +150762,10 @@ async function fetchStep(worldEnv, runId, stepId, resolveData = "all") {
150355
150762
  });
150356
150763
  }
150357
150764
  }
150358
- function analyticsEventToEvent(event) {
150359
- const eventData = {
150360
- ...event.stepName ? { stepName: event.stepName } : {},
150361
- ...event.resumeAt ? { resumeAt: event.resumeAt } : {},
150362
- ...event.retryAfter ? { retryAfter: event.retryAfter } : {}
150363
- };
150364
- const base = {
150365
- runId: event.runId,
150366
- eventId: event.eventId,
150367
- eventType: event.eventType,
150368
- createdAt: event.createdAt,
150369
- ...event.correlationId ? { correlationId: event.correlationId } : {},
150370
- ...event.specVersion !== void 0 ? { specVersion: event.specVersion } : {},
150371
- ...Object.keys(eventData).length > 0 ? { eventData } : {}
150372
- };
150373
- return base;
150374
- }
150375
150765
  async function fetchEvents(worldEnv, runId, params) {
150376
150766
  const { cursor, sortOrder = "asc", limit = 1e3, withData = false } = params;
150377
150767
  try {
150378
150768
  const world = await getWorldFromEnv(worldEnv);
150379
- if (world.analytics && !withData) {
150380
- const result2 = await world.analytics.events.list({
150381
- runId,
150382
- pagination: { cursor, limit, sortOrder }
150383
- });
150384
- return createResponse({
150385
- data: result2.data.map(analyticsEventToEvent),
150386
- cursor: result2.cursor ?? void 0,
150387
- hasMore: result2.hasMore,
150388
- pageInfo: getPageInfo(result2)
150389
- });
150390
- }
150391
150769
  const result = await world.events.list({
150392
150770
  runId,
150393
150771
  pagination: { cursor, limit, sortOrder },
@@ -150433,19 +150811,6 @@ async function fetchEventsByCorrelationId(worldEnv, correlationId, params) {
150433
150811
  } = params;
150434
150812
  try {
150435
150813
  const world = await getWorldFromEnv(worldEnv);
150436
- if (world.analytics && !withData) {
150437
- const result2 = await world.analytics.events.listByCorrelationId({
150438
- correlationId,
150439
- runId,
150440
- pagination: { cursor, limit, sortOrder }
150441
- });
150442
- return createResponse({
150443
- data: result2.data.map(analyticsEventToEvent),
150444
- cursor: result2.cursor ?? void 0,
150445
- hasMore: result2.hasMore,
150446
- pageInfo: getPageInfo(result2)
150447
- });
150448
- }
150449
150814
  const result = await world.events.listByCorrelationId({
150450
150815
  correlationId,
150451
150816
  runId,
@@ -171936,7 +172301,7 @@ function BreadcrumbSeparator({
171936
172301
  }
171937
172302
  const INITIAL_PAGE_SIZE = 100;
171938
172303
  const LOAD_MORE_PAGE_SIZE = 100;
171939
- const MAX_CORRELATION_SEARCH_PAGES = 30;
172304
+ const MAX_CORRELATION_SEARCH_PAGES = 5;
171940
172305
  function useEventsListData(env2, runId, options = {}) {
171941
172306
  const { sortOrder = "asc", encryptionKey, enabled = true } = options;
171942
172307
  const [events2, setEvents] = reactExports.useState([]);
@@ -172874,7 +173239,6 @@ const route2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
172874
173239
  const handlers = {
172875
173240
  fetchRuns: (p2) => fetchRuns(p2.worldEnv ?? {}, p2.params ?? {}),
172876
173241
  fetchRun: (p2) => fetchRun(p2.worldEnv ?? {}, p2.runId, p2.resolveData),
172877
- fetchSteps: (p2) => fetchSteps(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
172878
173242
  fetchStep: (p2) => fetchStep(p2.worldEnv ?? {}, p2.runId, p2.stepId, p2.resolveData),
172879
173243
  fetchEvents: (p2) => fetchEvents(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
172880
173244
  fetchEvent: (p2) => fetchEvent(p2.worldEnv ?? {}, p2.runId, p2.eventId, p2.resolveData),
@@ -173028,7 +173392,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
173028
173392
  __proto__: null,
173029
173393
  loader
173030
173394
  }, Symbol.toStringTag, { value: "Module" }));
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 };
173395
+ 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-qx_45_fH.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/mermaid-3ZIDBTTL-BKwl_LgA.js", "/assets/loader-circle-BX6ycuOI.js", "/assets/arrow-up-right-CSovqivK.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-BbyW_T74.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-C-1D0sAn.js", "/assets/mermaid-3ZIDBTTL-BKwl_LgA.js", "/assets/loader-circle-BX6ycuOI.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-BoGFG1Fe.js", "imports": ["/assets/index-PFjW8YjQ.js", "/assets/workflow-graph-viewer-C-1D0sAn.js", "/assets/mermaid-3ZIDBTTL-BKwl_LgA.js", "/assets/arrow-up-right-CSovqivK.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-34c486ef.js", "version": "34c486ef", "sri": void 0 };
173032
173396
  const assetsBuildDirectory = "build/client";
173033
173397
  const basename = "/";
173034
173398
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
@@ -173237,147 +173601,150 @@ function createFetchHandler(basename2 = "/") {
173237
173601
  return (request2) => handler(request2, loadContext);
173238
173602
  }
173239
173603
  export {
173240
- SPEC_VERSION_SUPPORTS_ATTRIBUTES as $,
173604
+ SPEC_VERSION_CURRENT as $,
173241
173605
  ANALYTICS_EVENTS_GET_MANY_LIMIT as A,
173242
173606
  BULK_CANCEL_MAX_RUN_IDS as B,
173243
173607
  CHILD_ENTITY_CREATION_EVENT_TYPES as C,
173244
173608
  DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
173245
173609
  EVENT_ID_BODY_LENGTH as E,
173246
173610
  FIRST_EVENT_SLOT as F,
173247
- HealthCheckPayloadSchema as G,
173611
+ HOOK_LIFECYCLE_EVENT_TYPES as G,
173248
173612
  HookSchema as H,
173249
- HookCreatedEventSchema as I,
173250
- HookResumeCapabilitiesSchema as J,
173251
- NODE_HTTP_DEFAULT as K,
173252
- LegacySerializedDataSchemaV1 as L,
173253
- MessageId as M,
173613
+ HOOK_RESUME_DEDUP_VERSION as I,
173614
+ HOOK_RESUME_INPUT_VERSION as J,
173615
+ HealthCheckPayloadSchema as K,
173616
+ HookCreatedEventSchema as L,
173617
+ HookResumeCapabilitiesSchema as M,
173254
173618
  Nt as N,
173255
- NODE_HTTP_ENV_VAR as O,
173256
- PARENT_RUN_ID_ATTRIBUTE as P,
173257
- PaginatedResponseSchema as Q,
173258
- QueuePayloadSchema as R,
173259
- QueuePrefix as S,
173260
- RESERVED_ATTRIBUTE_KEY_PREFIX as T,
173261
- ROOT_RUN_ID_ATTRIBUTE as U,
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 _,
173268
- ATTRIBUTE_KEY_MAX_LENGTH as a,
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,
173333
- ATTRIBUTE_MAX_PER_RUN as b,
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,
173359
- ATTRIBUTE_VALUE_MAX_BYTES as c,
173360
- AnalyticsAttributeKeySchema as d,
173361
- AnalyticsEventSchema as e,
173362
- AnalyticsHookSchema as f,
173363
- AnalyticsRunSchema as g,
173364
- AnalyticsStepSchema as h,
173365
- AnalyticsWaitSchema as i,
173366
- AttributeChangeSchema as j,
173367
- AttributeChangesSchema as k,
173368
- AttributeKeySchema as l,
173369
- AttributeValidationError as m,
173370
- AttributeValueSchema as n,
173371
- BaseEventSchema as o,
173372
- BulkCancelWorkflowRunResultSchema as p,
173373
- BulkCancelWorkflowRunsRequestSchema as q,
173374
- BulkCancelWorkflowRunsResultSchema as r,
173375
- DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as s,
173376
- EVENT_ID_PREFIX as t,
173377
- EventSchema as u,
173378
- EventTypeSchema as v,
173379
- HOOK_EVENTS_REQUIRING_EXISTENCE as w,
173380
- HOOK_LIFECYCLE_EVENT_TYPES as x,
173381
- HOOK_RESUME_DEDUP_VERSION as y,
173382
- HOOK_RESUME_INPUT_VERSION as z
173619
+ LegacySerializedDataSchemaV1 as O,
173620
+ MessageId as P,
173621
+ NODE_HTTP_DEFAULT as Q,
173622
+ NODE_HTTP_ENV_VAR as R,
173623
+ PARENT_RUN_ID_ATTRIBUTE as S,
173624
+ PaginatedResponseSchema as T,
173625
+ QueuePayloadSchema as U,
173626
+ QueuePrefix as V,
173627
+ RESERVED_ATTRIBUTE_KEY_PREFIX as W,
173628
+ ROOT_RUN_ID_ATTRIBUTE as X,
173629
+ RUN_ENTITY_KEY as Y,
173630
+ RunInputSchema as Z,
173631
+ SEALED_LOG_ENV_VAR as _,
173632
+ ANALYTICS_MAX_ATTRIBUTE_FILTERS as a,
173633
+ workflowRunIdSchema as a$,
173634
+ SPEC_VERSION_LEGACY as a0,
173635
+ SPEC_VERSION_MAX_SUPPORTED as a1,
173636
+ SPEC_VERSION_SUPPORTS_ATTRIBUTES as a2,
173637
+ SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as a3,
173638
+ SPEC_VERSION_SUPPORTS_COMPRESSION as a4,
173639
+ SPEC_VERSION_SUPPORTS_SEALED_LOG as a5,
173640
+ SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as a6,
173641
+ STEP_EVENT_TYPES as a7,
173642
+ SerializedDataSchema as a8,
173643
+ StepSchema as a9,
173644
+ getMaxEventsPerRun as aA,
173645
+ getQueueTopicPrefix as aB,
173646
+ isChildEntityCreationEvent as aC,
173647
+ isChildEntityCreationEventType as aD,
173648
+ isHookEventRequiringExistence as aE,
173649
+ isHookLifecycleEventType as aF,
173650
+ isLegacySpecVersion as aG,
173651
+ isNodeHttpEnabled as aH,
173652
+ isSealedNoopEvent$1 as aI,
173653
+ isSlotBody as aJ,
173654
+ isSlotEventId as aK,
173655
+ isStepEventType as aL,
173656
+ isTerminalRunEventType as aM,
173657
+ isTerminalStepEventType as aN,
173658
+ isTerminalStepStatus as aO,
173659
+ isTerminalWorkflowRunStatus as aP,
173660
+ isWaitEventType as aQ,
173661
+ mintedSpecVersion as aR,
173662
+ parseQueueName as aS,
173663
+ reenqueueActiveRuns as aT,
173664
+ requiresNewerWorld as aU,
173665
+ resolveQueueNamespace as aV,
173666
+ slotToEventId as aW,
173667
+ stripEventDataRefs as aX,
173668
+ ulidToDate as aY,
173669
+ validateAttributeChanges as aZ,
173670
+ validateUlidTimestamp as a_,
173671
+ StepStatusSchema as aa,
173672
+ StructuredErrorSchema as ab,
173673
+ TERMINAL_EVENT_CLASSES as ac,
173674
+ TERMINAL_RUN_EVENT_TYPES as ad,
173675
+ TERMINAL_STEP_EVENT_TYPES as ae,
173676
+ TERMINAL_STEP_STATUSES as af,
173677
+ TERMINAL_WORKFLOW_RUN_STATUSES as ag,
173678
+ TerminalRunEventTypeSchema as ah,
173679
+ TerminalStepStatusSchema as ai,
173680
+ TerminalWorkflowRunStatusSchema as aj,
173681
+ ValidQueueName as ak,
173682
+ WAIT_EVENT_TYPES as al,
173683
+ WaitSchema as am,
173684
+ WaitStatusSchema as an,
173685
+ WorkflowInvokePayloadSchema as ao,
173686
+ WorkflowRunBaseSchema as ap,
173687
+ WorkflowRunSchema as aq,
173688
+ WorkflowRunStatusSchema as ar,
173689
+ applyAttributeChanges as as,
173690
+ classifyEntityEvent as at,
173691
+ entityEventClass as au,
173692
+ envFlag as av,
173693
+ envNumber as aw,
173694
+ eventIdToSlot as ax,
173695
+ getEventDataPayloadField as ay,
173696
+ getEventDataRefFields as az,
173697
+ ANALYTICS_PAGE_LIMIT as b,
173698
+ reactExports as b0,
173699
+ R as b1,
173700
+ Ks as b2,
173701
+ jsxRuntimeExports as b3,
173702
+ Qe as b4,
173703
+ registerZstdDecoder as b5,
173704
+ isWsEventsTransportEnabled as b6,
173705
+ debugLog as b7,
173706
+ getHttpUrl as b8,
173707
+ globalSingleton as b9,
173708
+ version as ba,
173709
+ getHttpConfig as bb,
173710
+ headersToRecord as bc,
173711
+ getRequestTimeoutMs as bd,
173712
+ injectTraceContextIntoHeaders as be,
173713
+ withHttpClientSpan as bf,
173714
+ ErrorType as bg,
173715
+ WorkflowWsReconnectAttempt as bh,
173716
+ NetworkProtocolName as bi,
173717
+ WorkflowEventsTransport as bj,
173718
+ distExports as bk,
173719
+ decodeFrames as bl,
173720
+ getDefaultExportFromCjs as bm,
173721
+ requireTokenUtil as bn,
173722
+ requireTokenError as bo,
173723
+ getAugmentedNamespace as bp,
173724
+ app as bq,
173725
+ createFetchHandler as br,
173726
+ ANALYTICS_RUN_SCOPED_PAGE_LIMIT as c,
173727
+ ATTRIBUTE_KEY_MAX_LENGTH as d,
173728
+ ATTRIBUTE_MAX_PER_RUN as e,
173729
+ ATTRIBUTE_VALUE_MAX_BYTES as f,
173730
+ AnalyticsAttributeKeySchema as g,
173731
+ AnalyticsEventSchema as h,
173732
+ AnalyticsHookSchema as i,
173733
+ AnalyticsRunSchema as j,
173734
+ AnalyticsStepSchema as k,
173735
+ AnalyticsWaitSchema as l,
173736
+ AttributeChangeSchema as m,
173737
+ AttributeChangesSchema as n,
173738
+ AttributeKeySchema as o,
173739
+ AttributeValidationError as p,
173740
+ AttributeValueSchema as q,
173741
+ BaseEventSchema as r,
173742
+ BulkCancelWorkflowRunResultSchema as s,
173743
+ BulkCancelWorkflowRunsRequestSchema as t,
173744
+ BulkCancelWorkflowRunsResultSchema as u,
173745
+ DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS as v,
173746
+ EVENT_ID_PREFIX as w,
173747
+ EventSchema as x,
173748
+ EventTypeSchema as y,
173749
+ HOOK_EVENTS_REQUIRING_EXISTENCE as z
173383
173750
  };