@oomol-lab/open-flow 0.1.0-beta.84 → 0.1.0-beta.86

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 (97) hide show
  1. package/dist/browser/{FlowCanvas-B2g7NceZ.js → FlowCanvas-CHIaMaBv.js} +112 -16
  2. package/dist/browser/{createResourceDialog-Bi4fUnbD.js → createResourceDialog-C0E5yPe6.js} +3 -3
  3. package/dist/browser/{dialog-BzoSxhXQ.js → dialog-b3hsdu8i.js} +291 -143
  4. package/dist/browser/{exportPng-DLdtJvg3.js → exportPng-DGHcejgy.js} +2 -2
  5. package/dist/browser/{flowChanges-C567g-Pc.js → flowChanges-BvSWezEb.js} +375 -83
  6. package/dist/browser/{flowWorkspace-DBk4A-Ld.js → flowWorkspace-BKnMRClO.js} +1619 -475
  7. package/dist/browser/fr-CNTSedYU.js +593 -0
  8. package/dist/browser/ja-CxQBHr2J.js +593 -0
  9. package/dist/browser/ko-D1Exiv1h.js +593 -0
  10. package/dist/browser/licenses.md +1 -1
  11. package/dist/browser/{markdownContent-DIuJThGK.js → markdownContent-BR9-1ikU.js} +1 -1
  12. package/dist/browser/preview.css +181 -181
  13. package/dist/browser/preview.js +2103 -636
  14. package/dist/browser/ru-BzLZv0B7.js +593 -0
  15. package/dist/browser/{tooltip-DGj5pudg.js → tooltip-DSBF3bRw.js} +55 -23
  16. package/dist/browser/workbench.css +181 -181
  17. package/dist/browser/workbench.js +86 -17
  18. package/dist/browser/{workbenchSelect-BIaEVTx6.js → workbenchSelect-Di1Bm_-d.js} +2 -2
  19. package/dist/browser/{wrapLayout-C4moMKgb.js → wrapLayout-B0AT8_-i.js} +1 -1
  20. package/dist/browser/zh-CN-Dg_xSGde.js +593 -0
  21. package/dist/browser/zh-TW-oxuLwsV0.js +593 -0
  22. package/dist/command/index.js +61 -57
  23. package/dist/command/licenses.md +28 -4
  24. package/dist/common/authoring.d.ts +5 -5
  25. package/dist/common/authoringExamples.d.ts +3 -2
  26. package/dist/common/authoringSchema.d.ts +41 -4
  27. package/dist/common/catalogCache.d.ts +46 -0
  28. package/dist/common/connector-action.js +13 -10
  29. package/dist/common/connector-proxy.d.ts +96 -0
  30. package/dist/common/connector-proxy.js +5209 -0
  31. package/dist/common/control-api-conformance.js +312 -46
  32. package/dist/common/control-api.d.ts +12 -1
  33. package/dist/common/control-api.js +303 -41
  34. package/dist/common/control-requests.d.ts +4 -3
  35. package/dist/common/control-requests.js +14111 -171
  36. package/dist/common/engine-contract.d.ts +3 -2
  37. package/dist/common/event-source.js +55 -23
  38. package/dist/common/flow-authoring-node.d.ts +2 -0
  39. package/dist/common/flow-authoring.js +6936 -6781
  40. package/dist/common/flow-change-schema.d.ts +1 -1
  41. package/dist/common/flow-change.d.ts +2 -2
  42. package/dist/common/flow-change.js +91 -36
  43. package/dist/common/flow-connectionUsage.d.ts +1 -1
  44. package/dist/common/flow-encoding.js +93 -38
  45. package/dist/common/flow-requestParameters.d.ts +34 -0
  46. package/dist/common/flow-semantics.js +9429 -9236
  47. package/dist/common/flow-state.js +55 -23
  48. package/dist/common/flow-workflowFile.d.ts +3 -1
  49. package/dist/common/http-request.d.ts +6 -11
  50. package/dist/common/http-request.js +192 -141
  51. package/dist/common/licenses.md +1 -1
  52. package/dist/common/mcp.d.ts +3 -3
  53. package/dist/common/mcp.js +303 -41
  54. package/dist/common/run-events.js +1 -0
  55. package/dist/common/runtime-contract.js +10 -4
  56. package/dist/common/runtime-nodejs-compat.js +55 -23
  57. package/dist/common/scheduler-checkpoint.d.ts +3 -3
  58. package/dist/common/scheduler-dependencies.d.ts +22 -28
  59. package/dist/common/scheduler-node-execution.d.ts +1 -0
  60. package/dist/common/scheduler.d.ts +8 -2
  61. package/dist/common/scheduler.js +274 -95
  62. package/dist/common/workflow.js +51 -19
  63. package/dist/common/workflowAuthoring.d.ts +411 -0
  64. package/dist/render/browser/licenses.md +1 -1
  65. package/dist/render/browser/runtime.js +289 -61
  66. package/dist/render/node/index.js +85 -30
  67. package/dist/render/node/licenses.md +1 -1
  68. package/package.json +1 -1
  69. package/skills/open-flow/references/flow-authoring.md +14 -13
  70. package/src/base/common/jsonSchema.ts +11 -0
  71. package/src/connector/common/actionSchema.ts +4 -11
  72. package/src/connector/common/proxy.ts +152 -0
  73. package/src/control/common/api.ts +99 -3
  74. package/src/control/common/authoring.ts +23 -9
  75. package/src/control/common/authoringExamples.ts +9 -0
  76. package/src/control/common/authoringSchema.ts +21 -12
  77. package/src/control/common/catalogCache.ts +145 -0
  78. package/src/control/common/conformance.ts +9 -3
  79. package/src/control/common/connectorQueries.ts +17 -2
  80. package/src/control/common/requests.ts +1 -0
  81. package/src/control/common/workflowAuthoring.ts +120 -0
  82. package/src/execution/common/checkpoint.ts +18 -12
  83. package/src/execution/common/dependencies.ts +132 -15
  84. package/src/execution/common/events.ts +3 -0
  85. package/src/execution/common/node-execution.ts +22 -15
  86. package/src/execution/common/scheduler.ts +20 -31
  87. package/src/flow/common/change.ts +2 -1
  88. package/src/flow/common/changeSchema.ts +11 -1
  89. package/src/flow/common/connectionUsage.ts +4 -2
  90. package/src/flow/common/errorHandling.ts +3 -1
  91. package/src/flow/common/nodeChanges.ts +35 -18
  92. package/src/flow/common/requestParameters.ts +120 -0
  93. package/src/flow/common/semantics.ts +51 -1
  94. package/src/flow/common/sourceField.ts +3 -2
  95. package/src/flow/common/workflowFile.ts +2 -2
  96. package/src/http/common/httpRequest.ts +28 -78
  97. package/src/runtime/common/engineContract.ts +6 -3
