@oomol-lab/open-flow 0.1.0-beta.77 → 0.1.0-beta.79

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 (64) hide show
  1. package/README.md +2 -0
  2. package/dist/browser/{ContentIcon-VZQO8VZU.js → ContentIcon-CMn0c-kl.js} +93 -3
  3. package/dist/browser/{FlowCanvas-BNGDMaWr.js → FlowCanvas-BQGBcfoL.js} +1675 -591
  4. package/dist/browser/{createResourceDialog-BmtakfVg.js → createResourceDialog-DkovGogv.js} +3 -3
  5. package/dist/browser/{dialog-BcFBfRB1.js → dialog-CFFuRM8s.js} +37 -86
  6. package/dist/browser/{exportSvg-CG8hEUNk.js → exportSvg-CYwyYiuH.js} +2 -2
  7. package/dist/browser/{flowChanges-BGo_4Ypo.js → flowChanges-CN2R-m1M.js} +1258 -422
  8. package/dist/browser/{flowWorkspace-BFHGev7s.js → flowWorkspace-CXVL1FNv.js} +634 -628
  9. package/dist/browser/licenses.md +1 -1
  10. package/dist/browser/preview.css +512 -462
  11. package/dist/browser/preview.js +8183 -6384
  12. package/dist/browser/{tooltip-BAWSUexx.js → tooltip-BDcVTNpu.js} +65 -2
  13. package/dist/browser/{typeScriptSession-CRoezJPN.js → typeScriptSession-CoEIptNC.js} +1 -1
  14. package/dist/browser/ui.css +5 -24
  15. package/dist/browser/workbench.css +512 -462
  16. package/dist/browser/workbench.d.ts +2 -3
  17. package/dist/browser/workbench.js +65 -690
  18. package/dist/browser/{workbenchSelect-CjK-xdm3.js → workbenchSelect-CkOS95gX.js} +2 -2
  19. package/dist/command/index.js +31 -31
  20. package/dist/common/authoring.d.ts +3 -3
  21. package/dist/common/authoringExamples.d.ts +3 -3
  22. package/dist/common/authoringSchema.d.ts +14 -22
  23. package/dist/common/control-api-conformance.js +91 -25
  24. package/dist/common/control-api.d.ts +8 -3
  25. package/dist/common/control-api.js +51 -25
  26. package/dist/common/control-requests.d.ts +9 -3
  27. package/dist/common/control-requests.js +54 -42
  28. package/dist/common/flow-authoring.js +32 -19
  29. package/dist/common/flow-change.d.ts +1 -1
  30. package/dist/common/flow-change.js +32 -19
  31. package/dist/common/flow-encoding.js +31 -18
  32. package/dist/common/flow-semantics.js +41 -26
  33. package/dist/common/flow-state.d.ts +49 -43
  34. package/dist/common/flow-state.js +95 -110
  35. package/dist/common/mcp.d.ts +35 -4
  36. package/dist/common/mcp.js +51 -26
  37. package/dist/common/run-events.js +19 -9
  38. package/dist/common/runtime-contract.d.ts +4 -1
  39. package/dist/common/runtime-contract.js +66 -17
  40. package/dist/common/runtime-nodejs-compat.js +11 -12
  41. package/dist/common/scheduler.d.ts +2 -1
  42. package/dist/common/scheduler.js +82 -55
  43. package/dist/common/state-conformance.d.ts +3 -3
  44. package/dist/index.d.ts +1 -0
  45. package/package.json +1 -1
  46. package/src/control/common/api.ts +36 -7
  47. package/src/control/common/authoring.ts +6 -5
  48. package/src/control/common/authoringExamples.ts +6 -5
  49. package/src/control/common/authoringSchema.ts +7 -7
  50. package/src/control/common/conformance.ts +31 -0
  51. package/src/control/common/mcp.ts +7 -2
  52. package/src/control/common/requests.ts +10 -1
  53. package/src/execution/common/events.ts +22 -10
  54. package/src/execution/common/node-execution.ts +1 -1
  55. package/src/execution/common/scheduler.ts +28 -14
  56. package/src/flow/common/change.ts +1 -1
  57. package/src/flow/common/changeSchema.ts +4 -4
  58. package/src/flow/common/errorHandling.ts +1 -1
  59. package/src/flow/common/semantics.ts +12 -6
  60. package/src/runtime/common/nodejsGuest.generated.json +11 -12
  61. package/src/runtime/common/runtime.ts +45 -12
  62. package/src/state/common/conformance.ts +32 -21
  63. package/src/state/common/state.ts +85 -80
  64. package/src/types/index.ts +1 -0
