@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
@@ -22,44 +22,6 @@ function dequal(foo, bar) {
22
22
  return foo !== foo && bar !== bar;
23
23
  }
24
24
  //#endregion
25
- //#region src/execution/common/engineContract.ts
26
- var currentEngineContract = "open-flow-engine/v8";
27
- `${JSON.stringify(currentEngineContract)}`, new Set([
28
- "assert",
29
- "assert/strict",
30
- "buffer",
31
- "console",
32
- "constants",
33
- "crypto",
34
- "events",
35
- "fs",
36
- "fs/promises",
37
- "os",
38
- "path",
39
- "path/posix",
40
- "process",
41
- "punycode",
42
- "querystring",
43
- "stream",
44
- "stream/promises",
45
- "stream/web",
46
- "string_decoder",
47
- "timers",
48
- "timers/promises",
49
- "url",
50
- "util",
51
- "zlib"
52
- ].flatMap((name) => [name, `node:${name}`])), `${JSON.stringify("open-flow-engine/v8/nodejs-compat-v1")}`;
53
- //#endregion
54
- //#region src/http/common/authBindings.ts
55
- /** Never allow credentials to enter a Revision as literal node inputs. */
56
- function assertHttpAuthBindings(document) {
57
- for (const node of Object.values(document.graph.nodes)) {
58
- if (node.kind != "task" || !("executor" in node.task) || !["openapi", "http-request"].includes(node.task.executor.kind)) continue;
59
- 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.");
60
- }
61
- }
62
- //#endregion
63
25
  //#region ../../node_modules/.bun/zod@4.6.5/node_modules/zod/v4/core/util.js
64
26
  function getEnumValues(entries) {
65
27
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -8514,6 +8476,9 @@ function isSchemaKeyword(value) {
8514
8476
  }
8515
8477
  //#endregion
8516
8478
  //#region src/decision/common/decision.ts
8479
+ function isDecisionExecutor(executor) {
8480
+ return executor.kind === "decision";
8481
+ }
8517
8482
  var decisionLimits = {
8518
8483
  choice: 255,
8519
8484
  score: 10
@@ -8536,7 +8501,7 @@ function limitDecisionQuestions(questions) {
8536
8501
  }
8537
8502
  /** Loading an oversized task also updates its previously generated output schemas. */
8538
8503
  function limitDecisionTask(task) {
8539
- if (task.executor.kind !== "decision") return task;
8504
+ if (!isDecisionExecutor(task.executor)) return task;
8540
8505
  const original = task.executor.questions;
8541
8506
  const questions = limitDecisionQuestions(original);
8542
8507
  if (questions === original) return task;
@@ -8603,6 +8568,20 @@ function answerSchema(question) {
8603
8568
  };
8604
8569
  }
8605
8570
  //#endregion
8571
+ //#region src/http/common/authBindings.ts
8572
+ /** Never allow credentials to enter a Revision as literal inputs of an OpenAPI or HTTP request node. */
8573
+ function assertHttpAuthBindings(inputs) {
8574
+ 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.");
8575
+ }
8576
+ //#endregion
8577
+ //#region src/http/common/hosts.ts
8578
+ /** Hosts of a Code `http` Capability: lowercase DNS names or IPv4 addresses; `*.example.com` matches subdomains only. */
8579
+ 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])?$/;
8580
+ /** Wildcards must name a registrable suffix, so `*.com` is rejected. */
8581
+ function isHttpHost(value) {
8582
+ return httpHostPattern.test(value) && (!value.startsWith("*.") || value.slice(2).includes("."));
8583
+ }
8584
+ //#endregion
8606
8585
  //#region src/http/common/httpRequest.ts
