@workflow/web 5.0.4 → 5.0.5

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 (21) hide show
  1. package/build/client/assets/{arrow-up-right-ychoyK1y.js → arrow-up-right-BjmInfWj.js} +1 -1
  2. package/build/client/assets/{highlighted-body-B3W2YXNL-C53ps5L5.js → highlighted-body-B3W2YXNL-Fxz5Vhrs.js} +1 -1
  3. package/build/client/assets/{home-C3xDSPLC.js → home-Cj8BA1xg.js} +3 -3
  4. package/build/client/assets/{loader-circle-BaPqCMKN.js → loader-circle-BHf0PB8D.js} +1 -1
  5. package/build/client/assets/{manifest-4e8be598.js → manifest-9875bf74.js} +1 -1
  6. package/build/client/assets/{mermaid-3ZIDBTTL-COEB4Hc6.js → mermaid-3ZIDBTTL-C-jkx8xu.js} +73 -42
  7. package/build/client/assets/{root-DixDz_si.js → root-D1LRhSwl.js} +3 -3
  8. package/build/client/assets/{run-detail-CEQc0q3W.js → run-detail-L1jBcQcp.js} +3 -3
  9. package/build/client/assets/{workflow-graph-viewer-B9ovZj-2.js → workflow-graph-viewer-BRI-aUt7.js} +1 -1
  10. package/build/client/assets/{zstd-browser-decoder-D9w7uXpQ.js → zstd-browser-decoder-HGSvkFdF.js} +1 -1
  11. package/build/server/assets/{app-B50FKpUW.js → app-C7EyOacb.js} +561 -467
  12. package/build/server/assets/{highlighted-body-B3W2YXNL-DwfdU2_m.js → highlighted-body-B3W2YXNL-99nXCMDQ.js} +1 -1
  13. package/build/server/assets/{index-C3Gx8HYZ.js → index-CI1MEtXX.js} +1 -1
  14. package/build/server/assets/{index-D1YkUiuC.js → index-TQ324kzl.js} +2 -2
  15. package/build/server/assets/{mermaid-3ZIDBTTL-koYqT7Zj.js → mermaid-3ZIDBTTL-Csd1n701.js} +1 -1
  16. package/build/server/assets/{token-DbFnZp4-.js → token-C7Y4VFl0.js} +1 -1
  17. package/build/server/assets/{token-util-BXkc19cz.js → token-util-DCNDhnc8.js} +1 -1
  18. package/build/server/assets/{wrapper-BC7AidWM.js → wrapper-CA2LUUpa.js} +2 -2
  19. package/build/server/assets/{zstd-browser-decoder-ClonRoMz.js → zstd-browser-decoder-BJ5qrMmm.js} +1 -1
  20. package/build/server/index.js +1 -1
  21. package/package.json +4 -4
@@ -13,7 +13,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
13
13
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
16
- var _a2, _b, _c, _d, _listeners, _onabort, _reader, _worldPromise, _Run_instances, lazyWorldPromise_get, _encryptionKeyPromise, _resilientStart, getEncryptionKey_fn, getEncryptionKeyLazily_fn, getMetadata_fn, resolveTerminalReturnValue_fn, pollReturnValue_fn, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn;
16
+ var _a2, _b, _c, _d, _e2, _f, _listeners, _onabort, _reader, _worldPromise, _Run_instances, lazyWorldPromise_get, _encryptionKeyPromise, _resilientStart, getEncryptionKey_fn, getEncryptionKeyLazily_fn, getMetadata_fn, resolveTerminalReturnValue_fn, pollReturnValue_fn, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn;
17
17
  import { createRequire as __wkfCreateRequire } from "node:module";
18
18
  if (typeof require === "undefined") {
19
19
  globalThis.require = __wkfCreateRequire(import.meta.url);
@@ -3793,7 +3793,7 @@ async function parseResponseBody$1(response2) {
3793
3793
  return response2.text();
3794
3794
  }
3795
3795
  async function convertDataStrategyResultToDataResult(dataStrategyResult) {
3796
- var _a3, _b2, _c2, _d2, _e2;
3796
+ var _a3, _b2, _c2, _d2, _e3;
3797
3797
  let { result, type } = dataStrategyResult;
3798
3798
  if (isResponse(result)) {
3799
3799
  let data2;
@@ -3845,7 +3845,7 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
3845
3845
  type: "data",
3846
3846
  data: result.data,
3847
3847
  statusCode: (_d2 = result.init) == null ? void 0 : _d2.status,
3848
- headers: ((_e2 = result.init) == null ? void 0 : _e2.headers) ? new Headers(result.init.headers) : void 0
3848
+ headers: ((_e3 = result.init) == null ? void 0 : _e3.headers) ? new Headers(result.init.headers) : void 0
3849
3849
  };
3850
3850
  }
3851
3851
  return { type: "data", data: result };
@@ -34033,7 +34033,7 @@ function isTopLayer(element2) {
34033
34033
  return topLayerSelectors.some((selector2) => {
34034
34034
  try {
34035
34035
  return element2.matches(selector2);
34036
- } catch (_e2) {
34036
+ } catch (_e3) {
34037
34037
  return false;
34038
34038
  }
34039
34039
  });
@@ -34635,7 +34635,7 @@ function observeMove(element2, onMove) {
34635
34635
  // Handle <iframe>s
34636
34636
  root: root2.ownerDocument
34637
34637
  });
34638
- } catch (_e2) {
34638
+ } catch (_e3) {
34639
34639
  io2 = new IntersectionObserver(handleObserve, options);
34640
34640
  }
34641
34641
  io2.observe(element2);
@@ -35096,7 +35096,7 @@ var CONTENT_NAME$9 = "PopperContent";
35096
35096
  var [PopperContentProvider$1, useContentContext$1] = createPopperContext$1(CONTENT_NAME$9);
