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

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 (146) hide show
  1. package/README.md +3 -1
  2. package/dist/browser/{ContentIcon-FCpKiwjp.js → ContentIcon-VZQO8VZU.js} +9 -6
  3. package/dist/browser/{FlowCanvas-dzRBnlUT.js → FlowCanvas-BNGDMaWr.js} +75 -63
  4. package/dist/browser/{createResourceDialog-BeYDdUl-.js → createResourceDialog-BmtakfVg.js} +63 -57
  5. package/dist/browser/{dialog-ZtpsFbl4.js → dialog-BcFBfRB1.js} +126 -32
  6. package/dist/browser/{exportSvg-DqXw1yf-.js → exportSvg-CG8hEUNk.js} +2 -2
  7. package/dist/browser/{flowChanges-b_5UobFj.js → flowChanges-BGo_4Ypo.js} +6063 -11285
  8. package/dist/browser/{flowWorkspace-ItojZbO4.js → flowWorkspace-BFHGev7s.js} +1065 -2570
  9. package/dist/browser/preview.css +626 -653
  10. package/dist/browser/preview.js +1907 -9663
  11. package/dist/browser/theme.css +117 -263
  12. package/dist/browser/{tooltip-wZJRB9oP.js → tooltip-BAWSUexx.js} +2 -2
  13. package/dist/browser/{typeScriptSession-CSRwWmZm.js → typeScriptSession-CRoezJPN.js} +1 -1
  14. package/dist/browser/ui.css +464 -463
  15. package/dist/browser/ui.js +4 -3
  16. package/dist/browser/workbench.css +9891 -9897
  17. package/dist/browser/workbench.d.ts +6 -2
  18. package/dist/browser/workbench.js +838 -499
  19. package/dist/browser/{workbenchSelect-M441Lz0d.js → workbenchSelect-CjK-xdm3.js} +2 -2
  20. package/dist/command/index.js +48 -50
  21. package/dist/common/authoring.d.ts +5 -5
  22. package/dist/common/authoringExamples.d.ts +3 -2
  23. package/dist/common/authoringSchema.d.ts +26 -4
  24. package/dist/common/connector-proxy.d.ts +1 -1
  25. package/dist/common/control-api-conformance.js +352 -144
  26. package/dist/common/control-api-errors.d.ts +12 -0
  27. package/dist/common/control-api.d.ts +38 -4
  28. package/dist/common/control-api.js +373 -162
  29. package/dist/common/control-requests.d.ts +22 -3
  30. package/dist/common/control-requests.js +268 -28
  31. package/dist/common/cron-trigger.d.ts +2 -1
  32. package/dist/common/decision.d.ts +4 -4
  33. package/dist/common/decision.js +5 -2
  34. package/dist/common/engine-contract.d.ts +6 -1
  35. package/dist/common/event-source-definition.d.ts +1 -1
  36. package/dist/common/event-source-view.d.ts +22 -0
  37. package/dist/common/event-source.d.ts +1 -1
  38. package/dist/common/event-source.js +24 -65
  39. package/dist/common/event-sources.d.ts +0 -21
  40. package/dist/common/flow-authoring.js +90 -20
  41. package/dist/common/flow-change-schema.d.ts +9 -1
  42. package/dist/common/flow-change.d.ts +8 -202
  43. package/dist/common/flow-change.js +96 -24
  44. package/dist/common/flow-encoding.js +89 -21
  45. package/dist/common/flow-input-value.d.ts +1 -1
  46. package/dist/common/flow-model.d.ts +121 -0
  47. package/dist/common/flow-notifications.d.ts +1 -1
  48. package/dist/common/flow-retry.d.ts +2 -4
  49. package/dist/common/flow-semantics.js +161 -80
  50. package/dist/common/flow-state.d.ts +123 -0
  51. package/dist/common/flow-state.js +5852 -0
  52. package/dist/common/flow-workflowReferences.d.ts +8 -0
  53. package/dist/common/flowInspection.d.ts +1 -1
  54. package/dist/common/http-hosts.d.ts +6 -0
  55. package/dist/common/http-request.d.ts +13 -5
  56. package/dist/common/http-request.js +23 -5
  57. package/dist/common/integration-trigger.d.ts +2 -1
  58. package/dist/common/mcp.d.ts +96 -3
  59. package/dist/common/mcp.js +355 -142
  60. package/dist/common/openapi.d.ts +4 -4
  61. package/dist/common/openapi.js +4 -1
  62. package/dist/common/poll-trigger.d.ts +2 -1
  63. package/dist/common/run-events.js +1 -0
  64. package/dist/common/runtime-contract.d.ts +37 -1
  65. package/dist/common/runtime-contract.js +717 -72
  66. package/dist/common/runtime-nodejs-compat.d.ts +44 -0
  67. package/dist/common/runtime-nodejs-compat.js +5870 -0
  68. package/dist/common/scheduler-checkpoint.d.ts +1 -1
  69. package/dist/common/scheduler-node-execution.d.ts +2 -1
  70. package/dist/common/scheduler.d.ts +2 -2
  71. package/dist/common/scheduler.js +76 -6
  72. package/dist/common/state-conformance.d.ts +16 -0
  73. package/dist/common/tags.d.ts +4 -0
  74. package/dist/common/trigger-catalog.d.ts +1 -7
  75. package/dist/common/trigger-config-options.d.ts +1 -1
  76. package/dist/common/trigger-config.d.ts +1 -1
  77. package/dist/common/trigger-contract.d.ts +2 -1
  78. package/dist/common/trigger-localization.d.ts +8 -2
  79. package/dist/common/trigger-model.d.ts +101 -0
  80. package/dist/common/webhook-response.d.ts +1 -1
  81. package/dist/common/webhook-trigger.d.ts +3 -1
  82. package/dist/common/workflow.d.ts +3 -12
  83. package/dist/common/workflow.js +25 -23
  84. package/dist/index.d.ts +52 -14
  85. package/package.json +9 -1
  86. package/src/base/common/json.ts +1 -1
  87. package/src/connector/common/proxy.ts +1 -1
  88. package/src/control/common/api.ts +90 -16
  89. package/src/control/common/authoring.ts +6 -1
  90. package/src/control/common/authoringExamples.ts +8 -0
  91. package/src/control/common/authoringSchema.ts +26 -13
  92. package/src/control/common/authoringTools.ts +1 -1
  93. package/src/control/common/conformance.ts +1 -1
  94. package/src/control/common/connectorDecoders.ts +1 -1
  95. package/src/control/common/errors.ts +6 -0
  96. package/src/control/common/eventSources.ts +2 -29
  97. package/src/control/common/flowDecoders.ts +1 -0
  98. package/src/control/common/mcp.ts +16 -0
  99. package/src/control/common/requests.ts +10 -2
  100. package/src/control/common/tags.ts +20 -0
  101. package/src/control/common/triggerCatalog.ts +1 -8
  102. package/src/decision/common/decision.ts +15 -7
  103. package/src/event-source/common/definition.ts +1 -1
  104. package/src/event-source/common/index.ts +1 -1
  105. package/src/event-source/common/view.ts +20 -0
  106. package/src/execution/common/checkpoint.ts +1 -1
  107. package/src/execution/common/events.ts +3 -0
  108. package/src/execution/common/node-execution.ts +4 -1
  109. package/src/execution/common/scheduler.ts +3 -1
  110. package/src/flow/common/change.ts +60 -193
  111. package/src/flow/common/changeSchema.ts +39 -4
  112. package/src/flow/common/connectionUsage.ts +1 -1
  113. package/src/flow/common/errorHandling.ts +1 -1
  114. package/src/flow/common/inputValue.ts +1 -1
  115. package/src/flow/common/model.ts +130 -0
  116. package/src/flow/common/modules.ts +1 -1
  117. package/src/flow/common/portChanges.ts +1 -1
  118. package/src/flow/common/retry.ts +2 -4
  119. package/src/flow/common/semantics.ts +31 -4
  120. package/src/flow/common/webhookResponse.ts +1 -1
  121. package/src/flow/common/workflowReferences.ts +31 -0
  122. package/src/http/common/authBindings.ts +6 -9
  123. package/src/http/common/hosts.ts +13 -0
  124. package/src/http/common/httpRequest.ts +30 -15
  125. package/src/openapi/common/openapi.ts +9 -5
  126. package/src/{execution → runtime}/common/engineContract.ts +23 -15
  127. package/src/runtime/common/nodejsCompat.ts +275 -0
  128. package/src/runtime/common/nodejsGuest.generated.json +47 -0
  129. package/src/runtime/common/runtime.ts +1254 -0
  130. package/src/state/common/conformance.ts +86 -0
  131. package/src/state/common/state.ts +169 -0
  132. package/src/trigger/common/config.ts +1 -1
  133. package/src/trigger/common/configOptions.ts +1 -1
  134. package/src/trigger/common/contract.ts +2 -1
  135. package/src/trigger/common/cron.ts +2 -1
  136. package/src/trigger/common/integration.ts +2 -1
  137. package/src/trigger/common/model.ts +87 -0
  138. package/src/trigger/common/poll.ts +2 -1
  139. package/src/trigger/common/webhook.ts +3 -1
  140. package/src/trigger/providers/fieldDescriptions.ts +1 -1
  141. package/src/trigger/providers/localization.ts +9 -2
  142. package/src/trigger/providers/remote.ts +1 -1
  143. package/src/types/index.ts +55 -15
  144. package/src/workflow/common/workflow.ts +3 -44
  145. package/src/execution/common/runtime.ts +0 -563
  146. /package/src/{control → connector}/common/providerIconSprite.ts +0 -0