@@ -14,7 +14,7 @@ var nanoid$1 = (size = 21) => {
14
14
  return id;
15
15
  };
16
16
  //#endregion
17
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
17
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/util.js
18
18
  function getEnumValues(entries) {
19
19
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
20
20
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -339,6 +339,17 @@ function prefixIssues(path, issues) {
339
339
  function unwrapMessage(message) {
340
340
  return typeof message === "string" ? message : message?.message;
341
341
  }
342
+ /** The leading size checks of `defChecks` that set an upper bound, each paired with it. */
343
+ function sizeCaps(defChecks) {
344
+ const caps = [];
345
+ for (const ch of defChecks ?? []) {
346
+ const d = ch._zod.def;
347
+ if (!/_(length|size)$|_equals$/.test(d.check)) break;
348
+ const max = d.maximum ?? d.length ?? d.size;
349
+ if (max >= 0) caps.push([max, ch]);
350
+ }
351
+ return caps;
352
+ }
342
353
  function attachSchema(issues, start, inst) {
343
354
  var _a;
344
355
  for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
@@ -555,7 +566,7 @@ function constantCatch(value) {
555
566
  return fn;
556
567
  }
557
568
  //#endregion
558
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/core.js
569
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/core.js
559
570
  var _a$1;
560
571
  var _zodDesc = {
561
572
  value: void 0,
@@ -661,7 +672,7 @@ function config(newConfig) {
661
672
  return globalConfig;
662
673
  }
663
674
  //#endregion
664
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/errors.js
675
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/errors.js
665
676
  function _getMessage() {
666
677
  const internals = this._zod;
667
678
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -777,7 +788,7 @@ function formatError(error, mapper = (issue) => issue.message) {
777
788
  return fieldErrors;
778
789
  }
779
790
  //#endregion
780
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/parse.js
791
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/parse.js
781
792
  function finalizeParams(callee, params) {
782
793
  return {
783
794
  callee: params?.callee ?? callee,
@@ -980,7 +991,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
980
991
  return _safeParseAsync(_Err)(schema, value, _ctx);
981
992
  };
982
993
  //#endregion
983
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/regexes.js
994
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/regexes.js
984
995
  /**
985
996
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
986
997
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -1053,7 +1064,7 @@ var _null$2 = /^null$/i;
1053
1064
  var lowercase = /^[^A-Z]*$/;
1054
1065
  var uppercase = /^[^a-z]*$/;
1055
1066
  //#endregion
1056
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/checks.js
1067
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/checks.js
1057
1068
  var $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1058
1069
  var _a;
1059
1070
  inst._zod ?? (inst._zod = {});
@@ -1349,7 +1360,7 @@ var $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst,
1349
1360
  };
1350
1361
  });
1351
1362
  //#endregion
1352
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/doc.js
1363
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/doc.js
1353
1364
  var Doc = class {
1354
1365
  constructor(args = [], closed = {}) {
1355
1366
  this.content = [];
@@ -1383,14 +1394,14 @@ var Doc = class {
1383
1394
  }
1384
1395
  };
1385
1396
  //#endregion
1386
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/versions.js
1397
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/versions.js
1387
1398
  var version = {
1388
1399
  major: 4,
1389
1400
  minor: 6,
1390
- patch: 5
1401
+ patch: 7
1391
1402
  };
1392
1403
  //#endregion
1393
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/schemas.js
1404
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/schemas.js
1394
1405
  var $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1395
1406
  var _a;
1396
1407
  inst ?? (inst = {});
@@ -1903,6 +1914,26 @@ var $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
1903
1914
  return payload;
1904
1915
  };
1905
1916
  });
1917
+ function capSize(inst, size) {
1918
+ const caps = sizeCaps(inst._zod.def.checks);
1919
+ if (!caps.length) return;
1920
+ const cap = Math.min(...caps.map((c) => c[0]));
1921
+ const parse = inst._zod.parse;
1922
+ inst._zod.parse = (payload, ctx) => {
1923
+ const n = size(payload.value);
1924
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
1925
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) if (n > max && ch._zod.def.when(payload)) {
1926
+ const start = payload.issues.length;
1927
+ ch._zod.check(payload);
1928
+ payload.issues[start].continue = false;
1929
+ attachSchema(payload.issues, start, inst);
1930
+ return payload;
1931
+ }
1932
+ }
1933
+ return parse(payload, ctx);
1934
+ };
1935
+ }
1936
+ var arraySize = (input) => Array.isArray(input) ? input.length : -1;
1906
1937
  function handleArrayResult(result, final, index) {
1907
1938
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1908
1939
  final.value[index] = result.value;
@@ -1940,6 +1971,7 @@ var $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1940
1971
  if (proms.length) return Promise.all(proms).then(() => payload);
1941
1972
  return payload;
1942
1973
  };
1974
+ capSize(inst, arraySize);
1943
1975
  });
1944
1976
  function handlePropertyResult(result, final, key, input, optin, optout) {
1945
1977
  const isPresent = key in input;
@@ -2858,7 +2890,7 @@ function handleRefineResult(result, payload, input, inst) {
2858
2890
  }
2859
2891
  }
2860
2892
  //#endregion
2861
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
2893
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/memoizer.js
2862
2894
  var $ZodCyclicError = class extends Error {
2863
2895
  constructor() {
2864
2896
  super(`Cannot parse a reference cycle that closes through a transform`);
@@ -3111,7 +3143,7 @@ function isBackEdge(ctx, value) {
3111
3143
  return backEdges !== void 0 && isRef(value) && backEdges.has(value);
3112
3144
  }
3113
3145
  //#endregion
3114
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/locales/en.js
3146
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/en.js
3115
3147
  var error = () => {
3116
3148
  const Sizable = {
3117
3149
  string: {
@@ -3219,7 +3251,7 @@ function en_default() {
3219
3251
  return { localeError: error() };
3220
3252
  }
3221
3253
  //#endregion
3222
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/registries.js
3254
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/registries.js
3223
3255
  var _a;
3224
3256
  var $ZodRegistry = class {
3225
3257
  constructor() {
@@ -3266,7 +3298,7 @@ function registry() {
3266
3298
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
3267
3299
  var globalRegistry = globalThis.__zod_globalRegistry;
3268
3300
  //#endregion
3269
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/api.js
3301
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/api.js
3270
3302
  function snapshotChecks(def) {
3271
3303
  if (def.checks) def.checks = [...def.checks];
3272
3304
  return def;
@@ -3782,7 +3814,7 @@ function _check(fn, params) {
3782
3814
  return ch;
3783
3815
  }
3784
3816
  //#endregion
3785
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
3817
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.js
3786
3818
  function assignProps(target, ...sources) {
3787
3819
  for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3788
3820
  return target;
@@ -4226,7 +4258,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
4226
4258
  return finalize(ctx, schema);
4227
4259
  };
4228
4260
  //#endregion
4229
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
4261
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.js
4230
4262
  var narrowMin = (agg, key, value) => {
4231
4263
  if (agg[key] === void 0 || value > agg[key]) agg[key] = value;
4232
4264
  };
@@ -4687,7 +4719,7 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4687
4719
  seen.ref = innerType;
4688
4720
  };
4689
4721
  //#endregion
4690
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/errors.js
4722
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/errors.js
4691
4723
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4692
4724
  function _lazyMethod(proto, key, make) {
4693
4725
  Object.defineProperty(proto, key, {
@@ -4737,7 +4769,7 @@ var initializer = (inst, issues) => {
4737
4769
  };
4738
4770
  var ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
4739
4771
  //#endregion
4740
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/parse.js
4772
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/parse.js
4741
4773
  var parse = /* @__PURE__ */ _parse(ZodRealError);
4742
4774
  var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
4743
4775
  var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -4751,7 +4783,7 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
4751
4783
  var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
4752
4784
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
4753
4785
  //#endregion
4754
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
4786
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/schemas.js
4755
4787
  function _ensureDefaultLocale() {
4756
4788
  if (!globalConfig.localeError) config(en_default());
4757
4789
  }
@@ -5683,7 +5715,7 @@ function preprocess(fn, schema) {
5683
5715
  });
5684
5716
  }
5685
5717
  //#endregion
5686
- //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/classic/iso.js
5718
+ //#region ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/classic/iso.js
5687
5719
  function datetime(params) {
5688
5720
  return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
5689
5721
  }
@@ -5719,6 +5751,39 @@ function dequal(foo, bar) {
5719
5751
  return foo !== foo && bar !== bar;
5720
5752
  }
5721
5753
  //#endregion
5754
+ //#region src/http/common/headers.ts
5755
+ /** Header names are case-insensitive; never silently combine duplicate business fields. */
5756
+ function httpHeaderNameIssue(name, names) {
5757
+ if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
5758
+ if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
5759
+ }
5760
+ //#endregion
5761
+ //#region src/flow/common/requestParameters.ts
5762
+ var requestParameterSchema = strictObject({
5763
+ mode: _enum(["fields", "object"]).default("fields"),
5764
+ names: array(string$1()).default([])
5765
+ });
5766
+ var connectorProxyExecutorSchema = strictObject({
5767
+ providerId: string$1().min(1),
5768
+ connectionId: string$1().optional(),
5769
+ method: _enum([
5770
+ "GET",
5771
+ "POST",
5772
+ "PUT",
5773
+ "PATCH",
5774
+ "DELETE"
5775
+ ]).default("GET"),
5776
+ query: requestParameterSchema.default({
5777
+ mode: "fields",
5778
+ names: []
5779
+ }),
5780
+ headers: requestParameterSchema.default({
5781
+ mode: "fields",
5782
+ names: []
5783
+ }),
5784
+ bodyFormat: _enum(["none", "json"]).default("none")
5785
+ }).extend({ kind: literal("connector-proxy") });
5786
+ //#endregion
5722
5787
  //#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
5723
5788
  function deepCompareStrict(a, b) {
5724
5789
  const typeofa = typeof a;
@@ -9482,19 +9547,6 @@ var httpHostPattern = /^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0
9482
9547
  function isHttpHost(value) {
9483
9548
  return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
9484
9549
  }
9485
- //#endregion
9486
- //#region src/http/common/headers.ts
9487
- /** Header names are case-insensitive; never silently combine duplicate business fields. */
9488
- function httpHeaderNameIssue(name, names) {
9489
- if (!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(name)) return "invalid";
9490
- if (names.some((candidate) => candidate.toLowerCase() === name.toLowerCase())) return "duplicate";
9491
- }
9492
- //#endregion
9493
- //#region src/http/common/httpRequest.ts
9494
- var parameterSchema = strictObject({
9495
- mode: _enum(["fields", "object"]).default("fields"),
9496
- names: array(string$1()).default([])
9497
- });
9498
9550
  var httpRequestExecutorSchema = strictObject({
9499
9551
  method: _enum([
9500
9552
  "GET",
@@ -9505,11 +9557,11 @@ var httpRequestExecutorSchema = strictObject({
9505
9557
  "HEAD",
9506
9558
  "OPTIONS"
9507
9559
  ]).default("GET"),
9508
- query: parameterSchema.default({
9560
+ query: requestParameterSchema.default({
9509
9561
  mode: "fields",
9510
9562
  names: []
9511
9563
  }),
9512
- headers: parameterSchema.default({
9564
+ headers: requestParameterSchema.default({
9513
9565
  mode: "fields",
9514
9566
  names: []
9515
9567
  }),
@@ -9952,7 +10004,8 @@ var managedFields = object({
9952
10004
  revisionId: text
9953
10005
  }),
9954
10006
  httpRequestExecutorSchema,
9955
- skipDuplicatesExecutorSchema
10007
+ skipDuplicatesExecutorSchema,
10008
+ connectorProxyExecutorSchema
9956
10009
  ])
9957
10010
  });
9958
10011
  var managed = managedFields.transform(limitDecisionTask);
@@ -10207,7 +10260,8 @@ object({
10207
10260
  literal(10),
10208
10261
  literal(11),
10209
10262
  literal(12),
10210
- literal(13)
10263
+ literal(13),
10264
+ literal(14)
10211
10265
  ]),
10212
10266
  document,
10213
10267
  modules: record$1(text, module)
@@ -10615,7 +10669,7 @@ var nodeErrorSchema = {
10615
10669
  }
10616
10670
  };
10617
10671
  function supportsNodeErrorHandling(node) {
10618
- return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "skip-duplicates";
10672
+ return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && ["skip-duplicates", "connector-proxy"].includes(node.task.executor.kind);
10619
10673
  }
10620
10674
  function nodeSystemOutputPorts(node) {
10621
10675
  return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
@@ -10939,9 +10993,6 @@ var inputSchema = record$1(string$1(), strictObject({
10939
10993
  outputs: outputsSchema,
10940
10994
  systemOutputs: outputsSchema.optional()
10941
10995
  }));
10942
- function dependencyValues(input) {
10943
- return Object.fromEntries(Object.entries(input).map(([id, result]) => [id, result.outputs]));
10944
- }
10945
10996
  var stateSchema = strictObject({
10946
10997
  id: number().int().nonnegative(),
10947
10998
  status: _enum([
@@ -10958,11 +11009,112 @@ var stateSchema = strictObject({
10958
11009
  jobId: string$1().optional(),
10959
11010
  seeded: boolean()
10960
11011
  });
10961
- var dependenciesSchema = strictObject({
11012
+ var legacyDependenciesSchema = strictObject({
10962
11013
  nextId: number().int().nonnegative(),
10963
11014
  iterations: record$1(string$1(), number().int().nonnegative()),
10964
11015
  nodes: record$1(string$1(), stateSchema)
10965
11016
  });
11017
+ var referenceSchema = number().int().nonnegative();
11018
+ var dependenciesSchema = strictObject({
11019
+ nextId: referenceSchema,
11020
+ iterations: record$1(string$1(), referenceSchema),
11021
+ nodes: record$1(string$1(), stateSchema.omit({
11022
+ input: true,
11023
+ output: true,
11024
+ systemOutputs: true
11025
+ }).extend({
11026
+ input: referenceSchema,
11027
+ output: referenceSchema.optional()
11028
+ })),
11029
+ frames: array(strictObject({
11030
+ parent: referenceSchema.optional(),
11031
+ input: record$1(string$1(), referenceSchema)
11032
+ })),
11033
+ results: array(strictObject({
11034
+ nodeId: string$1(),
11035
+ execution: referenceSchema,
11036
+ outputs: outputsSchema,
11037
+ systemOutputs: outputsSchema.optional()
11038
+ }))
11039
+ });
11040
+ function decodeDependenciesCheckpoint(input, version) {
11041
+ const saved = version == 6 ? saveDependencies(legacyDependenciesSchema.parse(input)) : dependenciesSchema.parse(input);
11042
+ for (const [index, frame] of saved.frames.entries()) {
11043
+ if (frame.parent != null && (frame.parent >= index || Object.keys(frame.input).length != 1)) throw new Error("Checkpoint input frame parent is invalid.");
11044
+ for (const [nodeId, reference] of Object.entries(frame.input)) {
11045
+ const result = saved.results[reference];
11046
+ if (result == null || result.nodeId != nodeId) throw new Error("Checkpoint input result reference is invalid.");
11047
+ }
11048
+ }
11049
+ for (const [nodeId, state] of Object.entries(saved.nodes)) {
11050
+ if (saved.frames[state.input] == null) throw new Error("Checkpoint input frame reference is invalid.");
11051
+ if (state.output != null) {
11052
+ const result = saved.results[state.output];
11053
+ if (result == null || result.nodeId != nodeId || result.execution != state.id) throw new Error("Checkpoint output result reference is invalid.");
11054
+ }
11055
+ }
11056
+ for (const result of saved.results) if (saved.nodes[result.nodeId] == null || result.execution > saved.nodes[result.nodeId].id || result.execution >= saved.nextId) throw new Error("Checkpoint dependency result identity is invalid.");
11057
+ return saved;
11058
+ }
11059
+ function saveDependencies(state, frames) {
11060
+ const results = [];
11061
+ const references = /* @__PURE__ */ new Map();
11062
+ const saveResult = (nodeId, result) => {
11063
+ const key = JSON.stringify([
11064
+ nodeId,
11065
+ result.execution,
11066
+ Object.keys(result.outputs).toSorted()
11067
+ ]);
11068
+ let reference = references.get(key);
11069
+ if (reference == null) {
11070
+ reference = results.length;
11071
+ references.set(key, reference);
11072
+ results.push({
11073
+ nodeId,
11074
+ ...result
11075
+ });
11076
+ } else if (!dequal(results[reference].outputs, result.outputs) || !dequal(results[reference].systemOutputs, result.systemOutputs)) throw new Error("Checkpoint invocation results conflict.");
11077
+ return reference;
11078
+ };
11079
+ const savedFrames = [];
11080
+ const frameIds = /* @__PURE__ */ new Map();
11081
+ const saveFrame = (frame) => {
11082
+ const existing = frameIds.get(frame);
11083
+ if (existing != null) return existing;
11084
+ const saved = "source" in frame ? {
11085
+ parent: saveFrame(frame.parent),
11086
+ input: { [frame.source]: saveResult(frame.source, frame.result) }
11087
+ } : { input: Object.fromEntries(Object.entries(frame.values).map(([id, result]) => [id, saveResult(id, result)])) };
11088
+ const id = savedFrames.length;
11089
+ savedFrames.push(saved);
11090
+ frameIds.set(frame, id);
11091
+ return id;
11092
+ };
11093
+ const nodes = Object.fromEntries(Object.entries(state.nodes).map(([id, current]) => {
11094
+ const { id: execution, status, previous, released, jobId, seeded, output, systemOutputs } = current;
11095
+ return [id, {
11096
+ id: execution,
11097
+ status,
11098
+ previous,
11099
+ released,
11100
+ seeded,
11101
+ ...jobId == null ? {} : { jobId },
11102
+ input: saveFrame(frames?.get(id) ?? { values: current.input }),
11103
+ ...output == null ? {} : { output: saveResult(id, {
11104
+ execution: current.id,
11105
+ outputs: output,
11106
+ ...systemOutputs == null ? {} : { systemOutputs }
11107
+ }) }
11108
+ }];
11109
+ }));
11110
+ return {
11111
+ nextId: state.nextId,
11112
+ iterations: { ...state.iterations },
11113
+ nodes,
11114
+ frames: savedFrames,
11115
+ results
11116
+ };
11117
+ }
10966
11118
  /** Dependency completion belongs to an invocation, never to a Run-wide latest-result table. */
10967
11119
  var Dependencies = class {
10968
11120
  constructor(graph, saved) {
@@ -11033,18 +11185,55 @@ var Dependencies = class {
11033
11185
  });
11034
11186
  }
11035
11187
  this.innerLoopsFirst = [...this.loops.values()].toSorted((a, b) => a.body.size - b.body.size || a.header.localeCompare(b.header));
11036
- this.state = saved == null ? {
11037
- nextId: 0,
11038
- iterations: {},
11188
+ this.state = {
11189
+ nextId: saved?.nextId ?? 0,
11190
+ iterations: { ...saved?.iterations },
11039
11191
  nodes: {}
11040
- } : structuredClone(saved);
11192
+ };
11041
11193
  if (saved == null) for (const id of ids) this.state.nodes[id] = this.fresh();
11042
- else this.validate();
11194
+ else {
11195
+ const frames = [];
11196
+ for (const frame of saved.frames) if (frame.parent == null) frames.push({ values: Object.fromEntries(Object.entries(frame.input).map(([id, reference]) => [id, saved.results[reference]])) });
11197
+ else {
11198
+ const [source, reference] = Object.entries(frame.input)[0];
11199
+ frames.push({
11200
+ source,
11201
+ result: saved.results[reference],
11202
+ parent: frames[frame.parent],
11203
+ cache: /* @__PURE__ */ new Map()
11204
+ });
11205
+ }
11206
+ for (const [id, current] of Object.entries(saved.nodes)) {
11207
+ const { input, output, ...node } = current;
11208
+ const result = output == null ? void 0 : saved.results[output];
11209
+ const frame = frames[input];
11210
+ this.frames.set(id, frame);
11211
+ const restored = {
11212
+ ...node,
11213
+ input: {},
11214
+ ...result == null ? {} : {
11215
+ output: result.outputs,
11216
+ systemOutputs: result.systemOutputs
11217
+ }
11218
+ };
11219
+ if (this.loops.size == 0) Object.defineProperty(restored, "input", {
11220
+ enumerable: true,
11221
+ configurable: true,
11222
+ get: () => this.snapshot(frame)
11223
+ });
11224
+ else restored.input = this.snapshot(frame);
11225
+ this.state.nodes[id] = restored;
11226
+ }
11227
+ this.validate();
11228
+ }
11043
11229
  for (const id of ids) {
11044
11230
  if (this.state.nodes[id].status == "pending") this.candidates.add(id);
11045
- this.frames.set(id, { values: this.state.nodes[id].input });
11231
+ if (saved == null) this.frames.set(id, { values: this.state.nodes[id].input });
11046
11232
  }
11047
11233
  }
11234
+ checkpoint() {
11235
+ return saveDependencies(this.state, this.loops.size == 0 ? this.frames : void 0);
11236
+ }
11048
11237
  fresh() {
11049
11238
  return {
11050
11239
  id: this.state.nextId++,
@@ -11070,8 +11259,7 @@ var Dependencies = class {
11070
11259
  if (state.previous.some((source) => !this.graph.edges.some((edge) => edge.source == source && edge.target == id))) throw new Error("Checkpoint predecessor does not match the graph.");
11071
11260
  if (state.previous.length != new Set(state.previous).size) throw new Error("Checkpoint predecessors are duplicated.");
11072
11261
  if (state.status == "completed" && state.output == null) throw new Error("Checkpoint completed dependency has no output.");
11073
- if (state.previous.some((source) => state.input[source] == null)) throw new Error("Checkpoint predecessor has no input snapshot.");
11074
- for (const [source, result] of Object.entries(state.input)) if (nodes[source] == null || result.execution > nodes[source].id || result.execution >= nextId) throw new Error("Checkpoint dependency result identity is invalid.");
11262
+ if (state.previous.some((source) => this.input(id, source) == null)) throw new Error("Checkpoint predecessor has no input snapshot.");
11075
11263
  }
11076
11264
  if (Object.keys(iterations).some((id) => !this.loops.has(id))) throw new Error("Checkpoint loop scope is invalid.");
11077
11265
  }
@@ -11541,7 +11729,7 @@ function validateOutputs(nodeId, node, value) {
11541
11729
  const raw = outputRecord(value, nodeId);
11542
11730
  const discardUndeclared = node.kind == "task" && "executor" in node.task && (node.task.executor.kind == "connector" || node.task.executor.kind == "workflow");
11543
11731
  const ports = node.kind == "outputs" ? nodeInputPorts(node) : isResolutionNode(node) ? resolutionOutputPorts(node) : node.kind == "task" ? portsByHandle(node.task.outputs) : node.kind == "value" ? portsByHandle(node.values) : {};
11544
- const outputs = outputRecord(jsonValue(Object.fromEntries(Object.entries(raw).map(([handle, item]) => [handle, Object.hasOwn(ports, handle) && item === void 0 ? null : item])), `Node "${nodeId}" outputs`), nodeId);
11732
+ const outputs = outputRecord(jsonValue(Object.fromEntries(Object.entries(raw).filter(([handle]) => !discardUndeclared || Object.hasOwn(ports, handle)).map(([handle, item]) => [handle, Object.hasOwn(ports, handle) && item === void 0 ? null : item])), `Node "${nodeId}" outputs`), nodeId);
11545
11733
  const complete = node.kind == "condition" || isResolutionNode(node) ? outputs : {
11546
11734
  ...Object.fromEntries(Object.keys(ports).map((handle) => [handle, null])),
11547
11735
  ...outputs
@@ -11549,11 +11737,7 @@ function validateOutputs(nodeId, node, value) {
11549
11737
  const validated = [];
11550
11738
  for (const [handle, output] of Object.entries(complete)) {
11551
11739
  const port = ports[handle];
11552
- if (port == null) {
11553
- if (discardUndeclared) continue;
11554
- throw new PortValidationError(`Node "${nodeId}" output "${handle}" does not match its declaration.`);
11555
- }
11556
- if (!(output === null && port.nullable) && !matchesSchema(output, port.jsonSchema)) throw new PortValidationError(`Node "${nodeId}" output "${handle}" does not match its declaration.`);
11740
+ if (port == null || !(output === null && port.nullable) && !matchesSchema(output, port.jsonSchema)) throw new PortValidationError(`Node "${nodeId}" output "${handle}" does not match its declaration.`);
11557
11741
  validated.push([handle, output]);
11558
11742
  }
11559
11743
  return Object.fromEntries(validated);
@@ -11587,8 +11771,9 @@ function executeNode(context, input) {
11587
11771
  const { nodeId, node, jobId, nodeInputs, flowId, runId, graph, dependencies, previousIds, saved, workflowRunId, resolution } = input;
11588
11772
  const config = agentConfig(node);
11589
11773
  const nodeRemainingMs = saved?.remainingMs ?? node.timeoutMs;
11590
- const startedAt = performance.now();
11774
+ let startedAt = 0;
11591
11775
  const execution = Effect.gen(function* () {
11776
+ startedAt = performance.now();
11592
11777
  const kind = nodeKind(node);
11593
11778
  const title = nodeTitle(node);
11594
11779
  const projectedInputs = Object.fromEntries(Object.entries(nodeInputs).filter(([handle]) => {
@@ -11729,10 +11914,15 @@ function executeNode(context, input) {
11729
11914
  catch: (error) => new NodeValidationError("node.output-invalid", error)
11730
11915
  });
11731
11916
  });
11732
- return nodeRemainingMs == null ? execution : execution.pipe(Effect.timeoutOrElse({
11917
+ const timed = nodeRemainingMs == null ? execution : execution.pipe(Effect.timeoutOrElse({
11733
11918
  duration: nodeRemainingMs,
11734
11919
  orElse: () => Effect.fail(/* @__PURE__ */ new Error(`Node "${nodeId}" timed out.`))
11735
11920
  }));
11921
+ return node.kind == "task" && workflowRunId == null && context.admitTask != null ? Effect.andThen(context.admitTask({
11922
+ runId,
11923
+ nodeId,
11924
+ jobId
11925
+ }), timed) : timed;
11736
11926
  }
11737
11927
  //#endregion
11738
11928
  //#region src/execution/common/checkpoint.ts
@@ -11761,7 +11951,8 @@ function decodeFlowRunCheckpoint(input) {
11761
11951
  "waits",
11762
11952
  ...source.calls === void 0 ? [] : ["calls"]
11763
11953
  ], "Flow Run checkpoint");
11764
- if (source.version != 6) throw new Error("Flow Run checkpoint version is unsupported.");
11954
+ const version = source.version;
11955
+ if (version !== 6 && version !== 7) throw new Error("Flow Run checkpoint version is unsupported.");
11765
11956
  const bindingValues = Object.fromEntries(Object.entries(checkpointRecord(source.bindingValues, "Checkpoint bindings")).map(([id, value]) => {
11766
11957
  if (typeof value != "string") throw new Error("Checkpoint binding must be a string.");
11767
11958
  return [id, value];
@@ -11784,7 +11975,7 @@ function decodeFlowRunCheckpoint(input) {
11784
11975
  }];
11785
11976
  }));
11786
11977
  const counts = record$1(string$1(), record$1(string$1(), number().int().positive().max(Number.MAX_SAFE_INTEGER))).parse(source.counts);
11787
- const dependencies = dependenciesSchema.parse(source.dependencies);
11978
+ const dependencies = decodeDependenciesCheckpoint(source.dependencies, version);
11788
11979
  const pendingWaits = array(strictObject({
11789
11980
  jobId: string$1().min(1),
11790
11981
  nodeId: string$1().min(1),
@@ -11825,12 +12016,12 @@ function decodeFlowRunCheckpoint(input) {
11825
12016
  dependencies,
11826
12017
  inputs,
11827
12018
  results,
11828
- version: 6,
12019
+ version: 7,
11829
12020
  waits: pendingWaits,
11830
12021
  ...source.calls === void 0 ? {} : { calls }
11831
12022
  };
11832
12023
  }
11833
- function validateCheckpoint(target, checkpoint, resolveInputs) {
12024
+ function validateCheckpoint(target, checkpoint, dependencies, resolveInputs) {
11834
12025
  const launch = checkpoint.inputs;
11835
12026
  const agents = checkpoint.agents;
11836
12027
  if ([...Object.keys(checkpoint.results), ...Object.keys(launch)].some((id) => target.graph.nodes[id] == null)) throw new Error("Checkpoint nodes do not match the prepared graph.");
@@ -11879,12 +12070,12 @@ function validateCheckpoint(target, checkpoint, resolveInputs) {
11879
12070
  const node = target.graph.nodes[id];
11880
12071
  if (isTriggerNode(node) || Object.keys(values).some((handle) => nodeInputPorts(node)[handle] == null)) throw new Error("Checkpoint launch inputs do not match the prepared graph.");
11881
12072
  }
11882
- for (const [nodeId, state] of Object.entries(checkpoint.dependencies.nodes)) {
11883
- const frame = dependencyValues(state.input);
11884
- validateResults(frame, true, state.input);
12073
+ for (const result of checkpoint.dependencies.results) validateResults({ [result.nodeId]: result.outputs }, true, { [result.nodeId]: result });
12074
+ const graphTriggers = Object.keys(target.graph.nodes).filter((id) => isTriggerNode(target.graph.nodes[id]));
12075
+ for (const [nodeId, state] of Object.entries(dependencies.state.nodes)) {
11885
12076
  if (!isTriggerNode(target.graph.nodes[nodeId]) && (state.status == "running" || state.status == "completed")) {
11886
- const triggers = Object.keys(frame).filter((id) => isTriggerNode(target.graph.nodes[id]));
11887
- if (triggers.length != 1 || triggers[0] != triggerIds[0] || !jsonEqual(frame[triggers[0]], checkpoint.results[triggers[0]].outputs)) throw new Error("Checkpoint input Trigger does not match the Run.");
12077
+ const triggers = graphTriggers.filter((id) => dependencies.input(nodeId, id) != null);
12078
+ if (triggers.length != 1 || triggers[0] != triggerIds[0] || !jsonEqual(dependencies.input(nodeId, triggers[0]).outputs, checkpoint.results[triggers[0]].outputs)) throw new Error("Checkpoint input Trigger does not match the Run.");
11888
12079
  }
11889
12080
  if (state.output != null) validateResults({ [nodeId]: state.output }, state.status == "running");
11890
12081
  if (state.status == "completed") {
@@ -11899,7 +12090,7 @@ function validateCheckpoint(target, checkpoint, resolveInputs) {
11899
12090
  for (const waiting of checkpoint.waits) {
11900
12091
  const node = target.graph.nodes[waiting.nodeId];
11901
12092
  if (node == null || isTriggerNode(node)) throw new Error("Checkpoint waiting node is missing.");
11902
- const state = checkpoint.dependencies.nodes[waiting.nodeId];
12093
+ const state = dependencies.state.nodes[waiting.nodeId];
11903
12094
  const expectedOutput = waiting.pending == null ? void 0 : { pending: waiting.pending };
11904
12095
  if (state.output == null != (expectedOutput == null) || state.output != null && !jsonEqual(state.output, expectedOutput)) throw new Error("Checkpoint waiting dependency output is inconsistent.");
11905
12096
  const config = agentConfig(node);
@@ -11972,7 +12163,6 @@ function withWaitNotificationMessage$1(value) {
11972
12163
  var withWaitNotificationMessage = withWaitNotificationMessage$1;
11973
12164
  var normalizeWaitComment = normalizeWaitComment$1;
11974
12165
  var waitAutoContinueAt = waitAutoContinueAt$1;
11975
- var waitRetentionMs = 12e4;
11976
12166
  function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
11977
12167
  return Effect.scoped(Effect.gen(function* () {
11978
12168
  if (resume == null) yield* context.emit({
@@ -12016,7 +12206,6 @@ function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
12016
12206
  let measuredAt = yield* Clock.currentTimeMillis;
12017
12207
  let nextCallCheckAt = measuredAt + (resume == null ? 1e3 : 0);
12018
12208
  let readyWorkflowRunIds = resume?.readyWorkflowRunIds;
12019
- let idleSince;
12020
12209
  const agents = { ...resume?.checkpoint.agents };
12021
12210
  const resolveInputs = (nodeId, node) => resolveNodeInputs(nodeId, node, dependencies, context.bindingValues, launch[nodeId]);
12022
12211
  const commit = (nodeId, jobId, outputs, releasedHandles = Object.keys(outputs), failure, response) => Effect.uninterruptible(Effect.gen(function* () {
@@ -12181,21 +12370,17 @@ function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
12181
12370
  })).pipe(Effect.ensuring(Queue.offer(changes, void 0))));
12182
12371
  };
12183
12372
  if (resume != null) yield* Effect.try({
12184
- try: () => validateCheckpoint(target, resume.checkpoint, resolveInputs),
12373
+ try: () => validateCheckpoint(target, resume.checkpoint, dependencies, resolveInputs),
12185
12374
  catch: (error) => error instanceof Error ? error : new Error(String(error))
12186
12375
  });
12187
12376
  if (resume == null) {
12188
12377
  if (trigger != null) dependencies.start(trigger.nodeId, trigger.outputs);
12189
12378
  }
12190
- const applyResolutions = (resolutions, now) => {
12379
+ const applyResolutions = (resolutions) => {
12191
12380
  for (const saved of pendingWaits.values()) {
12192
12381
  const resolution = resolutions[saved.waitId];
12193
12382
  if (resolution == null) continue;
12194
12383
  const { action, resolvedAt, comment } = resolution;
12195
- if (idleSince != null) {
12196
- idleSince = void 0;
12197
- measuredAt = now;
12198
- }
12199
12384
  pendingWaits.delete(saved.jobId);
12200
12385
  const node = target.graph.nodes[saved.nodeId];
12201
12386
  runNode(observe(saved.nodeId, saved.jobId, Effect.gen(function* () {
@@ -12219,7 +12404,7 @@ function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
12219
12404
  };
12220
12405
  while (true) {
12221
12406
  const now = yield* Clock.currentTimeMillis;
12222
- if (idleSince == null && remainingMs != null) remainingMs -= now - measuredAt;
12407
+ if (remainingMs != null) remainingMs -= now - measuredAt;
12223
12408
  measuredAt = now;
12224
12409
  if (remainingMs != null && remainingMs <= 0) return yield* Effect.fail(/* @__PURE__ */ new Error("Run exceeded its execution deadline."));
12225
12410
  if (firstCause != null) {
@@ -12232,7 +12417,7 @@ function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
12232
12417
  }).pipe(Effect.ignore);
12233
12418
  return yield* Effect.failCause(firstCause);
12234
12419
  }
12235
- if (pendingWaits.size > 0 && context.waits != null) applyResolutions(yield* context.waits.resolutions([...pendingWaits.values()].map((wait) => wait.waitId), false), now);
12420
+ if (pendingWaits.size > 0 && context.waits != null) applyResolutions(yield* context.waits.resolutions([...pendingWaits.values()].map((wait) => wait.waitId), false));
12236
12421
  if (pendingCalls.size > 0 && now >= nextCallCheckAt) {
12237
12422
  for (const call of pendingCalls.values()) {
12238
12423
  if (readyWorkflowRunIds != null && !readyWorkflowRunIds.has(call.childRunId)) continue;
@@ -12252,17 +12437,14 @@ function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
12252
12437
  if (dependencies.incomplete) return yield* Effect.fail(/* @__PURE__ */ new Error("Execution graph contains unresolved dependencies."));
12253
12438
  break;
12254
12439
  }
12255
- if (running > 0 || ready.length > 0) idleSince = void 0;
12256
- else idleSince ??= now;
12257
- const left = idleSince == null ? remainingMs : waitRetentionMs - (now - idleSince);
12258
- if (idleSince != null && (left <= 0 || pendingCalls.size > 0)) {
12440
+ if (running == 0 && ready.length == 0) {
12259
12441
  const checkpoint = {
12260
12442
  bindingValues: context.bindingValues,
12261
12443
  inputs: launch,
12262
12444
  results: Object.fromEntries(completed),
12263
12445
  counts: context.counts,
12264
- dependencies: dependencies.state,
12265
- version: 6,
12446
+ dependencies: dependencies.checkpoint(),
12447
+ version: 7,
12266
12448
  agents,
12267
12449
  waits: [...pendingWaits.values()],
12268
12450
  ...pendingCalls.size == 0 ? {} : { calls: [...pendingCalls.values()] }
@@ -12279,8 +12461,8 @@ function runGraph(context, target, runId, launchInputs = {}, trigger, resume) {
12279
12461
  const decision = pendingWaits.size == 0 || context.waits == null ? Effect.never : context.waits.resolutions([...pendingWaits.values()].map((wait) => wait.waitId), true);
12280
12462
  let next = Effect.raceFirst(activity, decision);
12281
12463
  if (pendingCalls.size > 0) next = Effect.raceFirst(next, Effect.sleep(Math.max(0, nextCallCheckAt - (yield* Clock.currentTimeMillis))).pipe(Effect.as({})));
12282
- if (left != null) next = Effect.raceFirst(next, Effect.sleep(Math.max(0, left)).pipe(Effect.as({})));
12283
- applyResolutions(yield* next, yield* Clock.currentTimeMillis);
12464
+ if (remainingMs != null) next = Effect.raceFirst(next, Effect.sleep(Math.max(0, remainingMs)).pipe(Effect.as({})));
12465
+ applyResolutions(yield* next);
12284
12466
  }
12285
12467
  yield* context.emit({
12286
12468
  progress: 100,
@@ -12330,14 +12512,10 @@ function runFlow(prepared, options) {
12330
12512
  }])),
12331
12513
  dependencies: {
12332
12514
  ...decoded.dependencies,
12333
- nodes: Object.fromEntries(Object.entries(decoded.dependencies.nodes).map(([id, state]) => [id, {
12334
- ...state,
12335
- ...state.output == null ? {} : { output: outputs(id, state.output) },
12336
- input: Object.fromEntries(Object.entries(state.input).map(([source, result]) => [source, {
12337
- ...result,
12338
- outputs: outputs(source, result.outputs)
12339
- }]))
12340
- }]))
12515
+ results: decoded.dependencies.results.map((result) => ({
12516
+ ...result,
12517
+ outputs: outputs(result.nodeId, result.outputs)
12518
+ }))
12341
12519
  },
12342
12520
  waits: decoded.waits.map((wait) => wait.pending == null ? wait : Object.assign({}, wait, { pending: withWaitNotificationMessage(wait.pending) }))
12343
12521
  };
@@ -12358,6 +12536,7 @@ function runFlow(prepared, options) {
12358
12536
  createId: options.createId,
12359
12537
  emit,
12360
12538
  invokeTask: options.invokeTask,
12539
+ admitTask: options.admitTask,
12361
12540
  prepared,
12362
12541
  projectFailure: options.projectFailure,
12363
12542
  waits: options.waits,
@@ -12375,4 +12554,4 @@ function runFlow(prepared, options) {
12375
12554
  });
12376
12555
  }
12377
12556
  //#endregion
12378
- export { PortValidationError, decodeFlowRunCheckpoint, normalizeWaitComment, runFlow, waitAutoContinueAt, waitRetentionMs, withWaitNotificationMessage };
12557
+ export { PortValidationError, decodeFlowRunCheckpoint, normalizeWaitComment, runFlow, waitAutoContinueAt, withWaitNotificationMessage };