@oomol-lab/open-flow 0.1.0-beta.50 → 0.1.0-beta.52

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 (44) hide show
  1. package/dist/browser/{createResourceDialog-CSltk-qY.js → createResourceDialog-BsaBMf7_.js} +2 -1
  2. package/dist/browser/flow-authoring-node.d.ts +3 -1
  3. package/dist/browser/flow-authoring.js +82 -3
  4. package/dist/browser/flow-change-schema.d.ts +1 -1
  5. package/dist/browser/flow-change.d.ts +15 -2
  6. package/dist/browser/flow-change.js +81 -3
  7. package/dist/browser/{flowChanges-DbYrpHnS.js → flowChanges-DtraMpva.js} +3858 -1921
  8. package/dist/browser/{flowWorkspace-CjwpbVBR.js → flowWorkspace-DLgti4Lk.js} +1353 -513
  9. package/dist/browser/{workbenchSelect-oVujN2z6.js → icons-0s-Q_3lp.js} +92 -35
  10. package/dist/browser/licenses.md +204 -0
  11. package/dist/browser/preview.css +302 -179
  12. package/dist/browser/preview.js +4829 -2198
  13. package/dist/browser/theme.css +2 -0
  14. package/dist/browser/ui-hostNavigationActions.d.ts +13 -0
  15. package/dist/browser/ui-hostTooltip.d.ts +8 -0
  16. package/dist/browser/ui-logo.d.ts +5 -0
  17. package/dist/browser/ui.css +102 -8
  18. package/dist/browser/ui.d.ts +3 -0
  19. package/dist/browser/ui.js +176 -11
  20. package/dist/browser/workbench-contract.d.ts +5 -11
  21. package/dist/browser/workbench.css +366 -200
  22. package/dist/browser/workbench.d.ts +1 -1
  23. package/dist/browser/workbench.js +1154 -379
  24. package/dist/browser/workbenchSelect-BqUPacsr.js +31 -0
  25. package/dist/common/authoringExamples.d.ts +4 -2
  26. package/dist/common/control-api-conformance.js +129 -11
  27. package/dist/common/control-api.d.ts +38 -5
  28. package/dist/common/control-api.js +198 -12
  29. package/dist/common/control-requests.d.ts +4 -0
  30. package/dist/common/control-requests.js +1320 -67
  31. package/dist/common/flow-encoding.js +64 -5
  32. package/dist/common/flow-semantics.js +823 -316
  33. package/dist/common/integration-trigger.js +39 -1
  34. package/dist/common/mcp.js +129 -11
  35. package/dist/common/openapi.d.ts +53 -0
  36. package/dist/common/openapi.js +10390 -0
  37. package/dist/common/poll-trigger.js +39 -1
  38. package/dist/common/provider-triggers.js +39 -1
  39. package/dist/common/run-events.js +26 -1
  40. package/dist/common/scheduler.d.ts +4 -1
  41. package/dist/common/scheduler.js +122 -6
  42. package/dist/common/trigger-contract.d.ts +2 -0
  43. package/dist/common/webhook-trigger.js +39 -1
  44. package/package.json +5 -1
@@ -5822,6 +5822,15 @@ function json$2(params) {
5822
5822
  });
5823
5823
  return jsonSchema;
5824
5824
  }