@@ -1,54 +1,79 @@
1
- //#region src/execution/common/engineContract.ts
2
- var currentEngineContract = "open-flow-engine/v8";
3
- `${JSON.stringify(currentEngineContract)}`, new Set([
4
- "assert",
5
- "assert/strict",
6
- "buffer",
7
- "console",
8
- "constants",
9
- "crypto",
10
- "events",
11
- "fs",
12
- "fs/promises",
13
- "os",
14
- "path",
15
- "path/posix",
16
- "process",
17
- "punycode",
18
- "querystring",
19
- "stream",
20
- "stream/promises",
21
- "stream/web",
22
- "string_decoder",
23
- "timers",
24
- "timers/promises",
25
- "url",
26
- "util",
27
- "zlib"
28
- ].flatMap((name) => [name, `node:${name}`])), `${JSON.stringify("open-flow-engine/v8/nodejs-compat-v1")}`;
29
- //#endregion
30
- //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
31
- var has = Object.prototype.hasOwnProperty;
32
- function dequal(foo, bar) {
33
- var ctor, len;
34
- if (foo === bar) return true;
35
- if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
36
- if (ctor === Date) return foo.getTime() === bar.getTime();
37
- if (ctor === RegExp) return foo.toString() === bar.toString();
38
- if (ctor === Array) {
39
- if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
40
- return len === -1;
41
- }
42
- if (!ctor || typeof foo === "object") {
43
- len = 0;
44
- for (ctor in foo) {
45
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
46
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
47
- }
48
- return Object.keys(bar).length === len;
49
- }
50
- }
51
- return foo !== foo && bar !== bar;
1
+ //#region src/runtime/common/engineContract.ts
2
+ /** v10 adds persistent Flow State to the published v9 Node compatibility and fetch contract. */
3
+ var currentEngineContract = "open-flow-engine/v10";
4
+ /** The published v8 Node compatibility contract, retained for existing Publications and Runs. */
5
+ var nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
6
+ var platformSource = (contract) => `export const engineContract = ${JSON.stringify(contract)}
7
+ export function identity(value) { return value }
8
+ `;
9
+ var v8Contract = {
10
+ workflowTools: true,
11
+ httpRequests: true,
12
+ waitAutoContinue: true,
13
+ webhookResponses: true,
14
+ platformExports: /* @__PURE__ */ new Set(["engineContract", "identity"]),
15
+ platformModule: "open-flow:platform",
16
+ platformSource: platformSource("open-flow-engine/v8")
17
+ };
18
+ var nodejsContract = {
19
+ ...v8Contract,
20
+ builtinModules: new Set([
21
+ "assert",
22
+ "assert/strict",
23
+ "buffer",
24
+ "console",
25
+ "constants",
26
+ "crypto",
27
+ "events",
28
+ "fs",
29
+ "fs/promises",
30
+ "os",
31
+ "path",
32
+ "path/posix",
33
+ "process",
34
+ "punycode",
35
+ "querystring",
36
+ "stream",
37
+ "stream/promises",
38
+ "stream/web",
39
+ "string_decoder",
40
+ "timers",
41
+ "timers/promises",
42
+ "url",
43
+ "util",
44
+ "zlib"
45
+ ].flatMap((name) => [name, `node:${name}`])),
46
+ platformSource: platformSource(nodejsEngineContract)
47
+ };
48
+ var v9Contract = {
49
+ ...nodejsContract,
50
+ codeFetch: true,
51
+ platformSource: platformSource("open-flow-engine/v9")
52
+ };
53
+ var currentContract = {
54
+ ...v9Contract,
55
+ flowState: true,
56
+ platformSource: platformSource(currentEngineContract)
57
+ };
58
+ function findEngineContract(contract) {
59
+ if (contract == "open-flow-engine/v10") return currentContract;
60
+ if (contract == "open-flow-engine/v9") return v9Contract;
61
+ if (contract == "open-flow-engine/v8") return v8Contract;
62
+ if (contract == "open-flow-engine/v8/nodejs-compat-v1") return nodejsContract;
63
+ if (contract == "open-flow-engine/v7" || contract == "open-flow-engine/v7/nodejs-compat-v1") return {
64
+ ...contract.endsWith("/nodejs-compat-v1") ? nodejsContract : v8Contract,
65
+ workflowTools: false,
66
+ httpRequests: false,
67
+ platformSource: platformSource(contract)
68
+ };
69
+ if (contract == "open-flow-engine/v6" || contract == "open-flow-engine/v6/nodejs-compat-v1") return {
70
+ ...contract == "open-flow-engine/v6" ? v8Contract : nodejsContract,
71
+ workflowTools: false,
72
+ httpRequests: false,
73
+ waitAutoContinue: false,
74
+ webhookResponses: false,
75
+ platformSource: platformSource(contract)
76
+ };
52
77
  }