@@ -8833,23 +8833,30 @@ var httpRequestExecutorSchema = strictObject({
8833
8833
  ]).default("auto"),
8834
8834
  statusPolicy: _enum(["success", "all"]).default("success")
8835
8835
  }).extend({ kind: literal("http-request") });
8836
+ //#endregion
8837
+ //#region src/state/common/state.ts
8838
+ var stateReadLimits = {
8839
+ maxKeys: 16,
8840
+ maxBytes: 1048576
8841
+ };
8842
+ var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
8843
+ strictObject({
8844
+ scope: _enum(["draft", "live"]),
8845
+ values: literal(false).optional()
8846
+ });
8836
8847
  strictObject({
8837
8848
  scope: _enum(["draft", "live"]),
8838
- values: boolean().optional()
8849
+ keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
8839
8850
  });
8840
8851
  strictObject({
8841
8852
  scope: _enum(["draft", "live"]),
8842
- key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
8853
+ key: keySchema.optional()
8843
8854
  });
8844
8855
  strictObject({
8845
8856
  scope: _enum(["draft", "live"]),
8846
8857
  space: string().regex(/^(flow|node:.+)$/)
8847
8858
  });
8848
- var dedupeExecutorSchema = strictObject({
8849
- field: string().default(""),
8850
- mode: _enum(["new", "increasing"]).default("new"),
8851
- space: _enum(["node", "flow"]).default("node")
8852
- }).extend({ kind: literal("dedupe") });
8859
+ var skipDuplicatesExecutorSchema = strictObject({ fields: array(string().refine((field) => field.length > 0 && field.split(".").every((part) => part.length > 0), "Use a nonempty dot-separated field path.")).refine((fields) => new Set(fields).size === fields.length, "Identity fields must be distinct.").default([]) }).extend({ kind: literal("skip-duplicates") });
8853
8860
  object({
8854
8861
  version: literal(1),
8855
8862
  scope: _enum(["draft", "live"]),
@@ -8860,24 +8867,30 @@ object({
8860
8867
  maxIdentities: number().positive(),
8861
8868
  maxRunWrites: number().positive()
8862
8869
  }),
8863
- values: array(object({
8870
+ values: array(strictObject({
8864
8871
  key: string(),
8865
8872
  size: number().nonnegative(),
8866
- updatedAt: number(),
8867
- value: json$1().optional()
8873
+ updatedAt: number()
8868
8874
  })),
8869
8875
  spaces: array(object({
8870
8876
  space: string(),
8871
- mode: _enum(["new", "increasing"]),
8872
8877
  count: number().nonnegative(),
8873
- watermark: union([
8874
- string(),
8875
- number(),
8876
- _null()
8877
- ]),
8878
+ pendingCount: number().nonnegative(),
8879
+ reservedCount: number().nonnegative(),
8878
8880
  updatedAt: number()
8879
8881
  }))
8880
8882
  });
8883
+ object({
8884
+ version: literal(1),
8885
+ scope: _enum(["draft", "live"]),
8886
+ values: array(strictObject({
8887
+ key: keySchema,
8888
+ value: json$1()
8889
+ })).min(1).max(stateReadLimits.maxKeys)
8890
+ }).refine((response) => {
8891
+ const encoder = new TextEncoder();
8892
+ return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
8893
+ }, "State values exceed the 1 MiB read limit.");
8881
8894
  function checkJsonDepth(value, depth = 0) {
8882
8895
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
8883
8896
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -9177,7 +9190,7 @@ var managedFields = object({
9177
9190
  revisionId: text
9178
9191
  }),
9179
9192
  httpRequestExecutorSchema,
9180
- dedupeExecutorSchema
9193
+ skipDuplicatesExecutorSchema
9181
9194
  ])
9182
9195
  });
9183
9196
  var managed = managedFields.transform(limitDecisionTask);
@@ -9673,7 +9686,7 @@ function changeOperationsSchema(kind) {
9673
9686
  return toJSONSchema(schema, { io: "input" });
9674
9687
  }
