@workflow/web 5.0.4 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/build/client/assets/app-Dl8u94Mn.css +1 -0
  2. package/build/client/assets/{arrow-up-right-ychoyK1y.js → arrow-up-right-DDLzuSl1.js} +1 -1
  3. package/build/client/assets/{highlighted-body-B3W2YXNL-C53ps5L5.js → highlighted-body-B3W2YXNL-7nJixRf5.js} +1 -1
  4. package/build/client/assets/{home-C3xDSPLC.js → home-DjMKxUF0.js} +3 -3
  5. package/build/client/assets/{loader-circle-BaPqCMKN.js → loader-circle-BuHkkqyY.js} +1 -1
  6. package/build/client/assets/{manifest-4e8be598.js → manifest-4ef14c64.js} +1 -1
  7. package/build/client/assets/{mermaid-3ZIDBTTL-COEB4Hc6.js → mermaid-3ZIDBTTL-CQkIfF6F.js} +97 -46
  8. package/build/client/assets/{root-DixDz_si.js → root-BdoS4wTM.js} +3 -3
  9. package/build/client/assets/root-DlBeVW_-.css +1 -0
  10. package/build/client/assets/{run-detail-CEQc0q3W.js → run-detail-CY1rcVcm.js} +126 -20
  11. package/build/client/assets/{workflow-graph-viewer-B9ovZj-2.js → workflow-graph-viewer-DaFQpLw8.js} +3 -2
  12. package/build/client/assets/{zstd-browser-decoder-D9w7uXpQ.js → zstd-browser-decoder-BEdfA1e2.js} +1 -1
  13. package/build/server/assets/{app-B50FKpUW.js → app-BWanCGIY.js} +993 -634
  14. package/build/server/assets/{highlighted-body-B3W2YXNL-DwfdU2_m.js → highlighted-body-B3W2YXNL-DTYrZ-0h.js} +1 -1
  15. package/build/server/assets/{index-D1YkUiuC.js → index-BE6TqyDE.js} +36 -34
  16. package/build/server/assets/{index-C3Gx8HYZ.js → index-DKlEIDGP.js} +1 -1
  17. package/build/server/assets/{mermaid-3ZIDBTTL-koYqT7Zj.js → mermaid-3ZIDBTTL-lgfv9_nj.js} +1 -1
  18. package/build/server/assets/{token-DbFnZp4-.js → token-BhYk3Bk4.js} +1 -1
  19. package/build/server/assets/{token-util-BXkc19cz.js → token-util-CfkQa5kX.js} +1 -1
  20. package/build/server/assets/{wrapper-BC7AidWM.js → wrapper-BO03ZtLx.js} +9 -9
  21. package/build/server/assets/{zstd-browser-decoder-ClonRoMz.js → zstd-browser-decoder-BAaFFyPz.js} +1 -1
  22. package/build/server/index.js +2 -2
  23. package/package.json +7 -7
  24. package/build/client/assets/app-Cruj5elv.css +0 -1
  25. package/build/client/assets/root-D51qsCcK.css +0 -1
@@ -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
  }