53
78
  //#endregion
54
79
  //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
@@ -5725,6 +5750,76 @@ function datetime(params) {
5725
5750
  return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
5726
5751
  }
5727
5752
  //#endregion
5753
+ //#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
5754
+ var has = Object.prototype.hasOwnProperty;
5755
+ function dequal(foo, bar) {
5756
+ var ctor, len;
5757
+ if (foo === bar) return true;
5758
+ if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
5759
+ if (ctor === Date) return foo.getTime() === bar.getTime();
5760
+ if (ctor === RegExp) return foo.toString() === bar.toString();
5761
+ if (ctor === Array) {
5762
+ if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
5763
+ return len === -1;
5764
+ }
5765
+ if (!ctor || typeof foo === "object") {
5766
+ len = 0;
5767
+ for (ctor in foo) {
5768
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
5769
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
5770
+ }
5771
+ return Object.keys(bar).length === len;
5772
+ }
5773
+ }
5774
+ return foo !== foo && bar !== bar;
5775
+ }
5776
+ strictObject({
5777
+ scope: _enum(["draft", "live"]),
5778
+ values: boolean().optional()
5779
+ });
5780
+ strictObject({
5781
+ scope: _enum(["draft", "live"]),
5782
+ key: string$1().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
5783
+ });
5784
+ strictObject({
5785
+ scope: _enum(["draft", "live"]),
5786
+ space: string$1().regex(/^(flow|node:.+)$/)
5787
+ });
5788
+ var dedupeConfigSchema = strictObject({
5789
+ field: string$1().default(""),
5790
+ mode: _enum(["new", "increasing"]).default("new"),
5791
+ space: _enum(["node", "flow"]).default("node")
5792
+ });
5793
+ var dedupeExecutorSchema = dedupeConfigSchema.extend({ kind: literal("dedupe") });
5794
+ var flowStateViewSchema = object({
5795
+ version: literal(1),
5796
+ scope: _enum(["draft", "live"]),
5797
+ limits: object({
5798
+ maxValueBytes: number().positive(),
5799
+ maxValues: number().int().positive(),
5800
+ maxSpaces: number().int().positive(),
5801
+ maxIdentities: number().positive(),
5802
+ maxRunWrites: number().positive()
5803
+ }),
5804
+ values: array(object({
5805
+ key: string$1(),
5806
+ size: number().nonnegative(),
5807
+ updatedAt: number(),
5808
+ value: json$3().optional()
5809
+ })),
5810
+ spaces: array(object({
5811
+ space: string$1(),
5812
+ mode: _enum(["new", "increasing"]),
5813
+ count: number().nonnegative(),
5814
+ watermark: union([
5815
+ string$1(),
5816
+ number(),
5817
+ _null()
5818
+ ]),
5819
+ updatedAt: number()
5820
+ }))
5821
+ });
5822
+ //#endregion
5728
5823
  //#region src/json-schema-subset/utils.ts
5729
5824
  var nextId = 0;
5730
5825
  function createId() {
@@ -8554,6 +8649,9 @@ function webhookSupportsBody(method) {
8554
8649
  }
8555
8650
  //#endregion
8556
8651
  //#region src/decision/common/decision.ts
8652
+ function isDecisionExecutor(executor) {
8653
+ return executor.kind === "decision";
8654
+ }
8557
8655
  var decisionLimits = {
8558
8656
  choice: 255,
8559
8657
  score: 10
@@ -8576,7 +8674,7 @@ function limitDecisionQuestions(questions) {
8576
8674
  }
8577
8675
  /** Loading an oversized task also updates its previously generated output schemas. */
8578
8676
  function limitDecisionTask(task) {
8579
- if (task.executor.kind !== "decision") return task;
8677
+ if (!isDecisionExecutor(task.executor)) return task;
8580
8678
  const original = task.executor.questions;
8581
8679
  const questions = limitDecisionQuestions(original);
8582
8680
  if (questions === original) return task;
@@ -8644,12 +8742,17 @@ function answerSchema(question) {
8644
8742
  }
8645
8743
  //#endregion
8646
8744
  //#region src/http/common/authBindings.ts
8647
- /** Never allow credentials to enter a Revision as literal node inputs. */
8648
- function assertHttpAuthBindings(document) {
8649
- for (const node of Object.values(document.graph.nodes)) {
8650
- if (node.kind != "task" || !("executor" in node.task) || !["openapi", "http-request"].includes(node.task.executor.kind)) continue;
8651
- for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
8652
- }
8745
+ /** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
8746
+ function assertHttpAuthBindings(inputs) {
8747
+ for (const [handle, mapping] of Object.entries(inputs)) if (handle.startsWith("auth.") && mapping.kind == "value") throw new TypeError("HTTP authentication accepts deployment variables and upstream outputs only.");
8748
+ }
8749
+ //#endregion
8750
+ //#region src/http/common/hosts.ts
8751
+ /** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
8752
+ var httpHostPattern = /^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
8753
+ /** Wildcards must name a registrable suffix, so `*.com` is rejected. */
8754
+ function isHttpHost(value) {
8755
+ return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
8653
8756
  }
8654
8757
  //#endregion
8655
8758
  //#region src/http/common/httpRequest.ts
@@ -8875,7 +8978,15 @@ var workflowCapabilitySchema = strictObject({
8875
8978
  inputs: array(port$1),
8876
8979
  outputs: array(port$1).nullable()
8877
8980
  });
8878
- var capability = union([connectorCapabilitySchema, workflowCapabilitySchema]);
8981
+ var httpCapabilitySchema = strictObject({
8982
+ kind: literal("http"),
8983
+ hosts: array(text.refine(isHttpHost, "Use a lowercase host name or IPv4 address, optionally prefixed by \"*.\" for subdomains.")).min(1).max(20).describe("Hosts Code may call with context.fetch. \"*.example.com\" matches subdomains only.")
8984
+ });
8985
+ var capability = union([
8986
+ connectorCapabilitySchema,
8987
+ workflowCapabilitySchema,
8988
+ httpCapabilitySchema
8989
+ ]);
8879
8990
  var inline = object({
8880
8991
  ...ports$1,
8881
8992
  name: text,
@@ -8986,7 +9097,8 @@ var managedFields = object({
8986
9097
  flowId: text,
8987
9098
  revisionId: text
8988
9099
  }),
8989
- httpRequestExecutorSchema
9100
+ httpRequestExecutorSchema,
9101
+ dedupeExecutorSchema
8990
9102
  ])
8991
9103
  });
8992
9104
  var managed = managedFields.transform(limitDecisionTask);
@@ -9255,7 +9367,9 @@ var revision = object({
9255
9367
  literal(8),
9256
9368
  literal(9),
9257
9369
  literal(10),
9258
- literal(11)
9370
+ literal(11),
9371
+ literal(12),
9372
+ literal(13)
9259
9373
  ]),
9260
9374
  document,
9261
9375
  modules: record$2(text, module)
@@ -9286,7 +9400,7 @@ function decodeRevisionContent(value) {
9286
9400
  checkJsonDepth(value);
9287
9401
  const content = revision.parse(value);
9288
9402
  checkModelVersion(content);
9289
- assertHttpAuthBindings(content.document);
9403
+ assertDocumentHttpAuthBindings(content.document);
9290
9404
  return content;
9291
9405
  }
9292
9406
  var shapes = {
@@ -9456,6 +9570,8 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
9456
9570
  ...shape
9457
9571
  })])).values()])).min(1);