9675
9688
  function checkModelVersion(content) {
9676
- if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "dedupe")) throw new Error("Deduplication requires Flow model v13.");
9689
+ if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "skip-duplicates")) throw new Error("Skip Duplicates requires Flow model v13.");
9677
9690
  if (content.modelVersion < 12 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "moduleId" in candidateNode.task && candidateNode.task.capabilities?.some((item) => item.kind == "http"))) throw new TypeError("Code HTTP access requires Flow model version 12.");
9678
9691
  if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind == "http-request")) throw new TypeError("HTTP Request requires Flow model version 11.");
9679
9692
  if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && ("moduleId" in candidateNode.task ? candidateNode.task.capabilities?.some((item) => item.kind == "workflow") : candidateNode.task.executor.kind == "agent" && candidateNode.task.executor.tools.some((item) => item.kind == "workflow")))) throw new TypeError("Workflow tools require Flow model version 11.");
@@ -9772,7 +9785,7 @@ var nodeErrorSchema = {
9772
9785
  }
9773
9786
  };
9774
9787
  function supportsNodeErrorHandling(node) {
9775
- return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "dedupe";
9788
+ return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "skip-duplicates";
9776
9789
  }
9777
9790
  function nodeSystemOutputPorts(node) {
9778
9791
  return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
@@ -8604,23 +8604,30 @@ var httpRequestExecutorSchema = strictObject({
8604
8604
  ]).default("auto"),
8605
8605
  statusPolicy: _enum(["success", "all"]).default("success")
8606
8606
  }).extend({ kind: literal("http-request") });
8607
+ //#endregion
8608
+ //#region src/state/common/state.ts
8609
+ var stateReadLimits = {
8610
+ maxKeys: 16,
8611
+ maxBytes: 1048576
8612
+ };
8613
+ var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
8614
+ strictObject({
8615
+ scope: _enum(["draft", "live"]),
8616
+ values: literal(false).optional()
8617
+ });
8607
8618
  strictObject({
8608
8619
  scope: _enum(["draft", "live"]),
8609
- values: boolean().optional()
8620
+ keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
8610
8621
  });
8611
8622
  strictObject({
8612
8623
  scope: _enum(["draft", "live"]),
8613
- key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
8624
+ key: keySchema.optional()
8614
8625
  });
8615
8626
  strictObject({
8616
8627
  scope: _enum(["draft", "live"]),
8617
8628
  space: string().regex(/^(flow|node:.+)$/)
8618
8629
  });
8619
- var dedupeExecutorSchema = strictObject({
8620
- field: string().default(""),
8621
- mode: _enum(["new", "increasing"]).default("new"),
8622
- space: _enum(["node", "flow"]).default("node")
8623
- }).extend({ kind: literal("dedupe") });
8630
+ var skipDuplicatesExecutorSchema = strictObject({ fields: array(string().refine((field) => field.length > 0 && field.split(".").every((part) => part.length > 0), "Use a nonempty dot-separated field path.")).refine((fields) => new Set(fields).size === fields.length, "Identity fields must be distinct.").default([]) }).extend({ kind: literal("skip-duplicates") });
8624
8631
  object({
8625
8632
  version: literal(1),
8626
8633
  scope: _enum(["draft", "live"]),
@@ -8631,24 +8638,30 @@ object({
8631
8638
  maxIdentities: number().positive(),
8632
8639
  maxRunWrites: number().positive()
8633
8640
  }),
8634
- values: array(object({
8641
+ values: array(strictObject({
8635
8642
  key: string(),
8636
8643
  size: number().nonnegative(),
8637
- updatedAt: number(),
8638
- value: json$1().optional()
8644
+ updatedAt: number()
8639
8645
  })),
8640
8646
  spaces: array(object({
8641
8647
  space: string(),
8642
- mode: _enum(["new", "increasing"]),
8643
8648
  count: number().nonnegative(),
8644
- watermark: union([
8645
- string(),
8646
- number(),
8647
- _null()
8648
- ]),
8649
+ pendingCount: number().nonnegative(),
8650
+ reservedCount: number().nonnegative(),
8649
8651
  updatedAt: number()
8650
8652
  }))
8651
8653
  });
8654
+ object({
8655
+ version: literal(1),
8656
+ scope: _enum(["draft", "live"]),
8657
+ values: array(strictObject({
8658
+ key: keySchema,
8659
+ value: json$1()
8660
+ })).min(1).max(stateReadLimits.maxKeys)
8661
+ }).refine((response) => {
8662
+ const encoder = new TextEncoder();
8663
+ return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
8664
+ }, "State values exceed the 1 MiB read limit.");
8652
8665
  //#endregion
8653
8666
  //#region src/flow/common/json.ts
8654
8667
  var maxJsonDepth = 64;
@@ -8936,7 +8949,7 @@ var managedFields = object({
8936
8949
  revisionId: text
8937
8950
  }),
8938
8951
  httpRequestExecutorSchema,
8939
- dedupeExecutorSchema
8952
+ skipDuplicatesExecutorSchema
8940
8953
  ])
8941
8954
  });