@@ -36309,7 +36309,7 @@ const createLucideIcon = (iconName, iconNode) => {
36309
36309
  * This source code is licensed under the ISC license.
36310
36310
  * See the LICENSE file in the root directory of this source tree.
36311
36311
  */
36312
- const __iconNode$D = [
36312
+ const __iconNode$E = [
36313
36313
  [
36314
36314
  "path",
36315
36315
  {
@@ -36318,14 +36318,14 @@ const __iconNode$D = [
36318
36318
  }
36319
36319
  ]
36320
36320
  ];
36321
- const Activity = createLucideIcon("activity", __iconNode$D);
36321
+ const Activity = createLucideIcon("activity", __iconNode$E);
36322
36322
  /**
36323
36323
  * @license lucide-react v0.575.0 - ISC
36324
36324
  *
36325
36325
  * This source code is licensed under the ISC license.
36326
36326
  * See the LICENSE file in the root directory of this source tree.
36327
36327
  */
36328
- const __iconNode$C = [
36328
+ const __iconNode$D = [
36329
36329
  ["path", { d: "M6.87 6.87a8 8 0 1 0 11.26 11.26", key: "3on8tj" }],
36330
36330
  ["path", { d: "M19.9 14.25a8 8 0 0 0-9.15-9.15", key: "15ghsc" }],
36331
36331
  ["path", { d: "m22 6-3-3", key: "1opdir" }],
@@ -36333,127 +36333,127 @@ const __iconNode$C = [
36333
36333
  ["path", { d: "m2 2 20 20", key: "1ooewy" }],
36334
36334
  ["path", { d: "M4 4 2 6", key: "1ycko6" }]
36335
36335
  ];
36336
- const AlarmClockOff = createLucideIcon("alarm-clock-off", __iconNode$C);
36336
+ const AlarmClockOff = createLucideIcon("alarm-clock-off", __iconNode$D);
36337
36337
  /**
36338
36338
  * @license lucide-react v0.575.0 - ISC
36339
36339
  *
36340
36340
  * This source code is licensed under the ISC license.
36341
36341
  * See the LICENSE file in the root directory of this source tree.
36342
36342
  */
36343
- const __iconNode$B = [
36343
+ const __iconNode$C = [
36344
36344
  ["path", { d: "m3 16 4 4 4-4", key: "1co6wj" }],
36345
36345
  ["path", { d: "M7 20V4", key: "1yoxec" }],
36346
36346
  ["path", { d: "M20 8h-5", key: "1vsyxs" }],
36347
36347
  ["path", { d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10", key: "ag13bf" }],
36348
36348
  ["path", { d: "M15 14h5l-5 6h5", key: "ur5jdg" }]
36349
36349
  ];
36350
- const ArrowDownAZ = createLucideIcon("arrow-down-a-z", __iconNode$B);
36350
+ const ArrowDownAZ = createLucideIcon("arrow-down-a-z", __iconNode$C);
36351
36351
  /**
36352
36352
  * @license lucide-react v0.575.0 - ISC
36353
36353
  *
36354
36354
  * This source code is licensed under the ISC license.
36355
36355
  * See the LICENSE file in the root directory of this source tree.
36356
36356
  */
36357
- const __iconNode$A = [
36357
+ const __iconNode$B = [
36358
36358
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
36359
36359
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
36360
36360
  ];
36361
- const ArrowLeft = createLucideIcon("arrow-left", __iconNode$A);
36361
+ const ArrowLeft = createLucideIcon("arrow-left", __iconNode$B);
36362
36362
  /**
36363
36363
  * @license lucide-react v0.575.0 - ISC
36364
36364
  *
36365
36365
  * This source code is licensed under the ISC license.
36366
36366
  * See the LICENSE file in the root directory of this source tree.
36367
36367
  */
36368
- const __iconNode$z = [
36368
+ const __iconNode$A = [
36369
36369
  ["path", { d: "M5 12h14", key: "1ays0h" }],
36370
36370
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
36371
36371
  ];
36372
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$z);
36372
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$A);
36373
36373
  /**
36374
36374
  * @license lucide-react v0.575.0 - ISC
36375
36375
  *
36376
36376
  * This source code is licensed under the ISC license.
36377
36377
  * See the LICENSE file in the root directory of this source tree.
36378
36378
  */
36379
- const __iconNode$y = [
36379
+ const __iconNode$z = [
36380
36380
  ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
36381
36381
  ["path", { d: "M7 4v16", key: "1glfcx" }],
36382
36382
  ["path", { d: "M20 8h-5", key: "1vsyxs" }],
36383
36383
  ["path", { d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10", key: "ag13bf" }],
36384
36384
  ["path", { d: "M15 14h5l-5 6h5", key: "ur5jdg" }]
36385
36385
  ];
36386
- const ArrowUpAZ = createLucideIcon("arrow-up-a-z", __iconNode$y);
36386
+ const ArrowUpAZ = createLucideIcon("arrow-up-a-z", __iconNode$z);
36387
36387
  /**
36388
36388
  * @license lucide-react v0.575.0 - ISC
36389
36389
  *
36390
36390
  * This source code is licensed under the ISC license.
36391
36391
  * See the LICENSE file in the root directory of this source tree.
36392
36392
  */
36393
- const __iconNode$x = [
36393
+ const __iconNode$y = [
36394
36394
  ["path", { d: "M7 7h10v10", key: "1tivn9" }],
36395
36395
  ["path", { d: "M7 17 17 7", key: "1vkiza" }]
36396
36396
  ];
36397
- const ArrowUpRight = createLucideIcon("arrow-up-right", __iconNode$x);
36397
+ const ArrowUpRight = createLucideIcon("arrow-up-right", __iconNode$y);
36398
36398
  /**
36399
36399
  * @license lucide-react v0.575.0 - ISC
36400
36400
  *
36401
36401
  * This source code is licensed under the ISC license.
36402
36402
  * See the LICENSE file in the root directory of this source tree.
36403
36403
  */
36404
- const __iconNode$w = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
36405
- const Check = createLucideIcon("check", __iconNode$w);
36404
+ const __iconNode$x = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
36405
+ const Check = createLucideIcon("check", __iconNode$x);
36406
36406
  /**
36407
36407
  * @license lucide-react v0.575.0 - ISC
36408
36408
  *
36409
36409
  * This source code is licensed under the ISC license.
36410
36410
  * See the LICENSE file in the root directory of this source tree.
36411
36411
  */
36412
- const __iconNode$v = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
36413
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$v);
36412
+ const __iconNode$w = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
36413
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$w);
36414
36414
  /**
36415
36415
  * @license lucide-react v0.575.0 - ISC
36416
36416
  *
36417
36417
  * This source code is licensed under the ISC license.
36418
36418
  * See the LICENSE file in the root directory of this source tree.
36419
36419
  */
36420
- const __iconNode$u = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
36421
- const ChevronLeft = createLucideIcon("chevron-left", __iconNode$u);
36420
+ const __iconNode$v = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
36421
+ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$v);
36422
36422
  /**
36423
36423
  * @license lucide-react v0.575.0 - ISC
36424
36424
  *
36425
36425
  * This source code is licensed under the ISC license.
36426
36426
  * See the LICENSE file in the root directory of this source tree.
36427
36427
  */
36428
- const __iconNode$t = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
36429
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$t);
36428
+ const __iconNode$u = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
36429
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$u);
36430
36430
  /**
36431
36431
  * @license lucide-react v0.575.0 - ISC
36432
36432
  *
36433
36433
  * This source code is licensed under the ISC license.
36434
36434
  * See the LICENSE file in the root directory of this source tree.
36435
36435
  */
36436
- const __iconNode$s = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
36437
- const ChevronUp = createLucideIcon("chevron-up", __iconNode$s);
36436
+ const __iconNode$t = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
36437
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$t);
36438
36438
  /**
36439
36439
  * @license lucide-react v0.575.0 - ISC
36440
36440
  *
36441
36441
  * This source code is licensed under the ISC license.
36442
36442
  * See the LICENSE file in the root directory of this source tree.
36443
36443
  */
36444
- const __iconNode$r = [
36444
+ const __iconNode$s = [
36445
36445
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
36446
36446
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
36447
36447
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
36448
36448
  ];
36449
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$r);
36449
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$s);
36450
36450
  /**
36451
36451
  * @license lucide-react v0.575.0 - ISC
36452
36452
  *
36453
36453
  * This source code is licensed under the ISC license.
36454
36454
  * See the LICENSE file in the root directory of this source tree.
36455
36455
  */
36456
- const __iconNode$q = [
36456
+ const __iconNode$r = [
36457
36457
  [
36458
36458
  "path",
36459
36459
  {
@@ -36463,115 +36463,115 @@ const __iconNode$q = [
36463
36463
  ],
36464
36464
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
36465
36465
  ];
36466
- const CirclePlay = createLucideIcon("circle-play", __iconNode$q);
36466
+ const CirclePlay = createLucideIcon("circle-play", __iconNode$r);
36467
36467
  /**
36468
36468
  * @license lucide-react v0.575.0 - ISC
36469
36469
  *
36470
36470
  * This source code is licensed under the ISC license.
36471
36471
  * See the LICENSE file in the root directory of this source tree.
36472
36472
  */
36473
- const __iconNode$p = [
36473
+ const __iconNode$q = [
36474
36474
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
36475
36475
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
36476
36476
  ["path", { d: "M12 17h.01", key: "p32p05" }]
36477
36477
  ];
36478
- const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$p);
36478
+ const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$q);
36479
36479
  /**
36480
36480
  * @license lucide-react v0.575.0 - ISC
36481
36481
  *
36482
36482
  * This source code is licensed under the ISC license.
36483
36483
  * See the LICENSE file in the root directory of this source tree.
36484
36484
  */
36485
- const __iconNode$o = [
36485
+ const __iconNode$p = [
36486
36486
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
36487
36487
  ["rect", { x: "9", y: "9", width: "6", height: "6", rx: "1", key: "1ssd4o" }]
36488
36488
  ];
36489
- const CircleStop = createLucideIcon("circle-stop", __iconNode$o);
36489
+ const CircleStop = createLucideIcon("circle-stop", __iconNode$p);
36490
36490
  /**
36491
36491
  * @license lucide-react v0.575.0 - ISC
36492
36492
  *
36493
36493
  * This source code is licensed under the ISC license.
36494
36494
  * See the LICENSE file in the root directory of this source tree.
36495
36495
  */
36496
- const __iconNode$n = [
36496
+ const __iconNode$o = [
36497
36497
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
36498
36498
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
36499
36499
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
36500
36500
  ];
36501
- const CircleX = createLucideIcon("circle-x", __iconNode$n);
36501
+ const CircleX = createLucideIcon("circle-x", __iconNode$o);
36502
36502
  /**
36503
36503
  * @license lucide-react v0.575.0 - ISC
36504
36504
  *
36505
36505
  * This source code is licensed under the ISC license.
36506
36506
  * See the LICENSE file in the root directory of this source tree.
36507
36507
  */
36508
- const __iconNode$m = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
36509
- const Circle = createLucideIcon("circle", __iconNode$m);
36508
+ const __iconNode$n = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
36509
+ const Circle = createLucideIcon("circle", __iconNode$n);
36510
36510
  /**
36511
36511
  * @license lucide-react v0.575.0 - ISC
36512
36512
  *
36513
36513
  * This source code is licensed under the ISC license.
36514
36514
  * See the LICENSE file in the root directory of this source tree.
36515
36515
  */
36516
- const __iconNode$l = [
36516
+ const __iconNode$m = [
36517
36517
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
36518
36518
  ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
36519
36519
  ];
36520
- const Clock = createLucideIcon("clock", __iconNode$l);
36520
+ const Clock = createLucideIcon("clock", __iconNode$m);
36521
36521
  /**
36522
36522
  * @license lucide-react v0.575.0 - ISC
36523
36523
  *
36524
36524
  * This source code is licensed under the ISC license.
36525
36525
  * See the LICENSE file in the root directory of this source tree.
36526
36526
  */
36527
- const __iconNode$k = [
36527
+ const __iconNode$l = [
36528
36528
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
36529
36529
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
36530
36530
  ];
36531
- const Copy = createLucideIcon("copy", __iconNode$k);
36531
+ const Copy = createLucideIcon("copy", __iconNode$l);
36532
36532
  /**
36533
36533
  * @license lucide-react v0.575.0 - ISC
36534
36534
  *
36535
36535
  * This source code is licensed under the ISC license.
36536
36536
  * See the LICENSE file in the root directory of this source tree.
36537
36537
  */
36538
- const __iconNode$j = [
36538
+ const __iconNode$k = [
36539
36539
  ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
36540
36540
  ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
36541
36541
  ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
36542
36542
  ];
36543
- const Ellipsis = createLucideIcon("ellipsis", __iconNode$j);
36543
+ const Ellipsis = createLucideIcon("ellipsis", __iconNode$k);
36544
36544
  /**
36545
36545
  * @license lucide-react v0.575.0 - ISC
36546
36546
  *
36547
36547
  * This source code is licensed under the ISC license.
36548
36548
  * See the LICENSE file in the root directory of this source tree.
36549
36549
  */
36550
- const __iconNode$i = [
36550
+ const __iconNode$j = [
36551
36551
  ["path", { d: "M15 6a9 9 0 0 0-9 9V3", key: "1cii5b" }],
36552
36552
  ["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
36553
36553
  ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }]
36554
36554
  ];
36555
- const GitBranch = createLucideIcon("git-branch", __iconNode$i);
36555
+ const GitBranch = createLucideIcon("git-branch", __iconNode$j);
36556
36556
  /**
36557
36557
  * @license lucide-react v0.575.0 - ISC
36558
36558
  *
36559
36559
  * This source code is licensed under the ISC license.
36560
36560
  * See the LICENSE file in the root directory of this source tree.
36561
36561
  */
36562
- const __iconNode$h = [
36562
+ const __iconNode$i = [
36563
36563
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
36564
36564
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
36565
36565
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
36566
36566
  ];
36567
- const Link2 = createLucideIcon("link-2", __iconNode$h);
36567
+ const Link2 = createLucideIcon("link-2", __iconNode$i);
36568
36568
  /**
36569
36569
  * @license lucide-react v0.575.0 - ISC
36570
36570
  *
36571
36571
  * This source code is licensed under the ISC license.
36572
36572
  * See the LICENSE file in the root directory of this source tree.
36573
36573
  */
36574
- const __iconNode$g = [
36574
+ const __iconNode$h = [
36575
36575
  ["path", { d: "M3 5h.01", key: "18ugdj" }],
36576
36576
  ["path", { d: "M3 12h.01", key: "nlz23k" }],
36577
36577
  ["path", { d: "M3 19h.01", key: "noohij" }],
@@ -36579,53 +36579,53 @@ const __iconNode$g = [
36579
36579
  ["path", { d: "M8 12h13", key: "1za7za" }],
36580
36580
  ["path", { d: "M8 19h13", key: "m83p4d" }]
36581
36581
  ];
36582
- const List$1 = createLucideIcon("list", __iconNode$g);
36582
+ const List$1 = createLucideIcon("list", __iconNode$h);
36583
36583
  /**
36584
36584
  * @license lucide-react v0.575.0 - ISC
36585
36585
  *
36586
36586
  * This source code is licensed under the ISC license.
36587
36587
  * See the LICENSE file in the root directory of this source tree.
36588
36588
  */
36589
- const __iconNode$f = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
36590
- const LoaderCircle = createLucideIcon("loader-circle", __iconNode$f);
36589
+ const __iconNode$g = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
36590
+ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$g);
36591
36591
  /**
36592
36592
  * @license lucide-react v0.575.0 - ISC
36593
36593
  *
36594
36594
  * This source code is licensed under the ISC license.
36595
36595
  * See the LICENSE file in the root directory of this source tree.
36596
36596
  */
36597
- const __iconNode$e = [
36597
+ const __iconNode$f = [
36598
36598
  ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
36599
36599
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
36600
36600
  ];
36601
- const Lock = createLucideIcon("lock", __iconNode$e);
36601
+ const Lock = createLucideIcon("lock", __iconNode$f);
36602
36602
  /**
36603
36603
  * @license lucide-react v0.575.0 - ISC
36604
36604
  *
36605
36605
  * This source code is licensed under the ISC license.
36606
36606
  * See the LICENSE file in the root directory of this source tree.
36607
36607
  */
36608
- const __iconNode$d = [["path", { d: "M5 12h14", key: "1ays0h" }]];
36609
- const Minus = createLucideIcon("minus", __iconNode$d);
36608
+ const __iconNode$e = [["path", { d: "M5 12h14", key: "1ays0h" }]];
36609
+ const Minus = createLucideIcon("minus", __iconNode$e);
36610
36610
  /**
36611
36611
  * @license lucide-react v0.575.0 - ISC
36612
36612
  *
36613
36613
  * This source code is licensed under the ISC license.
36614
36614
  * See the LICENSE file in the root directory of this source tree.
36615
36615
  */
36616
- const __iconNode$c = [
36616
+ const __iconNode$d = [
36617
36617
  ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
36618
36618
  ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
36619
36619
  ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
36620
36620
  ];
36621
- const Monitor = createLucideIcon("monitor", __iconNode$c);
36621
+ const Monitor = createLucideIcon("monitor", __iconNode$d);
36622
36622
  /**
36623
36623
  * @license lucide-react v0.575.0 - ISC
36624
36624
  *
36625
36625
  * This source code is licensed under the ISC license.
36626
36626
  * See the LICENSE file in the root directory of this source tree.
36627
36627
  */
36628
- const __iconNode$b = [
36628
+ const __iconNode$c = [
36629
36629
  [
36630
36630
  "path",
36631
36631
  {
@@ -36634,60 +36634,60 @@ const __iconNode$b = [
36634
36634
  }
36635
36635
  ]
36636
36636
  ];
36637
- const Moon = createLucideIcon("moon", __iconNode$b);
36637
+ const Moon = createLucideIcon("moon", __iconNode$c);
36638
36638
  /**
36639
36639
  * @license lucide-react v0.575.0 - ISC
36640
36640
  *
36641
36641
  * This source code is licensed under the ISC license.
36642
36642
  * See the LICENSE file in the root directory of this source tree.
36643
36643
  */
36644
- const __iconNode$a = [
36644
+ const __iconNode$b = [
36645
36645
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
36646
36646
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
36647
36647
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
36648
36648
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
36649
36649
  ];
36650
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$a);
36650
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$b);
36651
36651
  /**
36652
36652
  * @license lucide-react v0.575.0 - ISC
36653
36653
  *
36654
36654
  * This source code is licensed under the ISC license.
36655
36655
  * See the LICENSE file in the root directory of this source tree.
36656
36656
  */
36657
- const __iconNode$9 = [
36657
+ const __iconNode$a = [
36658
36658
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
36659
36659
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
36660
36660
  ];
36661
- const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$9);
36661
+ const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$a);
36662
36662
  /**
36663
36663
  * @license lucide-react v0.575.0 - ISC
36664
36664
  *
36665
36665
  * This source code is licensed under the ISC license.
36666
36666
  * See the LICENSE file in the root directory of this source tree.
36667
36667
  */
36668
- const __iconNode$8 = [
36668
+ const __iconNode$9 = [
36669
36669
  ["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
36670
36670
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }]
36671
36671
  ];
36672
- const RotateCw = createLucideIcon("rotate-cw", __iconNode$8);
36672
+ const RotateCw = createLucideIcon("rotate-cw", __iconNode$9);
36673
36673
  /**
36674
36674
  * @license lucide-react v0.575.0 - ISC
36675
36675
  *
36676
36676
  * This source code is licensed under the ISC license.
36677
36677
  * See the LICENSE file in the root directory of this source tree.
36678
36678
  */
36679
- const __iconNode$7 = [
36679
+ const __iconNode$8 = [
36680
36680
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
36681
36681
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
36682
36682
  ];
36683
- const Search = createLucideIcon("search", __iconNode$7);
36683
+ const Search = createLucideIcon("search", __iconNode$8);
36684
36684
  /**
36685
36685
  * @license lucide-react v0.575.0 - ISC
36686
36686
  *
36687
36687
  * This source code is licensed under the ISC license.
36688
36688
  * See the LICENSE file in the root directory of this source tree.
36689
36689
  */
36690
- const __iconNode$6 = [
36690
+ const __iconNode$7 = [
36691
36691
  [
36692
36692
  "path",
36693
36693
  {
@@ -36697,14 +36697,14 @@ const __iconNode$6 = [
36697
36697
  ],
36698
36698
  ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
36699
36699
  ];
36700
- const Send = createLucideIcon("send", __iconNode$6);
36700
+ const Send = createLucideIcon("send", __iconNode$7);
36701
36701
  /**
36702
36702
  * @license lucide-react v0.575.0 - ISC
36703
36703
  *
36704
36704
  * This source code is licensed under the ISC license.
36705
36705
  * See the LICENSE file in the root directory of this source tree.
36706
36706
  */
36707
- const __iconNode$5 = [
36707
+ const __iconNode$6 = [
36708
36708
  ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
36709
36709
  ["path", { d: "M12 2v2", key: "tus03m" }],
36710
36710
  ["path", { d: "M12 20v2", key: "1lh1kg" }],
@@ -36715,7 +36715,25 @@ const __iconNode$5 = [
36715
36715
  ["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
36716
36716
  ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
36717
36717
  ];
36718
- const Sun = createLucideIcon("sun", __iconNode$5);
36718
+ const Sun = createLucideIcon("sun", __iconNode$6);
36719
+ /**
36720
+ * @license lucide-react v0.575.0 - ISC
36721
+ *
36722
+ * This source code is licensed under the ISC license.
36723
+ * See the LICENSE file in the root directory of this source tree.
36724
+ */
36725
+ const __iconNode$5 = [
36726
+ [
36727
+ "path",
36728
+ {
36729
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
36730
+ key: "wmoenq"
36731
+ }
36732
+ ],
36733
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
36734
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
36735
+ ];
36736
+ const TriangleAlert = createLucideIcon("triangle-alert", __iconNode$5);
36719
36737
  /**
36720
36738
  * @license lucide-react v0.575.0 - ISC
36721
36739
  *
@@ -40527,7 +40545,7 @@ function attachSchema(issues, start2, inst) {
40527
40545
  }
40528
40546
  }
40529
40547
  function finalizeIssue(iss, ctx, config2) {
40530
- var _a4, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j;
40548
+ var _a4, _b2, _c2, _d2, _e3, _f2, _g, _h, _i, _j;
40531
40549
  var _a3;
40532
40550
  const traits = (_b2 = (_a4 = iss.inst) == null ? void 0 : _a4._zod) == null ? void 0 : _b2.traits;
40533
40551
  if (traits == null ? void 0 : traits.has("$ZodType")) {
@@ -40537,7 +40555,7 @@ function finalizeIssue(iss, ctx, config2) {
40537
40555
  iss.schema = iss.inst;
40538
40556
  }
40539
40557
  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";
40558
+ 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
40559
  const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
40542
40560
  rest.path ?? (rest.path = []);
40543
40561
  rest.message = message2;
@@ -48888,6 +48906,16 @@ function getMaxEventsPerRun() {
48888
48906
  const maxEvents = envNumber("WORKFLOW_MAX_EVENTS", DEFAULT_MAX_EVENTS_PER_RUN, { integer: true });
48889
48907
  return maxEvents > 0 ? maxEvents : DEFAULT_MAX_EVENTS_PER_RUN;
48890
48908
  }
48909
+ function isEventLimitExemptRun(run2) {
48910
+ const context = run2 == null ? void 0 : run2.executionContext;
48911
+ if (context === null || typeof context !== "object")
48912
+ return false;
48913
+ const { workflowVm, snapshotThreshold } = context;
48914
+ return workflowVm === "quickjs" && typeof snapshotThreshold === "number" && Number.isSafeInteger(snapshotThreshold) && snapshotThreshold > 0;
48915
+ }
48916
+ function getMaxEventsForRun(run2) {
48917
+ return isEventLimitExemptRun(run2) ? Number.MAX_SAFE_INTEGER : getMaxEventsPerRun();
48918
+ }
48891
48919
  const QueuePrefix = compile(string$2().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_$/, "Must match __wkf_workflow_ or __{namespace}_wkf_workflow_"));
48892
48920
  const ValidQueueName = compile(string$2().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_.+$/, "Must be a valid queue name with a recognized prefix"));
48893
48921
  const QueueNamespace = compile(string$2().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter"));
@@ -49168,6 +49196,19 @@ const HealthCheckPayloadSchema = compile(object$1({
49168
49196
  * probe response. That lets the caller seal the workflow arguments without
49169
49197
  * a separate key lookup. Absent for probes issued for other reasons (CLI
49170
49198
  * health command, dashboard), in which case no key is returned.
49199
+ *
49200
+ * Deliberately not named `runId`: `runId` is the only required field of
49201
+ * `WorkflowInvokePayloadSchema`, and 4.x deployments parse queue payloads
49202
+ * with a union that tries the invoke schema before the health check. A
49203
+ * probe carrying `runId` is read there as "replay this run", which POSTs
49204
+ * `run_started` for a run that does not exist yet (404) and retries the
49205
+ * delivery, so the probe never answers.
49206
+ */
49207
+ probeRunId: string$2().optional(),
49208
+ /**
49209
+ * Legacy spelling of {@link probeRunId}, sent by 5.x callers released
49210
+ * before the rename. Accepted so those callers still get a public key
49211
+ * back from this deployment; never sent.
49171
49212
  */
49172
49213
  runId: string$2().optional()
49173
49214
  }));
@@ -52948,23 +52989,24 @@ function foldDuplicates(ordered) {
52948
52989
  const seenClasses = /* @__PURE__ */ new Set();
52949
52990
  const closedEntities = /* @__PURE__ */ new Set();
52950
52991
  for (const event of ordered) {
52992
+ if (event.correlationId && closedEntities.has(event.correlationId)) {
52993
+ duplicates.add(event.eventId);
52994
+ continue;
52995
+ }
52951
52996
  const classification = classifyEntityEvent(event);
52952
52997
  if (classification === void 0)
52953
52998
  continue;
52954
52999
  const { eventClass, entity } = classification;
52955
53000
  const classKey = `${eventClass}:${entity}`;
52956
53001
  const repeatsClass = seenClasses.has(classKey);
52957
- const entityWasClosed = closedEntities.has(entity);
52958
53002
  if (TERMINAL_EVENT_CLASSES.has(eventClass)) {
52959
53003
  closedEntities.add(entity);
52960
53004
  }
52961
53005
  if (!repeatsClass) {
52962
- if (entityWasClosed)
52963
- break;
52964
53006
  seenClasses.add(classKey);
52965
53007
  continue;
52966
53008
  }
52967
- if (entityWasClosed || SINGLETON_EVENT_CLASSES.has(eventClass)) {
53009
+ if (SINGLETON_EVENT_CLASSES.has(eventClass)) {
52968
53010
  duplicates.add(event.eventId);
52969
53011
  }
52970
53012
  }
@@ -53269,6 +53311,21 @@ class DevalueError extends Error {
53269
53311
  this.root = root2;
53270
53312
  }
53271
53313
  }
53314
+ const MAP_KEY = Symbol();
53315
+ function format_path(keys2, format_map_key) {
53316
+ const path2 = [];
53317
+ for (let i = 0; i < keys2.length; i += 1) {
53318
+ const segment = keys2[i];
53319
+ if (segment === MAP_KEY) {
53320
+ path2.push(`.get(${format_map_key(keys2[++i])})`);
53321
+ } else if (typeof segment === "number") {
53322
+ path2.push(`[${segment}]`);
53323
+ } else {
53324
+ path2.push(stringify_key(segment));
53325
+ }
53326
+ }
53327
+ return path2;
53328
+ }
53272
53329
  const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
53273
53330
  function is_plain_object(thing) {
53274
53331
  const proto2 = Object.getPrototypeOf(thing);
@@ -53277,50 +53334,37 @@ function is_plain_object(thing) {
53277
53334
  function get_type(thing) {
53278
53335
  return Object.prototype.toString.call(thing).slice(8, -1);
53279
53336
  }
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
- }
53337
+ function is_buffer(thing) {
53338
+ return typeof Buffer !== "undefined" && Buffer.isBuffer(thing);
53339
+ }
53340
+ const needs_escape = /["<\\\u0000-\u001f\u2028\u2029]/;
53341
+ const json_leaves_raw = /[<\u2028\u2029]/g;
53342
+ const raw_escapes = { "<": "\\u003C", "\u2028": "\\u2028", "\u2029": "\\u2029" };
53343
+ function escape_raw(char) {
53344
+ return raw_escapes[char];
53305
53345
  }
53306
53346
  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
- }
53347
+ if (!needs_escape.test(str) && str.isWellFormed()) return `"${str}"`;
53348
+ return JSON.stringify(str).replace(json_leaves_raw, escape_raw);
53349
+ }
53350
+ const MAX_CACHED_KEY_LENGTH = 64;
53351
+ const quoted_keys = /* @__PURE__ */ new Map();
53352
+ function quote_key(key) {
53353
+ if (key.length > MAX_CACHED_KEY_LENGTH) return stringify_string(key);
53354
+ let quoted = quoted_keys.get(key);
53355
+ if (quoted === void 0) {
53356
+ if (quoted_keys.size >= 1024) quoted_keys.clear();
53357
+ quoted = stringify_string(key);
53358
+ quoted_keys.set(key, quoted);
53317
53359
  }
53318
- return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
53360
+ return quoted;
53319
53361
  }
53320
53362
  function enumerable_symbols(object2) {
53321
- return Object.getOwnPropertySymbols(object2).filter(
53322
- (symbol) => Object.getOwnPropertyDescriptor(object2, symbol).enumerable
53323
- );
53363
+ const symbols2 = Object.getOwnPropertySymbols(object2);
53364
+ return symbols2.length === 0 ? symbols2 : symbols2.filter((symbol) => {
53365
+ var _a3;
53366
+ return (_a3 = Object.getOwnPropertyDescriptor(object2, symbol)) == null ? void 0 : _a3.enumerable;
53367
+ });
53324
53368
  }
53325
53369
  const is_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
53326
53370
  function stringify_key(key) {
@@ -53378,7 +53422,12 @@ function encode_legacy(array_buffer) {
53378
53422
  const chunk_size = 32768;
53379
53423
  for (let i = 0; i < array2.length; i += chunk_size) {
53380
53424
  const chunk = array2.subarray(i, i + chunk_size);
53381
- binary += String.fromCharCode.apply(null, chunk);
53425
+ binary += String.fromCharCode.apply(
53426
+ null,
53427
+ /** @type {number[]} */
53428
+ /** @type {unknown} */
53429
+ chunk
53430
+ );
53382
53431
  }
53383
53432
  return btoa(binary);
53384
53433
  }
@@ -53410,8 +53459,8 @@ function merge_operations(defaults2, overrides) {
53410
53459
  }
53411
53460
  return merged;
53412
53461
  }
53413
- const NOT_PLAIN = Object.freeze({ kind: "not-plain" });
53414
- const SYMBOL_KEYS = Object.freeze({ kind: "symbol-keys" });
53462
+ const NOT_PLAIN = /* @__PURE__ */ Object.freeze({ kind: "not-plain" });
53463
+ const SYMBOL_KEYS = /* @__PURE__ */ Object.freeze({ kind: "symbol-keys" });
53415
53464
  const stringify_operations = {
53416
53465
  identify: (value) => value,
53417
53466
  typeOf: (value) => value === null ? "null" : typeof value,
@@ -53425,13 +53474,16 @@ const stringify_operations = {
53425
53474
  regExpInfo: (regexp) => ({ source: regexp.source, flags: regexp.flags }),
53426
53475
  valuesOf: (set2) => set2,
53427
53476
  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
- }),
53477
+ viewInfo: (view) => {
53478
+ if (is_buffer(view)) view = new Uint8Array(view);
53479
+ return {
53480
+ buffer: view.buffer,
53481
+ byteOffset: view.byteOffset,
53482
+ byteLength: view.byteLength,
53483
+ length: view.length,
53484
+ bufferByteLength: view.buffer.byteLength
53485
+ };
53486
+ },
53435
53487
  toArrayBuffer: (buffer2) => buffer2,
53436
53488
  lengthOf: (array2) => array2.length,
53437
53489
  hasOwn: (value, key) => Object.hasOwn(value, key),
@@ -53446,7 +53498,12 @@ const stringify_operations = {
53446
53498
  },
53447
53499
  get: (value, key) => value[key]
53448
53500
  };
53449
- const default_stringify_operations = Object.freeze(stringify_operations);
53501
+ const default_stringify_operations = /* @__PURE__ */ Object.freeze(stringify_operations);
53502
+ const array_buffer_byte_length = (
53503
+ /** @type {() => number} */
53504
+ (_b = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")) == null ? void 0 : _b.get
53505
+ );
53506
+ const shared_array_buffer_byte_length = typeof SharedArrayBuffer === "undefined" ? void 0 : (_c = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, "byteLength")) == null ? void 0 : _c.get;
53450
53507
  const parse_operations = {
53451
53508
  fromPrimitive: (primitive) => primitive,
53452
53509
  fromISOString: (iso) => new Date(iso),
@@ -53458,6 +53515,12 @@ const parse_operations = {
53458
53515
  fromArrayBuffer: (buffer2) => buffer2,
53459
53516
  fromRegExpInfo: (source, flags) => new RegExp(source, flags),
53460
53517
  fromViewInfo: (tag, buffer2, byteOffset, length) => {
53518
+ try {
53519
+ array_buffer_byte_length.call(buffer2);
53520
+ } catch (error2) {
53521
+ if (!shared_array_buffer_byte_length) throw error2;
53522
+ shared_array_buffer_byte_length.call(buffer2);
53523
+ }
53461
53524
  const Constructor = (
53462
53525
  /** @type {any} */
53463
53526
  globalThis[tag]
@@ -53487,7 +53550,10 @@ const parse_operations = {
53487
53550
  map2.set(key, value);
53488
53551
  }
53489
53552
  };
53490
- const default_parse_operations = Object.freeze(parse_operations);
53553
+ const default_parse_operations = /* @__PURE__ */ Object.freeze(parse_operations);
53554
+ function invalid() {
53555
+ throw new Error("Invalid input");
53556
+ }
53491
53557
  function parse$6(serialized, revivers, options) {
53492
53558
  return unflatten(JSON.parse(serialized), revivers, options);
53493
53559
  }
@@ -53495,7 +53561,7 @@ function unflatten(parsed, revivers, options) {
53495
53561
  const ops = merge_operations(default_parse_operations, options == null ? void 0 : options.operations);
53496
53562
  if (typeof parsed === "number") return hydrate2(parsed, true);
53497
53563
  if (!Array.isArray(parsed) || parsed.length === 0) {
53498
- throw new Error("Invalid input");
53564
+ invalid();
53499
53565
  }
53500
53566
  const values = (
53501
53567
  /** @type {any[]} */
@@ -53503,6 +53569,12 @@ function unflatten(parsed, revivers, options) {
53503
53569
  );
53504
53570
  const hydrated = Array(values.length);
53505
53571
  let hydrating = null;
53572
+ function get_raw(index2) {
53573
+ if (!is_valid_array_index(index2) || index2 >= values.length) {
53574
+ invalid();
53575
+ }
53576
+ return values[index2];
53577
+ }
53506
53578
  function hydrate2(index2, standalone = false) {
53507
53579
  if (index2 === UNDEFINED$2) return ops.fromPrimitive(void 0);
53508
53580
  if (index2 === NAN) return ops.fromPrimitive(NaN);
@@ -53510,11 +53582,11 @@ function unflatten(parsed, revivers, options) {
53510
53582
  if (index2 === NEGATIVE_INFINITY) return ops.fromPrimitive(-Infinity);
53511
53583
  if (index2 === NEGATIVE_ZERO) return ops.fromPrimitive(-0);
53512
53584
  if (standalone || typeof index2 !== "number") {
53513
- throw new Error(`Invalid input`);
53585
+ invalid();
53514
53586
  }
53515
53587
  if (index2 in hydrated) return hydrated[index2];
53516
53588
  if (index2 >= values.length) {
53517
- throw new Error(`Invalid input`);
53589
+ invalid();
53518
53590
  }
53519
53591
  const value = values[index2];
53520
53592
  if (!value || typeof value !== "object") {
@@ -53563,8 +53635,13 @@ function unflatten(parsed, revivers, options) {
53563
53635
  break;
53564
53636
  case "Object": {
53565
53637
  const wrapped_index = value[1];
53566
- if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") {
53567
- throw new Error("Invalid input");
53638
+ const is_boxable_sentinel = wrapped_index === NAN || wrapped_index === POSITIVE_INFINITY || wrapped_index === NEGATIVE_INFINITY || wrapped_index === NEGATIVE_ZERO;
53639
+ if (!is_boxable_sentinel) {
53640
+ const wrapped = get_raw(wrapped_index);
53641
+ const is_bigint = Array.isArray(wrapped) && wrapped[0] === "BigInt";
53642
+ if ((wrapped === void 0 || typeof wrapped === "object") && !is_bigint) {
53643
+ invalid();
53644
+ }
53568
53645
  }
53569
53646
  hydrated[index2] = ops.box(hydrate2(wrapped_index));
53570
53647
  break;
@@ -53576,10 +53653,14 @@ function unflatten(parsed, revivers, options) {
53576
53653
  const obj = ops.createNullPrototypeObject();
53577
53654
  hydrated[index2] = obj;
53578
53655
  for (let i = 1; i < value.length; i += 2) {
53579
- if (value[i] === "__proto__") {
53656
+ const key = value[i];
53657
+ if (typeof key !== "string") {
53658
+ throw new Error("Cannot parse an object with a non-string key");
53659
+ }
53660
+ if (key === "__proto__") {
53580
53661
  throw new Error("Cannot parse an object with a `__proto__` property");
53581
53662
  }
53582
- ops.set(obj, value[i], hydrate2(value[i + 1]));
53663
+ ops.set(obj, key, hydrate2(value[i + 1]));
53583
53664
  }
53584
53665
  break;
53585
53666
  case "Int8Array":
@@ -53595,10 +53676,12 @@ function unflatten(parsed, revivers, options) {
53595
53676
  case "BigInt64Array":
53596
53677
  case "BigUint64Array":
53597
53678
  case "DataView": {
53598
- if (values[value[1]][0] !== "ArrayBuffer") {
53599
- throw new Error("Invalid data");
53679
+ const buffer_index = value[1];
53680
+ const raw2 = get_raw(buffer_index);
53681
+ if (!Array.isArray(raw2) || raw2[0] !== "ArrayBuffer") {
53682
+ invalid();
53600
53683
  }
53601
- const buffer2 = hydrate2(value[1]);
53684
+ const buffer2 = hydrate2(buffer_index);
53602
53685
  hydrated[index2] = ops.fromViewInfo(type, buffer2, value[2], value[3]);
53603
53686
  break;
53604
53687
  }
@@ -53629,14 +53712,14 @@ function unflatten(parsed, revivers, options) {
53629
53712
  } else if (value[0] === SPARSE) {
53630
53713
  const len = value[1];
53631
53714
  if (!is_valid_array_len(len)) {
53632
- throw new Error("Invalid input");
53715
+ invalid();
53633
53716
  }
53634
53717
  const array2 = ops.createSparseArray(len);
53635
53718
  hydrated[index2] = array2;
53636
53719
  for (let i = 2; i < value.length; i += 2) {
53637
53720
  const idx = value[i];
53638
53721
  if (!is_valid_array_index(idx) || idx >= len) {
53639
- throw new Error("Invalid input");
53722
+ invalid();
53640
53723
  }
53641
53724
  ops.set(array2, idx, hydrate2(value[i + 1]));
53642
53725
  }
@@ -53677,8 +53760,16 @@ function run(async, value, reducers, options) {
53677
53760
  custom2.push({ key, fn: reducers[key] });
53678
53761
  }
53679
53762
  }
53680
- const keys2 = [];
53763
+ let keys2 = [];
53681
53764
  let p2 = 0;
53765
+ function error2(message2, thing) {
53766
+ const path2 = format_path(keys2, (key) => {
53767
+ const key_type = ops.typeOf(key);
53768
+ const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
53769
+ return key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "...";
53770
+ });
53771
+ throw new DevalueError(message2, path2, thing, value);
53772
+ }
53682
53773
  function flatten2(thing, index3) {
53683
53774
  const type = ops.typeOf(thing);
53684
53775
  if (type === "undefined") return UNDEFINED$2;
@@ -53706,22 +53797,25 @@ function run(async, value, reducers, options) {
53706
53797
  }
53707
53798
  }
53708
53799
  if (type === "function") {
53709
- throw new DevalueError(`Cannot stringify a function`, keys2, thing, value);
53800
+ error2(`Cannot stringify a function`, thing);
53710
53801
  } else if (type === "symbol") {
53711
- throw new DevalueError(`Cannot stringify a Symbol primitive`, keys2, thing, value);
53802
+ error2(`Cannot stringify a Symbol primitive`, thing);
53712
53803
  }
53713
53804
  let str = "";
53714
53805
  if (type !== "object") {
53715
53806
  str = stringify_primitive(type === "number" ? number2 : ops.toPrimitive(thing));
53716
53807
  } else if (ops.isThenable(thing)) {
53717
53808
  {
53718
- throw new DevalueError(
53719
- `Cannot stringify a Promise or thenable — use stringifyAsync instead`,
53720
- keys2,
53721
- thing,
53722
- value
53723
- );
53809
+ error2(`Cannot stringify a Promise or thenable — use stringifyAsync instead`, thing);
53724
53810
  }
53811
+ const prev_keys = keys2.slice();
53812
+ str = ops.toPromise(thing).then((value2) => {
53813
+ keys2 = prev_keys;
53814
+ const i = flatten2(value2, index3);
53815
+ if (i < 0) stringified[index3] = i;
53816
+ });
53817
+ str.catch(() => {
53818
+ });
53725
53819
  } else {
53726
53820
  const tag = ops.tagOf(thing);
53727
53821
  switch (tag) {
@@ -53751,7 +53845,7 @@ function run(async, value, reducers, options) {
53751
53845
  for (let i = 0; i < length; i += 1) {
53752
53846
  if (i > 0) str += ",";
53753
53847
  if (ops.hasOwn(thing, i)) {
53754
- keys2.push(`[${i}]`);
53848
+ keys2.push(i);
53755
53849
  str += flatten2(ops.get(thing, i));
53756
53850
  keys2.pop();
53757
53851
  } else if (mostly_dense) {
@@ -53766,7 +53860,7 @@ function run(async, value, reducers, options) {
53766
53860
  str = "[" + SPARSE + "," + length;
53767
53861
  for (let j2 = 0; j2 < populated_keys.length; j2++) {
53768
53862
  const key = populated_keys[j2];
53769
- keys2.push(`[${key}]`);
53863
+ keys2.push(+key);
53770
53864
  str += "," + key + "," + flatten2(ops.get(thing, key));
53771
53865
  keys2.pop();
53772
53866
  }
@@ -53790,13 +53884,10 @@ function run(async, value, reducers, options) {
53790
53884
  case "Map":
53791
53885
  str = '["Map"';
53792
53886
  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
- );
53887
+ keys2.push(MAP_KEY, key);
53798
53888
  str += `,${flatten2(key)},${flatten2(value2)}`;
53799
53889
  keys2.pop();
53890
+ keys2.pop();
53800
53891
  }
53801
53892
  str += "]";
53802
53893
  break;
@@ -53847,24 +53938,19 @@ function run(async, value, reducers, options) {
53847
53938
  default: {
53848
53939
  const shape = ops.shapeOf(thing);
53849
53940
  if (shape.kind === "not-plain") {
53850
- throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys2, thing, value);
53941
+ error2(`Cannot stringify arbitrary non-POJOs`, thing);
53851
53942
  }
53852
53943
  if (shape.kind === "symbol-keys") {
53853
- throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys2, thing, value);
53944
+ error2(`Cannot stringify POJOs with symbolic keys`, thing);
53854
53945
  }
53855
53946
  if (shape.kind === "null-proto") {
53856
53947
  str = '["null"';
53857
53948
  for (const key of shape.keys) {
53858
53949
  if (key === "__proto__") {
53859
- throw new DevalueError(
53860
- `Cannot stringify objects with __proto__ keys`,
53861
- keys2,
53862
- thing,
53863
- value
53864
- );
53950
+ error2(`Cannot stringify objects with __proto__ keys`, thing);
53865
53951
  }
53866
- keys2.push(stringify_key(key));
53867
- str += `,${stringify_string(key)},${flatten2(ops.get(thing, key))}`;
53952
+ keys2.push(key);
53953
+ str += `,${quote_key(key)},${flatten2(ops.get(thing, key))}`;
53868
53954
  keys2.pop();
53869
53955
  }
53870
53956
  str += "]";
@@ -53873,17 +53959,12 @@ function run(async, value, reducers, options) {
53873
53959
  let started = false;
53874
53960
  for (const key of shape.keys) {
53875
53961
  if (key === "__proto__") {
53876
- throw new DevalueError(
53877
- `Cannot stringify objects with __proto__ keys`,
53878
- keys2,
53879
- thing,
53880
- value
53881
- );
53962
+ error2(`Cannot stringify objects with __proto__ keys`, thing);
53882
53963
  }
53883
53964
  if (started) str += ",";
53884
53965
  started = true;
53885
- keys2.push(stringify_key(key));
53886
- str += `${stringify_string(key)}:${flatten2(ops.get(thing, key))}`;
53966
+ keys2.push(key);
53967
+ str += `${quote_key(key)}:${flatten2(ops.get(thing, key))}`;
53887
53968
  keys2.pop();
53888
53969
  }
53889
53970
  str += "}";
@@ -55291,11 +55372,18 @@ function hydrateResourceIO$1(resource, revivers) {
55291
55372
  }
55292
55373
  if ("executionContext" in hydrated) {
55293
55374
  const { executionContext, ...rest } = hydrated;
55294
- const workflowCoreVersion = executionContext && typeof executionContext === "object" && "workflowCoreVersion" in executionContext ? executionContext.workflowCoreVersion : void 0;
55295
- if (workflowCoreVersion) {
55296
- return { ...rest, workflowCoreVersion };
55375
+ const ctx = executionContext && typeof executionContext === "object" ? executionContext : void 0;
55376
+ const preserved = {};
55377
+ if (ctx == null ? void 0 : ctx.workflowCoreVersion) {
55378
+ preserved.workflowCoreVersion = ctx.workflowCoreVersion;
55297
55379
  }
55298
- return rest;
55380
+ if (typeof (ctx == null ? void 0 : ctx.workflowVm) === "string") {
55381
+ preserved.workflowVm = ctx.workflowVm;
55382
+ }
55383
+ if (typeof (ctx == null ? void 0 : ctx.snapshotThreshold) === "number") {
55384
+ preserved.snapshotThreshold = ctx.snapshotThreshold;
55385
+ }
55386
+ return { ...rest, ...preserved };
55299
55387
  }
55300
55388
  return hydrated;
55301
55389
  }
@@ -55643,7 +55731,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
55643
55731
  }
55644
55732
  async function hydrateResourceIOAsync(resource, key) {
55645
55733
  const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
55646
- const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-ClonRoMz.js");
55734
+ const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-BAaFFyPz.js");
55647
55735
  ensureZstdDecoderRegistered();
55648
55736
  const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
55649
55737
  const revivers = getRevivers();
@@ -58101,8 +58189,8 @@ function isObjectLike(value) {
58101
58189
  return typeof value === "object" && value !== null;
58102
58190
  }
58103
58191
  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);
58192
+ var _a3, _b2, _c2, _d2, _e3, _f2;
58193
+ 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
58194
  }
58107
58195
  function haveSameIterableValues(a2, b2, seen) {
58108
58196
  const aIterator = a2[Symbol.iterator]();
@@ -59181,8 +59269,13 @@ function buildNameMaps(events2, run2) {
59181
59269
  const correlationNameMap = /* @__PURE__ */ new Map();
59182
59270
  if (events2) {
59183
59271
  for (const event of events2) {
59184
- if (event.eventType === "step_created" && event.correlationId) {
59185
- const stepName = ((_a3 = event.eventData) == null ? void 0 : _a3.stepName) ?? "";
59272
+ if ((event.eventType === "step_created" || event.eventType === "step_started") && event.correlationId) {
59273
+ const stepName = (_a3 = event.eventData) == null ? void 0 : _a3.stepName;
59274
+ if (typeof stepName !== "string")
59275
+ continue;
59276
+ if (event.eventType === "step_started" && correlationNameMap.has(event.correlationId)) {
59277
+ continue;
59278
+ }
59186
59279
  const parsed = parseStepName(String(stepName)) ?? parseWorkflowName(String(stepName));
59187
59280
  correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
59188
59281
  }
@@ -85927,7 +86020,7 @@ var x = class u2 {
85927
86020
  return this.inlineQueue.push({ src: e, tokens: t }), t;
85928
86021
  }
85929
86022
  inlineTokens(e, t = []) {
85930
- var _a3, _b2, _c2, _d2, _e2;
86023
+ var _a3, _b2, _c2, _d2, _e3;
85931
86024
  let n = e, r2 = null;
85932
86025
  if (this.tokens.links) {
85933
86026
  let o = Object.keys(this.tokens.links);
@@ -85985,7 +86078,7 @@ var x = class u2 {
85985
86078
  continue;
85986
86079
  }
85987
86080
  let l = e;
85988
- if ((_e2 = this.options.extensions) == null ? void 0 : _e2.startInline) {
86081
+ if ((_e3 = this.options.extensions) == null ? void 0 : _e3.startInline) {
85989
86082
  let p2 = 1 / 0, c = e.slice(1), d2;
85990
86083
  this.options.extensions.startInline.forEach((h2) => {
85991
86084
  d2 = h2.call({ lexer: this }, c), typeof d2 == "number" && d2 >= 0 && (p2 = Math.min(p2, d2));
@@ -86311,7 +86404,7 @@ var b = class u3 {
86311
86404
  return n;
86312
86405
  }
86313
86406
  };
86314
- var P = (_b = class {
86407
+ var P = (_d = class {
86315
86408
  constructor(e) {
86316
86409
  __publicField(this, "options");
86317
86410
  __publicField(this, "block");
@@ -86335,7 +86428,7 @@ var P = (_b = class {
86335
86428
  provideParser() {
86336
86429
  return this.block ? b.parse : b.parseInline;
86337
86430
  }
86338
- }, __publicField(_b, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_b, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _b);
86431
+ }, __publicField(_d, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_d, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _d);
86339
86432
  var B = class {
86340
86433
  constructor(...e) {
86341
86434
  __publicField(this, "defaults", M());
@@ -86631,7 +86724,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
86631
86724
  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
86725
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
86633
86726
  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 }) => {
86727
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-DTYrZ-0h.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
86635
86728
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
86636
86729
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
86637
86730
  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 +87046,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
86953
87046
  }, []), 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
87047
  };
86955
87048
  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]+)/;
87049
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-lgfv9_nj.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
86957
87050
  function ke(e, t) {
86958
87051
  if (!(e != null && e.position || t != null && t.position)) return true;
86959
87052
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -87657,9 +87750,10 @@ function waitToSpan(events2, maxEndTime, fallbackEndTime = maxEndTime) {
87657
87750
  };
87658
87751
  }
87659
87752
  const stepEventsToStepEntity = (events2) => {
87660
- var _a3;
87753
+ var _a3, _b2;
87661
87754
  const createdEvent = events2.find((event) => event.eventType === "step_created");
87662
87755
  const anchorEvent = createdEvent ?? events2[0];
87756
+ const firstStartedEvent = events2.find((event) => event.eventType === "step_started");
87663
87757
  if (!anchorEvent) {
87664
87758
  return null;
87665
87759
  }
@@ -87696,7 +87790,7 @@ const stepEventsToStepEntity = (events2) => {
87696
87790
  return {
87697
87791
  stepId: anchorEvent.correlationId ?? "",
87698
87792
  runId: anchorEvent.runId,
87699
- stepName: ((_a3 = createdEvent == null ? void 0 : createdEvent.eventData) == null ? void 0 : _a3.stepName) ?? "",
87793
+ stepName: ((_a3 = createdEvent == null ? void 0 : createdEvent.eventData) == null ? void 0 : _a3.stepName) ?? ((_b2 = firstStartedEvent == null ? void 0 : firstStartedEvent.eventData) == null ? void 0 : _b2.stepName) ?? "",
87700
87794
  status,
87701
87795
  attempt,
87702
87796
  createdAt: getEventTimestamp(anchorEvent) ?? anchorEvent.createdAt,
@@ -87813,7 +87907,7 @@ function runToSpan(run2, runEvents, nowTime) {
87813
87907
  const endTime = completedAt ?? now2;
87814
87908
  const wasCancelled = run2.status === "cancelled" || (terminalEvent == null ? void 0 : terminalEvent.eventType) === "run_cancelled";
87815
87909
  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;
87910
+ const { input: _i, output: _o2, error: _e3, ...runIdentity } = run2;
87817
87911
  const attributes = {
87818
87912
  resource: "run",
87819
87913
  data: {
@@ -89546,11 +89640,11 @@ const escapedStringRegExp = /^'([^]*?)'?$/;
89546
89640
  const doubleQuoteRegExp = /''/g;
89547
89641
  const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
89548
89642
  function format(date2, formatStr, options) {
89549
- var _a3, _b2, _c2, _d2, _e2, _f, _g, _h;
89643
+ var _a3, _b2, _c2, _d2, _e3, _f2, _g, _h;
89550
89644
  const defaultOptions2 = getDefaultOptions();
89551
89645
  const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
89552
89646
  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;
89647
+ 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
89648
  const originalDate = toDate(date2, options == null ? void 0 : options.in);
89555
89649
  if (!isValid(originalDate)) {
89556
89650
  throw new RangeError("Invalid time value");
@@ -89789,6 +89883,7 @@ const attributeOrder = [
89789
89883
  "computeInstanceId",
89790
89884
  "specVersion",
89791
89885
  "workflowCoreVersion",
89886
+ "workflowVm",
89792
89887
  "ownerId",
89793
89888
  "projectId",
89794
89889
  "environment",
@@ -89835,6 +89930,7 @@ const attributeDisplayNames = {
89835
89930
  computeInstanceId: "Compute Instance ID",
89836
89931
  specVersion: "Spec Version",
89837
89932
  workflowCoreVersion: "@workflow/core version",
89933
+ workflowVm: "Workflow VM",
89838
89934
  occurredAt: "Occurred",
89839
89935
  createdAt: "Created",
89840
89936
  startedAt: "Started",
@@ -89930,6 +90026,8 @@ const attributeToDisplayFn = {
89930
90026
  computeInstanceId: opaqueIdOrNull,
89931
90027
  specVersion: (value) => String(value),
89932
90028
  workflowCoreVersion: (value) => String(value),
90029
+ // Only present when the run's executionContext recorded an engine.
90030
+ workflowVm: (value) => typeof value === "string" && value.length > 0 ? value : null,
89933
90031
  // Tenancy (we don't show these)
89934
90032
  ownerId: (_value) => null,
89935
90033
  projectId: (_value) => null,
@@ -90131,6 +90229,9 @@ const AttributePanel = ({ data: data2, moduleSpecifier, moduleSourceUrl, isLoadi
90131
90229
  if (execCtx == null ? void 0 : execCtx.workflowCoreVersion) {
90132
90230
  result.workflowCoreVersion = execCtx.workflowCoreVersion;
90133
90231
  }
90232
+ if (typeof (execCtx == null ? void 0 : execCtx.workflowVm) === "string") {
90233
+ result.workflowVm = execCtx.workflowVm;
90234
+ }
90134
90235
  if (moduleSpecifier) {
90135
90236
  result.moduleSpecifier = moduleSpecifier;
90136
90237
  } else if (typeof data2.stepName === "string") {
@@ -92623,6 +92724,48 @@ function analyzeEvents(events2) {
92623
92724
  lastStepCompletionAt
92624
92725
  };
92625
92726
  }
92727
+ const MAX_EVENTS_EXCEEDED = "MAX_EVENTS_EXCEEDED";
92728
+ const REPLAY_TIMEOUT = "REPLAY_TIMEOUT";
92729
+ const DOCS_BASE_URL = "https://workflow-sdk.dev/err";
92730
+ function readVmPolicy(run2) {
92731
+ const ctx = run2.executionContext && typeof run2.executionContext === "object" ? run2.executionContext : void 0;
92732
+ return {
92733
+ workflowVm: run2.workflowVm ?? (ctx == null ? void 0 : ctx.workflowVm),
92734
+ snapshotThreshold: run2.snapshotThreshold ?? (ctx == null ? void 0 : ctx.snapshotThreshold)
92735
+ };
92736
+ }
92737
+ function isQuickJSSnapshotRun(run2) {
92738
+ const { workflowVm, snapshotThreshold } = readVmPolicy(run2);
92739
+ return workflowVm === "quickjs" && typeof snapshotThreshold === "number" && Number.isSafeInteger(snapshotThreshold) && snapshotThreshold > 0;
92740
+ }
92741
+ function getRunLimitGuidance(run2) {
92742
+ if (!run2 || run2.status !== "failed")
92743
+ return null;
92744
+ const code2 = run2.errorCode;
92745
+ if (code2 !== MAX_EVENTS_EXCEEDED && code2 !== REPLAY_TIMEOUT)
92746
+ return null;
92747
+ if (isQuickJSSnapshotRun(run2))
92748
+ return null;
92749
+ const { workflowVm } = readVmPolicy(run2);
92750
+ const onQuickJS = workflowVm === "quickjs";
92751
+ const remediation = onQuickJS ? "This run used the QuickJS VM, but a snapshot threshold wasn't recorded when it started (snapshotting was disabled, or the run was started by an older SDK), so the default event limit applied. Set a positive WORKFLOW_SNAPSHOT_THRESHOLD in the environment that starts runs, or upgrade the workflow package, so new runs are exempt." : "Run long-running workflows on the QuickJS VM with snapshotting. Snapshotted runs resume without replaying the full event log and are exempt from the default per-run event limit. Set this in the environment that starts runs; only new runs are affected.";
92752
+ if (code2 === MAX_EVENTS_EXCEEDED) {
92753
+ return {
92754
+ kind: "max-events-exceeded",
92755
+ title: "This run reached the per-run event limit",
92756
+ description: remediation,
92757
+ envVar: onQuickJS ? "WORKFLOW_SNAPSHOT_THRESHOLD=1000" : "WORKFLOW_VM=quickjs",
92758
+ docsUrl: `${DOCS_BASE_URL}/max-events-exceeded`
92759
+ };
92760
+ }
92761
+ return {
92762
+ kind: "replay-timeout",
92763
+ title: "This run exceeded the workflow replay time limit",
92764
+ description: `Replay time grows with the size of the event log. ${remediation}`,
92765
+ envVar: onQuickJS ? "WORKFLOW_SNAPSHOT_THRESHOLD=1000" : "WORKFLOW_VM=quickjs",
92766
+ docsUrl: `${DOCS_BASE_URL}/replay-timeout`
92767
+ };
92768
+ }
92626
92769
  const ServerConfigContext = reactExports.createContext(
92627
92770
  null
92628
92771
  );
@@ -95762,7 +95905,7 @@ function describeThrownValue(value) {
95762
95905
  }
95763
95906
  }
95764
95907
  function logOtelDiagnosticOnce$1(otel2, tracer) {
95765
- var _a3, _b2, _c2, _d2, _e2;
95908
+ var _a3, _b2, _c2, _d2, _e3;
95766
95909
  const debugEnabled = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
95767
95910
  if (otelDiagLogged$1 || !debugEnabled)
95768
95911
  return;
@@ -95777,7 +95920,7 @@ function logOtelDiagnosticOnce$1(otel2, tracer) {
95777
95920
  providerCtor: ((_b2 = provider == null ? void 0 : provider.constructor) == null ? void 0 : _b2.name) ?? null,
95778
95921
  delegateCtor: ((_c2 = delegate == null ? void 0 : delegate.constructor) == null ? void 0 : _c2.name) ?? null,
95779
95922
  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,
95923
+ probeCtor: ((_e3 = probe == null ? void 0 : probe.constructor) == null ? void 0 : _e3.name) ?? null,
95781
95924
  probeRecording: probe.isRecording()
95782
95925
  }));
95783
95926
  probe.end();
@@ -97607,13 +97750,13 @@ var EventConsumerResult;
97607
97750
  EventConsumerResult2[EventConsumerResult2["NotConsumed"] = 1] = "NotConsumed";
97608
97751
  EventConsumerResult2[EventConsumerResult2["Finished"] = 2] = "Finished";
97609
97752
  })(EventConsumerResult || (EventConsumerResult = {}));
97610
- _d = ABORT_STREAM_NAME, _c = ABORT_HOOK_TOKEN;
97753
+ _f = ABORT_STREAM_NAME, _e2 = ABORT_HOOK_TOKEN;
97611
97754
  class WorkflowAbortSignal {
97612
97755
  constructor(streamName, hookToken) {
97613
97756
  __publicField(this, "aborted", false);
97614
97757
  __publicField(this, "reason");
97615
- __publicField(this, _d);
97616
- __publicField(this, _c);
97758
+ __publicField(this, _f);
97759
+ __publicField(this, _e2);
97617
97760
  __privateAdd(this, _listeners, []);
97618
97761
  __privateAdd(this, _onabort, null);
97619
97762
  this[ABORT_STREAM_NAME] = streamName;
@@ -98954,7 +99097,10 @@ async function getForwardedWritableEncryptionKey(runId, deploymentId, encryption
98954
99097
  const world = await getWorldLazy();
98955
99098
  if (!world.getEncryptionKeyForRun)
98956
99099
  return void 0;
98957
- const rawKey = deploymentId ? await world.getEncryptionKeyForRun(runId, { deploymentId }) : await world.getEncryptionKeyForRun(await world.runs.get(runId));
99100
+ const ownerDeploymentId = deploymentId ?? (await world.runs.get(runId, { resolveData: "none" })).deploymentId;
99101
+ const rawKey = await world.getEncryptionKeyForRun(runId, {
99102
+ deploymentId: ownerDeploymentId
99103
+ });
98958
99104
  return rawKey ? await importKey(rawKey, ["encrypt"]) : void 0;
98959
99105
  }
98960
99106
  function lazyForwardedWritableEncryptionKey(runId, deploymentId, encryptionPublicKey) {
@@ -107436,7 +107582,7 @@ function getCompressionMode(capabilities) {
107436
107582
  }
107437
107583
  return capabilities.supportedFormats.has(SerializationFormat$1.ZSTD) ? true : "gzip";
107438
107584
  }
107439
- const version$1 = "5.2.1";
107585
+ const version$1 = "5.2.3";
107440
107586
  const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
107441
107587
  const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@()[\]]+$/;
107442
107588
  function getWorkflowQueueName(workflowName, namespace2) {
@@ -107540,7 +107686,10 @@ async function healthCheck(world, options) {
107540
107686
  await world.queue(queueName, {
107541
107687
  __healthCheck: true,
107542
107688
  correlationId,
107543
- ...(options == null ? void 0 : options.runId) ? { runId: options.runId } : {}
107689
+ // Sent as `probeRunId`, never `runId`: a 4.x responder would parse a
107690
+ // `runId`-bearing probe as a run invocation (see
107691
+ // `HealthCheckPayloadSchema`).
107692
+ ...(options == null ? void 0 : options.runId) ? { probeRunId: options.runId } : {}
107544
107693
  }, {
107545
107694
  // Use JSON transport so the health check works against both
107546
107695
  // old (JSON-only) and new (dual) deployments.
@@ -107616,6 +107765,7 @@ function getWorkflowVmFromEnv(env2 = process.env) {
107616
107765
  }
107617
107766
  throw new WorkflowRuntimeError(`Invalid WORKFLOW_VM value: "${raw2}". Expected one of: ${WORKFLOW_VMS.join(", ")}.`);
107618
107767
  }
107768
+ const DEFAULT_QUICKJS_SNAPSHOT_THRESHOLD = 1e3;
107619
107769
  function getSnapshotThresholdFromEnv(env2 = process.env) {
107620
107770
  const raw2 = env2.WORKFLOW_SNAPSHOT_THRESHOLD;
107621
107771
  if (raw2 === void 0 || raw2 === "")
@@ -107626,8 +107776,14 @@ function getSnapshotThresholdFromEnv(env2 = process.env) {
107626
107776
  }
107627
107777
  return parsed;
107628
107778
  }
107779
+ function getSnapshotThresholdForStart(workflowVm, env2 = process.env) {
107780
+ const fromEnv = getSnapshotThresholdFromEnv(env2);
107781
+ if (fromEnv !== void 0)
107782
+ return fromEnv;
107783
+ return workflowVm === "quickjs" ? DEFAULT_QUICKJS_SNAPSHOT_THRESHOLD : void 0;
107784
+ }
107629
107785
  function waitUntil(promise2) {
107630
- void import("./index-C3Gx8HYZ.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
107786
+ void import("./index-DKlEIDGP.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
107631
107787
  waitUntil2(promise2);
107632
107788
  });
107633
107789
  }
@@ -107760,7 +107916,7 @@ async function start$1(workflow, argsOrOptions, options) {
107760
107916
  const queueName = getWorkflowQueueName(workflowName, opts.namespace);
107761
107917
  const spanName = `workflow.start ${workflowDisplayName(workflowName)}`;
107762
107918
  return trace$2(spanName, async (span) => {
107763
- var _a3, _b2, _c2, _d2, _e2;
107919
+ var _a3, _b2, _c2, _d2, _e3;
107764
107920
  span == null ? void 0 : span.setAttributes({
107765
107921
  ...WorkflowName(workflowName),
107766
107922
  ...WorkflowOperation("start")
@@ -107914,7 +108070,7 @@ async function start$1(workflow, argsOrOptions, options) {
107914
108070
  encryptionPublicKey = rawKey ? bytesToBase64((await deriveRunKeyPair(rawKey)).publicKey) : void 0;
107915
108071
  }
107916
108072
  const workflowVm = getWorkflowVmFromEnv();
107917
- const snapshotThreshold = getSnapshotThresholdFromEnv();
108073
+ const snapshotThreshold = getSnapshotThresholdForStart(workflowVm);
107918
108074
  const queueNamespace = resolveQueueNamespace(opts.namespace);
107919
108075
  const executionContext = {
107920
108076
  traceCarrier,
@@ -107958,7 +108114,7 @@ async function start$1(workflow, argsOrOptions, options) {
107958
108114
  ...dynamicWorkflowCode ? { dynamicWorkflowCode } : {},
107959
108115
  ...dynamicWorkflowCodeRef ? { dynamicWorkflowCodeRef } : {}
107960
108116
  } : {};
107961
- const creatorEnvironment = (_e2 = world.getEnvironment) == null ? void 0 : _e2.call(world);
108117
+ const creatorEnvironment = (_e3 = world.getEnvironment) == null ? void 0 : _e3.call(world);
107962
108118
  const runCreated = world.events.create(runId, {
107963
108119
  eventType: "run_created",
107964
108120
  specVersion,
@@ -108044,7 +108200,7 @@ const normalizeWorkflowArgs = (args) => {
108044
108200
  return Array.isArray(args) ? args : [args];
108045
108201
  };
108046
108202
  async function recreateRunFromExisting(world, runId, options = {}) {
108047
- var _a3;
108203
+ var _a3, _b2;
108048
108204
  try {
108049
108205
  const run2 = await world.runs.get(runId, { resolveData: "all" });
108050
108206
  if (readDynamicWorkflowMetadata(run2.executionContext)) {
@@ -108055,12 +108211,14 @@ async function recreateRunFromExisting(world, runId, options = {}) {
108055
108211
  const workflowArgs = normalizeWorkflowArgs(await hydrateWorkflowArguments(run2.input, runId, encryptionKey, globalThis));
108056
108212
  const deploymentId = options.deploymentId ?? run2.deploymentId;
108057
108213
  const specVersion = options.specVersion ?? (deploymentId === run2.deploymentId ? run2.specVersion ?? SPEC_VERSION_LEGACY : void 0);
108214
+ const region = options.region ?? ((_b2 = world.regionForRunId) == null ? void 0 : _b2.call(world, runId)) ?? void 0;
108058
108215
  const newRun = await start$1({ workflowId: run2.workflowName }, workflowArgs, {
108059
108216
  deploymentId,
108060
108217
  world,
108061
108218
  specVersion,
108062
108219
  replayedFromRunId: runId,
108063
- namespace: options.namespace
108220
+ namespace: options.namespace,
108221
+ ...region !== void 0 ? { region } : {}
108064
108222
  });
108065
108223
  return newRun.runId;
108066
108224
  } catch (err) {
@@ -108472,10 +108630,20 @@ _resilientStart = new WeakMap();
108472
108630
  getEncryptionKey_fn = function(run2) {
108473
108631
  if (!__privateGet(this, _encryptionKeyPromise)) {
108474
108632
  __privateSet(this, _encryptionKeyPromise, (async () => {
108475
- var _a3;
108476
108633
  const world = await __privateGet(this, _Run_instances, lazyWorldPromise_get);
108477
- const runData = run2 ?? await world.runs.get(this.runId);
108478
- const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, runData));
108634
+ if (!world.getEncryptionKeyForRun)
108635
+ return void 0;
108636
+ let rawKey;
108637
+ if (run2) {
108638
+ rawKey = await world.getEncryptionKeyForRun(run2);
108639
+ } else {
108640
+ const { deploymentId } = await world.runs.get(this.runId, {
108641
+ resolveData: "none"
108642
+ });
108643
+ rawKey = await world.getEncryptionKeyForRun(this.runId, {
108644
+ deploymentId
108645
+ });
108646
+ }
108479
108647
  return rawKey ? await deriveRunPayloadKeys(rawKey) : void 0;
108480
108648
  })());
108481
108649
  }
@@ -108582,6 +108750,7 @@ pollReturnValue_fn = async function() {
108582
108750
  }
108583
108751
  };
108584
108752
  let Run = _Run;
108753
+ globalSingleton("@workflow/core//eventLimitWarnings", 1, () => /* @__PURE__ */ new Set());
108585
108754
  object$1({
108586
108755
  type: literal$1("hook_resume"),
108587
108756
  version: literal$1(1),
@@ -114959,7 +115128,7 @@ function requireUnwrapHandler() {
114959
115128
  var dispatcherBase;
114960
115129
  var hasRequiredDispatcherBase;
114961
115130
  function requireDispatcherBase() {
114962
- var _a3, _b2, _c2, _d2, _e2;
115131
+ var _a3, _b2, _c2, _d2, _e3;
114963
115132
  if (hasRequiredDispatcherBase) return dispatcherBase;
114964
115133
  hasRequiredDispatcherBase = 1;
114965
115134
  const Dispatcher = requireDispatcher();
@@ -114973,7 +115142,7 @@ function requireDispatcherBase() {
114973
115142
  const kOnDestroyed = Symbol("onDestroyed");
114974
115143
  const kOnClosed = Symbol("onClosed");
114975
115144
  const kWebSocketOptions = Symbol("webSocketOptions");
114976
- class DispatcherBase extends (_e2 = Dispatcher, _d2 = kDestroyed, _c2 = kOnDestroyed, _b2 = kClosed, _a3 = kOnClosed, _e2) {
115145
+ class DispatcherBase extends (_e3 = Dispatcher, _d2 = kDestroyed, _c2 = kOnDestroyed, _b2 = kClosed, _a3 = kOnClosed, _e3) {
114977
115146
  /**
114978
115147
  * @param {import('../../types/dispatcher').DispatcherOptions} [opts]
114979
115148
  */
@@ -121531,7 +121700,7 @@ function requireFixedQueue() {
121531
121700
  var poolBase;
121532
121701
  var hasRequiredPoolBase;
121533
121702
  function requirePoolBase() {
121534
- var _a3, _b2, _c2, _d2, _e2, _f, _g;
121703
+ var _a3, _b2, _c2, _d2, _e3, _f2, _g;
121535
121704
  if (hasRequiredPoolBase) return poolBase;
121536
121705
  hasRequiredPoolBase = 1;
121537
121706
  const { PoolStats } = requireStats();
@@ -121553,8 +121722,8 @@ function requirePoolBase() {
121553
121722
  constructor() {
121554
121723
  super(...arguments);
121555
121724
  __publicField(this, _g, new FixedQueue());
121556
- __publicField(this, _f, 0);
121557
- __publicField(this, _e2, []);
121725
+ __publicField(this, _f2, 0);
121726
+ __publicField(this, _e3, []);
121558
121727
  __publicField(this, _d2, false);
121559
121728
  __publicField(this, _c2, (origin, targets) => {
121560
121729
  this.emit("connect", origin, [this, ...targets]);
@@ -121566,7 +121735,7 @@ function requirePoolBase() {
121566
121735
  this.emit("connectionError", origin, [this, ...targets], err);
121567
121736
  });
121568
121737
  }
121569
- [(_g = kQueue, _f = kQueued, _e2 = kClients, _d2 = kNeedDrain, kOnDrain)](client2, origin, targets) {
121738
+ [(_g = kQueue, _f2 = kQueued, _e3 = kClients, _d2 = kNeedDrain, kOnDrain)](client2, origin, targets) {
121570
121739
  const queue = this[kQueue];
121571
121740
  let needDrain = false;
121572
121741
  while (!needDrain) {
@@ -123454,7 +123623,7 @@ function requireRetryHandler() {
123454
123623
  this.controllerProxy = new RetryController();
123455
123624
  }
123456
123625
  onResponseStartWithRetry(controller, statusCode, headers2, statusMessage, err) {
123457
- var _a3, _b2, _c2, _d2, _e2, _f;
123626
+ var _a3, _b2, _c2, _d2, _e3, _f2;
123458
123627
  if (this.retryOpts.throwOnError) {
123459
123628
  if (this.retryOpts.statusCodes.includes(statusCode) === false) {
123460
123629
  if (this.headersSent) {
@@ -123472,7 +123641,7 @@ function requireRetryHandler() {
123472
123641
  if (isDisturbed(this.opts.body)) {
123473
123642
  this.headersSent = true;
123474
123643
  this.checkpointResponseEnd(headers2);
123475
- (_f = (_e2 = this.handler).onResponseStart) == null ? void 0 : _f.call(_e2, this.controllerProxy, statusCode, headers2, statusMessage);
123644
+ (_f2 = (_e3 = this.handler).onResponseStart) == null ? void 0 : _f2.call(_e3, this.controllerProxy, statusCode, headers2, statusMessage);
123476
123645
  return;
123477
123646
  }
123478
123647
  function shouldRetry(passedErr) {
@@ -130843,7 +131012,7 @@ function requireDeduplicationHandler() {
130843
131012
  * @param {object} trailers
130844
131013
  */
130845
131014
  onResponseEnd(controller, trailers) {
130846
- var _a3, _b2, _c2, _d2, _e2;
131015
+ var _a3, _b2, _c2, _d2, _e3;
130847
131016
  if (__privateGet(this, _aborted) || __privateGet(this, _completed)) {
130848
131017
  return;
130849
131018
  }
@@ -130870,7 +131039,7 @@ function requireDeduplicationHandler() {
130870
131039
  waitingHandler.done = true;
130871
131040
  }
130872
131041
  __privateMethod(this, _DeduplicationHandler_instances, pruneDoneWaitingHandlers_fn).call(this);
130873
- (_e2 = __privateGet(this, _onComplete)) == null ? void 0 : _e2.call(this);
131042
+ (_e3 = __privateGet(this, _onComplete)) == null ? void 0 : _e3.call(this);
130874
131043
  }
130875
131044
  /**
130876
131045
  * @param {import('../../types/dispatcher.d.ts').default.DispatchController} controller
@@ -135668,14 +135837,14 @@ function requireEvents() {
135668
135837
  });
135669
135838
  }
135670
135839
  static createFastMessageEvent(type, init2) {
135671
- var _a3, _b2, _c2, _d2, _e2;
135840
+ var _a3, _b2, _c2, _d2, _e3;
135672
135841
  const messageEvent = new _MessageEvent(kConstruct, type, init2);
135673
135842
  __privateSet(messageEvent, _eventInit, init2);
135674
135843
  (_a3 = __privateGet(messageEvent, _eventInit)).data ?? (_a3.data = null);
135675
135844
  (_b2 = __privateGet(messageEvent, _eventInit)).origin ?? (_b2.origin = "");
135676
135845
  (_c2 = __privateGet(messageEvent, _eventInit)).lastEventId ?? (_c2.lastEventId = "");
135677
135846
  (_d2 = __privateGet(messageEvent, _eventInit)).source ?? (_d2.source = null);
135678
- (_e2 = __privateGet(messageEvent, _eventInit)).ports ?? (_e2.ports = []);
135847
+ (_e3 = __privateGet(messageEvent, _eventInit)).ports ?? (_e3.ports = []);
135679
135848
  return messageEvent;
135680
135849
  }
135681
135850
  };
@@ -140096,6 +140265,7 @@ function createRunsStorage(basedir, tag) {
140096
140265
  }
140097
140266
  const DAY_MS$1 = 24 * 60 * 60 * 1e3;
140098
140267
  const MAX_CACHED_EVENT_ENTRIES = 1e3;
140268
+ const MAX_FORCE_CLAIM_VICTIM_RETRIES = 100;
140099
140269
  function getHookRetentionLimitMs() {
140100
140270
  const days = Number(process.env.WORKFLOW_LOCAL_HOOK_RETENTION_LIMIT_DAYS ?? 30);
140101
140271
  if (!Number.isFinite(days) || days <= 0) {
@@ -140418,8 +140588,62 @@ function createEventsStorage(basedir, tag) {
140418
140588
  getSortKey: eventSortKey,
140419
140589
  getSortKeyFromFileId: (fileId) => eventSortKeyFromFileId(runId, fileId)
140420
140590
  });
140591
+ const missingRunCreatedError = (runId, reason) => new WorkflowWorldError(`Cannot restore missing run_created for workflow run "${runId}": ${reason}`);
140592
+ async function publishRunCreatedAtFirstSlot(event) {
140593
+ const eventId = slotToEventId(FIRST_EVENT_SLOT);
140594
+ const firstSlotEvent = event.eventId === eventId ? event : { ...event, eventId };
140595
+ const eventPath = taggedPath(basedir, runEntityDir("events", event.runId), `${event.runId}-${eventId}`, tag);
140596
+ const serializedEvent = JSON.stringify(firstSlotEvent, jsonReplacer, 2);
140597
+ if (await writeExclusive(eventPath, serializedEvent)) {
140598
+ notePublishedSlot(event.runId, eventId);
140599
+ rememberStoredEvent(firstSlotEvent, eventPath, serializedEvent);
140600
+ return true;
140601
+ }
140602
+ const occupant = await readJSONWithFallback(basedir, runEntityDir("events", event.runId), `${event.runId}-${eventId}`, ReadEventSchema, tag);
140603
+ if ((occupant == null ? void 0 : occupant.eventType) === "run_created" && occupant.runId === event.runId) {
140604
+ notePublishedSlot(event.runId, eventId);
140605
+ return false;
140606
+ }
140607
+ throw missingRunCreatedError(event.runId, `event slot ${FIRST_EVENT_SLOT} is occupied by ${occupant ? `"${occupant.eventType}"` : "an unreadable event"}`);
140608
+ }
140609
+ async function restoreMissingRunCreated(run2) {
140610
+ const firstPage = await queryRunEvents(run2.runId, {
140611
+ limit: 1,
140612
+ sortOrder: "asc"
140613
+ });
140614
+ const first = firstPage.data[0];
140615
+ if (first) {
140616
+ if (first.eventType === "run_created" && first.runId === run2.runId) {
140617
+ return;
140618
+ }
140619
+ throw missingRunCreatedError(run2.runId, `the event log is not empty (its first event is "${first.eventType}")`);
140620
+ }
140621
+ if (run2.input === void 0) {
140622
+ throw missingRunCreatedError(run2.runId, "the original input is missing");
140623
+ }
140624
+ const eventId = slotToEventId(FIRST_EVENT_SLOT);
140625
+ const event = {
140626
+ eventType: "run_created",
140627
+ runId: run2.runId,
140628
+ eventId,
140629
+ createdAt: run2.createdAt,
140630
+ specVersion: run2.specVersion,
140631
+ eventData: {
140632
+ deploymentId: run2.deploymentId,
140633
+ workflowName: run2.workflowName,
140634
+ input: run2.input,
140635
+ executionContext: run2.executionContext,
140636
+ attributes: run2.attributes,
140637
+ encryptionPublicKey: run2.encryptionPublicKey
140638
+ }
140639
+ };
140640
+ if (await publishRunCreatedAtFirstSlot(event)) {
140641
+ console.warn(`[world-local] restored missing run_created for ${run2.runId} (creation was interrupted or is still in flight)`);
140642
+ }
140643
+ }
140421
140644
  const stepLocks = /* @__PURE__ */ new Map();
140422
140645
  const hookLocks = /* @__PURE__ */ new Map();
140646
+ const hookLockKey = (runId, hookId) => tag ? `${runId}-${hookId}.hook.${tag}` : `${runId}-${hookId}.hook`;
140423
140647
  const storage = {
140424
140648
  clearCache,
140425
140649
  async create(runId, data2, params) {
@@ -140437,8 +140661,7 @@ function createEventsStorage(basedir, tag) {
140437
140661
  return withInProcessLock(stepLocks, lockKey, createImpl);
140438
140662
  }
140439
140663
  if (isHookLifecycleEventType(data2.eventType) && runId && data2.correlationId) {
140440
- const lockKey = tag ? `${runId}-${data2.correlationId}.hook.${tag}` : `${runId}-${data2.correlationId}.hook`;
140441
- return withInProcessLock(hookLocks, lockKey, createImpl);
140664
+ return withInProcessLock(hookLocks, hookLockKey(runId, data2.correlationId), createImpl);
140442
140665
  }
140443
140666
  return createImpl();
140444
140667
  async function createImpl() {
@@ -140463,6 +140686,7 @@ function createEventsStorage(basedir, tag) {
140463
140686
  }
140464
140687
  const effectiveSpecVersion = data2.specVersion ?? SPEC_VERSION_CURRENT;
140465
140688
  let currentRun = null;
140689
+ let createdByResilientStart = false;
140466
140690
  const skipRunValidationEvents = ["step_completed", "step_retrying"];
140467
140691
  if (data2.eventType !== "run_created" && !skipRunValidationEvents.includes(data2.eventType)) {
140468
140692
  currentRun = await readJSONWithFallback(basedir, "runs", effectiveRunId, WorkflowRunSchema, tag);
@@ -140515,14 +140739,27 @@ function createEventsStorage(basedir, tag) {
140515
140739
  encryptionPublicKey: runInputData.encryptionPublicKey
140516
140740
  }
140517
140741
  };
140518
- await storeEvent(runCreatedEvent);
140519
- currentRun = createdRun;
140742
+ const published = await publishRunCreatedAtFirstSlot(runCreatedEvent);
140743
+ currentRun = published ? createdRun : await readJSONWithFallback(basedir, "runs", effectiveRunId, WorkflowRunSchema, tag);
140744
+ createdByResilientStart = true;
140520
140745
  } else {
140521
140746
  currentRun = await readJSONWithFallback(basedir, "runs", effectiveRunId, WorkflowRunSchema, tag);
140522
140747
  }
140523
140748
  }
140524
140749
  }
140525
140750
  }
140751
+ if ((currentRun == null ? void 0 : currentRun.status) === "pending" && !createdByResilientStart && !requiresNewerWorld(currentRun.specVersion) && !isLegacySpecVersion(currentRun.specVersion) && (data2.eventType === "run_started" || data2.eventType === "attr_set" || data2.eventType === "run_cancelled" || data2.eventType === "run_failed")) {
140752
+ if (data2.eventType === "run_cancelled" || data2.eventType === "run_failed") {
140753
+ try {
140754
+ await restoreMissingRunCreated(currentRun);
140755
+ } catch (error2) {
140756
+ const reason = error2 instanceof Error ? error2.message : String(error2);
140757
+ console.warn(`[world-local] could not restore missing run_created for ${currentRun.runId}: ${reason}`);
140758
+ }
140759
+ } else {
140760
+ await restoreMissingRunCreated(currentRun);
140761
+ }
140762
+ }
140526
140763
  eventId = await mintEventId(effectiveRunId);
140527
140764
  if (!currentRun && (data2.eventType === "run_failed" || data2.eventType === "attr_set" || data2.eventType === "run_started")) {
140528
140765
  throw new WorkflowRunNotFoundError(effectiveRunId);
@@ -140550,7 +140787,7 @@ function createEventsStorage(basedir, tag) {
140550
140787
  return {
140551
140788
  event: stripEventDataRefs(stored, resolveData2),
140552
140789
  run: currentRun,
140553
- ...currentRun ? { maxEvents: getMaxEventsPerRun() } : {}
140790
+ ...currentRun ? { maxEvents: getMaxEventsForRun(currentRun) } : {}
140554
140791
  };
140555
140792
  }
140556
140793
  if (data2.eventType === "run_started") {
@@ -140744,7 +140981,7 @@ function createEventsStorage(basedir, tag) {
140744
140981
  if (params == null ? void 0 : params.skipPreload) {
140745
140982
  return {
140746
140983
  run: currentRun,
140747
- maxEvents: getMaxEventsPerRun()
140984
+ maxEvents: getMaxEventsForRun(currentRun)
140748
140985
  };
140749
140986
  }
140750
140987
  const preloaded = await queryRunEvents(effectiveRunId, {
@@ -140755,7 +140992,7 @@ function createEventsStorage(basedir, tag) {
140755
140992
  events: preloaded.data,
140756
140993
  cursor: preloaded.cursor,
140757
140994
  hasMore: preloaded.hasMore,
140758
- maxEvents: getMaxEventsPerRun()
140995
+ maxEvents: getMaxEventsForRun(currentRun)
140759
140996
  };
140760
140997
  }
140761
140998
  const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
@@ -141075,7 +141312,7 @@ function createEventsStorage(basedir, tag) {
141075
141312
  tokenRetentionUntil: hookData.tokenRetentionUntil,
141076
141313
  ...claimedFrom && { claimedFrom }
141077
141314
  });
141078
- const claimResult = await withHookTokenClaimLock(basedir, hookData.token, async (signal) => {
141315
+ const claimToken = (lockedVictim) => withHookTokenClaimLock(basedir, hookData.token, async (signal) => {
141079
141316
  let existingClaim = await readHookTokenClaim(constraintPath);
141080
141317
  if (!existingClaim) {
141081
141318
  signal.throwIfAborted();
@@ -141095,6 +141332,9 @@ function createEventsStorage(basedir, tag) {
141095
141332
  if (hookData.force !== true || !existingClaim.hookId) {
141096
141333
  return { status: "conflict", claim: existingClaim };
141097
141334
  }
141335
+ if (existingClaim.runId !== (lockedVictim == null ? void 0 : lockedVictim.runId) || existingClaim.hookId !== (lockedVictim == null ? void 0 : lockedVictim.hookId)) {
141336
+ return { status: "victim-changed" };
141337
+ }
141098
141338
  signal.throwIfAborted();
141099
141339
  const victimRun = await readJSONWithFallback(basedir, "runs", existingClaim.runId, WorkflowRunSchema, tag);
141100
141340
  const victimRunning = victimRun !== null && !isTerminalWorkflowRunStatus(victimRun.status);
@@ -141190,6 +141430,17 @@ function createEventsStorage(basedir, tag) {
141190
141430
  }
141191
141431
  return { status: "claimed" };
141192
141432
  });
141433
+ let claimResult;
141434
+ for (let attempt = 0; ; attempt++) {
141435
+ if (attempt === MAX_FORCE_CLAIM_VICTIM_RETRIES) {
141436
+ throw new WorkflowWorldError(`Hook token holder kept changing during a forced claim of "${data2.correlationId}"`);
141437
+ }
141438
+ const holder = hookData.force === true ? await readHookTokenClaim(constraintPath) : null;
141439
+ const victim = (holder == null ? void 0 : holder.hookId) && !(holder.runId === effectiveRunId && holder.hookId === data2.correlationId) ? { runId: holder.runId, hookId: holder.hookId } : void 0;
141440
+ claimResult = victim ? await withInProcessLock(hookLocks, hookLockKey(victim.runId, victim.hookId), () => claimToken(victim)) : await claimToken();
141441
+ if (claimResult.status !== "victim-changed")
141442
+ break;
141443
+ }
141193
141444
  if (claimResult.status === "owned" && claimResult.claim.claimedFrom) {
141194
141445
  claimedFrom = claimResult.claim.claimedFrom;
141195
141446
  }
@@ -141420,6 +141671,14 @@ function createEventsStorage(basedir, tag) {
141420
141671
  notePublishedSlot(effectiveRunId, eventId);
141421
141672
  break;
141422
141673
  }
141674
+ if (data2.eventType === "run_created") {
141675
+ const slot = eventIdToSlot(eventId);
141676
+ const occupant = await readJSONWithFallback(basedir, runEntityDir("events", effectiveRunId), `${effectiveRunId}-${eventId}`, ReadEventSchema, tag);
141677
+ if (slot === FIRST_EVENT_SLOT && (occupant == null ? void 0 : occupant.eventType) === "run_created" && occupant.runId === effectiveRunId) {
141678
+ break;
141679
+ }
141680
+ throw new WorkflowWorldError(`Cannot publish run_created for workflow run "${effectiveRunId}": event slot ${slot ?? eventId} is occupied by ${occupant ? `"${occupant.eventType}"` : "an unreadable event"}`);
141681
+ }
141423
141682
  if (data2.eventType === "hook_received" && (params == null ? void 0 : params.resumeId)) {
141424
141683
  const occupant = await readJSONWithFallback(basedir, runEntityDir("events", effectiveRunId), `${effectiveRunId}-${eventId}`, ReadEventSchema, tag);
141425
141684
  if (occupant && isResumeEvent(occupant, {
@@ -141488,8 +141747,9 @@ function createEventsStorage(basedir, tag) {
141488
141747
  hook,
141489
141748
  wait,
141490
141749
  ...stepCreatedLazily ? { stepCreated: true } : {},
141491
- // Per-run event ceiling (mirrors the Vercel World).
141492
- ...run2 ? { maxEvents: getMaxEventsPerRun() } : {}
141750
+ // Per-run event ceiling (mirrors the Vercel World, including the
141751
+ // QuickJS-snapshot exemption).
141752
+ ...run2 ? { maxEvents: getMaxEventsForRun(run2) } : {}
141493
141753
  };
141494
141754
  if (!eventPage)
141495
141755
  return result;
@@ -141889,7 +142149,7 @@ function createWorld$2(args) {
141889
142149
  const basedir = mergedConfig.dataDir;
141890
142150
  const hooksDir = path$3.join(basedir, "hooks");
141891
142151
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
141892
- const { HookSchema: HookSchema2 } = await import("./index-D1YkUiuC.js");
142152
+ const { HookSchema: HookSchema2 } = await import("./index-BE6TqyDE.js");
141893
142153
  await settleAll(taggedHookFiles.map(async (hookFile) => {
141894
142154
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
141895
142155
  if (hook == null ? void 0 : hook.token) {
@@ -142077,8 +142337,8 @@ function requireGetVercelOidcToken() {
142077
142337
  }
142078
142338
  try {
142079
142339
  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)
142340
+ await import("./token-util-CfkQa5kX.js").then((n) => n.t),
142341
+ await import("./token-BhYk3Bk4.js").then((n) => n.t)
142082
142342
  ]);
142083
142343
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
142084
142344
  await refreshToken(options);
@@ -142641,7 +142901,7 @@ function requireDist() {
142641
142901
  return dist;
142642
142902
  }
142643
142903
  var distExports = requireDist();
142644
- const version = "5.2.1";
142904
+ const version = "5.2.3";
142645
142905
  const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
142646
142906
  dispatcher: void 0,
142647
142907
  queueDispatcher: void 0,
@@ -142775,9 +143035,10 @@ const EVENTS_RETRY_AGENT_OPTIONS = {
142775
143035
  ]
142776
143036
  };
142777
143037
  const STREAM_RETRY_OPTIONS = {
142778
- retryAfter: true,
143038
+ maxRetries: 0,
142779
143039
  methods: ["PUT"],
142780
- statusCodes: [429]
143040
+ statusCodes: [],
143041
+ errorCodes: []
142781
143042
  };
142782
143043
  const STREAM_CLOSE_RETRY_OPTIONS = {
142783
143044
  retryAfter: true,
@@ -143001,6 +143262,304 @@ function getDefaultStreamCloseDispatcher() {
143001
143262
  pools.streamCloseDispatcher ?? (pools.streamCloseDispatcher = createStreamDispatcher(STREAM_CLOSE_RETRY_OPTIONS));
143002
143263
  return pools.streamCloseDispatcher;
143003
143264
  }
143265
+ async function getDeadline() {
143266
+ const { getDeadline: getDeadline2 } = await import("./index-DKlEIDGP.js").then((n) => n.i);
143267
+ return getDeadline2();
143268
+ }
143269
+ class ReplayEventObserverError extends Error {
143270
+ constructor(error2) {
143271
+ super("Replay event observer failed", { cause: error2 });
143272
+ __publicField(this, "error");
143273
+ this.error = error2;
143274
+ this.name = "ReplayEventObserverError";
143275
+ }
143276
+ }
143277
+ class AfterCommitError extends Error {
143278
+ constructor(error2) {
143279
+ super("Event log read after a committed write failed", { cause: error2 });
143280
+ __publicField(this, "error");
143281
+ this.error = error2;
143282
+ this.name = "AfterCommitError";
143283
+ }
143284
+ }
143285
+ const STEP_OUTCOME_EVENT_TYPES = /* @__PURE__ */ new Set([
143286
+ "step_completed",
143287
+ "step_retrying"
143288
+ ]);
143289
+ function recordsStepOutcome(eventType) {
143290
+ return STEP_OUTCOME_EVENT_TYPES.has(eventType);
143291
+ }
143292
+ const EVENT_RETRY_ELIGIBILITY = {
143293
+ // Creates: conditional create → 409 EntityConflictError if it already exists.
143294
+ run_created: {
143295
+ retryable: true,
143296
+ reason: "conditional create → 409 if exists"
143297
+ },
143298
+ step_created: {
143299
+ retryable: true,
143300
+ reason: "conditional create → 409 if exists"
143301
+ },
143302
+ wait_created: {
143303
+ retryable: true,
143304
+ reason: "conditional create → 409 if exists"
143305
+ },
143306
+ hook_created: {
143307
+ retryable: true,
143308
+ reason: "transactional token uniqueness → 409 if exists"
143309
+ },
143310
+ // Run start: early-returns if already running, writes no duplicate row.
143311
+ run_started: {
143312
+ retryable: true,
143313
+ reason: "early-returns if already running, no duplicate row"
143314
+ },
143315
+ // Terminal transitions: conditional `.where()` excludes terminal states →
143316
+ // 409 before the event row is written.
143317
+ run_completed: {
143318
+ retryable: true,
143319
+ reason: "terminal-state guard → 409, no duplicate row"
143320
+ },
143321
+ run_failed: {
143322
+ retryable: true,
143323
+ reason: "terminal-state guard → 409, no duplicate row"
143324
+ },
143325
+ run_cancelled: {
143326
+ retryable: true,
143327
+ reason: "terminal-state guard → 409, no duplicate row"
143328
+ },
143329
+ step_completed: {
143330
+ retryable: true,
143331
+ reason: "terminal-state guard → 409, no duplicate row"
143332
+ },
143333
+ step_failed: {
143334
+ retryable: true,
143335
+ reason: "terminal-state guard → 409, no duplicate row"
143336
+ },
143337
+ wait_completed: {
143338
+ retryable: true,
143339
+ reason: "waiting-state guard → 409, no duplicate row"
143340
+ },
143341
+ hook_disposed: {
143342
+ retryable: true,
143343
+ reason: "conditional delete (exists) → 409, no duplicate row"
143344
+ },
143345
+ // True idempotency via a correlationId constraint that reuses the eventId.
143346
+ attr_set: {
143347
+ retryable: true,
143348
+ reason: "correlationId constraint reuses eventId (idempotent replay)"
143349
+ },
143350
+ // NOT safe to retry; see the module comment.
143351
+ step_started: {
143352
+ retryable: false,
143353
+ reason: "unconditional attempt increment → a retry double-counts attempts"
143354
+ },
143355
+ step_retrying: {
143356
+ retryable: false,
143357
+ reason: "no duplicate guard → a retry appends a second event row"
143358
+ },
143359
+ hook_received: {
143360
+ retryable: false,
143361
+ 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 })"
143362
+ },
143363
+ // Server-originated; the SDK never POSTs it.
143364
+ hook_conflict: {
143365
+ retryable: false,
143366
+ reason: "server-originated; never POSTed by the SDK"
143367
+ },
143368
+ // Server-originated sealed-log filler (specVersion 7); the SDK never
143369
+ // POSTs it. The server's read path writes it to seal an abandoned slot.
143370
+ noop: {
143371
+ retryable: false,
143372
+ reason: "server-originated; never POSTed by the SDK"
143373
+ }
143374
+ };
143375
+ const MAX_EVENT_POST_RETRIES = 2;
143376
+ const THROTTLE_RETRY_BUDGET_MS = 3e4;
143377
+ const THROTTLE_DEADLINE_RESERVE_MS = 15e3;
143378
+ const THROTTLE_RETRY_MAX_BUDGET_MS = 15 * 6e4;
143379
+ const DEFAULT_THROTTLE_RETRY_AFTER_SECONDS = 1;
143380
+ const EVENT_POST_RETRY_BASE_MS = 100;
143381
+ const EVENT_POST_RETRY_JITTER_MS = 50;
143382
+ const TRANSIENT_CODES = /* @__PURE__ */ new Set([
143383
+ "ECONNRESET",
143384
+ "ECONNREFUSED",
143385
+ "ENOTFOUND",
143386
+ "ENETDOWN",
143387
+ "ENETUNREACH",
143388
+ "EHOSTDOWN",
143389
+ "EHOSTUNREACH",
143390
+ "EPIPE",
143391
+ "ETIMEDOUT",
143392
+ "UND_ERR_SOCKET",
143393
+ "UND_ERR_REQ_RETRY",
143394
+ "UND_ERR_CONNECT_TIMEOUT",
143395
+ "UND_ERR_HEADERS_TIMEOUT",
143396
+ "UND_ERR_BODY_TIMEOUT",
143397
+ // Names (undici/Node surface these on the error or its cause).
143398
+ // `TimeoutError` is our own per-request deadline (`AbortSignal.timeout` in
143399
+ // makeRequest), a genuinely ambiguous failure worth retrying. We deliberately
143400
+ // do NOT include `AbortError`: that is how an external/caller-supplied
143401
+ // cancellation surfaces (makeRequest composes the caller's signal via
143402
+ // `AbortSignal.any`), and re-issuing a write the caller asked to cancel
143403
+ // (stalling the abort by the full backoff budget) would be wrong.
143404
+ "TimeoutError",
143405
+ "RequestRetryError"
143406
+ ]);
143407
+ function collectErrorMarkers(err, depth = 0) {
143408
+ if (depth > 5 || err === null || typeof err !== "object")
143409
+ return [];
143410
+ const markers = [];
143411
+ const e = err;
143412
+ if (typeof e.code === "string")
143413
+ markers.push(e.code);
143414
+ if (typeof e.name === "string")
143415
+ markers.push(e.name);
143416
+ if (e.cause)
143417
+ markers.push(...collectErrorMarkers(e.cause, depth + 1));
143418
+ return markers;
143419
+ }
143420
+ function isRetryableEventPostError(err) {
143421
+ if (err instanceof ReplayEventObserverError)
143422
+ return false;
143423
+ if (EntityConflictError.is(err) || // A takeover redirect is definitive for THIS target; the runtime's
143424
+ // resume path follows the token instead of re-issuing the write here.
143425
+ HookForceClaimedError.is(err) || RunExpiredError.is(err) || TooEarlyError.is(err) || ThrottleError.is(err)) {
143426
+ return false;
143427
+ }
143428
+ if (WorkflowWorldError.is(err) || StreamError.is(err)) {
143429
+ if (err.code === "PARSE_ERROR")
143430
+ return true;
143431
+ if (err.code === "TRANSPORT")
143432
+ return true;
143433
+ if (typeof err.status === "number") {
143434
+ return err.status >= 500 && err.status <= 599;
143435
+ }
143436
+ if (err.code === "STREAM_ERROR") {
143437
+ return !collectErrorMarkers(err).some((marker) => [
143438
+ "AbortError",
143439
+ "ABORT_ERR",
143440
+ "UND_ERR_ABORTED",
143441
+ "ERR_HTTP2_STREAM_CANCEL"
143442
+ ].includes(marker));
143443
+ }
143444
+ }
143445
+ return collectErrorMarkers(err).some((m2) => TRANSIENT_CODES.has(m2));
143446
+ }
143447
+ const sleep$1 = (ms2, signal) => new Promise((resolve2, reject) => {
143448
+ if (signal == null ? void 0 : signal.aborted) {
143449
+ reject(signal.reason);
143450
+ return;
143451
+ }
143452
+ const onAbort = () => {
143453
+ clearTimeout(timer2);
143454
+ reject(signal == null ? void 0 : signal.reason);
143455
+ };
143456
+ const timer2 = setTimeout(() => {
143457
+ signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
143458
+ resolve2();
143459
+ }, ms2);
143460
+ signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
143461
+ });
143462
+ const RETRY_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
143463
+ function logRetry(message2, fields) {
143464
+ if (!RETRY_DEBUG_ENABLED)
143465
+ return;
143466
+ const suffix = Object.entries(fields).map(([k2, v2]) => `${k2}=${v2}`).join(" ");
143467
+ console.debug(`[workflow:world-vercel:event-retry] ${message2} ${suffix}`);
143468
+ }
143469
+ function errorMarker(err) {
143470
+ if (WorkflowWorldError.is(err)) {
143471
+ return err.code ?? (err.status != null ? `status_${err.status}` : err.name);
143472
+ }
143473
+ return collectErrorMarkers(err)[0] ?? (err instanceof Error ? err.name : "unknown");
143474
+ }
143475
+ async function resolveDeadlineMs() {
143476
+ try {
143477
+ const deadline = await getDeadline();
143478
+ const ms2 = deadline == null ? void 0 : deadline.getTime();
143479
+ return ms2 !== void 0 && Number.isFinite(ms2) ? ms2 : void 0;
143480
+ } catch {
143481
+ return void 0;
143482
+ }
143483
+ }
143484
+ function createThrottleWaiter(target2, budget, beforeWait) {
143485
+ let waitedMs = 0;
143486
+ let limit;
143487
+ return async (err, signal) => {
143488
+ const waitMs = Math.max(1, typeof err.retryAfter === "number" ? err.retryAfter : DEFAULT_THROTTLE_RETRY_AFTER_SECONDS) * 1e3;
143489
+ if (limit === void 0) {
143490
+ const deadlineMs = await resolveDeadlineMs();
143491
+ limit = {
143492
+ budgetMs: budget === "invocation" && deadlineMs !== void 0 ? THROTTLE_RETRY_MAX_BUDGET_MS : THROTTLE_RETRY_BUDGET_MS,
143493
+ deadlineMs
143494
+ };
143495
+ }
143496
+ const outlastsInvocation = limit.deadlineMs !== void 0 && Date.now() + waitMs > limit.deadlineMs - THROTTLE_DEADLINE_RESERVE_MS;
143497
+ if (waitedMs + waitMs > limit.budgetMs || outlastsInvocation) {
143498
+ logRetry("throttle retry budget exhausted; surfacing to the queue", {
143499
+ target: target2,
143500
+ budget,
143501
+ waitedMs,
143502
+ retryAfter: err.retryAfter,
143503
+ outlastsInvocation
143504
+ });
143505
+ throw err;
143506
+ }
143507
+ waitedMs += waitMs;
143508
+ console.warn(`[workflow] Throttled (429) ${target2}; retrying in-process in ${waitMs / 1e3}s`);
143509
+ await (beforeWait == null ? void 0 : beforeWait());
143510
+ await sleep$1(waitMs, signal);
143511
+ };
143512
+ }
143513
+ function throttleBudgetFor(eventType, options) {
143514
+ if ((options == null ? void 0 : options.batchIdempotent) !== void 0)
143515
+ return "bounded";
143516
+ return (options == null ? void 0 : options.afterStepBody) === true || recordsStepOutcome(eventType) ? "invocation" : "bounded";
143517
+ }
143518
+ function isEligibleForTransientRetry(eventType, options) {
143519
+ var _a3;
143520
+ if ((options == null ? void 0 : options.inBand) === true)
143521
+ return false;
143522
+ if ((options == null ? void 0 : options.batchIdempotent) !== void 0) {
143523
+ return options.batchIdempotent;
143524
+ }
143525
+ return eventType === "hook_received" && (options == null ? void 0 : options.idempotentHookResume) === true || (((_a3 = EVENT_RETRY_ELIGIBILITY[eventType]) == null ? void 0 : _a3.retryable) ?? false);
143526
+ }
143527
+ async function withEventPostRetry(fn2, eventType, options) {
143528
+ const retryable = isEligibleForTransientRetry(eventType, options);
143529
+ const waitOutThrottle = createThrottleWaiter(`writing ${eventType} event`, throttleBudgetFor(eventType, options));
143530
+ for (let attempt = 0; ; ) {
143531
+ try {
143532
+ return await fn2();
143533
+ } catch (err) {
143534
+ if (err instanceof AfterCommitError)
143535
+ throw err;
143536
+ if (ThrottleError.is(err)) {
143537
+ await waitOutThrottle(err);
143538
+ continue;
143539
+ }
143540
+ if (!retryable || !isRetryableEventPostError(err)) {
143541
+ throw err;
143542
+ }
143543
+ if (attempt >= MAX_EVENT_POST_RETRIES) {
143544
+ logRetry("exhausted in-process retries; surfacing for queue redelivery", {
143545
+ eventType,
143546
+ attempts: attempt + 1,
143547
+ error: errorMarker(err)
143548
+ });
143549
+ throw err;
143550
+ }
143551
+ const backoff = EVENT_POST_RETRY_BASE_MS * 2 ** attempt + Math.floor(Math.random() * EVENT_POST_RETRY_JITTER_MS);
143552
+ attempt++;
143553
+ logRetry("retrying event POST after transient failure", {
143554
+ eventType,
143555
+ attempt,
143556
+ backoffMs: backoff,
143557
+ error: errorMarker(err)
143558
+ });
143559
+ await sleep$1(backoff);
143560
+ }
143561
+ }
143562
+ }
143004
143563
  const otel = globalSingleton("@workflow/world-vercel//telemetry", 1, () => ({
143005
143564
  // Lazy load OpenTelemetry API to make it optional
143006
143565
  apiPromise: null,
@@ -143022,7 +143581,7 @@ function workflowDebugEnabled() {
143022
143581
  }
143023
143582
  let otelDiagLogged = false;
143024
143583
  function logOtelDiagnosticOnce(otel2, tracer) {
143025
- var _a3, _b2, _c2, _d2, _e2;
143584
+ var _a3, _b2, _c2, _d2, _e3;
143026
143585
  if (otelDiagLogged || !workflowDebugEnabled())
143027
143586
  return;
143028
143587
  otelDiagLogged = true;
@@ -143036,7 +143595,7 @@ function logOtelDiagnosticOnce(otel2, tracer) {
143036
143595
  providerCtor: ((_b2 = provider == null ? void 0 : provider.constructor) == null ? void 0 : _b2.name) ?? null,
143037
143596
  delegateCtor: ((_c2 = delegate == null ? void 0 : delegate.constructor) == null ? void 0 : _c2.name) ?? null,
143038
143597
  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,
143598
+ probeCtor: ((_e3 = probe == null ? void 0 : probe.constructor) == null ? void 0 : _e3.name) ?? null,
143040
143599
  probeRecording: probe.isRecording()
143041
143600
  }));
143042
143601
  probe.end();
@@ -143247,7 +143806,10 @@ function parseRetryAfter(value) {
143247
143806
  if (!value)
143248
143807
  return void 0;
143249
143808
  const parsed = parseInt(value, 10);
143250
- return Number.isNaN(parsed) ? void 0 : parsed;
143809
+ if (!Number.isNaN(parsed))
143810
+ return parsed;
143811
+ const date2 = Date.parse(value);
143812
+ return Number.isNaN(date2) ? void 0 : Math.max(0, (date2 - Date.now()) / 1e3);
143251
143813
  }
143252
143814
  function headersToRecord$1(headers2) {
143253
143815
  const out = {};
@@ -143359,16 +143921,56 @@ function recordClientSpanStatus(span, status) {
143359
143921
  span == null ? void 0 : span.setAttributes({ ...ErrorType(`HTTP ${status}`) });
143360
143922
  }
143361
143923
  }
143924
+ const STREAM_APPEND_MAX_RETRIES = 5;
143925
+ const STREAM_APPEND_CONNECT_ERROR_CODES = /* @__PURE__ */ new Set([
143926
+ "ECONNREFUSED",
143927
+ "ENOTFOUND",
143928
+ "EAI_AGAIN",
143929
+ "UND_ERR_CONNECT_TIMEOUT"
143930
+ ]);
143931
+ async function fetchStreamAppend(request2, signal) {
143932
+ let response2;
143933
+ const waitOutThrottle = createThrottleWaiter("appending stream chunks", "bounded", async () => {
143934
+ var _a3;
143935
+ await ((_a3 = response2.body) == null ? void 0 : _a3.cancel().catch(() => {
143936
+ }));
143937
+ });
143938
+ for (let retry2 = 0; ; retry2++) {
143939
+ try {
143940
+ response2 = await request2(retry2);
143941
+ } catch (error2) {
143942
+ const code2 = getTransientTransportCode(error2);
143943
+ if (retry2 === STREAM_APPEND_MAX_RETRIES || !code2 || !STREAM_APPEND_CONNECT_ERROR_CODES.has(code2)) {
143944
+ throw error2;
143945
+ }
143946
+ await sleep$1(500 * 2 ** retry2, signal);
143947
+ continue;
143948
+ }
143949
+ if (response2.status !== 429 || isFirewallChallenge429(response2.status, response2.headers.get("x-vercel-mitigated")) || retry2 === STREAM_APPEND_MAX_RETRIES) {
143950
+ return response2;
143951
+ }
143952
+ const throttle = {
143953
+ retryAfter: parseRetryAfter(response2.headers.get("Retry-After"))
143954
+ };
143955
+ try {
143956
+ await waitOutThrottle(throttle, signal);
143957
+ } catch (error2) {
143958
+ if (error2 === throttle)
143959
+ return response2;
143960
+ throw error2;
143961
+ }
143962
+ }
143963
+ }
143362
143964
  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;
143965
+ 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
143966
  const label = logLabel ?? url;
143365
143967
  validateHttpUrl(url);
143968
+ const retryAppend = retryStreamAppend && method === "PUT" && !!dispatcher2;
143969
+ const requestBody = retryAppend && body2 instanceof Uint8Array ? Uint8Array.from(body2) : body2;
143366
143970
  return withHttpClientSpan({ method, url, peerService, spanName, attributes }, async (span) => {
143367
- var _a3, _b2, _c2, _d2, _e2;
143971
+ var _a3, _b2, _c2, _d2, _e3;
143368
143972
  if (injectTraceContext2)
143369
143973
  await injectTraceContextIntoHeaders(headers2);
143370
- if (cacheBust)
143371
- headers2.set("X-Request-Time", Date.now().toString());
143372
143974
  const timeoutSignal = timeoutMs != null ? AbortSignal.timeout(timeoutMs) : void 0;
143373
143975
  const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
143374
143976
  const nodeAgents = dispatcher2 ? void 0 : getNodeHttpAgents();
@@ -143377,11 +143979,14 @@ async function instrumentedFetch(opts) {
143377
143979
  });
143378
143980
  const start2 = Date.now();
143379
143981
  let response2;
143380
- try {
143381
- const request2 = nodeAgents ? nodeHttpFetch(url, {
143982
+ const request2 = (retry2 = 0) => {
143983
+ signal == null ? void 0 : signal.throwIfAborted();
143984
+ if (cacheBust)
143985
+ headers2.set("X-Request-Time", Date.now().toString());
143986
+ const pending = nodeAgents ? nodeHttpFetch(url, {
143382
143987
  method,
143383
143988
  headers: headers2,
143384
- body: body2,
143989
+ body: requestBody,
143385
143990
  signal,
143386
143991
  agents: nodeAgents,
143387
143992
  // Match undici's per-phase defaults (which the undici agents
@@ -143393,13 +143998,17 @@ async function instrumentedFetch(opts) {
143393
143998
  }) : fetch(url, {
143394
143999
  method,
143395
144000
  headers: headers2,
143396
- body: body2,
144001
+ body: requestBody,
143397
144002
  signal,
143398
144003
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher type doesn't match @types/node's RequestInit
143399
144004
  dispatcher: dispatcher2
143400
144005
  });
143401
- onRequestDispatched == null ? void 0 : onRequestDispatched();
143402
- response2 = await request2;
144006
+ if (retry2 === 0)
144007
+ onRequestDispatched == null ? void 0 : onRequestDispatched();
144008
+ return pending;
144009
+ };
144010
+ try {
144011
+ response2 = await (retryAppend ? fetchStreamAppend(request2, signal) : request2());
143403
144012
  } catch (error2) {
143404
144013
  const elapsed = Date.now() - start2;
143405
144014
  onTransportOutcome == null ? void 0 : onTransportOutcome(error2);
@@ -143477,7 +144086,7 @@ async function instrumentedFetch(opts) {
143477
144086
  url,
143478
144087
  retryAfter: parseRetryAfter(response2.headers.get("Retry-After"))
143479
144088
  });
143480
- (_e2 = span == null ? void 0 : span.recordException) == null ? void 0 : _e2.call(span, error2);
144089
+ (_e3 = span == null ? void 0 : span.recordException) == null ? void 0 : _e3.call(span, error2);
143481
144090
  throw error2;
143482
144091
  }
143483
144092
  return response2;
@@ -144397,10 +145006,6 @@ function validateRunExecutionContext(value) {
144397
145006
  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
145007
  }
144399
145008
  }
144400
- async function getDeadline() {
144401
- const { getDeadline: getDeadline2 } = await import("./index-C3Gx8HYZ.js").then((n) => n.i);
144402
- return getDeadline2();
144403
- }
144404
145009
  const WORKFLOW_SERVER_SERVICE = {
144405
145010
  peerService: "workflow-server",
144406
145011
  rpcSystem: "http",
@@ -150038,299 +150643,6 @@ function createResolveLatestDeploymentId(config2) {
150038
150643
  return result.data.id;
150039
150644
  };
150040
150645
  }
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
150646
  const V4_FRAME_CONTENT_TYPE = "application/vnd.workflow.v4-frames";
150335
150647
  class IncompleteFrameError extends Error {
150336
150648
  }
@@ -152097,7 +152409,10 @@ async function createWorkflowRunEventInner(id2, data2, params, config2) {
152097
152409
  throw new WorkflowWorldError(validationError, { status: 400 });
152098
152410
  }
152099
152411
  }
152100
- const remoteRefBehavior = eventsNeedingResolve.has(data2.eventType) ? "resolve" : "lazy";
152412
+ const remoteRefBehavior = eventsNeedingResolve.has(data2.eventType) || // Concurrent hook reconciliation consumes the committed event directly.
152413
+ // Honor its explicit request for replay-ready metadata; other mutation
152414
+ // responses keep their existing lightweight entity-only behavior.
152415
+ data2.eventType === "hook_created" && (params == null ? void 0 : params.resolveData) === "all" ? "resolve" : "lazy";
152101
152416
  const { payload, meta } = splitEventDataForV4(data2);
152102
152417
  const input = {
152103
152418
  runId: id2,
@@ -152142,18 +152457,18 @@ async function createWorkflowRunEventInner(id2, data2, params, config2) {
152142
152457
  ...meta
152143
152458
  };
152144
152459
  if (data2.eventType === "run_started" && !(params == null ? void 0 : params.skipPreload)) {
152145
- const result = await createWorkflowRunStartedEventV4(input, config2, params == null ? void 0 : params.replayEventObserver);
152146
- const replayRun = reconstructRunFromReplayEvents(result.events);
152460
+ const result2 = await createWorkflowRunStartedEventV4(input, config2, params == null ? void 0 : params.replayEventObserver);
152461
+ const replayRun = reconstructRunFromReplayEvents(result2.events);
152147
152462
  if (!replayRun) {
152148
152463
  throw new WorkflowWorldError("v4 createEvent: run_started stream is missing lifecycle events", { code: "SCHEMA_VALIDATION" });
152149
152464
  }
152150
152465
  return {
152151
152466
  event: replayRun.event,
152152
152467
  run: replayRun.run,
152153
- events: result.events,
152154
- cursor: result.cursor,
152155
- hasMore: result.hasMore,
152156
- maxEvents: result.maxEvents
152468
+ events: result2.events,
152469
+ cursor: result2.cursor,
152470
+ hasMore: result2.hasMore,
152471
+ maxEvents: result2.maxEvents
152157
152472
  };
152158
152473
  }
152159
152474
  if (data2.eventType === "hook_received" && (params == null ? void 0 : params.preloadEvents) === true && params.resumeId !== void 0 && params.resumePayloadDigest !== void 0) {
@@ -152173,7 +152488,8 @@ async function createWorkflowRunEventInner(id2, data2, params, config2) {
152173
152488
  ...maxEvents !== void 0 ? { maxEvents } : {}
152174
152489
  };
152175
152490
  }
152176
- return createWorkflowRunEventV4(data2.eventType === "run_started" ? { ...input, eventType: "run_started", skipPreload: true } : { ...input, eventType: data2.eventType }, config2);
152491
+ const result = await createWorkflowRunEventV4(data2.eventType === "run_started" ? { ...input, eventType: "run_started", skipPreload: true } : { ...input, eventType: data2.eventType }, config2);
152492
+ return result.event ? { ...result, eventCursor: `eid:${result.event.eventId}` } : result;
152177
152493
  }
152178
152494
  function reconstructRunFromReplayEvents(events2) {
152179
152495
  const runCreated = events2.find((event) => event.eventType === "run_created");
@@ -152775,7 +153091,7 @@ function beginNormalWsClose(ws, reason) {
152775
153091
  await observed;
152776
153092
  span == null ? void 0 : span.setAttribute("workflow.stream.ws.close_cleanup_timeout", timedOut);
152777
153093
  });
152778
- void import("./index-C3Gx8HYZ.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => waitUntil2(cleanup)).catch(() => {
153094
+ void import("./index-DKlEIDGP.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => waitUntil2(cleanup)).catch(() => {
152779
153095
  });
152780
153096
  void cleanup.catch(() => {
152781
153097
  });
@@ -153160,7 +153476,7 @@ class VercelStreamWriteSession {
153160
153476
  return http3;
153161
153477
  });
153162
153478
  const [{ WebSocket: WebSocketImpl }, http2] = await Promise.all([
153163
- import("./wrapper-BC7AidWM.js"),
153479
+ import("./wrapper-BO03ZtLx.js"),
153164
153480
  httpPromise
153165
153481
  ]);
153166
153482
  if (this.mode !== "connecting")
@@ -153606,6 +153922,7 @@ async function writeStreamSessionOverHttp(runId, name2, chunks, config2, attribu
153606
153922
  body: encodeMultiChunks(chunks.slice(offset3, offset3 + pageSize)),
153607
153923
  headers: httpConfig.headers,
153608
153924
  dispatcher: getStreamDispatcher(config2),
153925
+ retryStreamAppend: !(config2 == null ? void 0 : config2.dispatcher),
153609
153926
  timeoutMs: null,
153610
153927
  logLabel: url.pathname,
153611
153928
  spanName: "workflow.stream.write",
@@ -153660,6 +153977,7 @@ function createStreamer(config2) {
153660
153977
  body: chunk,
153661
153978
  headers: httpConfig.headers,
153662
153979
  dispatcher: getStreamDispatcher(config2),
153980
+ retryStreamAppend: !(config2 == null ? void 0 : config2.dispatcher),
153663
153981
  timeoutMs: null,
153664
153982
  transportErrorCode: "STREAM_ERROR",
153665
153983
  logLabel: url.pathname,
@@ -153691,6 +154009,7 @@ function createStreamer(config2) {
153691
154009
  body: body2,
153692
154010
  headers: httpConfig.headers,
153693
154011
  dispatcher: getStreamDispatcher(config2),
154012
+ retryStreamAppend: !(config2 == null ? void 0 : config2.dispatcher),
153694
154013
  timeoutMs: null,
153695
154014
  transportErrorCode: "STREAM_ERROR",
153696
154015
  logLabel: url.pathname,
@@ -158063,6 +158382,7 @@ function createWorld$1(config2) {
158063
158382
  analytics: process.env.WORKFLOW_DISABLE_ANALYTICS_READS === "1" ? void 0 : createAnalytics(config2),
158064
158383
  ...instrumentObject("world.streams", createStreamer(config2)),
158065
158384
  createRunId,
158385
+ regionForRunId,
158066
158386
  describeRun,
158067
158387
  // Reports the environment this client's writes land in, so `start()` can
158068
158388
  // stamp it into the queue message and the consuming deployment can detect
@@ -158959,7 +159279,9 @@ async function resolveHookResumeInfo(hook) {
158959
159279
  if (hook.resumeContext) {
158960
159280
  return { resumeContext: hook.resumeContext, source: "hook" };
158961
159281
  }
158962
- const run2 = await (await getWorldLazy()).runs.get(hook.runId);
159282
+ const run2 = await (await getWorldLazy()).runs.get(hook.runId, {
159283
+ resolveData: "none"
159284
+ });
158963
159285
  return {
158964
159286
  resumeContext: resumeContextFromRun(run2),
158965
159287
  source: "run_fallback",
@@ -158967,9 +159289,9 @@ async function resolveHookResumeInfo(hook) {
158967
159289
  };
158968
159290
  }
158969
159291
  async function resolveHookEncryptionKey(hook, info) {
158970
- var _a3, _b2;
159292
+ var _a3;
158971
159293
  const world = await getWorldLazy();
158972
- const rawKey = info.run ? await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, info.run)) : await ((_b2 = world.getEncryptionKeyForRun) == null ? void 0 : _b2.call(world, hook.runId, {
159294
+ const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, hook.runId, {
158973
159295
  deploymentId: info.resumeContext.deploymentId
158974
159296
  }));
158975
159297
  return rawKey ? await importKey(rawKey) : void 0;
@@ -158983,10 +159305,10 @@ function withLazyMetadata(raw2) {
158983
159305
  let hydrated;
158984
159306
  let encryptionKey;
158985
159307
  const hydrate2 = async () => {
158986
- var _a3, _b2;
159308
+ var _a3;
158987
159309
  const world = await getWorldLazy();
158988
159310
  const info = await resolveHookResumeInfo(raw2);
158989
- const rawKey = info.run ? await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, info.run)) : await ((_b2 = world.getEncryptionKeyForRun) == null ? void 0 : _b2.call(world, raw2.runId, {
159311
+ const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, raw2.runId, {
158990
159312
  deploymentId: info.resumeContext.deploymentId
158991
159313
  }));
158992
159314
  encryptionKey = rawKey ? await deriveRunPayloadKeys(rawKey) : void 0;
@@ -159108,7 +159430,7 @@ async function resumeHookImpl(tokenOrHook, payload, encryptionKeyOverride, hookF
159108
159430
  });
159109
159431
  }
159110
159432
  async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKeyOverride, hookFreshlyLookedUp, resumeRequestedAtMs, logicalResumeId, webhookOnly) {
159111
- var _a3, _b2, _c2, _d2, _e2;
159433
+ var _a3, _b2, _c2, _d2, _e3;
159112
159434
  try {
159113
159435
  const suppliedToken = typeof tokenOrHook === "string";
159114
159436
  let hook;
@@ -159260,7 +159582,7 @@ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKe
159260
159582
  // of the messages. Claim-less writes have no resumeId and
159261
159583
  // keep the previous behavior.
159262
159584
  ...resumeId ? { idempotencyKey: `hook-${resumeId}` } : {}
159263
- }), (_e2 = world.isDeploymentUnavailableError) == null ? void 0 : _e2.bind(world));
159585
+ }), (_e3 = world.isDeploymentUnavailableError) == null ? void 0 : _e3.bind(world));
159264
159586
  span == null ? void 0 : span.setAttributes(HookWakePublished(true));
159265
159587
  return asLazyMetadataHook(hook);
159266
159588
  } catch (err) {
@@ -160160,8 +160482,10 @@ async function getEncryptionKeyForRun(worldEnv, runId) {
160160
160482
  if (!world.getEncryptionKeyForRun) {
160161
160483
  return createResponse(null);
160162
160484
  }
160163
- const run2 = await world.runs.get(runId);
160164
- const key = await world.getEncryptionKeyForRun(run2);
160485
+ const { deploymentId } = await world.runs.get(runId, {
160486
+ resolveData: "none"
160487
+ });
160488
+ const key = await world.getEncryptionKeyForRun(runId, { deploymentId });
160165
160489
  return createResponse(key ?? null);
160166
160490
  } catch (error2) {
160167
160491
  return createServerActionError(
@@ -160399,7 +160723,8 @@ const alertVariants = cva(
160399
160723
  variants: {
160400
160724
  variant: {
160401
160725
  default: "bg-background text-foreground",
160402
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
160726
+ destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
160727
+ warning: "border-[var(--ds-amber-400)] bg-[var(--ds-amber-100)] text-[var(--ds-amber-900)] [&>svg]:text-[var(--ds-amber-900)]"
160403
160728
  }
160404
160729
  },
160405
160730
  defaultVariants: {
@@ -161346,7 +161671,7 @@ var CONTENT_NAME$7 = "PopperContent";
161346
161671
  var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$7);
161347
161672
  var PopperContent = reactExports.forwardRef(
161348
161673
  (props, forwardedRef) => {
161349
- var _a3, _b2, _c2, _d2, _e2, _f;
161674
+ var _a3, _b2, _c2, _d2, _e3, _f2;
161350
161675
  const {
161351
161676
  __scopePopper,
161352
161677
  side = "bottom",
@@ -161445,12 +161770,12 @@ var PopperContent = reactExports.forwardRef(
161445
161770
  zIndex: contentZIndex,
161446
161771
  ["--radix-popper-transform-origin"]: [
161447
161772
  (_d2 = middlewareData.transformOrigin) == null ? void 0 : _d2.x,
161448
- (_e2 = middlewareData.transformOrigin) == null ? void 0 : _e2.y
161773
+ (_e3 = middlewareData.transformOrigin) == null ? void 0 : _e3.y
161449
161774
  ].join(" "),
161450
161775
  // hide the content if using the hide middleware and should be hidden
161451
161776
  // set visibility to hidden and disable pointer events so the UI behaves
161452
161777
  // as if the PopperContent isn't there at all
161453
- ...((_f = middlewareData.hide) == null ? void 0 : _f.referenceHidden) && {
161778
+ ...((_f2 = middlewareData.hide) == null ? void 0 : _f2.referenceHidden) && {
161454
161779
  visibility: "hidden",
161455
161780
  pointerEvents: "none"
161456
161781
  }
@@ -179077,7 +179402,7 @@ function getNodeIcon(nodeKind, label) {
179077
179402
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" });
179078
179403
  }
179079
179404
  function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT$1) {
179080
- var _a3, _b2, _c2, _d2, _e2;
179405
+ var _a3, _b2, _c2, _d2, _e3;
179081
179406
  const nodes = workflow.nodes.map((node2) => ({ ...node2 }));
179082
179407
  const groupNodes = [];
179083
179408
  const additionalEdges = [];
@@ -179156,7 +179481,7 @@ function calculateEnhancedLayout(workflow, layoutConfig = LAYOUT$1) {
179156
179481
  if (thenNodes.length > 0 && elseNodes.length > 0) {
179157
179482
  const baseY = Math.min(
179158
179483
  ((_d2 = thenNodes[0]) == null ? void 0 : _d2.position.y) || 0,
179159
- ((_e2 = elseNodes[0]) == null ? void 0 : _e2.position.y) || 0
179484
+ ((_e3 = elseNodes[0]) == null ? void 0 : _e3.position.y) || 0
179160
179485
  );
179161
179486
  thenNodes.forEach((node2, idx) => {
179162
179487
  node2.position = {
@@ -180340,6 +180665,37 @@ const route1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
180340
180665
  __proto__: null,
180341
180666
  default: home
180342
180667
  }, Symbol.toStringTag, { value: "Module" }));
180668
+ function RunLimitGuidanceAlert({
180669
+ run: run2
180670
+ }) {
180671
+ const guidance = getRunLimitGuidance(run2);
180672
+ if (!guidance) return null;
180673
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { variant: "warning", "data-testid": "run-limit-guidance", children: [
180674
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleAlert, { className: "h-4 w-4" }),
180675
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AlertTitle, { children: guidance.title }),
180676
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(AlertDescription, { children: [
180677
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: guidance.description }),
180678
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mt-2", children: [
180679
+ "Set",
180680
+ " ",
180681
+ /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "rounded bg-[var(--ds-amber-200)] px-1 py-0.5 font-mono text-xs", children: guidance.envVar }),
180682
+ " ",
180683
+ "and start the workflow again.",
180684
+ " ",
180685
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
180686
+ "a",
180687
+ {
180688
+ href: guidance.docsUrl,
180689
+ target: "_blank",
180690
+ rel: "noopener noreferrer",
180691
+ className: "font-medium underline underline-offset-4",
180692
+ children: "Learn more"
180693
+ }
180694
+ )
180695
+ ] })
180696
+ ] })
180697
+ ] });
180698
+ }
180343
180699
  var NODES = [
180344
180700
  "a",
180345
180701
  "button",
@@ -182280,7 +182636,8 @@ function RunDetailView({
182280
182636
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RelativeTime, { date: run2.expiredAt }) })
182281
182637
  ] })
182282
182638
  ] })
182283
- ] })
182639
+ ] }),
182640
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RunLimitGuidanceAlert, { run: runData })
182284
182641
  ] }),
182285
182642
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
182286
182643
  Tabs,
@@ -182567,7 +182924,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
182567
182924
  __proto__: null,
182568
182925
  loader
182569
182926
  }, 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 };
182927
+ 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-BdoS4wTM.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/mermaid-3ZIDBTTL-CQkIfF6F.js", "/assets/loader-circle-BuHkkqyY.js", "/assets/arrow-up-right-DDLzuSl1.js"], "css": ["/assets/root-DlBeVW_-.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-DjMKxUF0.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/workflow-graph-viewer-DaFQpLw8.js", "/assets/mermaid-3ZIDBTTL-CQkIfF6F.js", "/assets/loader-circle-BuHkkqyY.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-CY1rcVcm.js", "imports": ["/assets/index-CRmVVsbP.js", "/assets/workflow-graph-viewer-DaFQpLw8.js", "/assets/mermaid-3ZIDBTTL-CQkIfF6F.js", "/assets/arrow-up-right-DDLzuSl1.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-4ef14c64.js", "version": "4ef14c64", "sri": void 0 };
182571
182928
  const assetsBuildDirectory = "build/client";
182572
182929
  const basename = "/";
182573
182930
  const future = { "unstable_optimizeDeps": false, "v8_passThroughRequests": false, "v8_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
@@ -182709,7 +183066,7 @@ export {
182709
183066
  RESERVED_ATTRIBUTE_KEY_PREFIX as Z,
182710
183067
  RETENTION_ATTRIBUTE as _,
182711
183068
  ANALYTICS_MAX_ATTRIBUTE_FILTERS as a,
182712
- isTerminalStepStatus as a$,
183069
+ isTerminalRunEventType as a$,
182713
183070
  RETENTION_ZERO as a0,
182714
183071
  ROOT_RUN_ID_ATTRIBUTE as a1,
182715
183072
  RUN_ENTITY_KEY as a2,
@@ -182732,21 +183089,21 @@ export {
182732
183089
  eventIdToSlot as aJ,
182733
183090
  getEventDataPayloadField as aK,
182734
183091
  getEventDataRefFields as aL,
182735
- getMaxEventsPerRun as aM,
182736
- getQueueTopicPrefix as aN,
182737
- getRunQueueNamespace as aO,
182738
- isChildEntityCreationEvent as aP,
182739
- isChildEntityCreationEventType as aQ,
182740
- isHookEventRequiringExistence as aR,
182741
- isHookLifecycleEventType as aS,
182742
- isLegacySpecVersion as aT,
182743
- isNodeHttpEnabled as aU,
182744
- isSealedNoopEvent$1 as aV,
182745
- isSlotBody as aW,
182746
- isSlotEventId as aX,
182747
- isStepEventType as aY,
182748
- isTerminalRunEventType as aZ,
182749
- isTerminalStepEventType as a_,
183092
+ getMaxEventsForRun as aM,
183093
+ getMaxEventsPerRun as aN,
183094
+ getQueueTopicPrefix as aO,
183095
+ getRunQueueNamespace as aP,
183096
+ isChildEntityCreationEvent as aQ,
183097
+ isChildEntityCreationEventType as aR,
183098
+ isEventLimitExemptRun as aS,
183099
+ isHookEventRequiringExistence as aT,
183100
+ isHookLifecycleEventType as aU,
183101
+ isLegacySpecVersion as aV,
183102
+ isNodeHttpEnabled as aW,
183103
+ isSealedNoopEvent$1 as aX,
183104
+ isSlotBody as aY,
183105
+ isSlotEventId as aZ,
183106
+ isStepEventType as a_,
182750
183107
  SPEC_VERSION_SUPPORTS_COMPRESSION as aa,
182751
183108
  SPEC_VERSION_SUPPORTS_EVENT_SOURCING as ab,
182752
183109
  SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM as ac,
@@ -182774,40 +183131,42 @@ export {
182774
183131
  WorkflowRunBaseSchema as ay,
182775
183132
  WorkflowRunSchema as az,
182776
183133
  ANALYTICS_PAGE_LIMIT as b,
182777
- isTerminalWorkflowRunStatus as b0,
182778
- isWaitEventType as b1,
182779
- mintedSpecVersion as b2,
182780
- parseQueueName as b3,
182781
- parseQueueRoute as b4,
182782
- readRunRetention as b5,
182783
- reenqueueActiveRuns as b6,
182784
- requiresNewerWorld as b7,
182785
- resolveQueueNamespace as b8,
182786
- slotToEventId as b9,
182787
- stripEventDataRefs as ba,
182788
- ulidToDate as bb,
182789
- validateAttributeChanges as bc,
182790
- validateAttributeEventDataSize as bd,
182791
- validateUlidTimestamp as be,
182792
- workflowRunIdSchema as bf,
182793
- reactExports as bg,
182794
- R as bh,
182795
- Ks as bi,
182796
- jsxRuntimeExports as bj,
182797
- Qe as bk,
182798
- registerZstdDecoder as bl,
182799
- WebSocket as bm,
182800
- permessageDeflate as bn,
182801
- receiver as bo,
182802
- sender as bp,
182803
- websocketServer as bq,
182804
- stream as br,
182805
- extension as bs,
182806
- subprotocol as bt,
182807
- getDefaultExportFromCjs as bu,
182808
- requireTokenUtil as bv,
182809
- requireTokenError as bw,
182810
- createFetchHandler as bx,
183134
+ isTerminalStepEventType as b0,
183135
+ isTerminalStepStatus as b1,
183136
+ isTerminalWorkflowRunStatus as b2,
183137
+ isWaitEventType as b3,
183138
+ mintedSpecVersion as b4,
183139
+ parseQueueName as b5,
183140
+ parseQueueRoute as b6,
183141
+ readRunRetention as b7,
183142
+ reenqueueActiveRuns as b8,
183143
+ requiresNewerWorld as b9,
183144
+ resolveQueueNamespace as ba,
183145
+ slotToEventId as bb,
183146
+ stripEventDataRefs as bc,
183147
+ ulidToDate as bd,
183148
+ validateAttributeChanges as be,
183149
+ validateAttributeEventDataSize as bf,
183150
+ validateUlidTimestamp as bg,
183151
+ workflowRunIdSchema as bh,
183152
+ reactExports as bi,
183153
+ R as bj,
183154
+ Ks as bk,
183155
+ jsxRuntimeExports as bl,
183156
+ Qe as bm,
183157
+ registerZstdDecoder as bn,
183158
+ WebSocket as bo,
183159
+ permessageDeflate as bp,
183160
+ receiver as bq,
183161
+ sender as br,
183162
+ websocketServer as bs,
183163
+ stream as bt,
183164
+ extension as bu,
183165
+ subprotocol as bv,
183166
+ getDefaultExportFromCjs as bw,
183167
+ requireTokenUtil as bx,
183168
+ requireTokenError as by,
183169
+ createFetchHandler as bz,
182811
183170
  ANALYTICS_RUN_SCOPED_PAGE_LIMIT as c,
182812
183171
  ATTRIBUTE_EVENT_DATA_MAX_BYTES as d,
182813
183172
  ATTRIBUTE_KEY_MAX_LENGTH as e,