9458
9572
  function checkModelVersion(content) {
9573
+ 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.");
9574
+ 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.");
9459
9575
  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.");
9460
9576
  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.");
9461
9577
  if (content.modelVersion < 10 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "webhook" && (candidateNode.options?.responseBody != null || candidateNode.options?.responseStatusCodeOutput != null || candidateNode.options?.responseHeadersSource != null || candidateNode.options?.responseHeaderOutputs != null))) throw new TypeError("Dynamic Webhook responses require Flow model version 10.");
@@ -9471,6 +9587,9 @@ function checkModelVersion(content) {
9471
9587
  if (content.modelVersion < 6 && Object.values(content.document.graph.nodes).some((candidateNode) => candidateNode.kind == "task" && "executor" in candidateNode.task)) throw new TypeError("Node-owned managed Tasks require Flow model version 6.");
9472
9588
  if (content.modelVersion < 5 && Object.values(content.document.graph.nodes).some((itemNode) => itemNode.kind == "error")) throw new TypeError("Error workflows require Flow model version 5.");
9473
9589
  }
9590
+ function assertDocumentHttpAuthBindings(content) {
9591
+ for (const graphNode of Object.values(content.graph.nodes)) if (graphNode.kind == "task" && "executor" in graphNode.task && ["openapi", "http-request"].includes(graphNode.task.executor.kind)) assertHttpAuthBindings(graphNode.inputs);
9592
+ }
9474
9593
  //#endregion
9475
9594
  //#region src/control/common/authoringLlm.ts
