@oomol-lab/open-flow 0.1.0-beta.51 → 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 (41) hide show
  1. package/dist/browser/{createResourceDialog-BDtXpRSt.js → createResourceDialog-BsaBMf7_.js} +2 -1
  2. package/dist/browser/flow-authoring.js +46 -3
  3. package/dist/browser/flow-change.d.ts +6 -1
  4. package/dist/browser/flow-change.js +46 -3
  5. package/dist/browser/{flowChanges-BWSXSnMX.js → flowChanges-DtraMpva.js} +3463 -1930
  6. package/dist/browser/{flowWorkspace-DBaq2Eks.js → flowWorkspace-DLgti4Lk.js} +896 -325
  7. package/dist/browser/{workbenchSelect-C9kwcUmN.js → icons-0s-Q_3lp.js} +48 -32
  8. package/dist/browser/licenses.md +204 -0
  9. package/dist/browser/preview.css +282 -179
  10. package/dist/browser/preview.js +4289 -2193
  11. package/dist/browser/theme.css +2 -0
  12. package/dist/browser/ui-hostNavigationActions.d.ts +13 -0
  13. package/dist/browser/ui-hostTooltip.d.ts +8 -0
  14. package/dist/browser/ui-logo.d.ts +5 -0
  15. package/dist/browser/ui.css +82 -8
  16. package/dist/browser/ui.d.ts +3 -0
  17. package/dist/browser/ui.js +172 -8
  18. package/dist/browser/workbench-contract.d.ts +4 -11
  19. package/dist/browser/workbench.css +346 -200
  20. package/dist/browser/workbench.d.ts +1 -1
  21. package/dist/browser/workbench.js +1029 -365
  22. package/dist/browser/workbenchSelect-BqUPacsr.js +31 -0
  23. package/dist/common/authoringExamples.d.ts +4 -3
  24. package/dist/common/control-api-conformance.js +47 -1
  25. package/dist/common/control-api.d.ts +4 -0
  26. package/dist/common/control-api.js +51 -2
  27. package/dist/common/control-requests.d.ts +4 -0
  28. package/dist/common/control-requests.js +1299 -68
  29. package/dist/common/flow-encoding.js +34 -0
  30. package/dist/common/flow-semantics.js +674 -252
  31. package/dist/common/integration-trigger.js +23 -0
  32. package/dist/common/mcp.js +47 -1
  33. package/dist/common/openapi.d.ts +53 -0
  34. package/dist/common/openapi.js +10390 -0
  35. package/dist/common/poll-trigger.js +23 -0
  36. package/dist/common/provider-triggers.js +23 -0
  37. package/dist/common/run-events.js +1 -0
  38. package/dist/common/scheduler.d.ts +1 -1
  39. package/dist/common/scheduler.js +31 -1
  40. package/dist/common/webhook-trigger.js +23 -0
  41. package/package.json +5 -1
@@ -9369,6 +9369,24 @@ var managed = object({
9369
9369
  action: text,
9370
9370
  connectionId: text.optional()
9371
9371
  }),