8942
8955
  var managed = managedFields.transform(limitDecisionTask);
@@ -9655,7 +9668,7 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
9655
9668
  ...shape
9656
9669
  })])).values()])).min(1);
9657
9670
  function checkModelVersion(content) {
9658
- if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "dedupe")) throw new Error("Deduplication requires Flow model v13.");
9671
+ if (content.modelVersion < 13 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind === "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind === "skip-duplicates")) throw new Error("Skip Duplicates requires Flow model v13.");
9659
9672
  if (content.modelVersion < 12 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "moduleId" in candidateNode.task && candidateNode.task.capabilities?.some((item) => item.kind == "http"))) throw new TypeError("Code HTTP access requires Flow model version 12.");
9660
9673
  if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task && candidateNode.task.executor.kind == "http-request")) throw new TypeError("HTTP Request requires Flow model version 11.");
9661
9674
  if (content.modelVersion < 11 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && ("moduleId" in candidateNode.task ? candidateNode.task.capabilities?.some((item) => item.kind == "workflow") : candidateNode.task.executor.kind == "agent" && candidateNode.task.executor.tools.some((item) => item.kind == "workflow")))) throw new TypeError("Workflow tools require Flow model version 11.");
@@ -10362,30 +10362,37 @@ function openApiFieldIssues(task) {
10362
10362
  function openApiIssues(task) {
10363
10363
  return openApiFieldIssues(task).map((issue) => issue.message);
10364
10364
  }
10365
+ //#endregion
10366
+ //#region src/state/common/state.ts
10367
+ var stateReadLimits = {
10368
+ maxKeys: 16,
10369
+ maxBytes: 1048576
10370
+ };
10371
+ var keySchema = string().min(1).refine((value) => new TextEncoder().encode(value).length <= 256);
10365
10372
  strictObject({
10366
10373
  scope: _enum(["draft", "live"]),
10367
- values: boolean().optional()
10374
+ values: literal(false).optional()
10368
10375
  });
10369
10376
  strictObject({
10370
10377
  scope: _enum(["draft", "live"]),
10371
- key: string().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
10378
+ keys: array(keySchema).min(1).max(stateReadLimits.maxKeys).refine((keys) => new Set(keys).size === keys.length, "State keys must be distinct.")
10372
10379
  });
10373
10380
  strictObject({
10374
10381
  scope: _enum(["draft", "live"]),
10375
- space: string().regex(/^(flow|node:.+)$/)
10382
+ key: keySchema.optional()
10376
10383
  });
10377
- var dedupeConfigSchema = strictObject({
10378
- field: string().default(""),
10379
- mode: _enum(["new", "increasing"]).default("new"),
10380
- space: _enum(["node", "flow"]).default("node")
10384
+ strictObject({
10385
+ scope: _enum(["draft", "live"]),
10386
+ space: string().regex(/^(flow|node:.+)$/)
10381
10387
  });
10382
- var dedupeExecutorSchema = dedupeConfigSchema.extend({ kind: literal("dedupe") });
10383
- function dedupeTask(config = dedupeConfigSchema.parse({}), name = "Remove Duplicates") {
10388
+ var skipDuplicatesConfigSchema = strictObject({ fields: array(string().refine((field) => field.length > 0 && field.split(".").every((part) => part.length > 0), "Use a nonempty dot-separated field path.")).refine((fields) => new Set(fields).size === fields.length, "Identity fields must be distinct.").default([]) });
10389
+ var skipDuplicatesExecutorSchema = skipDuplicatesConfigSchema.extend({ kind: literal("skip-duplicates") });
10390
+ function skipDuplicatesTask(config = skipDuplicatesConfigSchema.parse({}), name = "Skip Duplicates") {
10384
10391
  return {
10385
10392
  name,
10386
10393
  executor: {
10387
10394
  ...config,
10388
- kind: "dedupe"
10395
+ kind: "skip-duplicates"
10389
10396
  },
10390
10397
  inputs: [{
10391
10398
  handle: "items",
@@ -10409,24 +10416,30 @@ object$1({
10409
10416
  maxIdentities: number().positive(),
10410
10417
  maxRunWrites: number().positive()
10411
10418
  }),
10412
- values: array(object$1({
10419
+ values: array(strictObject({
10413
10420
  key: string(),
10414
10421
  size: number().nonnegative(),
10415
- updatedAt: number(),
10416
- value: json$1().optional()
10422
+ updatedAt: number()
10417
10423
  })),
10418
10424
  spaces: array(object$1({
10419
10425
  space: string(),
10420
- mode: _enum(["new", "increasing"]),
10421
10426
  count: number().nonnegative(),
10422
- watermark: union([
10423
- string(),
10424
- number(),
10425
- _null()
10426
- ]),
10427
+ pendingCount: number().nonnegative(),
10428
+ reservedCount: number().nonnegative(),
10427
10429
  updatedAt: number()
10428
10430
  }))
10429
10431
  });
10432
+ object$1({
10433
+ version: literal(1),
10434
+ scope: _enum(["draft", "live"]),
10435
+ values: array(strictObject({
10436
+ key: keySchema,
10437
+ value: json$1()
10438
+ })).min(1).max(stateReadLimits.maxKeys)
10439
+ }).refine((response) => {
10440
+ const encoder = new TextEncoder();
10441
+ return response.values.reduce((bytes, item) => bytes + (item.value === null ? 0 : encoder.encode(JSON.stringify(item.value)).byteLength), 0) <= stateReadLimits.maxBytes;
10442
+ }, "State values exceed the 1 MiB read limit.");
10430
10443
  //#endregion
10431
10444
  //#region src/flow/common/inputValue.ts
10432
10445
  /** An explicit clear suppresses the default; absent mappings still inherit it. */
@@ -10802,7 +10815,7 @@ var managedFields = object$1({
10802
10815
  revisionId: text
10803
10816
  }),
10804
10817
  httpRequestExecutorSchema,
10805
- dedupeExecutorSchema
10818
+ skipDuplicatesExecutorSchema
10806
10819
  ])
10807
10820
  });
10808
10821
  var managed = managedFields.transform(limitDecisionTask);
@@ -11419,7 +11432,7 @@ var nodeErrorSchema = {
11419
11432
  }
11420
11433
  };
11421
11434
  function supportsNodeErrorHandling(node) {
11422
- return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "dedupe";
11435
+ return supportsNodeRetry(node) || node.kind === "task" && "executor" in node.task && node.task.executor.kind === "skip-duplicates";
11423
11436
  }
11424
11437
  function nodeSystemOutputPorts(node) {
11425
11438
  return supportsNodeErrorHandling(node) && node.onError == "error" ? { error: {
@@ -25007,10 +25020,10 @@ async function validateFlow(revision, engine) {
25007
25020
  message,
25008
25021
  path: `/document/graph/nodes/${nodeId}/task/executor`
25009
25022
  });
25010
- if (task.executor.kind === "dedupe") {
25011
- const expected = dedupeTask(task.executor);
25023
+ if (task.executor.kind === "skip-duplicates") {
25024
+ const expected = skipDuplicatesTask(task.executor);
25012
25025
  if (!dequal(httpPortContracts(task.inputs), httpPortContracts(expected.inputs)) || !dequal(httpPortContracts(task.outputs), httpPortContracts(expected.outputs))) checked.diagnostics.push({
25013
- code: "dedupe.ports-invalid",
25026
+ code: "skip-duplicates.ports-invalid",
25014
25027
  column: 0,
25015
25028
  line: 1,
25016
25029
  message: "Deduplication ports must match the fixed contract.",
@@ -25151,7 +25164,7 @@ var httpPortContracts = (ports) => ports.filter((port) => "handle" in port).map(
25151
25164
  async function prepareFlow(revision, engineContract, triggerId) {
25152
25165
  const engine = findEngineContract(engineContract);
25153
25166
  if (engine == null) return { kind: "engine-unsupported" };
25154
- if (!engine.flowState && Object.values(revision.document.graph.nodes).some((node) => node.kind === "task" && "executor" in node.task && node.task.executor.kind === "dedupe")) return { kind: "engine-unsupported" };
25167
+ if (!engine.flowState && Object.values(revision.document.graph.nodes).some((node) => node.kind === "task" && "executor" in node.task && node.task.executor.kind === "skip-duplicates")) return { kind: "engine-unsupported" };
25155
25168
  if (!engine.httpRequests && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "executor" in node.task && node.task.executor.kind == "http-request")) return { kind: "engine-unsupported" };
25156
25169
  if (!engine.codeFetch && Object.values(revision.document.graph.nodes).some((node) => node.kind == "task" && "moduleId" in node.task && node.task.capabilities?.some((item) => item.kind == "http"))) return { kind: "engine-unsupported" };
25157
25170
  if (!engine.workflowTools && Object.values(revision.document.graph.nodes).some((node) => nodeWorkflowReferences(node).some((ref) => ref.tool != null))) return { kind: "engine-unsupported" };
@@ -25200,11 +25213,13 @@ async function prepareFlow(revision, engineContract, triggerId) {
25200
25213
  }
25201
25214
  function createRuntimeProgram(prepared, entryModuleId, engineDigest) {
25202
25215
  if (!Object.hasOwn(prepared.modules, entryModuleId)) return;
25216
+ const modules = /* @__PURE__ */ new Set([entryModuleId]);
25217
+ for (const id of modules) for (const imported of prepared.modules[id].imports) modules.add(imported);
25203
25218
  return {
25204
25219
  engineContract: prepared.engineContract,
25205
25220
  engineDigest,
25206
25221
  entryModuleId,
25207
- modules: prepared.modules
25222
+ modules: Object.fromEntries([...modules].map((id) => [id, prepared.modules[id]]))
25208
25223
  };
25209
25224
  }
25210
25225
  function agentActions(flow) {
@@ -2,13 +2,25 @@ import type { JsonValue, ManagedTaskDefinitionOf } from './flow-model.js';
2
2
  import { z } from 'zod';
3
3
  export { stateConformanceCases, type StateConformanceHarness } from './state-conformance.js';
4
4
  export type StateScope = 'draft' | 'live';
5
+ export declare const stateReadLimits: {
6
+ maxKeys: number;
7
+ maxBytes: number;
8
+ };
5
9
  export declare const stateQuerySchema: z.ZodObject<{
6
10
  scope: z.ZodEnum<{
7
11
  draft: "draft";
8
12
  live: "live";
9
13
  }>;
10
- values: z.ZodOptional<z.ZodBoolean>;
14
+ values: z.ZodOptional<z.ZodLiteral<false>>;
15
+ }, z.core.$strict>;
16
+ export declare const stateReadSchema: z.ZodObject<{
17
+ scope: z.ZodEnum<{
18
+ draft: "draft";
19
+ live: "live";
20
+ }>;
21
+ keys: z.ZodArray<z.ZodString>;
11
22
  }, z.core.$strict>;
23
+ export type StateRead = z.infer<typeof stateReadSchema>;
12
24
  export declare const stateClearSchema: z.ZodObject<{
13
25
  scope: z.ZodEnum<{
14
26
  draft: "draft";
@@ -24,49 +36,29 @@ export declare const dedupeClearSchema: z.ZodObject<{
24
36
  space: z.ZodString;
25
37
  }, z.core.$strict>;
26
38
  export type DedupeIdentity = string | number;
27
- export declare const dedupeConfigSchema: z.ZodObject<{
28
- field: z.ZodDefault<z.ZodString>;
29
- mode: z.ZodDefault<z.ZodEnum<{
30
- increasing: "increasing";
31
- new: "new";
32
- }>>;
33
- space: z.ZodDefault<z.ZodEnum<{
34
- flow: "flow";
35
- node: "node";
36
- }>>;
39
+ export declare const skipDuplicatesConfigSchema: z.ZodObject<{
40
+ fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
37
41
  }, z.core.$strict>;
38
- export type DedupeConfig = z.infer<typeof dedupeConfigSchema>;
39
- export interface DedupeExecutor extends DedupeConfig {
40
- readonly kind: 'dedupe';
42
+ export type SkipDuplicatesConfig = z.infer<typeof skipDuplicatesConfigSchema>;
43
+ export interface SkipDuplicatesExecutor extends SkipDuplicatesConfig {
44
+ readonly kind: 'skip-duplicates';
41
45
  }
42
- export declare const dedupeExecutorSchema: z.ZodObject<{
43
- field: z.ZodDefault<z.ZodString>;
44
- mode: z.ZodDefault<z.ZodEnum<{
45
- increasing: "increasing";
46
- new: "new";
47
- }>>;
48
- space: z.ZodDefault<z.ZodEnum<{
49
- flow: "flow";
50
- node: "node";
51
- }>>;
52
- kind: z.ZodLiteral<"dedupe">;
46
+ export declare const skipDuplicatesExecutorSchema: z.ZodObject<{
47
+ fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
48
+ kind: z.ZodLiteral<"skip-duplicates">;
53
49
  }, z.core.$strict>;
54
- export declare function dedupeTask(config?: DedupeConfig, name?: string): ManagedTaskDefinitionOf<DedupeExecutor>;
50
+ export declare function skipDuplicatesTask(config?: SkipDuplicatesConfig, name?: string): ManagedTaskDefinitionOf<SkipDuplicatesExecutor>;
55
51
  export declare class StateError extends Error {
56
52
  readonly retryable = false;
57
53
  readonly catchable: boolean;
58
- readonly code: 'capability.invalid' | 'capability.denied' | 'dedupe.full' | 'limit-exceeded';
54
+ readonly code: 'capability.invalid' | 'capability.denied' | 'dedupe.full' | 'limit-exceeded' | 'node.input-invalid';
59
55
  constructor(code: StateError['code'], message: string);
60
56
  }
61
57
  export declare function stateKey(key: unknown): string;
62
58
  export declare function dedupeIdentities(value: unknown): DedupeIdentity[];
63
59
  export declare function hashIdentities(ids: readonly DedupeIdentity[]): Promise<Uint8Array[]>;
64
- export declare function watermarkValue(id: DedupeIdentity): number;
65
- export declare function increasingIdentities(ids: readonly DedupeIdentity[], watermark: DedupeIdentity | null): {
66
- inserted: boolean[];
67
- watermark: DedupeIdentity | null;
68
- };
69
- export declare function itemIdentities(items: JsonValue, field: string): DedupeIdentity[];
60
+ /** Canonical identities include the field definition and preserve scalar types. */
61
+ export declare function skipDuplicatesIdentities(items: JsonValue, fields: readonly string[]): string[];
70
62
  export interface FlowStateView {
71
63
  readonly version: 1;
72
64
  readonly scope: StateScope;
@@ -81,13 +73,12 @@ export interface FlowStateView {
81
73
  readonly key: string;
82
74
  readonly size: number;
83
75
  readonly updatedAt: number;
84
- readonly value?: JsonValue;
85
76
  }[];
86
77
  readonly spaces: readonly {
87
78
  readonly space: string;
88
- readonly mode: 'new' | 'increasing';
89
79
  readonly count: number;
90
- readonly watermark: DedupeIdentity | null;
80
+ readonly pendingCount: number;
81
+ readonly reservedCount: number;
91
82
  readonly updatedAt: number;
92
83
  }[];
93
84
  }
@@ -108,16 +99,31 @@ export declare const flowStateViewSchema: z.ZodObject<{
108
99
  key: z.ZodString;
109
100
  size: z.ZodNumber;
110
101
  updatedAt: z.ZodNumber;
111
- value: z.ZodOptional<z.ZodJSONSchema>;
112
- }, z.core.$strip>>;
102
+ }, z.core.$strict>>;
113
103
  spaces: z.ZodArray<z.ZodObject<{
114
104
  space: z.ZodString;
115
- mode: z.ZodEnum<{
116
- increasing: "increasing";
117
- new: "new";
118
- }>;
119
105
  count: z.ZodNumber;
120
- watermark: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
106
+ pendingCount: z.ZodNumber;
107
+ reservedCount: z.ZodNumber;
121
108
  updatedAt: z.ZodNumber;
122
109
  }, z.core.$strip>>;
123
110
  }, z.core.$strip>;
111
+ export interface FlowStateValues {
112
+ readonly version: 1;
113
+ readonly scope: StateScope;
114
+ readonly values: readonly {
115
+ readonly key: string;
116
+ readonly value: JsonValue;
117
+ }[];
118
+ }
119
+ export declare const flowStateValuesSchema: z.ZodObject<{
120
+ version: z.ZodLiteral<1>;
121
+ scope: z.ZodEnum<{
122
+ draft: "draft";
123
+ live: "live";
124
+ }>;
125
+ values: z.ZodArray<z.ZodObject<{
126
+ key: z.ZodString;
127
+ value: z.ZodJSONSchema;
128
+ }, z.core.$strict>>;
129
+ }, z.core.$strip>;