5825
+ //#endregion
5826
+ //#region src/openapi/common/authBindings.ts
5827
+ /** Never allow credentials to enter a Revision as literal node inputs. */
5828
+ function assertOpenApiAuthBindings(document) {
5829
+ for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
5830
+ if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
5831
+ for (const [handle, mapping] of Object.entries(node.inputs)) if (handle.startsWith("auth.") && (mapping.kind == "value" || mapping.kind == "sources" && mapping.sources.some((source) => source.kind == "flow"))) throw new TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.");
5832
+ }
5833
+ }
5825
5834
  function checkJsonDepth(value, depth = 0) {
5826
5835
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
5827
5836
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -5955,6 +5964,24 @@ var managed = object({
5955
5964
  action: text,
5956
5965
  connectionId: text.optional()
5957
5966
  }),
5967
+ object({
5968
+ kind: literal("openapi"),
5969
+ sourceUrl: text,
5970
+ method: text,
5971
+ path: text,
5972
+ serverUrl: text,
5973
+ document: json$1,
5974
+ auth: array(object({
5975
+ id: text,
5976
+ type: _enum([
5977
+ "bearer",
5978
+ "basic",
5979
+ "apiKey"
5980
+ ]),
5981
+ name: text.optional(),
5982
+ in: _enum(["header", "query"]).optional()
5983
+ }))
5984
+ }),
5958
5985
  object({
5959
5986
  kind: literal("llm"),
5960
5987
  mode: _enum(["chat", "json"])
@@ -6071,6 +6098,7 @@ var endpoint = object({
6071
6098
  ])),
6072
6099
  successStatus: number()
6073
6100
  });