9476
9595
  var authoringLlmConfiguration = strictObject({
@@ -9500,9 +9619,9 @@ var authoringOpenApiSchema = strictObject({
9500
9619
  });
9501
9620
  //#endregion
9502
9621
  //#region src/control/common/authoringSchema.ts
9503
- var id$1 = string$1().min(1);
9622
+ var id$2 = string$1().min(1);
9504
9623
  var json$1 = json$3();
9505
- var patch = record$2(id$1, json$1);
9624
+ var patch = record$2(id$2, json$1);
9506
9625
  var type = _enum([
9507
9626
  "start",
9508
9627
  "outputs",
@@ -9520,16 +9639,17 @@ var type = _enum([
9520
9639
  "decision",
9521
9640
  "openapi",
9522
9641
  "http-request",
9642
+ "dedupe",
9523
9643
  "condition",
9524
9644
  "value",
9525
9645
  "wait",
9526
9646
  "approval"
9527
9647
  ]);
9528
- var referenceSchema = id$1.describe("An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as \"step\", reference \"$step\", never bare \"step\". Aliases are local to one batch.");
9648
+ var referenceSchema = id$2.describe("An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as \"step\", reference \"$step\", never bare \"step\". Aliases are local to one batch.");
9529
9649
  var output = strictObject({
9530
9650
  kind: literal("output"),
9531
9651
  node: referenceSchema,
9532
- port: id$1.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9652
+ port: id$2.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9533
9653
  field: string$1().optional()
9534
9654
  });
9535
9655
  var system = strictObject({
@@ -9540,7 +9660,7 @@ var system = strictObject({
9540
9660
  });
9541
9661
  var variable$1 = strictObject({
9542
9662
  kind: literal("variable"),
9543
- name: id$1
9663
+ name: id$2
9544
9664
  });
9545
9665
  var authoringSourceSchema = union([
9546
9666
  output,
@@ -9571,7 +9691,7 @@ var operand = union([
9571
9691
  system,
9572
9692
  variable$1
9573
9693
  ]);
9574
- var toolSources = record$2(id$1, agentToolFields.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved.");
9694
+ var toolSources = record$2(id$2, agentToolFields.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved.");
9575
9695
  var agentTool = union([workflowAgentToolSchema.omit({
9576
9696
  id: true,
9577
9697
  inputs: true,
@@ -9581,20 +9701,24 @@ var agentTool = union([workflowAgentToolSchema.omit({
9581
9701
  id: true,
9582
9702
  inputs: true
9583
9703
  }).extend({ inputs: toolSources }).strict()]);
9584
- var authoringCapabilities = array(union([connectorCapabilitySchema, strictObject({
9585
- kind: literal("workflow"),
9586
- name: id$1,
9587
- flowId: id$1
9588
- })]));
9704
+ var authoringCapabilities = array(union([
9705
+ connectorCapabilitySchema,
9706
+ strictObject({
9707
+ kind: literal("workflow"),
9708
+ name: id$2,
9709
+ flowId: id$2
9710
+ }),
9711
+ httpCapabilitySchema
9712
+ ]));
9589
9713
  var notification = strictObject({
9590
9714
  ...authoringDefinitionSchemas.connector.shape,
9591
- messageHandle: id$1,
9592
- inputs: record$2(id$1, union([strictObject({
9715
+ messageHandle: id$2,
9716
+ inputs: record$2(id$2, union([strictObject({
9593
9717
  kind: literal("value"),
9594
9718
  value: json$1
9595
9719
  }), strictObject({
9596
9720
  kind: literal("input"),
9597
- input: id$1
9721
+ input: id$2
9598
9722
  })]))
9599
9723
  });
9600
9724
  var field = strictObject({
@@ -9602,14 +9726,14 @@ var field = strictObject({
9602
9726
  nullable: boolean().optional(),
9603
9727
  description: string$1().optional()
9604
9728
  });
9605
- var inputFields = record$2(id$1, field.extend({ default: json$1.optional() })).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data.");
9606
- var flowInputFields = record$2(id$1, field).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs.");
9729
+ var inputFields = record$2(id$2, field.extend({ default: json$1.optional() })).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data.");
9730
+ var flowInputFields = record$2(id$2, field).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs.");
9607
9731
  var flowOutputFields = flowInputFields.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs.");
9608
- var flowInputFieldsView = record$2(id$1, field.extend({
9732
+ var flowInputFieldsView = record$2(id$2, field.extend({
9609
9733
  schema: json$1,
9610
9734
  nullable: boolean()
9611
9735
  }));
9612
- var outputFields = record$2(id$1, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9736
+ var outputFields = record$2(id$2, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9613
9737
  var expression = strictObject({
9614
9738
  left: operand,
9615
9739
  operator: authoringDefinitionSchemas.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,
@@ -9623,20 +9747,20 @@ var when = union([
9623
9747
  ]);
9624
9748
  var authoringConfigurations = {
9625
9749
  "webhook-response": strictObject({}),
9626
- "workflow": strictObject({ flowId: id$1 }),
9750
+ "workflow": strictObject({ flowId: id$2 }),
9627
9751
  "start": strictObject({ inputDefs: flowInputFields.default({}) }),
9628
9752
  "outputs": strictObject({ outputDefs: flowOutputFields.default({}) }),
9629
- "error": strictObject({ sourceFlowIds: array(id$1).optional() }),
9753
+ "error": strictObject({ sourceFlowIds: array(id$2).optional() }),
9630
9754
  "webhook": authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(),
9631
9755
  "cron": strictObject({ schedule: authoringDefinitionSchemas.schedule }),
9632
9756
  "poll": strictObject({
9633
- key: id$1,
9634
- connectionId: id$1.optional(),
9757
+ key: id$2,
9758
+ connectionId: id$2.optional(),
9635
9759
  schedule: authoringDefinitionSchemas.schedule
9636
9760
  }),
9637
9761
  "integration": strictObject({
9638
- key: id$1,
9639
- connectionId: id$1.optional()
9762
+ key: id$2,
9763
+ connectionId: id$2.optional()
9640
9764
  }),
9641
9765
  "code": strictObject({
9642
9766
  inputs: inputFields,
@@ -9646,6 +9770,7 @@ var authoringConfigurations = {
9646
9770
  "connector": authoringDefinitionSchemas.connector.omit({ outputMode: true }).strict(),
9647
9771
  "openapi": authoringOpenApiSchema,
9648
9772
  "http-request": httpRequestConfigSchema,
9773
+ "dedupe": dedupeConfigSchema,
9649
9774
  "agent": authoringDefinitionSchemas.agent.omit({
9650
9775
  prompt: true,
9651
9776
  tools: true
@@ -9660,7 +9785,7 @@ var authoringConfigurations = {
9660
9785
  "condition": strictObject({
9661
9786
  match: _enum(["first", "all"]),
9662
9787
  branches: array(strictObject({
9663
- name: id$1,
9788
+ name: id$2,
9664
9789
  description: string$1().optional(),
9665
9790
  when
9666
9791
  }))
@@ -9677,7 +9802,7 @@ var authoringConfigurations = {
9677
9802
  };
9678
9803
  var updates = strictObject({
9679
9804
  onError: _enum(["stop", "error"]).optional(),
9680
- name: id$1.optional(),
9805
+ name: id$2.optional(),
9681
9806
  description: string$1().optional(),
9682
9807
  icon: string$1().optional(),
9683
9808
  maxExecutions: int().positive().optional(),
@@ -9688,13 +9813,13 @@ var updates = strictObject({
9688
9813
  var authoringEditSchema = discriminatedUnion("op", [
9689
9814
  strictObject({
9690
9815
  op: literal("node.add"),
9691
- as: id$1.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),
9816
+ as: id$2.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),
9692
9817
  type,
9693
- name: id$1,
9818
+ name: id$2,
9694
9819
  onError: _enum(["stop", "error"]).optional(),
9695
9820
  retry: retryConfigurationSchema.optional(),
9696
9821
  config: patch.optional(),
9697
- inputs: record$2(id$1, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9822
+ inputs: record$2(id$2, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9698
9823
  code: string$1().optional(),
9699
9824
  prompt: string$1().optional()
9700
9825
  }),
@@ -9702,12 +9827,12 @@ var authoringEditSchema = discriminatedUnion("op", [
9702
9827
  op: literal("node.update"),
9703
9828
  node: referenceSchema,
9704
9829
  set: updates.optional(),
9705
- clear: array(array(id$1).min(1)).optional()
9830
+ clear: array(array(id$2).min(1)).optional()
9706
9831
  }),
9707
9832
  strictObject({
9708
9833
  op: literal("node.refresh"),
9709
9834
  node: referenceSchema,
9710
- tool: id$1.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")
9835
+ tool: id$2.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")
9711
9836
  }),
9712
9837
  strictObject({
9713
9838
  op: literal("node.remove"),
@@ -9716,20 +9841,20 @@ var authoringEditSchema = discriminatedUnion("op", [
9716
9841
  strictObject({
9717
9842
  op: literal("input.set"),
9718
9843
  node: referenceSchema,
9719
- input: id$1,
9844
+ input: id$2,
9720
9845
  source: authoringSourceSchema
9721
9846
  }),
9722
9847
  strictObject({
9723
9848
  op: _enum(["edge.connect", "edge.disconnect"]),
9724
9849
  source: referenceSchema,
9725
9850
  target: referenceSchema,
9726
- branch: id$1.optional()
9851
+ branch: id$2.optional()
9727
9852
  }),
9728
9853
  strictObject({
9729
9854
  op: literal("text.edit"),
9730
9855
  node: referenceSchema,
9731
9856
  field: _enum(["code", "prompt"]),
9732
- oldText: id$1,
9857
+ oldText: id$2,
9733
9858
  newText: string$1()
9734
9859
  }),
9735
9860
  strictObject({
@@ -9740,15 +9865,15 @@ var authoringEditSchema = discriminatedUnion("op", [
9740
9865
  })
9741
9866
  ]);
9742
9867
  strictObject({
9743
- baseRevision: id$1,
9744
- requestId: id$1.max(256),
9868
+ baseRevision: id$2,
9869
+ requestId: id$2.max(256),
9745
9870
  edits: array(authoringEditSchema).min(1).max(1e3)
9746
9871
  });
9747
9872
  strictObject({
9748
- revision: id$1.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9749
- nodes: array(id$1).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),
9873
+ revision: id$2.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9874
+ nodes: array(id$2).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),
9750
9875
  text: strictObject({
9751
- node: id$1,
9876
+ node: id$2,
9752
9877
  field: _enum(["code", "prompt"]),
9753
9878
  start: int().positive().default(1),
9754
9879
  lines: int().min(1).max(200).default(80)
@@ -9757,42 +9882,43 @@ strictObject({
9757
9882
  not: { required: ["nodes", "text"] },
9758
9883
  description: "Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."
9759
9884
  });
9760
- strictObject({ revisionId: id$1 });
9885
+ strictObject({ revisionId: id$2 });
9761
9886
  strictObject({
9762
- revision: id$1.optional(),
9763
- query: id$1.max(1e3),
9887
+ revision: id$2.optional(),
9888
+ query: id$2.max(1e3),
9764
9889
  type: type.optional(),
9765
9890
  offset: int().nonnegative().default(0),
9766
9891
  limit: int().min(1).max(100).default(20)
9767
9892
  });
9768
9893
  strictObject({
9769
9894
  type: type.optional(),
9770
- action: id$1.optional()
9895
+ action: id$2.optional()
9771
9896
  }).refine((v) => v.type == null || v.action == null, "Choose type or action.");
9897
+ `${[...findEngineContract(currentEngineContract).builtinModules].filter((name) => !name.startsWith("node:")).join(", ")}`;
9772
9898
  var authoringDiagnosticSchema = object({
9773
- code: id$1,
9899
+ code: id$2,
9774
9900
  message: string$1(),
9775
- nodes: array(id$1),
9901
+ nodes: array(id$2),
9776
9902
  field: string$1().optional(),
9777
9903
  line: number().optional(),
9778
9904
  column: number().optional()
9779
9905
  });
9780
9906
  var authoringCheckResponse = object({
9781
- flowId: id$1,
9782
- revisionId: id$1,
9907
+ flowId: id$2,
9908
+ revisionId: id$2,
9783
9909
  valid: boolean(),
9784
9910
  diagnostics: array(authoringDiagnosticSchema),
9785
9911
  version: literal(1)
9786
9912
  });
9787
9913
  var authoringEditResponse = object({
9788
- flowId: id$1,
9914
+ flowId: id$2,
9789
9915
  saved: literal(true),
9790
- revision: id$1,
9791
- nodes: record$2(id$1, id$1),
9916
+ revision: id$2,
9917
+ nodes: record$2(id$2, id$2),
9792
9918
  changes: array(object({
9793
9919
  index: int(),
9794
- op: id$1,
9795
- node: id$1.optional()
9920
+ op: id$2,
9921
+ node: id$2.optional()
9796
9922
  })),
9797
9923
  validation: object({
9798
9924
  status: _enum([
@@ -9805,8 +9931,8 @@ var authoringEditResponse = object({
9805
9931
  version: literal(1)
9806
9932
  });
9807
9933
  var authoringReadResponse = object({
9808
- flowId: id$1,
9809
- revision: id$1,
9934
+ flowId: id$2,
9935
+ revision: id$2,
9810
9936
  data: object({
9811
9937
  nodes: array(record$2(string$1(), json$1)).optional(),
9812
9938
  edges: array(json$1).optional(),
@@ -9815,12 +9941,12 @@ var authoringReadResponse = object({
9815
9941
  version: literal(1)
9816
9942
  });
9817
9943
  var authoringSearchResponse = object({
9818
- flowId: id$1,
9819
- revision: id$1,
9944
+ flowId: id$2,
9945
+ revision: id$2,
9820
9946
  data: object({
9821
9947
  matches: array(object({
9822
- node: id$1.optional(),
9823
- field: id$1,
9948
+ node: id$2.optional(),
9949
+ field: id$2,
9824
9950
  line: int().optional(),
9825
9951
  excerpt: string$1()
9826
9952
  })),
@@ -9912,6 +10038,9 @@ var controlErrorCode = {
9912
10038
  triggerKeyInvalid: "trigger-key.invalid",
9913
10039
  triggerKeyNotFound: "trigger-key.not-found",
9914
10040
  triggerNotFound: "trigger.not-found",
10041
+ tagInvalid: "tag.invalid",
10042
+ tagConflict: "tag.conflict",
10043
+ tagNotFound: "tag.not-found",
9915
10044
  variableInvalid: "variable.invalid",
9916
10045
  variableLimitReached: "variable.limit-reached",
9917
10046
  variableNotFound: "variable.not-found"
@@ -9960,6 +10089,9 @@ var controlErrorMetadata = {
9960
10089
  [controlErrorCode.triggerKeyInvalid]: { status: 409 },
9961
10090
  [controlErrorCode.triggerKeyNotFound]: { status: 404 },
9962
10091
  [controlErrorCode.triggerNotFound]: { status: 404 },
10092
+ [controlErrorCode.tagInvalid]: { status: 400 },
10093
+ [controlErrorCode.tagConflict]: { status: 409 },
10094
+ [controlErrorCode.tagNotFound]: { status: 404 },
9963
10095
  [controlErrorCode.variableInvalid]: { status: 400 },
9964
10096
  [controlErrorCode.variableLimitReached]: { status: 409 },
9965
10097
  [controlErrorCode.variableNotFound]: { status: 404 }
@@ -10463,7 +10595,7 @@ function decodeEntries(values, current) {
10463
10595
  return parsed.data;
10464
10596
  }
10465
10597
  //#endregion
10466
- //#region src/control/common/providerIconSprite.ts
10598
+ //#region src/connector/common/providerIconSprite.ts
10467
10599
  /** Optional artwork must never make an otherwise usable catalog unavailable. */
10468
10600
  function providerIconAppearance(metadata, position) {
10469
10601
  if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
@@ -10521,7 +10653,7 @@ function conditionInputPorts(node) {
10521
10653
  }]));
10522
10654
  }
10523
10655
  //#endregion
10524
- //#region src/flow/common/change.ts
10656
+ //#region src/flow/common/model.ts
10525
10657
  function portsByHandle(ports) {
10526
10658
  return Object.fromEntries(ports.flatMap((port) => "handle" in port ? [[port.handle, port]] : []));
10527
10659
  }
@@ -11349,6 +11481,30 @@ function nodeDetails(content, nodeId, node) {
11349
11481
  };
11350
11482
  }
11351
11483
  //#endregion
11484
+ //#region src/event-source/common/view.ts
11485
+ var id$1 = string$1().min(1).max(256);
11486
+ /** Public projection of a source that Connector validates and Open Flow exposes unchanged. */
11487
+ var eventSourceViewSchema = object({
11488
+ appId: id$1.nullable(),
11489
+ workspaceId: id$1.optional(),
11490
+ installationId: id$1.optional(),
11491
+ organizationId: id$1.optional(),
11492
+ projectId: id$1.optional(),
11493
+ projectKey: id$1.optional(),
11494
+ subscriptionStatus: _enum([
11495
+ "idle",
11496
+ "pending",
11497
+ "ready",
11498
+ "error"
11499
+ ]).optional(),
11500
+ lastError: string$1().optional(),
11501
+ signingSecretConfigured: boolean().optional(),
11502
+ manageSubscriptions: boolean().nullable(),
11503
+ verificationTokenConfigured: boolean().nullable(),
11504
+ encryptKeyConfigured: boolean().nullable(),
11505
+ verifiedAt: string$1().nullable()
11506
+ });
11507
+ //#endregion
11352
11508
  //#region src/control/common/eventSources.ts
11353
11509
  var id = string$1().min(1).max(256);
11354
11510
  var eventType = string$1().regex(/^[a-z][a-z0-9_.:]{0,127}$/);
@@ -11368,29 +11524,12 @@ var eventSourceSchema = object({
11368
11524
  "fireflies",
11369
11525
  "jira"
11370
11526
  ]),
11371
- appId: id.nullable(),
11372
- workspaceId: id.optional(),
11373
- installationId: id.optional(),
11374
- organizationId: id.optional(),
11375
- projectId: id.optional(),
11376
- projectKey: id.optional(),
11377
- subscriptionStatus: _enum([
11378
- "idle",
11379
- "pending",
11380
- "ready",
11381
- "error"
11382
- ]).optional(),
11383
- lastError: string$1().optional(),
11384
- signingSecretConfigured: boolean().optional(),
11527
+ ...eventSourceViewSchema.shape,
11385
11528
  connectionId: id,
11386
11529
  teamId: id.nullable(),
11387
11530
  enabled: boolean(),
11388
11531
  eventTypes: array(eventType),
11389
- manageSubscriptions: boolean().nullable(),
11390
- verificationTokenConfigured: boolean().nullable(),
11391
- encryptKeyConfigured: boolean().nullable(),
11392
11532
  endpointUrl: string$1().nullable(),
11393
- verifiedAt: string$1().nullable(),
11394
11533
  lastReceivedAt: string$1().nullable(),
11395
11534
  updatedAt: string$1(),
11396
11535
  consumers: array(object({
@@ -11399,21 +11538,6 @@ var eventSourceSchema = object({
11399
11538
  triggerNodeId: id
11400
11539
  }))
11401
11540
  });
11402
- eventSourceSchema.pick({
11403
- appId: true,
11404
- workspaceId: true,
11405
- installationId: true,
11406
- organizationId: true,
11407
- projectId: true,
11408
- projectKey: true,
11409
- subscriptionStatus: true,
11410
- lastError: true,
11411
- signingSecretConfigured: true,
11412
- manageSubscriptions: true,
11413
- verificationTokenConfigured: true,
11414
- encryptKeyConfigured: true,
11415
- verifiedAt: true
11416
- });
11417
11541
  function decodeEventSource(value) {
11418
11542
  return eventSourceSchema.parse(value);
11419
11543
  }
@@ -11854,6 +11978,7 @@ function flow(value) {
11854
11978
  publicationId: string(target.publicationId),
11855
11979
  revisionId: string(target.revisionId)
11856
11980
  } },
11981
+ tagIds: source.tagIds === void 0 ? [] : strings(source.tagIds),
11857
11982
  createdAt: string(source.createdAt),
11858
11983
  ...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
11859
11984
  draftRevisionId: string(source.draftRevisionId),
@@ -12299,6 +12424,33 @@ function randomId() {
12299
12424
  return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
12300
12425
  }
12301
12426
  //#endregion
12427
+ //#region src/control/common/tags.ts
12428
+ function normalizeFlowQuery(query = {}) {
12429
+ return {
12430
+ query: query.query?.trim().toLowerCase() ?? "",
12431
+ tagIds: [...new Set(query.tagIds ?? [])].toSorted(),
12432
+ untagged: query.untagged ?? false
12433
+ };
12434
+ }
12435
+ function decodeTag(value) {
12436
+ const source = record(value);
12437
+ if (source.version != 1) return invalidResponse();
12438
+ return {
12439
+ tagId: string(source.tagId),
12440
+ name: string(source.name),
12441
+ version: 1
12442
+ };
12443
+ }
12444
+ function decodeTagListItem(value) {
12445
+ const source = record(value);
12446
+ const referenceCount = integer(source.referenceCount);
12447
+ if (referenceCount < 0) return invalidResponse();
12448
+ return {
12449
+ ...decodeTag(source),
12450
+ referenceCount
12451
+ };
12452
+ }
12453
+ //#endregion
12302
12454
  //#region src/control/common/api.ts
12303
12455
  function isRunTerminalEvent(event) {
12304
12456
  return event?.kind == "run.completed" || event?.kind == "run.failed" || event?.kind == "run.canceled" || event?.kind == "run.indeterminate";
@@ -12405,7 +12557,7 @@ function decodeRunEvent(value) {
12405
12557
  switch (kind) {
12406
12558
  case "node.started": {
12407
12559
  const nodeKind = payload.nodeKind;
12408
- if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "http-request" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "value" && nodeKind !== "outputs" && nodeKind !== "webhook-response" && nodeKind !== "workflow" && nodeKind !== "wait") return invalidResponse();
12560
+ if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "decision" && nodeKind !== "openapi" && nodeKind !== "http-request" && nodeKind !== "dedupe" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "value" && nodeKind !== "outputs" && nodeKind !== "webhook-response" && nodeKind !== "workflow" && nodeKind !== "wait") return invalidResponse();
12409
12561
  return {
12410
12562
  ...base,
12411
12563
  kind,
@@ -12532,6 +12684,10 @@ var ControlClient = class {
12532
12684
  }
12533
12685
  async listFlows(options = {}) {
12534
12686
  const parameters = new URLSearchParams();
12687
+ const filter = normalizeFlowQuery(options);
12688
+ if (filter.query) parameters.set("query", filter.query);
12689
+ if (filter.tagIds.length) parameters.set("tagIds", filter.tagIds.join(","));
12690
+ if (filter.untagged) parameters.set("untagged", "true");
12535
12691
  if (options.cursor != null) parameters.set("cursor", options.cursor);
12536
12692
  if (options.limit != null) parameters.set("limit", String(options.limit));
12537
12693
  if (options.includeTotal != null) parameters.set("includeTotal", String(options.includeTotal));
@@ -12621,15 +12777,17 @@ var ControlClient = class {
12621
12777
  file,
12622
12778
  name: options.name,
12623
12779
  teamId: options.teamId,
12780
+ tagIds: options.tagIds,
12624
12781
  version: 1
12625
12782
  })
12626
12783
  }));
12627
12784
  }
12628
- async createFlow(name, idempotencyKey = `flow-${randomId()}`, teamId) {
12785
+ async createFlow(name, idempotencyKey = `flow-${randomId()}`, teamId, tagIds) {
12629
12786
  return flow(await this.request("/v1/flows", {
12630
12787
  body: JSON.stringify({
12631
12788
  name,
12632
12789
  ...teamId == null ? {} : { teamId },
12790
+ ...tagIds == null ? {} : { tagIds },
12633
12791
  version: 1
12634
12792
  }),
12635
12793
  headers: { "idempotency-key": idempotencyKey },
@@ -12664,15 +12822,68 @@ var ControlClient = class {
12664
12822
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
12665
12823
  return source.listeners.map(errorListener);
12666
12824
  }
12667
- async renameFlow(flowId, name) {
12668
- return flow(await this.request(`/v1/flows/${segment(flowId)}`, {
12825
+ async listTags(signal) {
12826
+ const source = record(await this.request("/v1/tags", { signal }));
12827
+ if (source.version != 1 || !Array.isArray(source.tags)) return invalidResponse();
12828
+ return {
12829
+ tags: source.tags.map(decodeTagListItem),
12830
+ version: 1
12831
+ };
12832
+ }
12833
+ async createTag(name) {
12834
+ return decodeTag(await this.request("/v1/tags", {
12835
+ method: "POST",
12669
12836
  body: JSON.stringify({
12670
12837
  name,
12671
12838
  version: 1
12672
- }),
12673
- method: "PATCH"
12839
+ })
12840
+ }));
12841
+ }
12842
+ async renameTag(tagId, name) {
12843
+ return decodeTag(await this.request(`/v1/tags/${segment(tagId)}`, {
12844
+ method: "PATCH",
12845
+ body: JSON.stringify({
12846
+ name,
12847
+ version: 1
12848
+ })
12849
+ }));
12850
+ }
12851
+ async deleteTag(tagId) {
12852
+ if (record(await this.request(`/v1/tags/${segment(tagId)}`, { method: "DELETE" })).version != 1) invalidResponse();
12853
+ }
12854
+ async setFlowTags(flowId, tagIds) {
12855
+ return flow(await this.request(`/v1/flows/${segment(flowId)}/tags`, {
12856
+ method: "PUT",
12857
+ body: JSON.stringify({
12858
+ tagIds,
12859
+ version: 1
12860
+ })
12674
12861
  }));
12675
12862
  }
12863
+ async updateFlow(flowId, changes) {
12864
+ return flow(await this.request(`/v1/flows/${segment(flowId)}`, {
12865
+ method: "PATCH",
12866
+ body: JSON.stringify({
12867
+ ...changes,
12868
+ version: 1
12869
+ })
12870
+ }));
12871
+ }
12872
+ async getFlowState(flowId, scope, values = false) {
12873
+ const result = flowStateViewSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}&values=${values}`));
12874
+ return result.success && result.data.scope === scope ? result.data : invalidResponse();
12875
+ }
12876
+ async clearFlowState(flowId, scope, key) {
12877
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}${key == null ? "" : `&key=${encodeURIComponent(key)}`}`, { method: "DELETE" }));
12878
+ if (source.version !== 1 || source.cleared !== true) invalidResponse();
12879
+ }
12880
+ async clearFlowDedupe(flowId, scope, space) {
12881
+ const source = record(await this.request(`/v1/flows/${segment(flowId)}/dedupe?scope=${scope}&space=${encodeURIComponent(space)}`, { method: "DELETE" }));
12882
+ if (source.version !== 1 || source.cleared !== true) invalidResponse();
12883
+ }
12884
+ async renameFlow(flowId, name) {
12885
+ return this.updateFlow(flowId, { name });
12886
+ }
12676
12887
  async deleteFlow(flowId) {
12677
12888
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
12678
12889
  }
@@ -13188,4 +13399,4 @@ var ControlClient = class {
13188
13399
  }
13189
13400
  };
13190
13401
  //#endregion
13191
- export { ApiError, ControlClient, actionSummary, controlErrorCode, controlErrorMetadata, connectorAccess as decodeConnectorAccess, connectorAccessSnapshot as decodeConnectorAccessSnapshot, decodeEventSource, decodeEventSources, decodeResultList, decodeResultRead, decodeRunEvent, decodeTriggerCatalog, flowInputDefinitions, flowInspection, inspectFlowDraft, isRunTerminalEvent, liveEntries, nodeDetails, parseProviderAccessSource, parseResultQuery, providerAccessBindingId, providerIconAppearance, readResult, searchTriggerKeys };
13402
+ export { ApiError, ControlClient, actionSummary, controlErrorCode, controlErrorMetadata, connectorAccess as decodeConnectorAccess, connectorAccessSnapshot as decodeConnectorAccessSnapshot, decodeEventSource, decodeEventSources, decodeResultList, decodeResultRead, decodeRunEvent, decodeTriggerCatalog, flowInputDefinitions, flowInspection, inspectFlowDraft, isRunTerminalEvent, liveEntries, nodeDetails, normalizeFlowQuery, parseProviderAccessSource, parseResultQuery, providerAccessBindingId, providerIconAppearance, readResult, searchTriggerKeys };