8607
8586
  var parameterSchema = strictObject({
8608
8587
  mode: _enum(["fields", "object"]).default("fields"),
@@ -8649,6 +8628,52 @@ var httpRequestConfigSchema = strictObject({
8649
8628
  statusPolicy: _enum(["success", "all"]).default("success")
8650
8629
  });
8651
8630
  var httpRequestExecutorSchema = httpRequestConfigSchema.extend({ kind: literal("http-request") });
8631
+ strictObject({
8632
+ scope: _enum(["draft", "live"]),
8633
+ values: boolean().optional()
8634
+ });
8635
+ strictObject({
8636
+ scope: _enum(["draft", "live"]),
8637
+ key: string$1().min(1).refine((key) => new TextEncoder().encode(key).length <= 256).optional()
8638
+ });
8639
+ strictObject({
8640
+ scope: _enum(["draft", "live"]),
8641
+ space: string$1().regex(/^(flow|node:.+)$/)
8642
+ });
8643
+ var dedupeConfigSchema = strictObject({
8644
+ field: string$1().default(""),
8645
+ mode: _enum(["new", "increasing"]).default("new"),
8646
+ space: _enum(["node", "flow"]).default("node")
8647
+ });
8648
+ var dedupeExecutorSchema = dedupeConfigSchema.extend({ kind: literal("dedupe") });
8649
+ var flowStateViewSchema = object({
8650
+ version: literal(1),
8651
+ scope: _enum(["draft", "live"]),
8652
+ limits: object({
8653
+ maxValueBytes: number().positive(),
8654
+ maxValues: number().int().positive(),
8655
+ maxSpaces: number().int().positive(),
8656
+ maxIdentities: number().positive(),
8657
+ maxRunWrites: number().positive()
8658
+ }),
8659
+ values: array(object({
8660
+ key: string$1(),
8661
+ size: number().nonnegative(),
8662
+ updatedAt: number(),
8663
+ value: json$4().optional()
8664
+ })),
8665
+ spaces: array(object({
8666
+ space: string$1(),
8667
+ mode: _enum(["new", "increasing"]),
8668
+ count: number().nonnegative(),
8669
+ watermark: union([
8670
+ string$1(),
8671
+ number(),
8672
+ _null()
8673
+ ]),
8674
+ updatedAt: number()
8675
+ }))
8676
+ });
8652
8677
  function checkJsonDepth(value, depth = 0) {
8653
8678
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
8654
8679
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -8818,7 +8843,15 @@ var workflowCapabilitySchema = strictObject({
8818
8843
  inputs: array(port$1),
8819
8844
  outputs: array(port$1).nullable()
8820
8845
  });
8821
- var capability = union([connectorCapabilitySchema, workflowCapabilitySchema]);
8846
+ var httpCapabilitySchema = strictObject({
8847
+ kind: literal("http"),
8848
+ 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.")
8849
+ });
8850
+ var capability = union([
8851
+ connectorCapabilitySchema,
8852
+ workflowCapabilitySchema,
8853
+ httpCapabilitySchema
8854
+ ]);
8822
8855
  var inline = object({
8823
8856
  ...ports$1,
8824
8857
  name: text,
@@ -8929,7 +8962,8 @@ var managedFields = object({
8929
8962
  flowId: text,
8930
8963
  revisionId: text
8931
8964
  }),
8932
- httpRequestExecutorSchema
8965
+ httpRequestExecutorSchema,
8966
+ dedupeExecutorSchema
8933
8967
  ])
8934
8968
  });
8935
8969
  var managed = managedFields.transform(limitDecisionTask);
@@ -9198,7 +9232,9 @@ var revision = object({
9198
9232
  literal(8),
9199
9233
  literal(9),
9200
9234
  literal(10),
9201
- literal(11)
9235
+ literal(11),
9236
+ literal(12),
9237
+ literal(13)
9202
9238
  ]),
9203
9239
  document,
9204
9240
  modules: record$3(text, module)
@@ -9229,7 +9265,7 @@ function decodeRevisionContent(value) {
9229
9265
  checkJsonDepth(value);
9230
9266
  const content = revision.parse(value);
9231
9267
  checkModelVersion(content);
9232
- assertHttpAuthBindings(content.document);
9268
+ assertDocumentHttpAuthBindings(content.document);
9233
9269
  return content;
9234
9270
  }
9235
9271
  var shapes = {
@@ -9399,6 +9435,8 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
9399
9435
  ...shape
9400
9436
  })])).values()])).min(1);
9401
9437
  function checkModelVersion(content) {
9438
+ 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.");
9439
+ 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.");
9402
9440
  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.");
9403
9441
  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.");
9404
9442
  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.");
@@ -9414,6 +9452,9 @@ function checkModelVersion(content) {
9414
9452
  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.");
9415
9453
  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.");
9416
9454
  }
9455
+ function assertDocumentHttpAuthBindings(content) {
9456
+ 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);
9457
+ }
9417
9458
  //#endregion
9418
9459
  //#region src/flow/common/change.ts
9419
9460
  /** Lossless upgrade of readable content. Historical content and its encoding stay unchanged. */