6101
+ var sourceFlowIds = array(text.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
6074
6102
  var trigger = {
6075
6103
  name: text,
6076
6104
  description: text.optional(),
@@ -6128,6 +6156,11 @@ var node = union([
6128
6156
  ...trigger,
6129
6157
  kind: literal("manual")
6130
6158
  }),
6159
+ strictObject({
6160
+ ...trigger,
6161
+ kind: literal("error"),
6162
+ sourceFlowIds: sourceFlowIds.optional()
6163
+ }),
6131
6164
  object({
6132
6165
  ...trigger,
6133
6166
  kind: literal("webhook"),
@@ -6199,7 +6232,11 @@ var document = object({
6199
6232
  tasks: record(text, managed)
6200
6233
  });
6201
6234
  var revision = object({
6202
- modelVersion: union([literal(2), literal(4)]),
6235
+ modelVersion: union([
6236
+ literal(2),
6237
+ literal(4),
6238
+ literal(5)
6239
+ ]),
6203
6240
  document,
6204
6241
  modules: record(text, module)
6205
6242
  });
@@ -6209,9 +6246,17 @@ revision.extend({
6209
6246
  });
6210
6247
  function decodeRevisionContent(value) {
6211
6248
  checkJsonDepth(value);
6212
- return revision.parse(value);
6249
+ const content = revision.parse(value);
6250
+ checkErrorModelVersion(content);
6251
+ assertOpenApiAuthBindings(content.document);
6252
+ return content;
6213
6253
  }
6214
6254
  var shapes = {
6255
+ "graph.trigger.sources.set": {
6256
+ nodeId: text,
6257
+ before: sourceFlowIds.optional(),
6258
+ value: sourceFlowIds.optional()
6259
+ },
6215
6260
  "binding.create": {
6216
6261
  bindingId: text,
6217
6262
  binding
@@ -6365,6 +6410,11 @@ var shapes = {
6365
6410
  before: text.optional(),
6366
6411
  value: text.optional()
6367
6412
  },
6413
+ "task.openapi.set": {
6414
+ taskId: text,
6415
+ before: managed,
6416
+ value: managed
6417
+ },
6368
6418
  "task.agent.set": {
6369
6419
  taskId: text,
6370
6420
  before: managed,
@@ -6385,6 +6435,9 @@ array(union([...new Map(Object.entries(shapes).map(([kind, shape]) => [kind, sha
6385
6435
  kind: literal(kind),
6386
6436
  ...shape
6387
6437
  })])).values()])).min(1);
6438
+ function checkErrorModelVersion(content) {
6439
+ if (content.modelVersion < 5 && [content.document.graph, ...Object.values(content.document.subflows).map((item) => item.graph)].some((item) => Object.values(item.nodes).some((itemNode) => itemNode.kind == "error"))) throw new TypeError("Error workflows require Flow model version 5.");
6440
+ }
6388
6441
  //#endregion
6389
6442
  //#region src/flow/common/condition.ts
6390
6443
  var unaryOperator = (operator) => operator.startsWith("is");
@@ -9566,6 +9619,67 @@ function createSchemaComparer() {
9566
9619
  createSchemaComparer();
9567
9620
  //#endregion
9568
9621
  //#region src/trigger/common/contract.ts
9622
+ var errorOutputs = [
9623
+ {
9624
+ handle: "workflow",
9625
+ nullable: false,
9626
+ jsonSchema: {
9627
+ type: "object",
9628
+ additionalProperties: false,
9629
+ required: [
9630
+ "flowId",
9631
+ "name",
9632
+ "revisionId",
9633
+ "publicationId"
9634
+ ],
9635
+ properties: {
9636
+ flowId: { type: "string" },
9637
+ name: { type: "string" },
9638
+ revisionId: { type: "string" },
9639
+ publicationId: { type: ["string", "null"] }
9640
+ }
9641
+ }
9642
+ },
9643
+ {
9644
+ handle: "execution",
9645
+ nullable: false,
9646
+ jsonSchema: {
9647
+ type: "object",
9648
+ additionalProperties: false,
9649
+ required: [
9650
+ "runId",
9651
+ "status",
9652
+ "startedAt",
9653
+ "finishedAt"
9654
+ ],
9655
+ properties: {
9656
+ runId: { type: "string" },
9657
+ status: { enum: ["failed", "indeterminate"] },
9658
+ startedAt: { type: ["string", "null"] },
9659
+ finishedAt: { type: "string" }
9660
+ }
9661
+ }
9662
+ },
9663
+ {
9664
+ handle: "error",
9665
+ nullable: false,
9666
+ jsonSchema: {
9667
+ type: "object",
9668
+ additionalProperties: false,
9669
+ required: ["code", "message"],
9670
+ properties: {
9671
+ code: { type: "string" },
9672
+ message: { type: "string" },
9673
+ nodeId: { type: "string" },
9674
+ jobId: { type: "string" },
9675
+ path: {
9676
+ type: "array",
9677
+ items: { type: "string" }
9678
+ }
9679
+ }
9680
+ }
9681
+ }
9682
+ ];
9569
9683
  var webhookOutputs = [
9570
9684
  {
9571
9685
  handle: "headers",
@@ -9610,6 +9724,7 @@ var cronOutputs = [{
9610
9724
  }];
9611
9725
  function triggerOutputDefinitions(trigger) {
9612
9726
  switch (trigger.kind) {
9727
+ case "error": return errorOutputs;
9613
9728
  case "manual": return [];
9614
9729
  case "cron": return cronOutputs;
9615
9730
  case "poll":
@@ -9638,6 +9753,7 @@ function nodeInputPorts(document, node) {
9638
9753
  case "cron":
9639
9754
  case "integration":
9640
9755
  case "poll":
9756
+ case "error":
9641
9757
  case "manual":
9642
9758
  case "webhook": return {};
9643
9759
  }
@@ -9688,6 +9804,7 @@ function nodeOutputPorts(document, node) {
9688
9804
  case "cron":
9689
9805
  case "integration":
9690
9806
  case "poll":
9807
+ case "error":
9691
9808
  case "manual":
9692
9809
  case "webhook": return triggerOutputPorts(node);
9693
9810
  }
@@ -9839,6 +9956,7 @@ function inspectNode(document, node) {
9839
9956
  })) }))
9840
9957
  }))
9841
9958
  };
9959
+ case "error":
9842
9960
  case "manual":
9843
9961
  case "cron":
9844
9962
  case "subflow": return {
@@ -10023,6 +10141,7 @@ function triggerKey(value) {
10023
10141
  };
10024
10142
  }
10025
10143
  var triggerKinds = /* @__PURE__ */ new Set([
10144
+ "error",
10026
10145
  "cron",
10027
10146
  "integration",
10028
10147
  "poll",
@@ -10484,6 +10603,7 @@ function flow(value) {
10484
10603
  revisionId: string$1(target.revisionId)
10485
10604
  } },
10486
10605
  createdAt: string$1(source.createdAt),
10606
+ ...source.connectorTeamId == null ? {} : { connectorTeamId: string$1(source.connectorTeamId) },
10487
10607
  draftRevisionId: string$1(source.draftRevisionId),
10488
10608
  flowId: string$1(source.flowId),
10489
10609
  name: string$1(source.name),
@@ -10528,6 +10648,17 @@ function variable(value) {
10528
10648
  version: 1
10529
10649
  };
10530
10650
  }
10651
+ function errorListener(value) {
10652
+ const source = record$1(value);
10653
+ if (typeof source.enabled != "boolean") return invalidResponse();
10654
+ return {
10655
+ flowId: string$1(source.flowId),
10656
+ flowName: string$1(source.flowName),
10657
+ nodeId: string$1(source.nodeId),
10658
+ nodeName: string$1(source.nodeName),
10659
+ enabled: source.enabled
10660
+ };
10661
+ }
10531
10662
  //#endregion
10532
10663
  //#region src/control/common/publicationDecoders.ts
10533
10664
  function publication(value) {
@@ -10797,6 +10928,7 @@ function runDetails(value) {
10797
10928
  };
10798
10929
  const details = {
10799
10930
  ...summary,
10931
+ ...errorHandling(source),
10800
10932
  closureDigest: string$1(source.closureDigest),
10801
10933
  engineContract: string$1(source.engineContract),
10802
10934
  engineDigest: string$1(source.engineDigest),
@@ -10896,10 +11028,7 @@ function runResult(value) {
10896
11028
  const error = record$1(source.error);
10897
11029
  return {
10898
11030
  ...base,
10899
- error: {
10900
- code: string$1(error.code),
10901
- message: string$1(error.message)
10902
- },
11031
+ error: runFailure(error),
10903
11032
  status: "failed"
10904
11033
  };
10905
11034
  }
@@ -10907,15 +11036,52 @@ function runResult(value) {
10907
11036
  const error = record$1(source.error);
10908
11037
  return {
10909
11038
  ...base,
10910
- error: {
10911
- code: string$1(error.code),
10912
- message: string$1(error.message)
10913
- },
11039
+ error: runFailure(error),
10914
11040
  status: "indeterminate"
10915
11041
  };
10916
11042
  }
10917
11043
  return invalidResponse();
10918
11044
  }
11045
+ function errorHandling(source) {
11046
+ const errorSource = source.errorSource == null ? void 0 : record$1(source.errorSource);
11047
+ if (source.errorDispatches != null && !Array.isArray(source.errorDispatches)) return invalidResponse();
11048
+ return {
11049
+ ...errorSource == null ? {} : { errorSource: {
11050
+ flowId: string$1(errorSource.flowId),
11051
+ runId: string$1(errorSource.runId)
11052
+ } },
11053
+ ...source.errorDispatches == null ? {} : { errorDispatches: source.errorDispatches.map((value) => {
11054
+ const dispatch = record$1(value);
11055
+ const flowId = string$1(dispatch.flowId);
11056
+ switch (dispatch.status) {
11057
+ case "pending": return {
11058
+ status: "pending",
11059
+ flowId
11060
+ };
11061
+ case "dispatched": return {
11062
+ status: "dispatched",
11063
+ flowId,
11064
+ runId: string$1(dispatch.runId)
11065
+ };
11066
+ case "failed": return {
11067
+ status: "failed",
11068
+ flowId,
11069
+ message: string$1(dispatch.message)
11070
+ };
11071
+ default: return invalidResponse();
11072
+ }
11073
+ }) }
11074
+ };
11075
+ }
11076
+ function runFailure(error) {
11077
+ return {
11078
+ code: string$1(error.code),
11079
+ message: string$1(error.message),
11080
+ ...error.nodeId === void 0 ? {} : { nodeId: string$1(error.nodeId) },
11081
+ ...error.jobId === void 0 ? {} : { jobId: string$1(error.jobId) },
11082
+ ...error.path === void 0 ? {} : { path: (Array.isArray(error.path) ? error.path : invalidResponse()).map(string$1) }
11083
+ };
11084
+ }
10919
11085
  //#endregion
10920
11086
  //#region src/control/common/random.ts
10921
11087
  function randomId() {
@@ -10936,6 +11102,9 @@ function randomId() {
10936
11102
  }
10937
11103
  //#endregion
10938
11104
  //#region src/control/common/api.ts
11105
+ function isRunTerminalEvent(event) {
11106
+ return event?.kind == "run.completed" || event?.kind == "run.failed" || event?.kind == "run.canceled" || event?.kind == "run.indeterminate";
11107
+ }
10939
11108
  function decodeRunEvent(value) {
10940
11109
  const source = record$1(value);
10941
11110
  const sequence = integer$1(source.sequence);
@@ -11030,7 +11199,7 @@ function decodeRunEvent(value) {
11030
11199
  switch (kind) {
11031
11200
  case "node.started": {
11032
11201
  const nodeKind = payload.nodeKind;
11033
- if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "subflow" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
11202
+ if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "openapi" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "subflow" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
11034
11203
  return {
11035
11204
  ...base,
11036
11205
  kind,
@@ -11139,6 +11308,18 @@ var ControlClient = class {
11139
11308
  constructor(requestControl) {
11140
11309
  this.requestControl = requestControl;
11141
11310
  }
11311
+ async loadOpenApiDocument(url, signal) {
11312
+ const result = record$1(await this.request("/v1/openapi/document", {
11313
+ method: "POST",
11314
+ body: JSON.stringify({
11315
+ url,
11316
+ version: 1
11317
+ }),
11318
+ signal
11319
+ }));
11320
+ if (result.version != 1) return invalidResponse();
11321
+ return jsonValue(result.document);
11322
+ }
11142
11323
  async listFlows(options = {}) {
11143
11324
  const parameters = new URLSearchParams();
11144
11325
  if (options.cursor != null) parameters.set("cursor", options.cursor);
@@ -11214,6 +11395,11 @@ var ControlClient = class {
11214
11395
  async getFlow(flowId) {
11215
11396
  return flow(await this.request(`/v1/flows/${segment(flowId)}`));
11216
11397
  }
11398
+ async getErrorListeners(flowId, signal) {
11399
+ const source = record$1(await this.request(`/v1/flows/${segment(flowId)}/error-listeners`, { signal }));
11400
+ if (source.version != 1 || !Array.isArray(source.listeners)) return invalidResponse();
11401
+ return source.listeners.map(errorListener);
11402
+ }
11217
11403
  async renameFlow(flowId, name) {
11218
11404
  return flow(await this.request(`/v1/flows/${segment(flowId)}`, {
11219
11405
  body: JSON.stringify({
@@ -11695,4 +11881,4 @@ var ControlClient = class {
11695
11881
  }
11696
11882
  };
11697
11883
  //#endregion
11698
- export { ApiError, ControlClient, actionSummary, controlErrorCode, controlErrorMetadata, connectorAccess as decodeConnectorAccess, connectorAccessSnapshot as decodeConnectorAccessSnapshot, decodeEventSource, decodeEventSources, decodeResultList, decodeResultRead, decodeRunEvent, decodeTriggerCatalog, flowInspection, inspectFlowDraft, nodeDetails, parseProviderAccessSource, parseResultQuery, providerAccessBindingId, providerIconAppearance, readResult, searchTriggerKeys };
11884
+ export { ApiError, ControlClient, actionSummary, controlErrorCode, controlErrorMetadata, connectorAccess as decodeConnectorAccess, connectorAccessSnapshot as decodeConnectorAccessSnapshot, decodeEventSource, decodeEventSources, decodeResultList, decodeResultRead, decodeRunEvent, decodeTriggerCatalog, flowInspection, inspectFlowDraft, isRunTerminalEvent, nodeDetails, parseProviderAccessSource, parseResultQuery, providerAccessBindingId, providerIconAppearance, readResult, searchTriggerKeys };
@@ -7,6 +7,10 @@ export declare const waitActionBodySchema: {
7
7
  };
8
8
  };
9
9
  export declare const controlRequests: {
10
+ loadOpenApiDocument: (value: unknown) => {
11
+ url: string;
12
+ version: 1;
13
+ };
10
14
  createEventSource: (value: unknown) => {
11
15
  version: 1;
12
16
  name: string;