9372
+ object({
9373
+ kind: literal("openapi"),
9374
+ sourceUrl: text,
9375
+ method: text,
9376
+ path: text,
9377
+ serverUrl: text,
9378
+ document: json,
9379
+ auth: array(object({
9380
+ id: text,
9381
+ type: _enum([
9382
+ "bearer",
9383
+ "basic",
9384
+ "apiKey"
9385
+ ]),
9386
+ name: text.optional(),
9387
+ in: _enum(["header", "query"]).optional()
9388
+ }))
9389
+ }),
9372
9390
  object({
9373
9391
  kind: literal("llm"),
9374
9392
  mode: _enum(["chat", "json"])
@@ -9789,6 +9807,11 @@ var shapes = {
9789
9807
  before: text.optional(),
9790
9808
  value: text.optional()
9791
9809
  },
9810
+ "task.openapi.set": {
9811
+ taskId: text,
9812
+ before: managed,
9813
+ value: managed
9814
+ },
9792
9815
  "task.agent.set": {
9793
9816
  taskId: text,
9794
9817
  before: managed,
@@ -5877,6 +5877,15 @@ var runStatuses = [
5877
5877
  //#region src/execution/common/wait.ts
5878
5878
  /** Shared by decision entry points, the editor, and durable decision storage. */
5879
5879
  var waitCommentSchema = string$1().trim().refine((value) => [...value].length <= 2e3, "Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();
5880
+ //#endregion
5881
+ //#region src/openapi/common/authBindings.ts
5882
+ /** Never allow credentials to enter a Revision as literal node inputs. */
5883
+ function assertOpenApiAuthBindings(document) {
5884
+ for (const graph of [document.graph, ...Object.values(document.subflows).map((subflow) => subflow.graph)]) for (const node of Object.values(graph.nodes)) {
5885
+ if (node.kind != "task" || node.taskId == null || document.tasks[node.taskId]?.executor.kind != "openapi") continue;
5886
+ 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.");
5887
+ }
5888
+ }
5880
5889
  function checkJsonDepth(value, depth = 0) {
5881
5890
  if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
5882
5891
  if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
@@ -6007,6 +6016,24 @@ var managed = object({
6007
6016
  action: text,
6008
6017
  connectionId: text.optional()
6009
6018
  }),
6019
+ object({
6020
+ kind: literal("openapi"),
6021
+ sourceUrl: text,
6022
+ method: text,
6023
+ path: text,
6024
+ serverUrl: text,
6025
+ document: json$2,
6026
+ auth: array(object({
6027
+ id: text,
6028
+ type: _enum([
6029
+ "bearer",
6030
+ "basic",
6031
+ "apiKey"
6032
+ ]),
6033
+ name: text.optional(),
6034
+ in: _enum(["header", "query"]).optional()
6035
+ }))
6036
+ }),
6010
6037
  object({
6011
6038
  kind: literal("llm"),
6012
6039
  mode: _enum(["chat", "json"])
@@ -6273,6 +6300,7 @@ function decodeRevisionContent(value) {
6273
6300
  checkJsonDepth(value);
6274
6301
  const content = revision.parse(value);
6275
6302
  checkErrorModelVersion(content);
6303
+ assertOpenApiAuthBindings(content.document);
6276
6304
  return content;
6277
6305
  }
6278
6306
  var shapes = {
@@ -6434,6 +6462,11 @@ var shapes = {
6434
6462
  before: text.optional(),
6435
6463
  value: text.optional()
6436
6464
  },
6465
+ "task.openapi.set": {
6466
+ taskId: text,
6467
+ before: managed,
6468
+ value: managed
6469
+ },
6437
6470
  "task.agent.set": {
6438
6471
  taskId: text,
6439
6472
  before: managed,
@@ -10193,6 +10226,7 @@ function flow$1(value) {
10193
10226
  revisionId: string(target.revisionId)
10194
10227
  } },
10195
10228
  createdAt: string(source.createdAt),
10229
+ ...source.connectorTeamId == null ? {} : { connectorTeamId: string(source.connectorTeamId) },
10196
10230
  draftRevisionId: string(source.draftRevisionId),
10197
10231
  flowId: string(source.flowId),
10198
10232
  name: string(source.name),
@@ -10774,7 +10808,7 @@ function decodeRunEvent(value) {
10774
10808
  switch (kind) {
10775
10809
  case "node.started": {
10776
10810
  const nodeKind = payload.nodeKind;
10777
- if (nodeKind !== void 0 && nodeKind !== "approval" && nodeKind !== "condition" && nodeKind !== "connector" && nodeKind !== "javascript" && nodeKind !== "llm" && nodeKind !== "agent" && nodeKind !== "subflow" && nodeKind !== "value" && nodeKind !== "wait") return invalidResponse();
10811
+ 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();
10778
10812
  return {
10779
10813
  ...base,
10780
10814
  kind,
@@ -10883,6 +10917,18 @@ var ControlClient = class {
10883
10917
  constructor(requestControl) {
10884
10918
  this.requestControl = requestControl;
10885
10919
  }
10920
+ async loadOpenApiDocument(url, signal) {
10921
+ const result = record(await this.request("/v1/openapi/document", {
10922
+ method: "POST",
10923
+ body: JSON.stringify({
10924
+ url,
10925
+ version: 1
10926
+ }),
10927
+ signal
10928
+ }));
10929
+ if (result.version != 1) return invalidResponse();
10930
+ return jsonValue(result.document);
10931
+ }
10886
10932
  async listFlows(options = {}) {
10887
10933
  const parameters = new URLSearchParams();
10888
10934
  if (options.cursor != null) parameters.set("cursor", options.cursor);
@@ -0,0 +1,53 @@
1
+ import type { JsonValue, ManagedTaskDefinition } from '../browser/flow-change.js';
2
+ type ObjectValue = {
3
+ [key: string]: JsonValue;
4
+ };
5
+ export interface OpenApiAuth {
6
+ readonly id: string;
7
+ readonly type: 'bearer' | 'basic' | 'apiKey';
8
+ readonly name?: string;
9
+ readonly in?: 'header' | 'query';
10
+ }
11
+ export interface OpenApiExecutor {
12
+ readonly kind: 'openapi';
13
+ readonly sourceUrl: string;
14
+ readonly method: string;
15
+ readonly path: string;
16
+ readonly serverUrl: string;
17
+ readonly document: JsonValue;
18
+ readonly auth: readonly OpenApiAuth[];
19
+ }
20
+ export interface OpenApiOperation {
21
+ readonly method: string;
22
+ readonly path: string;
23
+ readonly label: string;
24
+ readonly tag: string;
25
+ }
26
+ export declare function object(value: unknown): ObjectValue;
27
+ export declare function httpUrl(value: string, base?: string): string;
28
+ export declare function parseOpenApi(value: unknown): ObjectValue;
29
+ export declare function listOperations(documentValue: JsonValue): OpenApiOperation[];
30
+ export declare function servers(value: JsonValue, path: string, method: string): readonly ObjectValue[];
31
+ export declare function serverAddress(server: ObjectValue, sourceUrl: string, variables?: Readonly<Record<string, string>>): string;
32
+ export declare function securityOptions(value: JsonValue, path: string, method: string): readonly {
33
+ label: string;
34
+ auth?: readonly OpenApiAuth[];
35
+ error?: string;
36
+ }[];
37
+ export declare function snapshot(documentValue: JsonValue, path: string, method: string): JsonValue;
38
+ export declare function authHandles(auth: readonly OpenApiAuth[]): string[];
39
+ export declare function openApiTask(config: OpenApiExecutor, name?: string): ManagedTaskDefinition;
40
+ export interface OpenApiFieldIssue {
41
+ readonly field: 'sourceUrl' | 'operation' | 'serverUrl';
42
+ readonly message: string;
43
+ }
44
+ /** The canvas validator and property panel share the same configuration contract. */
45
+ export declare function openApiFieldIssues(task: ManagedTaskDefinition): OpenApiFieldIssue[];
46
+ export declare function openApiIssues(task: ManagedTaskDefinition): string[];
47
+ export declare function selectOperation(value: JsonValue, sourceUrl: string, path: string, method: string): OpenApiExecutor;
48
+ export declare function buildRequest(config: OpenApiExecutor, input: Readonly<Record<string, JsonValue>>): {
49
+ url: string;
50
+ init: RequestInit;
51
+ };
52
+ export declare function parseResponse(config: OpenApiExecutor, status: number, headers: Headers, text: string): Record<string, JsonValue>;
53
+ export {};