35097
35097
  var PopperContent$1 = reactExports.forwardRef(
35098
35098
  (props, forwardedRef) => {
35099
- var _a3, _b2, _c2, _d2, _e2, _f;
35099
+ var _a3, _b2, _c2, _d2, _e3, _f2;
35100
35100
  const {
35101
35101
  __scopePopper,
35102
35102
  side = "bottom",
@@ -35195,12 +35195,12 @@ var PopperContent$1 = reactExports.forwardRef(
35195
35195
  zIndex: contentZIndex,
35196
35196
  ["--radix-popper-transform-origin"]: [
35197
35197
  (_d2 = middlewareData.transformOrigin) == null ? void 0 : _d2.x,
35198
- (_e2 = middlewareData.transformOrigin) == null ? void 0 : _e2.y
35198
+ (_e3 = middlewareData.transformOrigin) == null ? void 0 : _e3.y
35199
35199
  ].join(" "),
35200
35200
  // hide the content if using the hide middleware and should be hidden
35201
35201
  // set visibility to hidden and disable pointer events so the UI behaves
35202
35202
  // as if the PopperContent isn't there at all
35203
- ...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
35203
+ ...((_f2 = middlewareData.hide) == null ? void 0 : _f2.referenceHidden) && {
35204
35204
  visibility: "hidden",
35205
35205
  pointerEvents: "none"
35206
35206
  }
@@ -40527,7 +40527,7 @@ function attachSchema(issues, start2, inst) {
40527
40527
  }
40528
40528
  }
40529
40529
  function finalizeIssue(iss, ctx, config2) {
40530
- var _a4, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j;
40530
+ var _a4, _b2, _c2, _d2, _e3, _f2, _g, _h, _i, _j;
40531
40531
  var _a3;
40532
40532
  const traits = (_b2 = (_a4 = iss.inst) == null ? void 0 : _a4._zod) == null ? void 0 : _b2.traits;
40533
40533
  if (traits == null ? void 0 : traits.has("$ZodType")) {
@@ -40537,7 +40537,7 @@ function finalizeIssue(iss, ctx, config2) {
40537
40537
  iss.schema = iss.inst;
40538
40538
  }
40539
40539
  const schemaError = iss.schema !== iss.inst ? (_d2 = (_c2 = iss.schema) == null ? void 0 : _c2._zod.def) == null ? void 0 : _d2.error : void 0;
40540
- const message2 = iss.message ? iss.message : unwrapMessage((_g = (_f = (_e2 = iss.inst) == null ? void 0 : _e2._zod.def) == null ? void 0 : _f.error) == null ? void 0 : _g.call(_f, iss)) ?? unwrapMessage(schemaError == null ? void 0 : schemaError(iss)) ?? unwrapMessage((_h = ctx == null ? void 0 : ctx.error) == null ? void 0 : _h.call(ctx, iss)) ?? unwrapMessage((_i = config2.customError) == null ? void 0 : _i.call(config2, iss)) ?? unwrapMessage((_j = config2.localeError) == null ? void 0 : _j.call(config2, iss)) ?? "Invalid input";
40540
+ const message2 = iss.message ? iss.message : unwrapMessage((_g = (_f2 = (_e3 = iss.inst) == null ? void 0 : _e3._zod.def) == null ? void 0 : _f2.error) == null ? void 0 : _g.call(_f2, iss)) ?? unwrapMessage(schemaError == null ? void 0 : schemaError(iss)) ?? unwrapMessage((_h = ctx == null ? void 0 : ctx.error) == null ? void 0 : _h.call(ctx, iss)) ?? unwrapMessage((_i = config2.customError) == null ? void 0 : _i.call(config2, iss)) ?? unwrapMessage((_j = config2.localeError) == null ? void 0 : _j.call(config2, iss)) ?? "Invalid input";
40541
40541
  const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
40542
40542
  rest.path ?? (rest.path = []);
40543
40543
  rest.message = message2;
@@ -53269,6 +53269,21 @@ class DevalueError extends Error {
53269
53269
  this.root = root2;
53270
53270
  }
53271
53271
  }
53272
+ const MAP_KEY = Symbol();
53273
+ function format_path(keys2, format_map_key) {
53274
+ const path2 = [];
53275
+ for (let i = 0; i < keys2.length; i += 1) {
53276
+ const segment = keys2[i];
53277
+ if (segment === MAP_KEY) {
53278
+ path2.push(`.get(${format_map_key(keys2[++i])})`);
53279
+ } else if (typeof segment === "number") {
53280
+ path2.push(`[${segment}]`);
53281
+ } else {
53282
+ path2.push(stringify_key(segment));
53283
+ }
53284
+ }
53285
+ return path2;
53286
+ }
53272
53287
  const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
53273
53288
  function is_plain_object(thing) {
53274
53289
  const proto2 = Object.getPrototypeOf(thing);
@@ -53277,50 +53292,37 @@ function is_plain_object(thing) {
53277
53292
  function get_type(thing) {
53278
53293
  return Object.prototype.toString.call(thing).slice(8, -1);
53279
53294
  }
53280
- function get_escaped_char(char) {
53281
- switch (char) {
53282
- case '"':
53283
- return '\\"';
53284
- case "<":
53285
- return "\\u003C";
53286
- case "\\":
53287
- return "\\\\";
53288
- case "\n":
53289
- return "\\n";
53290
- case "\r":
53291
- return "\\r";
53292
- case " ":
53293
- return "\\t";
53294
- case "\b":
53295
- return "\\b";
53296
- case "\f":
53297
- return "\\f";
53298
- case "\u2028":
53299
- return "\\u2028";
53300
- case "\u2029":
53301
- return "\\u2029";
53302
- default:
53303
- return char < " " ? `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
53304
- }
53295
+ function is_buffer(thing) {
53296
+ return typeof Buffer !== "undefined" && Buffer.isBuffer(thing);
53297
+ }
53298
+ const needs_escape = /["<\\\u0000-\u001f\u2028\u2029]/;
53299
+ const json_leaves_raw = /[<\u2028\u2029]/g;
53300
+ const raw_escapes = { "<": "\\u003C", "\u2028": "\\u2028", "\u2029": "\\u2029" };
53301
+ function escape_raw(char) {
53302
+ return raw_escapes[char];
53305
53303
  }
53306
53304
  function stringify_string(str) {
53307
- let result = "";
53308
- let last_pos = 0;
53309
- const len = str.length;
53310
- for (let i = 0; i < len; i += 1) {
53311
- const char = str[i];
53312
- const replacement = get_escaped_char(char);
53313
- if (replacement) {
53314
- result += str.slice(last_pos, i) + replacement;
53315
- last_pos = i + 1;
53316
- }
53305
+ if (!needs_escape.test(str) && str.isWellFormed()) return `"${str}"`;
53306
+ return JSON.stringify(str).replace(json_leaves_raw, escape_raw);
53307
+ }
53308
+ const MAX_CACHED_KEY_LENGTH = 64;
53309
+ const quoted_keys = /* @__PURE__ */ new Map();
53310
+ function quote_key(key) {
53311
+ if (key.length > MAX_CACHED_KEY_LENGTH) return stringify_string(key);
53312
+ let quoted = quoted_keys.get(key);
53313
+ if (quoted === void 0) {
53314
+ if (quoted_keys.size >= 1024) quoted_keys.clear();
53315
+ quoted = stringify_string(key);
53316
+ quoted_keys.set(key, quoted);
53317
53317
  }
53318
- return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
53318
+ return quoted;
53319
53319
  }
53320
53320
  function enumerable_symbols(object2) {
53321
- return Object.getOwnPropertySymbols(object2).filter(
53322
- (symbol) => Object.getOwnPropertyDescriptor(object2, symbol).enumerable
53323
- );
53321
+ const symbols2 = Object.getOwnPropertySymbols(object2);
53322
+ return symbols2.length === 0 ? symbols2 : symbols2.filter((symbol) => {
53323
+ var _a3;
53324
+ return (_a3 = Object.getOwnPropertyDescriptor(object2, symbol)) == null ? void 0 : _a3.enumerable;
53325
+ });
53324
53326
  }
53325
53327
  const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
53326
53328
  function stringify_key(key) {
@@ -53378,7 +53380,12 @@ function encode_legacy(array_buffer) {
53378
53380
  const chunk_size = 32768;
53379
53381
  for (let i = 0; i < array2.length; i += chunk_size) {
53380
53382
  const chunk = array2.subarray(i, i + chunk_size);
53381
- binary += String.fromCharCode.apply(null, chunk);
53383
+ binary += String.fromCharCode.apply(
53384
+ null,
53385
+ /** @type {number[]} */
53386
+ /** @type {unknown} */
53387
+ chunk
53388
+ );
53382
53389
  }
53383
53390
  return btoa(binary);
53384
53391
  }
@@ -53410,8 +53417,8 @@ function merge_operations(defaults2, overrides) {
53410
53417
  }
53411
53418
  return merged;
53412
53419
  }
53413
- const NOT_PLAIN = Object.freeze({ kind: "not-plain" });
53414
- const SYMBOL_KEYS = Object.freeze({ kind: "symbol-keys" });
53420
+ const NOT_PLAIN = /* @__PURE__ */ Object.freeze({ kind: "not-plain" });
53421
+ const SYMBOL_KEYS = /* @__PURE__ */ Object.freeze({ kind: "symbol-keys" });
53415
53422
  const stringify_operations = {
53416
53423
  identify: (value) => value,
53417
53424
  typeOf: (value) => value === null ? "null" : typeof value,
@@ -53425,13 +53432,16 @@ const stringify_operations = {
53425
53432
  regExpInfo: (regexp) => ({ source: regexp.source, flags: regexp.flags }),
53426
53433
  valuesOf: (set2) => set2,
53427
53434
  entriesOf: (map2) => map2,
53428
- viewInfo: (view) => ({
53429
- buffer: view.buffer,
53430
- byteOffset: view.byteOffset,
53431
- byteLength: view.byteLength,
53432
- length: view.length,
53433
- bufferByteLength: view.buffer.byteLength
53434
- }),
53435
+ viewInfo: (view) => {
53436
+ if (is_buffer(view)) view = new Uint8Array(view);
53437
+ return {
53438
+ buffer: view.buffer,
53439
+ byteOffset: view.byteOffset,
53440
+ byteLength: view.byteLength,
53441
+ length: view.length,
53442
+ bufferByteLength: view.buffer.byteLength
53443
+ };
53444
+ },
53435
53445
  toArrayBuffer: (buffer2) => buffer2,
53436
53446
  lengthOf: (array2) => array2.length,
53437
53447
  hasOwn: (value, key) => Object.hasOwn(value, key),
@@ -53446,7 +53456,12 @@ const stringify_operations = {
53446
53456
  },
53447
53457
  get: (value, key) => value[key]
53448
53458
  };
53449
- const default_stringify_operations = Object.freeze(stringify_operations);
53459
+ const default_stringify_operations = /* @__PURE__ */ Object.freeze(stringify_operations);
53460
+ const array_buffer_byte_length = (
53461
+ /** @type {() => number} */
53462
+ (_b = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")) == null ? void 0 : _b.get
53463
+ );
53464
+ const shared_array_buffer_byte_length = typeof SharedArrayBuffer === "undefined" ? void 0 : (_c = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength")) == null ? void 0 : _c.get;
53450
53465
  const parse_operations = {
53451
53466
  fromPrimitive: (primitive) => primitive,
53452
53467
  fromISOString: (iso) => new Date(iso),
@@ -53458,6 +53473,12 @@ const parse_operations = {
53458
53473
  fromArrayBuffer: (buffer2) => buffer2,
53459
53474
  fromRegExpInfo: (source, flags) => new RegExp(source, flags),
53460
53475
  fromViewInfo: (tag, buffer2, byteOffset, length) => {
53476
+ try {
53477
+ array_buffer_byte_length.call(buffer2);
53478
+ } catch (error2) {
53479
+ if (!shared_array_buffer_byte_length) throw error2;
53480
+ shared_array_buffer_byte_length.call(buffer2);
53481
+ }
53461
53482
  const Constructor = (
53462
53483
  /** @type {any} */
53463
53484
  globalThis[tag]
@@ -53487,7 +53508,10 @@ const parse_operations = {
53487
53508
  map2.set(key, value);
53488
53509
  }
53489
53510
  };
53490
- const default_parse_operations = Object.freeze(parse_operations);
53511
+ const default_parse_operations = /* @__PURE__ */ Object.freeze(parse_operations);
53512
+ function invalid() {
53513
+ throw new Error("Invalid input");
53514
+ }
53491
53515
  function parse$6(serialized, revivers, options) {
53492
53516
  return unflatten(JSON.parse(serialized), revivers, options);
53493
53517
  }
@@ -53495,7 +53519,7 @@ function unflatten(parsed, revivers, options) {
53495
53519
  const ops = merge_operations(default_parse_operations, options == null ? void 0 : options.operations);
53496
53520
  if (typeof parsed === "number") return hydrate2(parsed, true);
53497
53521
  if (!Array.isArray(parsed) || parsed.length === 0) {
53498
- throw new Error("Invalid input");
53522
+ invalid();
53499
53523
  }
53500
53524
  const values = (
53501
53525
  /** @type {any[]} */
@@ -53503,6 +53527,12 @@ function unflatten(parsed, revivers, options) {
53503
53527
  );
53504
53528
  const hydrated = Array(values.length);
53505
53529
  let hydrating = null;
53530
+ function get_raw(index2) {
53531
+ if (!is_valid_array_index(index2) || index2 >= values.length) {
53532
+ invalid();
53533
+ }
53534
+ return values[index2];
53535
+ }
53506
53536
  function hydrate2(index2, standalone = false) {
53507
53537
  if (index2 === UNDEFINED$2) return ops.fromPrimitive(void 0);
53508
53538
  if (index2 === NAN) return ops.fromPrimitive(NaN);
@@ -53510,11 +53540,11 @@ function unflatten(parsed, revivers, options) {
53510
53540
  if (index2 === NEGATIVE_INFINITY) return ops.fromPrimitive(-Infinity);
53511
53541
  if (index2 === NEGATIVE_ZERO) return ops.fromPrimitive(-0);
53512
53542
  if (standalone || typeof index2 !== "number") {
53513
- throw new Error(`Invalid input`);
53543
+ invalid();
53514
53544
  }
53515
53545
  if (index2 in hydrated) return hydrated[index2];
53516
53546
  if (index2 >= values.length) {
53517
- throw new Error(`Invalid input`);
53547
+ invalid();
53518
53548
  }
53519
53549
  const value = values[index2];
53520
53550
  if (!value || typeof value !== "object") {
@@ -53563,8 +53593,13 @@ function unflatten(parsed, revivers, options) {
53563
53593
  break;
53564
53594
  case "Object": {
53565
53595
  const wrapped_index = value[1];
53566
- if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") {
53567
- throw new Error("Invalid input");
53596
+ const is_boxable_sentinel = wrapped_index === NAN || wrapped_index === POSITIVE_INFINITY || wrapped_index === NEGATIVE_INFINITY || wrapped_index === NEGATIVE_ZERO;
53597
+ if (!is_boxable_sentinel) {
53598
+ const wrapped = get_raw(wrapped_index);
53599
+ const is_bigint = Array.isArray(wrapped) && wrapped[0] === "BigInt";
53600
+ if ((wrapped === void 0 || typeof wrapped === "object") && !is_bigint) {
53601
+ invalid();
53602
+ }
53568
53603
  }
53569
53604
  hydrated[index2] = ops.box(hydrate2(wrapped_index));
53570
53605
  break;
@@ -53576,10 +53611,14 @@ function unflatten(parsed, revivers, options) {
53576
53611
  const obj = ops.createNullPrototypeObject();
53577
53612
  hydrated[index2] = obj;
53578
53613
  for (let i = 1; i < value.length; i += 2) {
53579
- if (value[i] === "__proto__") {
53614
+ const key = value[i];
53615
+ if (typeof key !== "string") {
53616
+ throw new Error("Cannot parse an object with a non-string key");
53617
+ }
53618
+ if (key === "__proto__") {
53580
53619
  throw new Error("Cannot parse an object with a `__proto__` property");
53581
53620
  }
53582
- ops.set(obj, value[i], hydrate2(value[i + 1]));
53621
+ ops.set(obj, key, hydrate2(value[i + 1]));
53583
53622
  }
53584
53623
  break;
53585
53624
  case "Int8Array":
@@ -53595,10 +53634,12 @@ function unflatten(parsed, revivers, options) {
53595
53634
  case "BigInt64Array":
53596
53635
  case "BigUint64Array":
53597
53636
  case "DataView": {
53598
- if (values[value[1]][0] !== "ArrayBuffer") {
53599
- throw new Error("Invalid data");
53637
+ const buffer_index = value[1];
53638
+ const raw2 = get_raw(buffer_index);
53639
+ if (!Array.isArray(raw2) || raw2[0] !== "ArrayBuffer") {
53640
+ invalid();
53600
53641
  }
53601
- const buffer2 = hydrate2(value[1]);
53642
+ const buffer2 = hydrate2(buffer_index);
53602
53643
  hydrated[index2] = ops.fromViewInfo(type, buffer2, value[2], value[3]);
53603
53644
  break;
53604
53645
  }
@@ -53629,14 +53670,14 @@ function unflatten(parsed, revivers, options) {
53629
53670
  } else if (value[0] === SPARSE) {
53630
53671
  const len = value[1];
53631
53672
  if (!is_valid_array_len(len)) {
53632
- throw new Error("Invalid input");
53673
+ invalid();
53633
53674
  }
53634
53675
  const array2 = ops.createSparseArray(len);
53635
53676
  hydrated[index2] = array2;
53636
53677
  for (let i = 2; i < value.length; i += 2) {
53637
53678
  const idx = value[i];
53638
53679
  if (!is_valid_array_index(idx) || idx >= len) {
53639
- throw new Error("Invalid input");
53680
+ invalid();
53640
53681
  }
53641
53682
  ops.set(array2, idx, hydrate2(value[i + 1]));
53642
53683
  }
@@ -53677,8 +53718,16 @@ function run(async, value, reducers, options) {
53677
53718
  custom2.push({ key, fn: reducers[key] });
53678
53719
  }
53679
53720
  }
53680
- const keys2 = [];
53721
+ let keys2 = [];
53681
53722
  let p2 = 0;
53723
+ function error2(message2, thing) {
53724
+ const path2 = format_path(keys2, (key) => {
53725
+ const key_type = ops.typeOf(key);
53726
+ const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
53727
+ return key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "...";
53728
+ });
53729
+ throw new DevalueError(message2, path2, thing, value);
53730
+ }
53682
53731
  function flatten2(thing, index3) {
53683
53732
  const type = ops.typeOf(thing);
53684
53733
  if (type === "undefined") return UNDEFINED$2;
@@ -53706,22 +53755,25 @@ function run(async, value, reducers, options) {
53706
53755
  }
53707
53756
  }
53708
53757
  if (type === "function") {
53709
- throw new DevalueError(`Cannot stringify a function`, keys2, thing, value);
53758
+ error2(`Cannot stringify a function`, thing);
53710
53759
  } else if (type === "symbol") {
53711
- throw new DevalueError(`Cannot stringify a Symbol primitive`, keys2, thing, value);
53760
+ error2(`Cannot stringify a Symbol primitive`, thing);
53712
53761
  }
53713
53762
  let str = "";
53714
53763
  if (type !== "object") {
53715
53764
  str = stringify_primitive(type === "number" ? number2 : ops.toPrimitive(thing));
53716
53765
  } else if (ops.isThenable(thing)) {
53717
53766
  {
53718
- throw new DevalueError(
53719
- `Cannot stringify a Promise or thenable — use stringifyAsync instead`,
53720
- keys2,
53721
- thing,
53722
- value
53723
- );
53767
+ error2(`Cannot stringify a Promise or thenable — use stringifyAsync instead`, thing);
53724
53768
  }
53769
+ const prev_keys = keys2.slice();
53770
+ str = ops.toPromise(thing).then((value2) => {
53771
+ keys2 = prev_keys;
53772
+ const i = flatten2(value2, index3);
53773
+ if (i < 0) stringified[index3] = i;
53774
+ });
53775
+ str.catch(() => {
53776
+ });
53725
53777
  } else {
53726
53778
  const tag = ops.tagOf(thing);
53727
53779
  switch (tag) {
@@ -53751,7 +53803,7 @@ function run(async, value, reducers, options) {
53751
53803
  for (let i = 0; i < length; i += 1) {
53752
53804
  if (i > 0) str += ",";
53753
53805
  if (ops.hasOwn(thing, i)) {
53754
- keys2.push(`[${i}]`);
53806
+ keys2.push(i);
53755
53807
  str += flatten2(ops.get(thing, i));
53756
53808
  keys2.pop();
53757
53809
  } else if (mostly_dense) {
@@ -53766,7 +53818,7 @@ function run(async, value, reducers, options) {
53766
53818
  str = "[" + SPARSE + "," + length;
53767
53819
  for (let j2 = 0; j2 < populated_keys.length; j2++) {
53768
53820
  const key = populated_keys[j2];
53769
- keys2.push(`[${key}]`);
53821
+ keys2.push(+key);
53770
53822
  str += "," + key + "," + flatten2(ops.get(thing, key));
53771
53823
  keys2.pop();
53772
53824
  }
@@ -53790,13 +53842,10 @@ function run(async, value, reducers, options) {
53790
53842
  case "Map":
53791
53843
  str = '["Map"';
53792
53844
  for (const [key, value2] of ops.entriesOf(thing)) {
53793
- const key_type = ops.typeOf(key);
53794
- const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
53795
- keys2.push(
53796
- `.get(${key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "..."})`
53797
- );
53845
+ keys2.push(MAP_KEY, key);
53798
53846
  str += `,${flatten2(key)},${flatten2(value2)}`;
53799
53847
  keys2.pop();
53848
+ keys2.pop();
53800
53849
  }
53801
53850
  str += "]";
53802
53851
  break;
@@ -53847,24 +53896,19 @@ function run(async, value, reducers, options) {
53847
53896
  default: {
53848
53897
  const shape = ops.shapeOf(thing);
53849
53898
  if (shape.kind === "not-plain") {
53850
- throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys2, thing, value);
53899
+ error2(`Cannot stringify arbitrary non-POJOs`, thing);
53851
53900
  }
53852
53901
  if (shape.kind === "symbol-keys") {
53853
- throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys2, thing, value);
53902
+ error2(`Cannot stringify POJOs with symbolic keys`, thing);
53854
53903
  }
53855
53904
  if (shape.kind === "null-proto") {
53856
53905
  str = '["null"';
53857
53906
  for (const key of shape.keys) {
53858
53907
  if (key === "__proto__") {
53859
- throw new DevalueError(
53860
- `Cannot stringify objects with __proto__ keys`,
53861
- keys2,
53862
- thing,
53863
- value
53864
- );
53908
+ error2(`Cannot stringify objects with __proto__ keys`, thing);
53865
53909
  }
53866
- keys2.push(stringify_key(key));
53867
- str += `,${stringify_string(key)},${flatten2(ops.get(thing, key))}`;
53910
+ keys2.push(key);
53911
+ str += `,${quote_key(key)},${flatten2(ops.get(thing, key))}`;
53868
53912
  keys2.pop();
53869
53913
  }
53870
53914
  str += "]";
@@ -53873,17 +53917,12 @@ function run(async, value, reducers, options) {
53873
53917
  let started = false;
53874
53918
  for (const key of shape.keys) {
53875
53919
  if (key === "__proto__") {
53876
- throw new DevalueError(
53877
- `Cannot stringify objects with __proto__ keys`,
53878
- keys2,
53879
- thing,
53880
- value
53881
- );
53920
+ error2(`Cannot stringify objects with __proto__ keys`, thing);
53882
53921
  }
53883
53922
  if (started) str += ",";
53884
53923
  started = true;
53885
- keys2.push(stringify_key(key));
53886
- str += `${stringify_string(key)}:${flatten2(ops.get(thing, key))}`;
53924
+ keys2.push(key);
53925
+ str += `${quote_key(key)}:${flatten2(ops.get(thing, key))}`;
53887
53926
  keys2.pop();
53888
53927
  }
53889
53928
  str += "}";
@@ -55643,7 +55682,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
55643
55682
  }
55644
55683
  async function hydrateResourceIOAsync(resource, key) {
55645
55684
  const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
55646
- const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-ClonRoMz.js");
55685
+ const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-BJ5qrMmm.js");
55647
55686
  ensureZstdDecoderRegistered();
55648
55687
  const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
55649
55688
  const revivers = getRevivers();
@@ -58101,8 +58140,8 @@ function isObjectLike(value) {
58101
58140
  return typeof value === "object" && value !== null;
58102
58141
  }
58103
58142
  function isSameBytesDisplay(a2, b2) {
58104
- var _a3, _b2, _c2, _d2, _e2, _f;
58105
- return a2.text === b2.text && ((_a3 = a2.decodedFrom) == null ? void 0 : _a3.type) === ((_b2 = b2.decodedFrom) == null ? void 0 : _b2.type) && ((_c2 = a2.decodedFrom) == null ? void 0 : _c2.encoding) === ((_d2 = b2.decodedFrom) == null ? void 0 : _d2.encoding) && ((_e2 = a2.decodedFrom) == null ? void 0 : _e2.rawSummary) === ((_f = b2.decodedFrom) == null ? void 0 : _f.rawSummary);
58143
+ var _a3, _b2, _c2, _d2, _e3, _f2;
58144
+ return a2.text === b2.text && ((_a3 = a2.decodedFrom) == null ? void 0 : _a3.type) === ((_b2 = b2.decodedFrom) == null ? void 0 : _b2.type) && ((_c2 = a2.decodedFrom) == null ? void 0 : _c2.encoding) === ((_d2 = b2.decodedFrom) == null ? void 0 : _d2.encoding) && ((_e3 = a2.decodedFrom) == null ? void 0 : _e3.rawSummary) === ((_f2 = b2.decodedFrom) == null ? void 0 : _f2.rawSummary);
58106
58145
  }
58107
58146
  function haveSameIterableValues(a2, b2, seen) {
58108
58147
  const aIterator = a2[Symbol.iterator]();
@@ -85927,7 +85966,7 @@ var x = class u2 {
85927
85966
  return this.inlineQueue.push({ src: e, tokens: t }), t;
85928
85967
  }
85929
85968
  inlineTokens(e, t = []) {
85930
- var _a3, _b2, _c2, _d2, _e2;
85969
+ var _a3, _b2, _c2, _d2, _e3;
85931
85970
  let n = e, r2 = null;
85932
85971
  if (this.tokens.links) {
85933
85972
  let o = Object.keys(this.tokens.links);
@@ -85985,7 +86024,7 @@ var x = class u2 {
85985
86024
  continue;
85986
86025
  }
85987
86026
  let l = e;
85988
- if ((_e2 = this.options.extensions) == null ? void 0 : _e2.startInline) {
86027
+ if ((_e3 = this.options.extensions) == null ? void 0 : _e3.startInline) {
85989
86028
  let p2 = 1 / 0, c = e.slice(1), d2;
85990
86029
  this.options.extensions.startInline.forEach((h2) => {
85991
86030
  d2 = h2.call({ lexer: this }, c), typeof d2 == "number" && d2 >= 0 && (p2 = Math.min(p2, d2));
@@ -86311,7 +86350,7 @@ var b = class u3 {
86311
86350
  return n;
86312
86351
  }
86313
86352
  };
86314
- var P = (_b = class {
86353
+ var P = (_d = class {
86315
86354
  constructor(e) {
86316
86355
  __publicField(this, "options");
86317
86356
  __publicField(this, "block");
@@ -86335,7 +86374,7 @@ var P = (_b = class {
86335
86374
  provideParser() {
86336
86375
  return this.block ? b.parse : b.parseInline;
86337
86376
  }
86338
- }, __publicField(_b, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_b, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _b);
86377
+ }, __publicField(_d, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_d, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _d);
86339
86378
  var B = class {
86340
86379
  constructor(...e) {
86341
86380
  __publicField(this, "defaults", M());
@@ -86631,7 +86670,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
86631
86670
  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 });
86632
86671
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
86633
86672
  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 }) });
86634
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-DwfdU2_m.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
86673
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-99nXCMDQ.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
86635
86674
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
86636
86675
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
86637
86676
  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 }) })] }) });
@@ -86953,7 +86992,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
86953
86992
  }, []), 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] });
86954
86993
  };
86955
86994
  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 }) })] });
86956
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-koYqT7Zj.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
86995
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-Csd1n701.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
86957
86996
  function ke(e, t) {
86958
86997
  if (!(e != null && e.position || t != null && t.position)) return true;
86959
86998
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -87813,7 +87852,7 @@ function runToSpan(run2, runEvents, nowTime) {
87813
87852
  const endTime = completedAt ?? now2;
87814
87853
  const wasCancelled = run2.status === "cancelled" || (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled";
87815
87854
  const cancelReason = (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled" && typeof ((_a3 = terminalEvent.eventData) == null ? void 0 : _a3.cancelReason) === "string" ? terminalEvent.eventData.cancelReason : null;
87816
- const { input: _i, output: _o2, error: _e2, ...runIdentity } = run2;
87855
+ const { input: _i, output: _o2, error: _e3, ...runIdentity } = run2;
87817
87856
  const attributes = {
87818
87857
  resource: "run",
87819
87858
  data: {
@@ -89546,11 +89585,11 @@ const escapedStringRegExp = /^'([^]*?)'?$/;
89546
89585
  const doubleQuoteRegExp = /''/g;
89547
89586
  const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
89548
89587
  function format(date2, formatStr, options) {
89549
- var _a3, _b2, _c2, _d2, _e2, _f, _g, _h;
89588
+ var _a3, _b2, _c2, _d2, _e3, _f2, _g, _h;
89550
89589
  const defaultOptions2 = getDefaultOptions();
89551
89590
  const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
89552
89591
  const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b2 = (_a3 = options == null ? void 0 : options.locale) == null ? void 0 : _a3.options) == null ? void 0 : _b2.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d2 = (_c2 = defaultOptions2.locale) == null ? void 0 : _c2.options) == null ? void 0 : _d2.firstWeekContainsDate) ?? 1;
89553
- const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e2 = options == null ? void 0 : options.locale) == null ? void 0 : _e2.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
89592
+ const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f2 = (_e3 = options == null ? void 0 : options.locale) == null ? void 0 : _e3.options) == null ? void 0 : _f2.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
89554
89593
  const originalDate = toDate(date2, options == null ? void 0 : options.in);
89555
89594
  if (!isValid(originalDate)) {
89556
89595
  throw new RangeError("Invalid time value");
@@ -95762,7 +95801,7 @@ function describeThrownValue(value) {
95762
95801
  }
95763
95802
  }
95764
95803
  function logOtelDiagnosticOnce$1(otel2, tracer) {
95765
- var _a3, _b2, _c2, _d2, _e2;
95804
+ var _a3, _b2, _c2, _d2, _e3;
95766
95805
  const debugEnabled = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
95767
95806
  if (otelDiagLogged$1 || !debugEnabled)
95768
95807
  return;
@@ -95777,7 +95816,7 @@ function logOtelDiagnosticOnce$1(otel2, tracer) {
95777
95816
  providerCtor: ((_b2 = provider == null ? void 0 : provider.constructor) == null ? void 0 : _b2.name) ?? null,
95778
95817
  delegateCtor: ((_c2 = delegate == null ? void 0 : delegate.constructor) == null ? void 0 : _c2.name) ?? null,
95779
95818
  tracerCtor: ((_d2 = tracer == null ? void 0 : tracer.constructor) == null ? void 0 : _d2.name) ?? null,
95780
- probeCtor: ((_e2 = probe == null ? void 0 : probe.constructor) == null ? void 0 : _e2.name) ?? null,
95819
+ probeCtor: ((_e3 = probe == null ? void 0 : probe.constructor) == null ? void 0 : _e3.name) ?? null,
95781
95820
  probeRecording: probe.isRecording()
95782
95821
  }));
95783
95822
  probe.end();
@@ -97607,13 +97646,13 @@ var EventConsumerResult;
97607
97646
  EventConsumerResult2[EventConsumerResult2["NotConsumed"] = 1] = "NotConsumed";
97608
97647
  EventConsumerResult2[EventConsumerResult2["Finished"] = 2] = "Finished";
97609
97648
  })(EventConsumerResult || (EventConsumerResult = {}));
97610
- _d = ABORT_STREAM_NAME, _c = ABORT_HOOK_TOKEN;
97649
+ _f = ABORT_STREAM_NAME, _e2 = ABORT_HOOK_TOKEN;
97611
97650
  class WorkflowAbortSignal {
97612
97651
  constructor(streamName, hookToken) {
97613
97652
  __publicField(this, "aborted", false);
97614
97653
  __publicField(this, "reason");
97615
- __publicField(this, _d);
97616
- __publicField(this, _c);
97654
+ __publicField(this, _f);
97655
+ __publicField(this, _e2);
97617
97656
  __privateAdd(this, _listeners, []);
97618
97657
  __privateAdd(this, _onabort, null);
97619
97658
  this[ABORT_STREAM_NAME] = streamName;
@@ -107436,7 +107475,7 @@ function getCompressionMode(capabilities) {
107436
107475
  }
107437
107476
  return capabilities.supportedFormats.has(SerializationFormat$1.ZSTD) ? true : "gzip";
107438
107477
  }
107439
- const version$1 = "5.2.1";
107478
+ const version$1 = "5.2.2";
107440
107479
  const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
107441
107480
  const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@()[\]]+$/;
107442
107481
  function getWorkflowQueueName(workflowName, namespace2) {
@@ -107627,7 +107666,7 @@ function getSnapshotThresholdFromEnv(env2 = process.env) {
107627
107666
  return parsed;
107628
107667
  }
107629
107668
  function waitUntil(promise2) {
107630
- void import("./index-C3Gx8HYZ.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
107669
+ void import("./index-CI1MEtXX.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
107631
107670
  waitUntil2(promise2);
107632
107671
  });
107633
107672
  }
@@ -107760,7 +107799,7 @@ async function start$1(workflow, argsOrOptions, options) {
107760
107799
  const queueName = getWorkflowQueueName(workflowName, opts.namespace);
107761
107800
  const spanName = `workflow.start ${workflowDisplayName(workflowName)}`;
107762
107801
  return trace$2(spanName, async (span) => {
107763
- var _a3, _b2, _c2, _d2, _e2;
107802
+ var _a3, _b2, _c2, _d2, _e3;
107764
107803
  span == null ? void 0 : span.setAttributes({
107765
107804
  ...WorkflowName(workflowName),
107766
107805
  ...WorkflowOperation("start")
@@ -107958,7 +107997,7 @@ async function start$1(workflow, argsOrOptions, options) {
107958
107997
  ...dynamicWorkflowCode ? { dynamicWorkflowCode } : {},
107959
107998
  ...dynamicWorkflowCodeRef ? { dynamicWorkflowCodeRef } : {}
107960
107999
  } : {};
107961
- const creatorEnvironment = (_e2 = world.getEnvironment) == null ? void 0 : _e2.call(world);
108000
+ const creatorEnvironment = (_e3 = world.getEnvironment) == null ? void 0 : _e3.call(world);
107962
108001
  const runCreated = world.events.create(runId, {
107963
108002
  eventType: "run_created",
107964
108003
  specVersion,
@@ -114959,7 +114998,7 @@ function requireUnwrapHandler() {
114959
114998
  var dispatcherBase;
114960
114999
  var hasRequiredDispatcherBase;
114961
115000
  function requireDispatcherBase() {
114962
- var _a3, _b2, _c2, _d2, _e2;
115001
+ var _a3, _b2, _c2, _d2, _e3;
114963
115002
  if (hasRequiredDispatcherBase) return dispatcherBase;
114964
115003
  hasRequiredDispatcherBase = 1;
114965
115004
  const Dispatcher = requireDispatcher();
@@ -114973,7 +115012,7 @@ function requireDispatcherBase() {
114973
115012
  const kOnDestroyed = Symbol("onDestroyed");
114974
115013
  const kOnClosed = Symbol("onClosed");
114975
115014
  const kWebSocketOptions = Symbol("webSocketOptions");
114976
- class DispatcherBase extends (_e2 = Dispatcher, _d2 = kDestroyed, _c2 = kOnDestroyed, _b2 = kClosed, _a3 = kOnClosed, _e2) {
115015
+ class DispatcherBase extends (_e3 = Dispatcher, _d2 = kDestroyed, _c2 = kOnDestroyed, _b2 = kClosed, _a3 = kOnClosed, _e3) {
114977
115016
  /**
114978
115017
  * @param {import('../../types/dispatcher').DispatcherOptions} [opts]
114979
115018
  */
@@ -121531,7 +121570,7 @@ function requireFixedQueue() {
121531
121570
  var poolBase;
121532
121571
  var hasRequiredPoolBase;
121533
121572
  function requirePoolBase() {
121534
- var _a3, _b2, _c2, _d2, _e2, _f, _g;
121573
+ var _a3, _b2, _c2, _d2, _e3, _f2, _g;
121535
121574
  if (hasRequiredPoolBase) return poolBase;
121536
121575
  hasRequiredPoolBase = 1;
121537
121576
  const { PoolStats } = requireStats();
@@ -121553,8 +121592,8 @@ function requirePoolBase() {
121553
121592
  constructor() {
121554
121593
  super(...arguments);
121555
121594
  __publicField(this, _g, new FixedQueue());
121556
- __publicField(this, _f, 0);
121557
- __publicField(this, _e2, []);
121595
+ __publicField(this, _f2, 0);
121596
+ __publicField(this, _e3, []);
121558
121597
  __publicField(this, _d2, false);
121559
121598
  __publicField(this, _c2, (origin, targets) => {
121560
121599
  this.emit("connect", origin, [this, ...targets]);
@@ -121566,7 +121605,7 @@ function requirePoolBase() {
121566
121605
  this.emit("connectionError", origin, [this, ...targets], err);
121567
121606
  });
121568
121607
  }
121569
- [(_g = kQueue, _f = kQueued, _e2 = kClients, _d2 = kNeedDrain, kOnDrain)](client2, origin, targets) {
121608
+ [(_g = kQueue, _f2 = kQueued, _e3 = kClients, _d2 = kNeedDrain, kOnDrain)](client2, origin, targets) {
121570
121609
  const queue = this[kQueue];
121571
121610
  let needDrain = false;
121572
121611
  while (!needDrain) {
@@ -123454,7 +123493,7 @@ function requireRetryHandler() {
123454
123493
  this.controllerProxy = new RetryController();
123455
123494
  }
123456
123495
  onResponseStartWithRetry(controller, statusCode, headers2, statusMessage, err) {
123457
- var _a3, _b2, _c2, _d2, _e2, _f;
123496
+ var _a3, _b2, _c2, _d2, _e3, _f2;
123458
123497
  if (this.retryOpts.throwOnError) {
123459
123498
  if (this.retryOpts.statusCodes.includes(statusCode) === false) {
123460
123499
  if (this.headersSent) {
@@ -123472,7 +123511,7 @@ function requireRetryHandler() {
123472
123511
  if (isDisturbed(this.opts.body)) {
123473
123512
  this.headersSent = true;
123474
123513
  this.checkpointResponseEnd(headers2);
123475
- (_f = (_e2 = this.handler).onResponseStart) == null ? void 0 : _f.call(_e2, this.controllerProxy, statusCode, headers2, statusMessage);
123514
+ (_f2 = (_e3 = this.handler).onResponseStart) == null ? void 0 : _f2.call(_e3, this.controllerProxy, statusCode, headers2, statusMessage);
123476
123515
  return;
123477
123516
  }
123478
123517
  function shouldRetry(passedErr) {
@@ -130843,7 +130882,7 @@ function requireDeduplicationHandler() {
130843
130882
  * @param {object} trailers
130844
130883
  */
130845
130884
  onResponseEnd(controller, trailers) {
130846
- var _a3, _b2, _c2, _d2, _e2;
130885
+ var _a3, _b2, _c2, _d2, _e3;
130847
130886
  if (__privateGet(this, _aborted) || __privateGet(this, _completed)) {
130848
130887
  return;
130849
130888
  }
@@ -130870,7 +130909,7 @@ function requireDeduplicationHandler() {
130870
130909
  waitingHandler.done = true;
130871
130910
  }
130872
130911
  __privateMethod(this, _DeduplicationHandler_instances, pruneDoneWaitingHandlers_fn).call(this);
130873
- (_e2 = __privateGet(this, _onComplete)) == null ? void 0 : _e2.call(this);
130912
+ (_e3 = __privateGet(this, _onComplete)) == null ? void 0 : _e3.call(this);
130874
130913
  }
130875
130914
  /**
130876
130915
  * @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
@@ -135668,14 +135707,14 @@ function requireEvents() {
135668
135707
  });
135669
135708
  }
135670
135709
  static createFastMessageEvent(type, init2) {
135671
- var _a3, _b2, _c2, _d2, _e2;
135710
+ var _a3, _b2, _c2, _d2, _e3;
135672
135711
  const messageEvent = new _MessageEvent(kConstruct, type, init2);
135673
135712
  __privateSet(messageEvent, _eventInit, init2);
135674
135713
  (_a3 = __privateGet(messageEvent, _eventInit)).data ?? (_a3.data = null);
135675
135714
  (_b2 = __privateGet(messageEvent, _eventInit)).origin ?? (_b2.origin = "");
135676
135715
  (_c2 = __privateGet(messageEvent, _eventInit)).lastEventId ?? (_c2.lastEventId = "");
135677
135716
  (_d2 = __privateGet(messageEvent, _eventInit)).source ?? (_d2.source = null);
135678
- (_e2 = __privateGet(messageEvent, _eventInit)).ports ?? (_e2.ports = []);
135717
+ (_e3 = __privateGet(messageEvent, _eventInit)).ports ?? (_e3.ports = []);
135679
135718
  return messageEvent;
135680
135719
  }
135681
135720
  };
@@ -141889,7 +141928,7 @@ function createWorld$2(args) {
141889
141928
  const basedir = mergedConfig.dataDir;
141890
141929
  const hooksDir = path$3.join(basedir, "hooks");
141891
141930
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
141892
- const { HookSchema: HookSchema2 } = await import("./index-D1YkUiuC.js");
141931
+ const { HookSchema: HookSchema2 } = await import("./index-TQ324kzl.js");
141893
141932
  await settleAll(taggedHookFiles.map(async (hookFile) => {
141894
141933
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
141895
141934
  if (hook == null ? void 0 : hook.token) {
@@ -142077,8 +142116,8 @@ function requireGetVercelOidcToken() {
142077
142116
  }
142078
142117
  try {
142079
142118
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
142080
- await import("./token-util-BXkc19cz.js").then((n) => n.t),
142081
- await import("./token-DbFnZp4-.js").then((n) => n.t)
142119
+ await import("./token-util-DCNDhnc8.js").then((n) => n.t),
142120
+ await import("./token-C7Y4VFl0.js").then((n) => n.t)
142082
142121
  ]);
142083
142122
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
142084
142123
  await refreshToken(options);
@@ -142641,7 +142680,7 @@ function requireDist() {
142641
142680
  return dist;
142642
142681
  }
142643
142682
  var distExports = requireDist();
142644
- const version = "5.2.1";
142683
+ const version = "5.2.2";
142645
142684
  const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
142646
142685
  dispatcher: void 0,
142647
142686
  queueDispatcher: void 0,
@@ -142775,9 +142814,10 @@ const EVENTS_RETRY_AGENT_OPTIONS = {
142775
142814
  ]
142776
142815
  };
142777
142816
  const STREAM_RETRY_OPTIONS = {
142778
- retryAfter: true,
142817
+ maxRetries: 0,
142779
142818
  methods: ["PUT"],
142780
- statusCodes: [429]
142819
+ statusCodes: [],
142820
+ errorCodes: []
142781
142821
  };
142782
142822
  const STREAM_CLOSE_RETRY_OPTIONS = {
142783
142823
  retryAfter: true,
@@ -143001,6 +143041,304 @@ function getDefaultStreamCloseDispatcher() {
143001
143041
  pools.streamCloseDispatcher ?? (pools.streamCloseDispatcher = createStreamDispatcher(STREAM_CLOSE_RETRY_OPTIONS));
143002
143042
  return pools.streamCloseDispatcher;
143003
143043
  }
143044
+ async function getDeadline() {
143045
+ const { getDeadline: getDeadline2 } = await import("./index-CI1MEtXX.js").then((n) => n.i);
143046
+ return getDeadline2();
143047
+ }
143048
+ class ReplayEventObserverError extends Error {
143049
+ constructor(error2) {
143050
+ super("Replay event observer failed", { cause: error2 });
143051
+ __publicField(this, "error");
143052
+ this.error = error2;
143053
+ this.name = "ReplayEventObserverError";
143054
+ }
143055
+ }
143056
+ class AfterCommitError extends Error {
143057
+ constructor(error2) {
143058
+ super("Event log read after a committed write failed", { cause: error2 });
143059
+ __publicField(this, "error");
143060
+ this.error = error2;
143061
+ this.name = "AfterCommitError";
143062
+ }
143063
+ }
143064
+ const STEP_OUTCOME_EVENT_TYPES = /* @__PURE__ */ new Set([
143065
+ "step_completed",
143066
+ "step_retrying"
143067
+ ]);
143068
+ function recordsStepOutcome(eventType) {
143069
+ return STEP_OUTCOME_EVENT_TYPES.has(eventType);
143070
+ }
143071
+ const EVENT_RETRY_ELIGIBILITY = {
143072
+ // Creates: conditional create → 409 EntityConflictError if it already exists.
143073
+ run_created: {
143074
+ retryable: true,
143075
+ reason: "conditional create → 409 if exists"
143076
+ },
143077
+ step_created: {
143078
+ retryable: true,
143079
+ reason: "conditional create → 409 if exists"
143080
+ },
143081
+ wait_created: {
143082
+ retryable: true,
143083
+ reason: "conditional create → 409 if exists"
143084
+ },
143085
+ hook_created: {
143086
+ retryable: true,
143087
+ reason: "transactional token uniqueness → 409 if exists"
143088
+ },
143089
+ // Run start: early-returns if already running, writes no duplicate row.
143090
+ run_started: {
143091
+ retryable: true,
143092
+ reason: "early-returns if already running, no duplicate row"
143093
+ },
143094
+ // Terminal transitions: conditional `.where()` excludes terminal states →
143095
+ // 409 before the event row is written.
143096
+ run_completed: {
143097
+ retryable: true,
143098
+ reason: "terminal-state guard → 409, no duplicate row"
143099
+ },
143100
+ run_failed: {
143101
+ retryable: true,
143102
+ reason: "terminal-state guard → 409, no duplicate row"
143103
+ },
143104
+ run_cancelled: {
143105
+ retryable: true,
143106
+ reason: "terminal-state guard → 409, no duplicate row"
143107
+ },
143108
+ step_completed: {
143109
+ retryable: true,
143110
+ reason: "terminal-state guard → 409, no duplicate row"
143111
+ },
143112
+ step_failed: {
143113
+ retryable: true,
143114
+ reason: "terminal-state guard → 409, no duplicate row"
143115
+ },
143116
+ wait_completed: {
143117
+ retryable: true,
143118
+ reason: "waiting-state guard → 409, no duplicate row"
143119
+ },
143120
+ hook_disposed: {
143121
+ retryable: true,
143122
+ reason: "conditional delete (exists) → 409, no duplicate row"
143123
+ },
143124
+ // True idempotency via a correlationId constraint that reuses the eventId.
143125
+ attr_set: {
143126
+ retryable: true,
143127
+ reason: "correlationId constraint reuses eventId (idempotent replay)"
143128
+ },
143129
+ // NOT safe to retry; see the module comment.
143130
+ step_started: {
143131
+ retryable: false,
143132
+ reason: "unconditional attempt increment → a retry double-counts attempts"
143133
+ },
143134
+ step_retrying: {
143135
+ retryable: false,
143136
+ reason: "no duplicate guard → a retry appends a second event row"
143137
+ },
143138
+ hook_received: {
143139
+ retryable: false,
143140
+ reason: "no server guard → a retry duplicates the row / re-delivers payload. EXCEPTION: the atomic lazy-resume shape (resumeId + digest) is deduplicated server-side by the (runId, resumeId) claim, so those writes opt in via withEventPostRetry({ idempotentHookResume })"
143141
+ },
143142
+ // Server-originated; the SDK never POSTs it.
143143
+ hook_conflict: {
143144
+ retryable: false,
143145
+ reason: "server-originated; never POSTed by the SDK"
143146
+ },
143147
+ // Server-originated sealed-log filler (specVersion 7); the SDK never
143148
+ // POSTs it. The server's read path writes it to seal an abandoned slot.
143149
+ noop: {
143150
+ retryable: false,
143151
+ reason: "server-originated; never POSTed by the SDK"
143152
+ }
143153
+ };
143154
+ const MAX_EVENT_POST_RETRIES = 2;
143155
+ const THROTTLE_RETRY_BUDGET_MS = 3e4;
143156
+ const THROTTLE_DEADLINE_RESERVE_MS = 15e3;
143157
+ const THROTTLE_RETRY_MAX_BUDGET_MS = 15 * 6e4;
143158
+ const DEFAULT_THROTTLE_RETRY_AFTER_SECONDS = 1;
143159
+ const EVENT_POST_RETRY_BASE_MS = 100;
143160
+ const EVENT_POST_RETRY_JITTER_MS = 50;
143161
+ const TRANSIENT_CODES = /* @__PURE__ */ new Set([
143162
+ "ECONNRESET",
143163
+ "ECONNREFUSED",
143164
+ "ENOTFOUND",
143165
+ "ENETDOWN",
143166
+ "ENETUNREACH",
143167
+ "EHOSTDOWN",
143168
+ "EHOSTUNREACH",
143169
+ "EPIPE",
143170
+ "ETIMEDOUT",
143171
+ "UND_ERR_SOCKET",
143172
+ "UND_ERR_REQ_RETRY",
143173
+ "UND_ERR_CONNECT_TIMEOUT",
143174
+ "UND_ERR_HEADERS_TIMEOUT",
143175
+ "UND_ERR_BODY_TIMEOUT",
143176
+ // Names (undici/Node surface these on the error or its cause).
143177
+ // `TimeoutError` is our own per-request deadline (`AbortSignal.timeout` in
143178
+ // makeRequest), a genuinely ambiguous failure worth retrying. We deliberately
143179
+ // do NOT include `AbortError`: that is how an external/caller-supplied
143180
+ // cancellation surfaces (makeRequest composes the caller's signal via
143181
+ // `AbortSignal.any`), and re-issuing a write the caller asked to cancel
143182
+ // (stalling the abort by the full backoff budget) would be wrong.
143183
+ "TimeoutError",
143184
+ "RequestRetryError"
143185
+ ]);
143186
+ function collectErrorMarkers(err, depth = 0) {
143187
+ if (depth > 5 || err === null || typeof err !== "object")
143188
+ return [];
143189
+ const markers = [];
143190
+ const e = err;
143191
+ if (typeof e.code === "string")
143192
+ markers.push(e.code);
143193
+ if (typeof e.name === "string")
143194
+ markers.push(e.name);
143195
+ if (e.cause)
143196
+ markers.push(...collectErrorMarkers(e.cause, depth + 1));
143197
+ return markers;
143198
+ }
143199
+ function isRetryableEventPostError(err) {
143200
+ if (err instanceof ReplayEventObserverError)
143201
+ return false;
143202
+ if (EntityConflictError.is(err) || // A takeover redirect is definitive for THIS target; the runtime's
143203
+ // resume path follows the token instead of re-issuing the write here.
143204
+ HookForceClaimedError.is(err) || RunExpiredError.is(err) || TooEarlyError.is(err) || ThrottleError.is(err)) {
143205
+ return false;
143206
+ }
143207
+ if (WorkflowWorldError.is(err) || StreamError.is(err)) {
143208
+ if (err.code === "PARSE_ERROR")
143209
+ return true;
143210
+ if (err.code === "TRANSPORT")
143211
+ return true;
143212
+ if (typeof err.status === "number") {
143213
+ return err.status >= 500 && err.status <= 599;
143214
+ }
143215
+ if (err.code === "STREAM_ERROR") {
143216
+ return !collectErrorMarkers(err).some((marker) => [
143217
+ "AbortError",
143218
+ "ABORT_ERR",
143219
+ "UND_ERR_ABORTED",
143220
+ "ERR_HTTP2_STREAM_CANCEL"
143221
+ ].includes(marker));
143222
+ }
143223
+ }
143224
+ return collectErrorMarkers(err).some((m2) => TRANSIENT_CODES.has(m2));
143225
+ }
143226
+ const sleep$1 = (ms2, signal) => new Promise((resolve2, reject) => {
143227
+ if (signal == null ? void 0 : signal.aborted) {
143228
+ reject(signal.reason);
143229
+ return;
143230
+ }
143231
+ const onAbort = () => {
143232
+ clearTimeout(timer2);
143233
+ reject(signal == null ? void 0 : signal.reason);
143234
+ };
143235
+ const timer2 = setTimeout(() => {
143236
+ signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
143237
+ resolve2();
143238
+ }, ms2);
143239
+ signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
143240
+ });
143241
+ const RETRY_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
143242
+ function logRetry(message2, fields) {
143243
+ if (!RETRY_DEBUG_ENABLED)
143244
+ return;
143245
+ const suffix = Object.entries(fields).map(([k2, v2]) => `${k2}=${v2}`).join(" ");
143246
+ console.debug(`[workflow:world-vercel:event-retry] ${message2} ${suffix}`);
143247
+ }
143248
+ function errorMarker(err) {
143249
+ if (WorkflowWorldError.is(err)) {
143250
+ return err.code ?? (err.status != null ? `status_${err.status}` : err.name);
143251
+ }
143252
+ return collectErrorMarkers(err)[0] ?? (err instanceof Error ? err.name : "unknown");
143253
+ }
143254
+ async function resolveDeadlineMs() {
143255
+ try {
143256
+ const deadline = await getDeadline();
143257
+ const ms2 = deadline == null ? void 0 : deadline.getTime();
143258
+ return ms2 !== void 0 && Number.isFinite(ms2) ? ms2 : void 0;
143259
+ } catch {
143260
+ return void 0;
143261
+ }
143262
+ }
143263
+ function createThrottleWaiter(target2, budget, beforeWait) {
143264
+ let waitedMs = 0;
143265
+ let limit;
143266
+ return async (err, signal) => {
143267
+ const waitMs = Math.max(1, typeof err.retryAfter === "number" ? err.retryAfter : DEFAULT_THROTTLE_RETRY_AFTER_SECONDS) * 1e3;
143268
+ if (limit === void 0) {
143269
+ const deadlineMs = await resolveDeadlineMs();
143270
+ limit = {
143271
+ budgetMs: budget === "invocation" && deadlineMs !== void 0 ? THROTTLE_RETRY_MAX_BUDGET_MS : THROTTLE_RETRY_BUDGET_MS,
143272
+ deadlineMs
143273
+ };
143274
+ }
143275
+ const outlastsInvocation = limit.deadlineMs !== void 0 && Date.now() + waitMs > limit.deadlineMs - THROTTLE_DEADLINE_RESERVE_MS;
143276
+ if (waitedMs + waitMs > limit.budgetMs || outlastsInvocation) {
143277
+ logRetry("throttle retry budget exhausted; surfacing to the queue", {
143278
+ target: target2,
143279
+ budget,
143280
+ waitedMs,
143281
+ retryAfter: err.retryAfter,
143282
+ outlastsInvocation
143283
+ });
143284
+ throw err;
143285
+ }
143286
+ waitedMs += waitMs;
143287
+ console.warn(`[workflow] Throttled (429) ${target2}; retrying in-process in ${waitMs / 1e3}s`);
143288
+ await (beforeWait == null ? void 0 : beforeWait());
143289
+ await sleep$1(waitMs, signal);
143290
+ };
143291
+ }
143292
+ function throttleBudgetFor(eventType, options) {
143293
+ if ((options == null ? void 0 : options.batchIdempotent) !== void 0)
143294
+ return "bounded";
143295
+ return (options == null ? void 0 : options.afterStepBody) === true || recordsStepOutcome(eventType) ? "invocation" : "bounded";
143296
+ }
143297
+ function isEligibleForTransientRetry(eventType, options) {
143298
+ var _a3;
143299
+ if ((options == null ? void 0 : options.inBand) === true)
143300
+ return false;
143301
+ if ((options == null ? void 0 : options.batchIdempotent) !== void 0) {
143302
+ return options.batchIdempotent;
143303
+ }
143304
+ return eventType === "hook_received" && (options == null ? void 0 : options.idempotentHookResume) === true || (((_a3 = EVENT_RETRY_ELIGIBILITY[eventType]) == null ? void 0 : _a3.retryable) ?? false);
143305
+ }
143306
+ async function withEventPostRetry(fn2, eventType, options) {
143307
+ const retryable = isEligibleForTransientRetry(eventType, options);
143308
+ const waitOutThrottle = createThrottleWaiter(`writing ${eventType} event`, throttleBudgetFor(eventType, options));
143309
+ for (let attempt = 0; ; ) {
143310
+ try {
143311
+ return await fn2();
143312
+ } catch (err) {
143313
+ if (err instanceof AfterCommitError)
143314
+ throw err;
143315
+ if (ThrottleError.is(err)) {
143316
+ await waitOutThrottle(err);
143317
+ continue;
143318
+ }
143319
+ if (!retryable || !isRetryableEventPostError(err)) {
143320
+ throw err;
143321
+ }
143322
+ if (attempt >= MAX_EVENT_POST_RETRIES) {
143323
+ logRetry("exhausted in-process retries; surfacing for queue redelivery", {
143324
+ eventType,
143325
+ attempts: attempt + 1,
143326
+ error: errorMarker(err)
143327
+ });
143328
+ throw err;
143329
+ }
143330
+ const backoff = EVENT_POST_RETRY_BASE_MS * 2 ** attempt + Math.floor(Math.random() * EVENT_POST_RETRY_JITTER_MS);
143331
+ attempt++;
143332
+ logRetry("retrying event POST after transient failure", {
143333
+ eventType,
143334
+ attempt,
143335
+ backoffMs: backoff,
143336
+ error: errorMarker(err)
143337
+ });
143338
+ await sleep$1(backoff);
143339
+ }
143340
+ }
143341
+ }
143004
143342
  const otel = globalSingleton("@workflow/world-vercel//telemetry", 1, () => ({
143005
143343
  // Lazy load OpenTelemetry API to make it optional
143006
143344
  apiPromise: null,
@@ -143022,7 +143360,7 @@ function workflowDebugEnabled() {
143022
143360
  }
143023
143361
  let otelDiagLogged = false;
143024
143362
  function logOtelDiagnosticOnce(otel2, tracer) {
143025
- var _a3, _b2, _c2, _d2, _e2;
143363
+ var _a3, _b2, _c2, _d2, _e3;
143026
143364
  if (otelDiagLogged || !workflowDebugEnabled())
143027
143365
  return;
143028
143366
  otelDiagLogged = true;
@@ -143036,7 +143374,7 @@ function logOtelDiagnosticOnce(otel2, tracer) {
143036
143374
  providerCtor: ((_b2 = provider == null ? void 0 : provider.constructor) == null ? void 0 : _b2.name) ?? null,
143037
143375
  delegateCtor: ((_c2 = delegate == null ? void 0 : delegate.constructor) == null ? void 0 : _c2.name) ?? null,
143038
143376
  tracerCtor: ((_d2 = tracer == null ? void 0 : tracer.constructor) == null ? void 0 : _d2.name) ?? null,
143039
- probeCtor: ((_e2 = probe == null ? void 0 : probe.constructor) == null ? void 0 : _e2.name) ?? null,
143377
+ probeCtor: ((_e3 = probe == null ? void 0 : probe.constructor) == null ? void 0 : _e3.name) ?? null,
143040
143378
  probeRecording: probe.isRecording()
143041
143379
  }));
143042
143380
  probe.end();
@@ -143247,7 +143585,10 @@ function parseRetryAfter(value) {
143247
143585
  if (!value)
143248
143586
  return void 0;
143249
143587
  const parsed = parseInt(value, 10);
143250
- return Number.isNaN(parsed) ? void 0 : parsed;
143588
+ if (!Number.isNaN(parsed))
143589
+ return parsed;
143590
+ const date2 = Date.parse(value);
143591
+ return Number.isNaN(date2) ? void 0 : Math.max(0, (date2 - Date.now()) / 1e3);
143251
143592
  }
143252
143593
  function headersToRecord$1(headers2) {
143253
143594
  const out = {};
@@ -143359,16 +143700,56 @@ function recordClientSpanStatus(span, status) {
143359
143700
  span == null ? void 0 : span.setAttributes({ ...ErrorType(`HTTP ${status}`) });
143360
143701
  }
143361
143702
  }
143703
+ const STREAM_APPEND_MAX_RETRIES = 5;
143704
+ const STREAM_APPEND_CONNECT_ERROR_CODES = /* @__PURE__ */ new Set([
143705
+ "ECONNREFUSED",
143706
+ "ENOTFOUND",
143707
+ "EAI_AGAIN",
143708
+ "UND_ERR_CONNECT_TIMEOUT"
143709
+ ]);
143710
+ async function fetchStreamAppend(request2, signal) {
143711
+ let response2;
143712
+ const waitOutThrottle = createThrottleWaiter("appending stream chunks", "bounded", async () => {
143713
+ var _a3;
143714
+ await ((_a3 = response2.body) == null ? void 0 : _a3.cancel().catch(() => {
143715
+ }));
143716
+ });
143717
+ for (let retry2 = 0; ; retry2++) {
143718
+ try {
143719
+ response2 = await request2(retry2);
143720
+ } catch (error2) {
143721
+ const code2 = getTransientTransportCode(error2);
143722
+ if (retry2 === STREAM_APPEND_MAX_RETRIES || !code2 || !STREAM_APPEND_CONNECT_ERROR_CODES.has(code2)) {
143723
+ throw error2;
143724
+ }
143725
+ await sleep$1(500 * 2 ** retry2, signal);
143726
+ continue;
143727
+ }
143728
+ if (response2.status !== 429 || isFirewallChallenge429(response2.status, response2.headers.get("x-vercel-mitigated")) || retry2 === STREAM_APPEND_MAX_RETRIES) {
143729
+ return response2;
143730
+ }
143731
+ const throttle = {
143732
+ retryAfter: parseRetryAfter(response2.headers.get("Retry-After"))
143733
+ };
143734
+ try {
143735
+ await waitOutThrottle(throttle, signal);
143736
+ } catch (error2) {
143737
+ if (error2 === throttle)
143738
+ return response2;
143739
+ throw error2;
143740
+ }
143741
+ }
143742
+ }
143362
143743
  async function instrumentedFetch(opts) {
143363
- const { method, url, headers: headers2, body: body2, dispatcher: dispatcher2, peerService, timeoutMs = getRequestTimeoutMs(), signal: callerSignal, injectTraceContext: injectTraceContext2 = true, cacheBust = true, logLabel, buildError, spanName, attributes, durationAttribute, onTransportOutcome, deferTransportSuccessUntilBody = false, onRequestDispatched, transportErrorCode = "TRANSPORT" } = opts;
143744
+ const { method, url, headers: headers2, body: body2, dispatcher: dispatcher2, peerService, timeoutMs = getRequestTimeoutMs(), signal: callerSignal, retryStreamAppend = false, injectTraceContext: injectTraceContext2 = true, cacheBust = true, logLabel, buildError, spanName, attributes, durationAttribute, onTransportOutcome, deferTransportSuccessUntilBody = false, onRequestDispatched, transportErrorCode = "TRANSPORT" } = opts;
143364
143745
  const label = logLabel ?? url;
143365
143746
  validateHttpUrl(url);
143747
+ const retryAppend = retryStreamAppend && method === "PUT" && !!dispatcher2;
143748
+ const requestBody = retryAppend && body2 instanceof Uint8Array ? Uint8Array.from(body2) : body2;
143366
143749
  return withHttpClientSpan({ method, url, peerService, spanName, attributes }, async (span) => {
143367
- var _a3, _b2, _c2, _d2, _e2;
143750
+ var _a3, _b2, _c2, _d2, _e3;
143368
143751
  if (injectTraceContext2)
143369
143752
  await injectTraceContextIntoHeaders(headers2);
143370
- if (cacheBust)
143371
- headers2.set("X-Request-Time", Date.now().toString());
143372
143753
  const timeoutSignal = timeoutMs != null ? AbortSignal.timeout(timeoutMs) : void 0;
143373
143754
  const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
143374
143755
  const nodeAgents = dispatcher2 ? void 0 : getNodeHttpAgents();
@@ -143377,11 +143758,14 @@ async function instrumentedFetch(opts) {
143377
143758
  });
143378
143759
  const start2 = Date.now();
143379
143760
  let response2;
143380
- try {
143381
- const request2 = nodeAgents ? nodeHttpFetch(url, {
143761
+ const request2 = (retry2 = 0) => {
143762
+ signal == null ? void 0 : signal.throwIfAborted();
143763
+ if (cacheBust)
143764
+ headers2.set("X-Request-Time", Date.now().toString());
143765
+ const pending = nodeAgents ? nodeHttpFetch(url, {
143382
143766
  method,
143383
143767
  headers: headers2,
143384
- body: body2,
143768
+ body: requestBody,
143385
143769
  signal,
143386
143770
  agents: nodeAgents,
143387
143771
  // Match undici's per-phase defaults (which the undici agents
@@ -143393,13 +143777,17 @@ async function instrumentedFetch(opts) {
143393
143777
  }) : fetch(url, {
143394
143778
  method,
143395
143779
  headers: headers2,
143396
- body: body2,
143780
+ body: requestBody,
143397
143781
  signal,
143398
143782
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher type doesn't match @types/node's RequestInit
143399
143783
  dispatcher: dispatcher2
143400
143784
  });
143401
- onRequestDispatched == null ? void 0 : onRequestDispatched();
143402
- response2 = await request2;
143785
+ if (retry2 === 0)
143786
+ onRequestDispatched == null ? void 0 : onRequestDispatched();
143787
+ return pending;
143788
+ };
143789
+ try {
143790
+ response2 = await (retryAppend ? fetchStreamAppend(request2, signal) : request2());
143403
143791
  } catch (error2) {
143404
143792
  const elapsed = Date.now() - start2;
143405
143793
  onTransportOutcome == null ? void 0 : onTransportOutcome(error2);
@@ -143477,7 +143865,7 @@ async function instrumentedFetch(opts) {
143477
143865
  url,
143478
143866
  retryAfter: parseRetryAfter(response2.headers.get("Retry-After"))
143479
143867
  });
143480
- (_e2 = span == null ? void 0 : span.recordException) == null ? void 0 : _e2.call(span, error2);
143868
+ (_e3 = span == null ? void 0 : span.recordException) == null ? void 0 : _e3.call(span, error2);
143481
143869
  throw error2;
143482
143870
  }
143483
143871
  return response2;
@@ -144397,10 +144785,6 @@ function validateRunExecutionContext(value) {
144397
144785
  throw new WorkflowRuntimeError(`Dynamic workflow execution context is ${bytes} bytes, exceeding the ${MAX_EXECUTION_CONTEXT_BYTES}-byte limit, so no run was created. Each step binding counts its alias and its step ID, which comes from the step's file path and function name and is usually the longer of the two; the \`exportName\` counts too. Bind fewer steps through \`experimental_dynamic.steps\`, or shorten the aliases, the step files' paths or names, or the \`exportName\`.`);
144398
144786
  }
144399
144787
  }
144400
- async function getDeadline() {
144401
- const { getDeadline: getDeadline2 } = await import("./index-C3Gx8HYZ.js").then((n) => n.i);
144402
- return getDeadline2();
144403
- }
144404
144788
  const WORKFLOW_SERVER_SERVICE = {
144405
144789
  peerService: "workflow-server",
144406
144790
  rpcSystem: "http",
@@ -150038,299 +150422,6 @@ function createResolveLatestDeploymentId(config2) {
150038
150422
  return result.data.id;
150039
150423
  };
150040
150424
  }
150041
- class ReplayEventObserverError extends Error {
150042
- constructor(error2) {
150043
- super("Replay event observer failed", { cause: error2 });
150044
- __publicField(this, "error");
150045
- this.error = error2;
150046
- this.name = "ReplayEventObserverError";
150047
- }
150048
- }
150049
- class AfterCommitError extends Error {
150050
- constructor(error2) {
150051
- super("Event log read after a committed write failed", { cause: error2 });
150052
- __publicField(this, "error");
150053
- this.error = error2;
150054
- this.name = "AfterCommitError";
150055
- }
150056
- }
150057
- const STEP_OUTCOME_EVENT_TYPES = /* @__PURE__ */ new Set([
150058
- "step_completed",
150059
- "step_retrying"
150060
- ]);
150061
- function recordsStepOutcome(eventType) {
150062
- return STEP_OUTCOME_EVENT_TYPES.has(eventType);
150063
- }
150064
- const EVENT_RETRY_ELIGIBILITY = {
150065
- // Creates: conditional create → 409 EntityConflictError if it already exists.
150066
- run_created: {
150067
- retryable: true,
150068
- reason: "conditional create → 409 if exists"
150069
- },
150070
- step_created: {
150071
- retryable: true,
150072
- reason: "conditional create → 409 if exists"
150073
- },
150074
- wait_created: {
150075
- retryable: true,
150076
- reason: "conditional create → 409 if exists"
150077
- },
150078
- hook_created: {
150079
- retryable: true,
150080
- reason: "transactional token uniqueness → 409 if exists"
150081
- },
150082
- // Run start: early-returns if already running, writes no duplicate row.
150083
- run_started: {
150084
- retryable: true,
150085
- reason: "early-returns if already running, no duplicate row"
150086
- },
150087
- // Terminal transitions: conditional `.where()` excludes terminal states →
150088
- // 409 before the event row is written.
150089
- run_completed: {
150090
- retryable: true,
150091
- reason: "terminal-state guard → 409, no duplicate row"
150092
- },
150093
- run_failed: {
150094
- retryable: true,
150095
- reason: "terminal-state guard → 409, no duplicate row"
150096
- },
150097
- run_cancelled: {
150098
- retryable: true,
150099
- reason: "terminal-state guard → 409, no duplicate row"
150100
- },
150101
- step_completed: {
150102
- retryable: true,
150103
- reason: "terminal-state guard → 409, no duplicate row"
150104
- },
150105
- step_failed: {
150106
- retryable: true,
150107
- reason: "terminal-state guard → 409, no duplicate row"
150108
- },
150109
- wait_completed: {
150110
- retryable: true,
150111
- reason: "waiting-state guard → 409, no duplicate row"
150112
- },
150113
- hook_disposed: {
150114
- retryable: true,
150115
- reason: "conditional delete (exists) → 409, no duplicate row"
150116
- },
150117
- // True idempotency via a correlationId constraint that reuses the eventId.
150118
- attr_set: {
150119
- retryable: true,
150120
- reason: "correlationId constraint reuses eventId (idempotent replay)"
150121
- },
150122
- // NOT safe to retry; see the module comment.
150123
- step_started: {
150124
- retryable: false,
150125
- reason: "unconditional attempt increment → a retry double-counts attempts"
150126
- },
150127
- step_retrying: {
150128
- retryable: false,
150129
- reason: "no duplicate guard → a retry appends a second event row"
150130
- },
150131
- hook_received: {
150132
- retryable: false,
150133
- reason: "no server guard → a retry duplicates the row / re-delivers payload. EXCEPTION: the atomic lazy-resume shape (resumeId + digest) is deduplicated server-side by the (runId, resumeId) claim, so those writes opt in via withEventPostRetry({ idempotentHookResume })"
150134
- },
150135
- // Server-originated; the SDK never POSTs it.
150136
- hook_conflict: {
150137
- retryable: false,
150138
- reason: "server-originated; never POSTed by the SDK"
150139
- },
150140
- // Server-originated sealed-log filler (specVersion 7); the SDK never
150141
- // POSTs it. The server's read path writes it to seal an abandoned slot.
150142
- noop: {
150143
- retryable: false,
150144
- reason: "server-originated; never POSTed by the SDK"
150145
- }
150146
- };
150147
- const MAX_EVENT_POST_RETRIES = 2;
150148
- const THROTTLE_RETRY_BUDGET_MS = 3e4;
150149
- const THROTTLE_DEADLINE_RESERVE_MS = 15e3;
150150
- const THROTTLE_RETRY_MAX_BUDGET_MS = 15 * 6e4;
150151
- const DEFAULT_THROTTLE_RETRY_AFTER_SECONDS = 1;
150152
- const EVENT_POST_RETRY_BASE_MS = 100;
150153
- const EVENT_POST_RETRY_JITTER_MS = 50;
150154
- const TRANSIENT_CODES = /* @__PURE__ */ new Set([
150155
- "ECONNRESET",
150156
- "ECONNREFUSED",
150157
- "ENOTFOUND",
150158
- "ENETDOWN",
150159
- "ENETUNREACH",
150160
- "EHOSTDOWN",
150161
- "EHOSTUNREACH",
150162
- "EPIPE",
150163
- "ETIMEDOUT",
150164
- "UND_ERR_SOCKET",
150165
- "UND_ERR_REQ_RETRY",
150166
- "UND_ERR_CONNECT_TIMEOUT",
150167
- "UND_ERR_HEADERS_TIMEOUT",
150168
- "UND_ERR_BODY_TIMEOUT",
150169
- // Names (undici/Node surface these on the error or its cause).
150170
- // `TimeoutError` is our own per-request deadline (`AbortSignal.timeout` in
150171
- // makeRequest), a genuinely ambiguous failure worth retrying. We deliberately
150172
- // do NOT include `AbortError`: that is how an external/caller-supplied
150173
- // cancellation surfaces (makeRequest composes the caller's signal via
150174
- // `AbortSignal.any`), and re-issuing a write the caller asked to cancel
150175
- // (stalling the abort by the full backoff budget) would be wrong.
150176
- "TimeoutError",
150177
- "RequestRetryError"
150178
- ]);
150179
- function collectErrorMarkers(err, depth = 0) {
150180
- if (depth > 5 || err === null || typeof err !== "object")
150181
- return [];
150182
- const markers = [];
150183
- const e = err;
150184
- if (typeof e.code === "string")
150185
- markers.push(e.code);
150186
- if (typeof e.name === "string")
150187
- markers.push(e.name);
150188
- if (e.cause)
150189
- markers.push(...collectErrorMarkers(e.cause, depth + 1));
150190
- return markers;
150191
- }
150192
- function isRetryableEventPostError(err) {
150193
- if (err instanceof ReplayEventObserverError)
150194
- return false;
150195
- if (EntityConflictError.is(err) || // A takeover redirect is definitive for THIS target; the runtime's
150196
- // resume path follows the token instead of re-issuing the write here.
150197
- HookForceClaimedError.is(err) || RunExpiredError.is(err) || TooEarlyError.is(err) || ThrottleError.is(err)) {
150198
- return false;
150199
- }
150200
- if (WorkflowWorldError.is(err) || StreamError.is(err)) {
150201
- if (err.code === "PARSE_ERROR")
150202
- return true;
150203
- if (err.code === "TRANSPORT")
150204
- return true;
150205
- if (typeof err.status === "number") {
150206
- return err.status >= 500 && err.status <= 599;
150207
- }
150208
- if (err.code === "STREAM_ERROR") {
150209
- return !collectErrorMarkers(err).some((marker) => [
150210
- "AbortError",
150211
- "ABORT_ERR",
150212
- "UND_ERR_ABORTED",
150213
- "ERR_HTTP2_STREAM_CANCEL"
150214
- ].includes(marker));
150215
- }
150216
- }
150217
- return collectErrorMarkers(err).some((m2) => TRANSIENT_CODES.has(m2));
150218
- }
150219
- const sleep$1 = (ms2, signal) => new Promise((resolve2, reject) => {
150220
- if (signal == null ? void 0 : signal.aborted) {
150221
- reject(signal.reason);
150222
- return;
150223
- }
150224
- const onAbort = () => {
150225
- clearTimeout(timer2);
150226
- reject(signal == null ? void 0 : signal.reason);
150227
- };
150228
- const timer2 = setTimeout(() => {
150229
- signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
150230
- resolve2();
150231
- }, ms2);
150232
- signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
150233
- });
150234
- const RETRY_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
150235
- function logRetry(message2, fields) {
150236
- if (!RETRY_DEBUG_ENABLED)
150237
- return;
150238
- const suffix = Object.entries(fields).map(([k2, v2]) => `${k2}=${v2}`).join(" ");
150239
- console.debug(`[workflow:world-vercel:event-retry] ${message2} ${suffix}`);
150240
- }
150241
- function errorMarker(err) {
150242
- if (WorkflowWorldError.is(err)) {
150243
- return err.code ?? (err.status != null ? `status_${err.status}` : err.name);
150244
- }
150245
- return collectErrorMarkers(err)[0] ?? (err instanceof Error ? err.name : "unknown");
150246
- }
150247
- async function resolveDeadlineMs() {
150248
- try {
150249
- const deadline = await getDeadline();
150250
- const ms2 = deadline == null ? void 0 : deadline.getTime();
150251
- return ms2 !== void 0 && Number.isFinite(ms2) ? ms2 : void 0;
150252
- } catch {
150253
- return void 0;
150254
- }
150255
- }
150256
- function createThrottleWaiter(target2, budget) {
150257
- let waitedMs = 0;
150258
- let limit;
150259
- return async (err, signal) => {
150260
- const waitMs = Math.max(1, typeof err.retryAfter === "number" ? err.retryAfter : DEFAULT_THROTTLE_RETRY_AFTER_SECONDS) * 1e3;
150261
- if (limit === void 0) {
150262
- const deadlineMs = await resolveDeadlineMs();
150263
- limit = {
150264
- budgetMs: budget === "invocation" && deadlineMs !== void 0 ? THROTTLE_RETRY_MAX_BUDGET_MS : THROTTLE_RETRY_BUDGET_MS,
150265
- deadlineMs
150266
- };
150267
- }
150268
- const outlastsInvocation = limit.deadlineMs !== void 0 && Date.now() + waitMs > limit.deadlineMs - THROTTLE_DEADLINE_RESERVE_MS;
150269
- if (waitedMs + waitMs > limit.budgetMs || outlastsInvocation) {
150270
- logRetry("throttle retry budget exhausted; surfacing to the queue", {
150271
- target: target2,
150272
- budget,
150273
- waitedMs,
150274
- retryAfter: err.retryAfter,
150275
- outlastsInvocation
150276
- });
150277
- throw err;
150278
- }
150279
- waitedMs += waitMs;
150280
- console.warn(`[workflow] Throttled (429) ${target2}; retrying in-process in ${waitMs / 1e3}s`);
150281
- await sleep$1(waitMs, signal);
150282
- };
150283
- }
150284
- function throttleBudgetFor(eventType, options) {
150285
- if ((options == null ? void 0 : options.batchIdempotent) !== void 0)
150286
- return "bounded";
150287
- return (options == null ? void 0 : options.afterStepBody) === true || recordsStepOutcome(eventType) ? "invocation" : "bounded";
150288
- }
150289
- function isEligibleForTransientRetry(eventType, options) {
150290
- var _a3;
150291
- if ((options == null ? void 0 : options.inBand) === true)
150292
- return false;
150293
- if ((options == null ? void 0 : options.batchIdempotent) !== void 0) {
150294
- return options.batchIdempotent;
150295
- }
150296
- return eventType === "hook_received" && (options == null ? void 0 : options.idempotentHookResume) === true || (((_a3 = EVENT_RETRY_ELIGIBILITY[eventType]) == null ? void 0 : _a3.retryable) ?? false);
150297
- }
150298
- async function withEventPostRetry(fn2, eventType, options) {
150299
- const retryable = isEligibleForTransientRetry(eventType, options);
150300
- const waitOutThrottle = createThrottleWaiter(`writing ${eventType} event`, throttleBudgetFor(eventType, options));
150301
- for (let attempt = 0; ; ) {
150302
- try {
150303
- return await fn2();
150304
- } catch (err) {
150305
- if (err instanceof AfterCommitError)
150306
- throw err;
150307
- if (ThrottleError.is(err)) {
150308
- await waitOutThrottle(err);
150309
- continue;
150310
- }
150311
- if (!retryable || !isRetryableEventPostError(err)) {
150312
- throw err;
150313
- }
150314
- if (attempt >= MAX_EVENT_POST_RETRIES) {
150315
- logRetry("exhausted in-process retries; surfacing for queue redelivery", {
150316
- eventType,
150317
- attempts: attempt + 1,
150318
- error: errorMarker(err)
150319
- });
150320
- throw err;
150321
- }
150322
- const backoff = EVENT_POST_RETRY_BASE_MS * 2 ** attempt + Math.floor(Math.random() * EVENT_POST_RETRY_JITTER_MS);
150323
- attempt++;
150324
- logRetry("retrying event POST after transient failure", {
150325
- eventType,
150326
- attempt,
150327
- backoffMs: backoff,
150328
- error: errorMarker(err)
150329
- });
150330
- await sleep$1(backoff);
150331
- }
150332
- }
150333
- }
150334
150425
  const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
150335
150426
  class IncompleteFrameError extends Error {
150336
150427
  }
@@ -152775,7 +152866,7 @@ function beginNormalWsClose(ws, reason) {
152775
152866
  await observed;
152776
152867
  span == null ? void 0 : span.setAttribute("workflow.stream.ws.close_cleanup_timeout", timedOut);
152777
152868
  });
152778
- void import("./index-C3Gx8HYZ.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => waitUntil2(cleanup)).catch(() => {
152869
+ void import("./index-CI1MEtXX.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => waitUntil2(cleanup)).catch(() => {
152779
152870
  });
152780
152871
  void cleanup.catch(() => {
152781
152872
  });
@@ -153160,7 +153251,7 @@ class VercelStreamWriteSession {
153160
153251
  return http3;
153161
153252
  });
153162
153253
  const [{ WebSocket: WebSocketImpl }, http2] = await Promise.all([
153163
- import("./wrapper-BC7AidWM.js"),
153254
+ import("./wrapper-CA2LUUpa.js"),
153164
153255
  httpPromise
153165
153256
  ]);
153166
153257
  if (this.mode !== "connecting")
@@ -153606,6 +153697,7 @@ async function writeStreamSessionOverHttp(runId, name2, chunks, config2, attribu
153606
153697
  body: encodeMultiChunks(chunks.slice(offset3, offset3 + pageSize)),
153607
153698
  headers: httpConfig.headers,
153608
153699
  dispatcher: getStreamDispatcher(config2),
153700
+ retryStreamAppend: !(config2 == null ? void 0 : config2.dispatcher),
153609
153701
  timeoutMs: null,
153610
153702
  logLabel: url.pathname,
153611
153703
  spanName: "workflow.stream.write",
@@ -153660,6 +153752,7 @@ function createStreamer(config2) {
153660
153752
  body: chunk,
153661
153753
  headers: httpConfig.headers,
153662
153754
  dispatcher: getStreamDispatcher(config2),
153755
+ retryStreamAppend: !(config2 == null ? void 0 : config2.dispatcher),
153663
153756
  timeoutMs: null,
153664
153757
  transportErrorCode: "STREAM_ERROR",
153665
153758
  logLabel: url.pathname,
@@ -153691,6 +153784,7 @@ function createStreamer(config2) {
153691
153784
  body: body2,
153692
153785
  headers: httpConfig.headers,
153693
153786
  dispatcher: getStreamDispatcher(config2),
153787
+ retryStreamAppend: !(config2 == null ? void 0 : config2.dispatcher),
153694
153788
  timeoutMs: null,
153695
153789
  transportErrorCode: "STREAM_ERROR",
153696
153790
  logLabel: url.pathname,
@@ -159108,7 +159202,7 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
159108
159202
  });
159109
159203
  }
159110
159204
  async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs, logicalResumeId, webhookOnly) {
159111
- var _a3, _b2, _c2, _d2, _e2;
159205
+ var _a3, _b2, _c2, _d2, _e3;
159112
159206
  try {
159113
159207
  const suppliedToken = typeof tokenOrHook === "string";
159114
159208
  let hook;
@@ -159260,7 +159354,7 @@ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKe
159260
159354
  // of the messages. Claim-less writes have no resumeId and
159261
159355
  // keep the previous behavior.
159262
159356
  ...resumeId ? { idempotencyKey: `hook-${resumeId}` } : {}
159263
- }), (_e2 = world.isDeploymentUnavailableError) == null ? void 0 : _e2.bind(world));
159357
+ }), (_e3 = world.isDeploymentUnavailableError) == null ? void 0 : _e3.bind(world));
159264
159358
  span == null ? void 0 : span.setAttributes(HookWakePublished(true));