@@ -9424,10 +9465,10 @@ function upgradeRevisionContent(content) {
9424
9465
  function upgradeDecodedRevisionContent(content) {
9425
9466
  const graph = content.document.graph;
9426
9467
  const hasManual = Object.values(graph.nodes).some((node) => node.kind == "manual");
9427
- if (!hasManual && content.modelVersion == 11) return content;
9468
+ if (!hasManual && content.modelVersion == 13) return content;
9428
9469
  return {
9429
9470
  ...content,
9430
- modelVersion: 11,
9471
+ modelVersion: 13,
9431
9472
  document: {
9432
9473
  ...content.document,
9433
9474
  graph: hasManual ? {
@@ -9445,6 +9486,84 @@ function upgradeManualTrigger(node) {
9445
9486
  } : node;
9446
9487
  }
9447
9488
  //#endregion
9489
+ //#region src/runtime/common/engineContract.ts
9490
+ /** v10 adds persistent Flow State to the published v9 Node compatibility and fetch contract. */
9491
+ var currentEngineContract = "open-flow-engine/v10";
9492
+ /** The published v8 Node compatibility contract, retained for existing Publications and Runs. */
9493
+ var nodejsEngineContract = "open-flow-engine/v8/nodejs-compat-v1";
9494
+ var platformSource = (contract) => `export const engineContract = ${JSON.stringify(contract)}
9495
+ export function identity(value) { return value }
9496
+ `;
9497
+ var v8Contract = {
9498
+ workflowTools: true,
9499
+ httpRequests: true,
9500
+ waitAutoContinue: true,
9501
+ webhookResponses: true,
9502
+ platformExports: /* @__PURE__ */ new Set(["engineContract", "identity"]),
9503
+ platformModule: "open-flow:platform",
9504
+ platformSource: platformSource("open-flow-engine/v8")
9505
+ };
9506
+ var nodejsContract = {
9507
+ ...v8Contract,
9508
+ builtinModules: new Set([
9509
+ "assert",
9510
+ "assert/strict",
9511
+ "buffer",
9512
+ "console",
9513
+ "constants",
9514
+ "crypto",
9515
+ "events",
9516
+ "fs",
9517
+ "fs/promises",
9518
+ "os",
9519
+ "path",
9520
+ "path/posix",
9521
+ "process",
9522
+ "punycode",
9523
+ "querystring",
9524
+ "stream",
9525
+ "stream/promises",
9526
+ "stream/web",
9527
+ "string_decoder",
9528
+ "timers",
9529
+ "timers/promises",
9530
+ "url",
9531
+ "util",
9532
+ "zlib"
9533
+ ].flatMap((name) => [name, `node:${name}`])),
9534
+ platformSource: platformSource(nodejsEngineContract)
9535
+ };
9536
+ var v9Contract = {
9537
+ ...nodejsContract,
9538
+ codeFetch: true,
9539
+ platformSource: platformSource("open-flow-engine/v9")
9540
+ };
9541
+ var currentContract = {
9542
+ ...v9Contract,
9543
+ flowState: true,
9544
+ platformSource: platformSource(currentEngineContract)
9545
+ };
9546
+ function findEngineContract(contract) {
9547
+ if (contract == "open-flow-engine/v10") return currentContract;
9548
+ if (contract == "open-flow-engine/v9") return v9Contract;
9549
+ if (contract == "open-flow-engine/v8") return v8Contract;
9550
+ if (contract == "open-flow-engine/v8/nodejs-compat-v1") return nodejsContract;
9551
+ if (contract == "open-flow-engine/v7" || contract == "open-flow-engine/v7/nodejs-compat-v1") return {
9552
+ ...contract.endsWith("/nodejs-compat-v1") ? nodejsContract : v8Contract,
9553
+ workflowTools: false,
9554
+ httpRequests: false,
9555
+ platformSource: platformSource(contract)
9556
+ };
9557
+ if (contract == "open-flow-engine/v6" || contract == "open-flow-engine/v6/nodejs-compat-v1") return {
9558
+ ...contract == "open-flow-engine/v6" ? v8Contract : nodejsContract,
9559
+ workflowTools: false,
9560
+ httpRequests: false,
9561
+ waitAutoContinue: false,
9562
+ webhookResponses: false,
9563
+ platformSource: platformSource(contract)
9564
+ };
9565
+ }
9566
+ //#endregion
9448
9567
  //#region src/workflow/common/workflow.ts
9449
9568
  var portSchema = object({
9450
9569
  handle: string$1().min(1),
@@ -9510,9 +9629,9 @@ var authoringOpenApiSchema = strictObject({
9510
9629
  });
9511
9630
  //#endregion
9512
9631
  //#region src/control/common/authoringSchema.ts
9513
- var id$1 = string$1().min(1);
9632
+ var id$2 = string$1().min(1);
9514
9633
  var json$2 = json$4();
9515
- var patch = record$3(id$1, json$2);
9634
+ var patch = record$3(id$2, json$2);
9516
9635
  var type = _enum([
9517
9636
  "start",
9518
9637
  "outputs",
@@ -9530,16 +9649,17 @@ var type = _enum([
9530
9649
  "decision",
9531
9650
  "openapi",
9532
9651
  "http-request",
9652
+ "dedupe",
9533
9653
  "condition",
9534
9654
  "value",
9535
9655
  "wait",
9536
9656
  "approval"
9537
9657
  ]);
9538
- 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.");
9658
+ 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.");
9539
9659
  var output = strictObject({
9540
9660
  kind: literal("output"),
9541
9661
  node: referenceSchema,
9542
- port: id$1.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9662
+ port: id$2.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),
9543
9663
  field: string$1().optional()
9544
9664
  });
9545
9665
  var system = strictObject({
@@ -9550,7 +9670,7 @@ var system = strictObject({
9550
9670
  });
9551
9671
  var variable$1 = strictObject({
9552
9672
  kind: literal("variable"),
9553
- name: id$1
9673
+ name: id$2
9554
9674
  });
9555
9675
  var authoringSourceSchema = union([
9556
9676
  output,
@@ -9581,7 +9701,7 @@ var operand = union([
9581
9701
  system,
9582
9702
  variable$1
9583
9703
  ]);
9584
- var toolSources = record$3(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.");
9704
+ var toolSources = record$3(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.");
9585
9705
  var agentTool = union([workflowAgentToolSchema.omit({
9586
9706
  id: true,
9587
9707
  inputs: true,
@@ -9591,20 +9711,24 @@ var agentTool = union([workflowAgentToolSchema.omit({
9591
9711
  id: true,
9592
9712
  inputs: true
9593
9713
  }).extend({ inputs: toolSources }).strict()]);
9594
- var authoringCapabilities = array(union([connectorCapabilitySchema, strictObject({
9595
- kind: literal("workflow"),
9596
- name: id$1,
9597
- flowId: id$1
9598
- })]));
9714
+ var authoringCapabilities = array(union([
9715
+ connectorCapabilitySchema,
9716
+ strictObject({
9717
+ kind: literal("workflow"),
9718
+ name: id$2,
9719
+ flowId: id$2
9720
+ }),
9721
+ httpCapabilitySchema
9722
+ ]));
9599
9723
  var notification = strictObject({
9600
9724
  ...authoringDefinitionSchemas.connector.shape,
9601
- messageHandle: id$1,
9602
- inputs: record$3(id$1, union([strictObject({
9725
+ messageHandle: id$2,
9726
+ inputs: record$3(id$2, union([strictObject({
9603
9727
  kind: literal("value"),
9604
9728
  value: json$2
9605
9729
  }), strictObject({
9606
9730
  kind: literal("input"),
9607
- input: id$1
9731
+ input: id$2
9608
9732
  })]))
9609
9733
  });
9610
9734
  var field = strictObject({
@@ -9612,14 +9736,14 @@ var field = strictObject({
9612
9736
  nullable: boolean().optional(),
9613
9737
  description: string$1().optional()
9614
9738
  });
9615
- var inputFields = record$3(id$1, field.extend({ default: json$2.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.");
9616
- var flowInputFields = record$3(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.");
9739
+ var inputFields = record$3(id$2, field.extend({ default: json$2.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.");
9740
+ var flowInputFields = record$3(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.");
9617
9741
  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.");
9618
- var flowInputFieldsView = record$3(id$1, field.extend({
9742
+ var flowInputFieldsView = record$3(id$2, field.extend({
9619
9743
  schema: json$2,
9620
9744
  nullable: boolean()
9621
9745
  }));
9622
- var outputFields = record$3(id$1, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9746
+ var outputFields = record$3(id$2, field).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true.");
9623
9747
  var expression = strictObject({
9624
9748
  left: operand,
9625
9749
  operator: authoringDefinitionSchemas.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,
@@ -9633,20 +9757,20 @@ var when = union([
9633
9757
  ]);
9634
9758
  var authoringConfigurations = {
9635
9759
  "webhook-response": strictObject({}),
9636
- "workflow": strictObject({ flowId: id$1 }),
9760
+ "workflow": strictObject({ flowId: id$2 }),
9637
9761
  "start": strictObject({ inputDefs: flowInputFields.default({}) }),
9638
9762
  "outputs": strictObject({ outputDefs: flowOutputFields.default({}) }),
9639
- "error": strictObject({ sourceFlowIds: array(id$1).optional() }),
9763
+ "error": strictObject({ sourceFlowIds: array(id$2).optional() }),
9640
9764
  "webhook": authoringDefinitionSchemas.webhook.omit({ bodyFields: true }).extend({ body: inputFields }).strict(),
9641
9765
  "cron": strictObject({ schedule: authoringDefinitionSchemas.schedule }),
9642
9766
  "poll": strictObject({
9643
- key: id$1,
9644
- connectionId: id$1.optional(),
9767
+ key: id$2,
9768
+ connectionId: id$2.optional(),
9645
9769
  schedule: authoringDefinitionSchemas.schedule
9646
9770
  }),
9647
9771
  "integration": strictObject({
9648
- key: id$1,
9649
- connectionId: id$1.optional()
9772
+ key: id$2,
9773
+ connectionId: id$2.optional()
9650
9774
  }),
9651
9775
  "code": strictObject({
9652
9776
  inputs: inputFields,
@@ -9656,6 +9780,7 @@ var authoringConfigurations = {
9656
9780
  "connector": authoringDefinitionSchemas.connector.omit({ outputMode: true }).strict(),
9657
9781
  "openapi": authoringOpenApiSchema,
9658
9782
  "http-request": httpRequestConfigSchema,
9783
+ "dedupe": dedupeConfigSchema,
9659
9784
  "agent": authoringDefinitionSchemas.agent.omit({
9660
9785
  prompt: true,
9661
9786
  tools: true
@@ -9670,7 +9795,7 @@ var authoringConfigurations = {
9670
9795
  "condition": strictObject({
9671
9796
  match: _enum(["first", "all"]),
9672
9797
  branches: array(strictObject({
9673
- name: id$1,
9798
+ name: id$2,
9674
9799
  description: string$1().optional(),
9675
9800
  when
9676
9801
  }))
@@ -9687,7 +9812,7 @@ var authoringConfigurations = {
9687
9812
  };
9688
9813
  var updates = strictObject({
9689
9814
  onError: _enum(["stop", "error"]).optional(),
9690
- name: id$1.optional(),
9815
+ name: id$2.optional(),
9691
9816
  description: string$1().optional(),
9692
9817
  icon: string$1().optional(),
9693
9818
  maxExecutions: int().positive().optional(),
@@ -9698,13 +9823,13 @@ var updates = strictObject({
9698
9823
  var authoringEditSchema = discriminatedUnion("op", [
9699
9824
  strictObject({
9700
9825
  op: literal("node.add"),
9701
- 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."),
9826
+ 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."),
9702
9827
  type,
9703
- name: id$1,
9828
+ name: id$2,
9704
9829
  onError: _enum(["stop", "error"]).optional(),
9705
9830
  retry: retryConfigurationSchema.optional(),
9706
9831
  config: patch.optional(),
9707
- inputs: record$3(id$1, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9832
+ inputs: record$3(id$2, authoringSourceSchema).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),
9708
9833
  code: string$1().optional(),
9709
9834
  prompt: string$1().optional()
9710
9835
  }),
@@ -9712,12 +9837,12 @@ var authoringEditSchema = discriminatedUnion("op", [
9712
9837
  op: literal("node.update"),
9713
9838
  node: referenceSchema,
9714
9839
  set: updates.optional(),
9715
- clear: array(array(id$1).min(1)).optional()
9840
+ clear: array(array(id$2).min(1)).optional()
9716
9841
  }),
9717
9842
  strictObject({
9718
9843
  op: literal("node.refresh"),
9719
9844
  node: referenceSchema,
9720
- tool: id$1.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")
9845
+ tool: id$2.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")
9721
9846
  }),
9722
9847
  strictObject({
9723
9848
  op: literal("node.remove"),
@@ -9726,20 +9851,20 @@ var authoringEditSchema = discriminatedUnion("op", [
9726
9851
  strictObject({
9727
9852
  op: literal("input.set"),
9728
9853
  node: referenceSchema,
9729
- input: id$1,
9854
+ input: id$2,
9730
9855
  source: authoringSourceSchema
9731
9856
  }),
9732
9857
  strictObject({
9733
9858
  op: _enum(["edge.connect", "edge.disconnect"]),
9734
9859
  source: referenceSchema,
9735
9860
  target: referenceSchema,
9736
- branch: id$1.optional()
9861
+ branch: id$2.optional()
9737
9862
  }),
9738
9863
  strictObject({
9739
9864
  op: literal("text.edit"),
9740
9865
  node: referenceSchema,
9741
9866
  field: _enum(["code", "prompt"]),
9742
- oldText: id$1,
9867
+ oldText: id$2,
9743
9868
  newText: string$1()
9744
9869
  }),
9745
9870
  strictObject({
@@ -9750,15 +9875,15 @@ var authoringEditSchema = discriminatedUnion("op", [
9750
9875
  })
9751
9876
  ]);
9752
9877
  strictObject({
9753
- baseRevision: id$1,
9754
- requestId: id$1.max(256),
9878
+ baseRevision: id$2,
9879
+ requestId: id$2.max(256),
9755
9880
  edits: array(authoringEditSchema).min(1).max(1e3)
9756
9881
  });
9757
9882
  strictObject({
9758
- revision: id$1.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9759
- 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."),
9883
+ revision: id$2.optional().describe("Fixed revision from a previous read; omit to read the current draft."),
9884
+ 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."),
9760
9885
  text: strictObject({
9761
- node: id$1,
9886
+ node: id$2,
9762
9887
  field: _enum(["code", "prompt"]),
9763
9888
  start: int().positive().default(1),
9764
9889
  lines: int().min(1).max(200).default(80)
@@ -9767,42 +9892,43 @@ strictObject({
9767
9892
  not: { required: ["nodes", "text"] },
9768
9893
  description: "Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."
9769
9894
  });
9770
- strictObject({ revisionId: id$1 });
9895
+ strictObject({ revisionId: id$2 });
9771
9896
  strictObject({
9772
- revision: id$1.optional(),
9773
- query: id$1.max(1e3),
9897
+ revision: id$2.optional(),
9898
+ query: id$2.max(1e3),
9774
9899
  type: type.optional(),
9775
9900
  offset: int().nonnegative().default(0),
9776
9901
  limit: int().min(1).max(100).default(20)
9777
9902
  });
9778
9903
  strictObject({
9779
9904
  type: type.optional(),
9780
- action: id$1.optional()
9905
+ action: id$2.optional()
9781
9906
  }).refine((v) => v.type == null || v.action == null, "Choose type or action.");
9907
+ `${[...findEngineContract(currentEngineContract).builtinModules].filter((name) => !name.startsWith("node:")).join(", ")}`;
9782
9908
  var authoringDiagnosticSchema = object({
9783
- code: id$1,
9909
+ code: id$2,
9784
9910
  message: string$1(),
9785
- nodes: array(id$1),
9911
+ nodes: array(id$2),
9786
9912
  field: string$1().optional(),
9787
9913
  line: number().optional(),
9788
9914
  column: number().optional()
9789
9915
  });
9790
9916
  var authoringCheckResponse = object({
9791
- flowId: id$1,
9792
- revisionId: id$1,
9917
+ flowId: id$2,
9918
+ revisionId: id$2,
9793
9919
  valid: boolean(),
9794
9920
  diagnostics: array(authoringDiagnosticSchema),
9795
9921
  version: literal(1)
9796
9922
  });
9797
9923
  var authoringEditResponse = object({
9798
- flowId: id$1,
9924
+ flowId: id$2,
9799
9925
  saved: literal(true),
9800
- revision: id$1,
9801
- nodes: record$3(id$1, id$1),
9926
+ revision: id$2,
9927
+ nodes: record$3(id$2, id$2),
9802
9928
  changes: array(object({
9803
9929
  index: int(),
9804
- op: id$1,
9805
- node: id$1.optional()
9930
+ op: id$2,
9931
+ node: id$2.optional()
9806
9932
  })),
9807
9933
  validation: object({
9808
9934
  status: _enum([
@@ -9815,8 +9941,8 @@ var authoringEditResponse = object({
9815
9941
  version: literal(1)
9816
9942
  });
9817
9943
  var authoringReadResponse = object({
9818
- flowId: id$1,
9819
- revision: id$1,
9944
+ flowId: id$2,
9945
+ revision: id$2,
9820
9946
  data: object({
9821
9947
  nodes: array(record$3(string$1(), json$2)).optional(),
9822
9948
  edges: array(json$2).optional(),
@@ -9825,12 +9951,12 @@ var authoringReadResponse = object({
9825
9951
  version: literal(1)
9826
9952
  });
9827
9953
  var authoringSearchResponse = object({
9828
- flowId: id$1,
9829
- revision: id$1,
9954
+ flowId: id$2,
9955
+ revision: id$2,
9830
9956
  data: object({
9831
9957
  matches: array(object({
9832
- node: id$1.optional(),
9833
- field: id$1,
9958
+ node: id$2.optional(),
9959
+ field: id$2,
9834
9960
  line: int().optional(),
9835
9961
  excerpt: string$1()
9836
9962
  })),
@@ -9885,11 +10011,14 @@ var controlErrorCode = {
9885
10011
  triggerKeyInvalid: "trigger-key.invalid",
9886
10012
  triggerKeyNotFound: "trigger-key.not-found",
9887
10013
  triggerNotFound: "trigger.not-found",
10014
+ tagInvalid: "tag.invalid",
10015
+ tagConflict: "tag.conflict",
10016
+ tagNotFound: "tag.not-found",
9888
10017
  variableInvalid: "variable.invalid",
9889
10018
  variableLimitReached: "variable.limit-reached",
9890
10019
  variableNotFound: "variable.not-found"
9891
10020
  };
9892
- controlErrorCode.eventSourceInvalid, controlErrorCode.eventSourceIdentityUnavailable, controlErrorCode.eventSourceNotFound, controlErrorCode.eventSourceConflict, controlErrorCode.authenticationRequired, controlErrorCode.authorizationDenied, controlErrorCode.bindingUnresolved, controlErrorCode.connectorActionNotFound, controlErrorCode.connectorAccessConflict, controlErrorCode.connectorAccessInvalid, controlErrorCode.connectorAccessRequired, controlErrorCode.connectorAccessUnsupported, controlErrorCode.connectorUnconfigured, controlErrorCode.connectorUnavailable, controlErrorCode.connectorConsoleUnconfigured, controlErrorCode.engineUnavailable, controlErrorCode.engineUnsupported, controlErrorCode.flowInvalid, controlErrorCode.flowRepairRequired, controlErrorCode.flowUpgradeRequired, controlErrorCode.flowNotFound, controlErrorCode.flowBusy, controlErrorCode.flowConflict, controlErrorCode.flowPresentationConflict, controlErrorCode.flowRevisionConflict, controlErrorCode.liveConflict, controlErrorCode.liveNotFound, controlErrorCode.pageInvalidCursor, controlErrorCode.publicationConflict, controlErrorCode.publicationNotFound, controlErrorCode.publicationUnsupported, controlErrorCode.publishOperationNotFound, controlErrorCode.routeNotFound, controlErrorCode.runConflict, controlErrorCode.runEventsExpired, controlErrorCode.runInvalid, controlErrorCode.runNotFound, controlErrorCode.runNotTerminal, controlErrorCode.runOverloaded, controlErrorCode.runWaitNotFound, controlErrorCode.triggerKeyInvalid, controlErrorCode.triggerKeyNotFound, controlErrorCode.triggerNotFound, controlErrorCode.variableInvalid, controlErrorCode.variableLimitReached, controlErrorCode.variableNotFound;
10021
+ controlErrorCode.eventSourceInvalid, controlErrorCode.eventSourceIdentityUnavailable, controlErrorCode.eventSourceNotFound, controlErrorCode.eventSourceConflict, controlErrorCode.authenticationRequired, controlErrorCode.authorizationDenied, controlErrorCode.bindingUnresolved, controlErrorCode.connectorActionNotFound, controlErrorCode.connectorAccessConflict, controlErrorCode.connectorAccessInvalid, controlErrorCode.connectorAccessRequired, controlErrorCode.connectorAccessUnsupported, controlErrorCode.connectorUnconfigured, controlErrorCode.connectorUnavailable, controlErrorCode.connectorConsoleUnconfigured, controlErrorCode.engineUnavailable, controlErrorCode.engineUnsupported, controlErrorCode.flowInvalid, controlErrorCode.flowRepairRequired, controlErrorCode.flowUpgradeRequired, controlErrorCode.flowNotFound, controlErrorCode.flowBusy, controlErrorCode.flowConflict, controlErrorCode.flowPresentationConflict, controlErrorCode.flowRevisionConflict, controlErrorCode.liveConflict, controlErrorCode.liveNotFound, controlErrorCode.pageInvalidCursor, controlErrorCode.publicationConflict, controlErrorCode.publicationNotFound, controlErrorCode.publicationUnsupported, controlErrorCode.publishOperationNotFound, controlErrorCode.routeNotFound, controlErrorCode.runConflict, controlErrorCode.runEventsExpired, controlErrorCode.runInvalid, controlErrorCode.runNotFound, controlErrorCode.runNotTerminal, controlErrorCode.runOverloaded, controlErrorCode.runWaitNotFound, controlErrorCode.triggerKeyInvalid, controlErrorCode.triggerKeyNotFound, controlErrorCode.triggerNotFound, controlErrorCode.tagInvalid, controlErrorCode.tagConflict, controlErrorCode.tagNotFound, controlErrorCode.variableInvalid, controlErrorCode.variableLimitReached, controlErrorCode.variableNotFound;
9893
10022
  var ApiError = class extends Error {
9894
10023
  constructor(status, code, message, details) {
9895
10024
  super(message);
@@ -10366,7 +10495,7 @@ function decodeEntries(values, current) {
10366
10495
  return parsed.data;
10367
10496
  }
10368
10497
  //#endregion
10369
- //#region src/control/common/providerIconSprite.ts
10498
+ //#region src/connector/common/providerIconSprite.ts
10370
10499
  /** Optional artwork must never make an otherwise usable catalog unavailable. */
10371
10500
  function providerIconAppearance(metadata, position) {
10372
10501
  if (!metadata || typeof metadata != "object" || !position || typeof position != "object") return {};
@@ -10798,6 +10927,30 @@ function connectorProvider(value) {
10798
10927
  };
10799
10928
  }
10800
10929
  //#endregion
10930
+ //#region src/event-source/common/view.ts
10931
+ var id$1 = string$1().min(1).max(256);
10932
+ /** Public projection of a source that Connector validates and Open Flow exposes unchanged. */
10933
+ var eventSourceViewSchema = object({
10934
+ appId: id$1.nullable(),
10935
+ workspaceId: id$1.optional(),
10936
+ installationId: id$1.optional(),
10937
+ organizationId: id$1.optional(),
10938
+ projectId: id$1.optional(),
10939
+ projectKey: id$1.optional(),
10940
+ subscriptionStatus: _enum([
10941
+ "idle",
10942
+ "pending",
10943
+ "ready",
10944
+ "error"
10945
+ ]).optional(),
10946
+ lastError: string$1().optional(),
10947
+ signingSecretConfigured: boolean().optional(),
10948
+ manageSubscriptions: boolean().nullable(),
10949
+ verificationTokenConfigured: boolean().nullable(),
10950
+ encryptKeyConfigured: boolean().nullable(),
10951
+ verifiedAt: string$1().nullable()
10952
+ });
10953
+ //#endregion
10801
10954
  //#region src/control/common/eventSources.ts
10802
10955
  var id = string$1().min(1).max(256);
10803
10956
  var eventType = string$1().regex(/^[a-z][a-z0-9_.:]{0,127}$/);
@@ -10817,29 +10970,12 @@ var eventSourceSchema = object({
10817
10970
  "fireflies",
10818
10971
  "jira"
10819
10972
  ]),
10820
- appId: id.nullable(),
10821
- workspaceId: id.optional(),
10822
- installationId: id.optional(),
10823
- organizationId: id.optional(),
10824
- projectId: id.optional(),
10825
- projectKey: id.optional(),
10826
- subscriptionStatus: _enum([
10827
- "idle",
10828
- "pending",
10829
- "ready",
10830
- "error"
10831
- ]).optional(),
10832
- lastError: string$1().optional(),
10833
- signingSecretConfigured: boolean().optional(),
10973
+ ...eventSourceViewSchema.shape,
10834
10974
  connectionId: id,
10835
10975
  teamId: id.nullable(),
10836
10976
  enabled: boolean(),
10837
10977
  eventTypes: array(eventType),
10838
- manageSubscriptions: boolean().nullable(),
10839
- verificationTokenConfigured: boolean().nullable(),
10840
- encryptKeyConfigured: boolean().nullable(),
10841
10978
  endpointUrl: string$1().nullable(),
10842
- verifiedAt: string$1().nullable(),
10843
10979
  lastReceivedAt: string$1().nullable(),
10844
10980
  updatedAt: string$1(),
10845
10981
  consumers: array(object({
@@ -10848,21 +10984,6 @@ var eventSourceSchema = object({
10848
10984
  triggerNodeId: id
10849
10985
  }))
10850
10986
  });
10851
- eventSourceSchema.pick({
10852
- appId: true,
10853
- workspaceId: true,
10854
- installationId: true,
10855
- organizationId: true,
10856
- projectId: true,
10857
- projectKey: true,
10858
- subscriptionStatus: true,
10859
- lastError: true,
10860
- signingSecretConfigured: true,
10861
- manageSubscriptions: true,
10862
- verificationTokenConfigured: true,
10863
- encryptKeyConfigured: true,
10864
- verifiedAt: true
10865
- });
10866
10987
  function decodeEventSource(value) {
10867
10988
  return eventSourceSchema.parse(value);
10868
10989
  }
@@ -11169,6 +11290,7 @@ function flow(value) {
11169
11290
  publicationId: string(target.publicationId),
11170
11291
  revisionId: string(target.revisionId)
11171
11292
  } },
11293
+ tagIds: source.tagIds === void 0 ? [] : strings(source.tagIds),
11172
11294
  createdAt: string(source.createdAt),
11173
11295
  ...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
11174
11296
  draftRevisionId: string(source.draftRevisionId),
@@ -11614,6 +11736,33 @@ function randomId() {
11614
11736
  return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
11615
11737
  }
11616
11738
  //#endregion
11739
+ //#region src/control/common/tags.ts
11740
+ function normalizeFlowQuery(query = {}) {
11741
+ return {
11742
+ query: query.query?.trim().toLowerCase() ?? "",
11743
+ tagIds: [...new Set(query.tagIds ?? [])].toSorted(),
11744
+ untagged: query.untagged ?? false
11745
+ };
11746
+ }
11747
+ function decodeTag(value) {
11748
+ const source = record$1(value);
11749
+ if (source.version != 1) return invalidResponse();
11750
+ return {
11751
+ tagId: string(source.tagId),
11752
+ name: string(source.name),
11753
+ version: 1
11754
+ };
11755
+ }
11756
+ function decodeTagListItem(value) {
11757
+ const source = record$1(value);
11758
+ const referenceCount = integer(source.referenceCount);
11759
+ if (referenceCount < 0) return invalidResponse();
11760
+ return {
11761
+ ...decodeTag(source),
11762
+ referenceCount
11763
+ };
11764
+ }
11765
+ //#endregion
11617
11766
  //#region src/control/common/api.ts
11618
11767
  function decodeRunEvent(value) {
11619
11768
  const source = record$1(value);
@@ -11717,7 +11866,7 @@ function decodeRunEvent(value) {
11717
11866
  switch (kind) {
11718
11867
  case "node.started": {
11719
11868
  const nodeKind = payload.nodeKind;
11720
- 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();
11869
+ 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();
11721
11870
  return {
11722
11871
  ...base,
11723
11872
  kind,
@@ -11844,6 +11993,10 @@ var ControlClient = class {
11844
11993
  }
11845
11994
  async listFlows(options = {}) {
11846
11995
  const parameters = new URLSearchParams();
11996
+ const filter = normalizeFlowQuery(options);
11997
+ if (filter.query) parameters.set("query", filter.query);
11998
+ if (filter.tagIds.length) parameters.set("tagIds", filter.tagIds.join(","));
11999
+ if (filter.untagged) parameters.set("untagged", "true");
11847
12000
  if (options.cursor != null) parameters.set("cursor", options.cursor);
11848
12001
  if (options.limit != null) parameters.set("limit", String(options.limit));
11849
12002
  if (options.includeTotal != null) parameters.set("includeTotal", String(options.includeTotal));
@@ -11933,15 +12086,17 @@ var ControlClient = class {
11933
12086
  file,
11934
12087
  name: options.name,
11935
12088
  teamId: options.teamId,
12089
+ tagIds: options.tagIds,
11936
12090
  version: 1
11937
12091
  })
11938
12092
  }));
11939
12093
  }
11940
- async createFlow(name, idempotencyKey = `flow-${randomId()}`, teamId) {
12094
+ async createFlow(name, idempotencyKey = `flow-${randomId()}`, teamId, tagIds) {
11941
12095
  return flow(await this.request("/v1/flows", {
11942
12096
  body: JSON.stringify({
11943
12097
  name,
11944
12098
  ...teamId == null ? {} : { teamId },
12099
+ ...tagIds == null ? {} : { tagIds },
11945
12100
  version: 1
11946
12101
  }),
11947
12102
  headers: { "idempotency-key": idempotencyKey },
@@ -11976,15 +12131,68 @@ var ControlClient = class {
11976
12131
  if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
11977
12132
  return source.listeners.map(errorListener);
11978
12133
  }
11979
- async renameFlow(flowId, name) {
11980
- return flow(await this.request(`/v1/flows/${segment(flowId)}`, {
12134
+ async listTags(signal) {
12135
+ const source = record$1(await this.request("/v1/tags", { signal }));
12136
+ if (source.version != 1 || !Array.isArray(source.tags)) return invalidResponse();
12137
+ return {
12138
+ tags: source.tags.map(decodeTagListItem),
12139
+ version: 1
12140
+ };
12141
+ }
12142
+ async createTag(name) {
12143
+ return decodeTag(await this.request("/v1/tags", {
12144
+ method: "POST",
11981
12145
  body: JSON.stringify({
11982
12146
  name,
11983
12147
  version: 1
11984
- }),
11985
- method: "PATCH"
12148
+ })
12149
+ }));
12150
+ }
12151
+ async renameTag(tagId, name) {
12152
+ return decodeTag(await this.request(`/v1/tags/${segment(tagId)}`, {
12153
+ method: "PATCH",
12154
+ body: JSON.stringify({
12155
+ name,
12156
+ version: 1
12157
+ })
12158
+ }));
12159
+ }
12160
+ async deleteTag(tagId) {
12161
+ if (record$1(await this.request(`/v1/tags/${segment(tagId)}`, { method: "DELETE" })).version != 1) invalidResponse();
12162
+ }
12163
+ async setFlowTags(flowId, tagIds) {
12164
+ return flow(await this.request(`/v1/flows/${segment(flowId)}/tags`, {
12165
+ method: "PUT",
12166
+ body: JSON.stringify({
12167
+ tagIds,
12168
+ version: 1
12169
+ })
12170
+ }));
12171
+ }
12172
+ async updateFlow(flowId, changes) {
12173
+ return flow(await this.request(`/v1/flows/${segment(flowId)}`, {
12174
+ method: "PATCH",
12175
+ body: JSON.stringify({
12176
+ ...changes,
12177
+ version: 1
12178
+ })
11986
12179
  }));
11987
12180
  }
12181
+ async getFlowState(flowId, scope, values = false) {
12182
+ const result = flowStateViewSchema.safeParse(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}&values=${values}`));
12183
+ return result.success && result.data.scope === scope ? result.data : invalidResponse();
12184
+ }
12185
+ async clearFlowState(flowId, scope, key) {
12186
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/state?scope=${scope}${key == null ? "" : `&key=${encodeURIComponent(key)}`}`, { method: "DELETE" }));
12187
+ if (source.version !== 1 || source.cleared !== true) invalidResponse();
12188
+ }
12189
+ async clearFlowDedupe(flowId, scope, space) {
12190
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/dedupe?scope=${scope}&space=${encodeURIComponent(space)}`, { method: "DELETE" }));
12191
+ if (source.version !== 1 || source.cleared !== true) invalidResponse();
12192
+ }
12193
+ async renameFlow(flowId, name) {
12194
+ return this.updateFlow(flowId, { name });
12195
+ }
11988
12196
  async deleteFlow(flowId) {
11989
12197
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, { method: "DELETE" }));
11990
12198
  }