159265
159359
  return asLazyMetadataHook(hook);
159266
159360
  } catch (err) {
@@ -161346,7 +161440,7 @@ var CONTENT_NAME$7 = "PopperContent";
161346
161440
  var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$7);
161347
161441
  var PopperContent = reactExports.forwardRef(
161348
161442
  (props, forwardedRef) => {
161349
- var _a3, _b2, _c2, _d2, _e2, _f;
161443
+ var _a3, _b2, _c2, _d2, _e3, _f2;
161350
161444
  const {
161351
161445
  __scopePopper,
161352
161446
  side = "bottom",
@@ -161445,12 +161539,12 @@ var PopperContent = reactExports.forwardRef(
161445
161539
  zIndex: contentZIndex,
161446
161540
  ["--radix-popper-transform-origin"]: [
161447
161541
  (_d2 = middlewareData.transformOrigin) == null ? void 0 : _d2.x,
161448
- (_e2 = middlewareData.transformOrigin) == null ? void 0 : _e2.y
161542
+ (_e3 = middlewareData.transformOrigin) == null ? void 0 : _e3.y
161449
161543
  ].join(" "),
161450
161544
  // hide the content if using the hide middleware and should be hidden
161451
161545
  // set visibility to hidden and disable pointer events so the UI behaves
161452
161546
  // as if the PopperContent isn't there at all
161453
- ...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
161547
+ ...((_f2 = middlewareData.hide) == null ? void 0 : _f2.referenceHidden) && {
161454
161548
  visibility: "hidden",
161455
161549
  pointerEvents: "none"
161456
161550
  }
@@ -179077,7 +179171,7 @@ function getNodeIcon(nodeKind, label) {
179077
179171
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" });
179078
179172
  }
179079
179173
  function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT$1) {
179080
- var _a3, _b2, _c2, _d2, _e2;
179174
+ var _a3, _b2, _c2, _d2, _e3;
179081
179175
  const nodes = workflow.nodes.map((node2) => ({ ...node2 }));
179082
179176
  const groupNodes = [];
179083
179177
  const additionalEdges = [];
@@ -179156,7 +179250,7 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT$1) {
179156
179250
  if (thenNodes.length > 0 && elseNodes.length > 0) {
179157
179251
  const baseY = Math.min(
179158
179252
  ((_d2 = thenNodes[0]) == null ? void 0 : _d2.position.y) || 0,
179159
- ((_e2 = elseNodes[0]) == null ? void 0 : _e2.position.y) || 0
179253
+ ((_e3 = elseNodes[0]) == null ? void 0 : _e3.position.y) || 0
179160
179254
  );
179161
179255
  thenNodes.forEach((node2, idx) => {
179162
179256
  node2.position = {
@@ -182567,7 +182661,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
182567
182661
  __proto__: null,
182568
182662
  loader
182569
182663
  }, Symbol.toStringTag, { value: "Module" }));
182570
- const serverManifest = { "entry": { "module": "/assets/entry.client-GbcnkvKL.js", "imports": ["/assets/index-CRmVVsbP.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-DixDz_si.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/mermaid-3ZIDBTTL-COEB4Hc6.js", "/assets/loader-circle-BaPqCMKN.js", "/assets/arrow-up-right-ychoyK1y.js"], "css": ["/assets/root-D51qsCcK.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-C3xDSPLC.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/workflow-graph-viewer-B9ovZj-2.js", "/assets/mermaid-3ZIDBTTL-COEB4Hc6.js", "/assets/loader-circle-BaPqCMKN.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-CEQc0q3W.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/workflow-graph-viewer-B9ovZj-2.js", "/assets/mermaid-3ZIDBTTL-COEB4Hc6.js", "/assets/arrow-up-right-ychoyK1y.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-4e8be598.js", "version": "4e8be598", "sri": void 0 };
182664
+ const serverManifest = { "entry": { "module": "/assets/entry.client-GbcnkvKL.js", "imports": ["/assets/index-CRmVVsbP.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-D1LRhSwl.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/mermaid-3ZIDBTTL-C-jkx8xu.js", "/assets/loader-circle-BHf0PB8D.js", "/assets/arrow-up-right-BjmInfWj.js"], "css": ["/assets/root-D51qsCcK.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-Cj8BA1xg.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/workflow-graph-viewer-BRI-aUt7.js", "/assets/mermaid-3ZIDBTTL-C-jkx8xu.js", "/assets/loader-circle-BHf0PB8D.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-L1jBcQcp.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/workflow-graph-viewer-BRI-aUt7.js", "/assets/mermaid-3ZIDBTTL-C-jkx8xu.js", "/assets/arrow-up-right-BjmInfWj.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-9875bf74.js", "version": "9875bf74", "sri": void 0 };
182571
182665
  const assetsBuildDirectory = "build/client";
182572
182666
  const basename = "/";
182573
182667
  const future = { "unstable_optimizeDeps": false, "v8_passThroughRequests": false, "v8_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };