@oomol-lab/open-flow 0.1.0-alpha.2 → 0.1.0-alpha.4

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 (31) hide show
  1. package/dist/browser/addNodeOptions-CGyTkP99.js +7272 -0
  2. package/dist/browser/{composite-7VwgfnXx.js → createLucideIcon-MmUpJrIU.js} +1570 -2087
  3. package/dist/browser/createResourceDialog-CIVfStiE.js +467 -0
  4. package/dist/browser/dist-0lWKriL5.js +252 -0
  5. package/dist/browser/field-runIpvMd.js +312 -0
  6. package/dist/browser/flowRunInputEditorStore-B49C0ZmK.js +8044 -0
  7. package/dist/browser/flowWorkspace-CGsEHe2F.js +40889 -0
  8. package/dist/browser/{markdownContent-ZZFfSRqO.js → markdownContent-BvYiwIwR.js} +1 -1
  9. package/dist/browser/project-authoring-edge.d.ts +3 -0
  10. package/dist/browser/project-authoring-flow.d.ts +4 -0
  11. package/dist/browser/project-authoring-module.d.ts +4 -0
  12. package/dist/browser/project-authoring-node.d.ts +90 -0
  13. package/dist/browser/project-authoring.d.ts +4 -0
  14. package/dist/browser/project-authoring.js +426 -0
  15. package/dist/browser/workbench-contract.d.ts +0 -1
  16. package/dist/browser/workbench.css +1 -1
  17. package/dist/browser/workbench.d.ts +1 -0
  18. package/dist/browser/workbench.js +516 -443
  19. package/dist/common/control-api-conformance.js +14 -17
  20. package/dist/common/control-api-errors.d.ts +4 -0
  21. package/dist/common/control-api.d.ts +6 -6
  22. package/dist/common/control-api.js +24 -24
  23. package/dist/common/integration-trigger.d.ts +1 -0
  24. package/dist/common/provider-triggers.js +928 -796
  25. package/dist/common/scheduler.js +3 -3
  26. package/dist/common/webhook-trigger.js +34 -0
  27. package/package.json +5 -1
  28. package/dist/browser/addNodeOptions-DqoIueCR.js +0 -33746
  29. package/dist/browser/createResourceDialog-ByuJWdSL.js +0 -439
  30. package/dist/browser/dist-n-z5HtaO.js +0 -4
  31. package/dist/browser/flowWorkspace-DwVMpcar.js +0 -22092
@@ -1,5 +1,5 @@
1
1
  import { o as e, r as t, t as n } from "./rolldown-runtime-CEFd7nDs.js";
2
- import { a as r } from "./dist-n-z5HtaO.js";
2
+ import { wn as r } from "./flowRunInputEditorStore-B49C0ZmK.js";
3
3
  import { memo as i, useEffect as a, useRef as o } from "react";
4
4
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
5
5
  //#region ../../node_modules/deepmerge/dist/cjs.js
@@ -0,0 +1,3 @@
1
+ import type { ChangeOperation, GraphEdge, GraphTarget, RevisionContent } from './project-change.js';
2
+ export declare function connect(content: RevisionContent, target: GraphTarget, edge: GraphEdge): readonly ChangeOperation[];
3
+ export declare function disconnect(content: RevisionContent, target: GraphTarget, edge: GraphEdge): readonly ChangeOperation[];
@@ -0,0 +1,4 @@
1
+ import type { ChangeOperation } from './project-change.js';
2
+ export declare function createFlow(flowId: string, name: string): readonly ChangeOperation[];
3
+ export declare function renameFlow(flowId: string, name: string): readonly ChangeOperation[];
4
+ export declare function deleteFlow(flowId: string): readonly ChangeOperation[];
@@ -0,0 +1,4 @@
1
+ import type { ChangeOperation } from './project-change.js';
2
+ export declare function imports(source: string): Promise<readonly string[]>;
3
+ export declare function replaceSource(moduleId: string, source: string, moduleImports: readonly string[]): readonly ChangeOperation[];
4
+ export declare function rename(moduleId: string, name: string): readonly ChangeOperation[];
@@ -0,0 +1,90 @@
1
+ import type { ChangeOperation, CodeModule, GraphTarget, JsonValue, PortDefinition, RevisionContent, TaskDefinition, TriggerKeySnapshot, TriggerNode, TriggerSchedule, WebhookOptions } from './project-change.js';
2
+ export interface Settings {
3
+ readonly concurrency: number;
4
+ readonly name?: string;
5
+ readonly timeoutMs?: number;
6
+ }
7
+ export interface LlmTaskOptions {
8
+ readonly inputs?: Readonly<Partial<Record<LlmInputHandle, JsonValue>>>;
9
+ readonly output?: PortDefinition;
10
+ }
11
+ export type LlmInputHandle = 'input' | 'messages' | 'model' | 'template';
12
+ interface TriggerSettingsBase {
13
+ readonly description?: string;
14
+ readonly name: string;
15
+ }
16
+ export type TriggerSettings = (TriggerSettingsBase & {
17
+ readonly inputs: Extract<TriggerNode, {
18
+ readonly kind: 'webhook';
19
+ }>['inputsDef'];
20
+ readonly kind: 'webhook';
21
+ readonly options: WebhookOptions;
22
+ }) | (TriggerSettingsBase & {
23
+ readonly kind: 'cron';
24
+ readonly schedule: readonly TriggerSchedule[];
25
+ }) | (TriggerSettingsBase & {
26
+ readonly config: Readonly<Record<string, JsonValue>>;
27
+ readonly kind: 'poll';
28
+ readonly schedule: readonly TriggerSchedule[];
29
+ }) | (TriggerSettingsBase & {
30
+ readonly config: Readonly<Record<string, JsonValue>>;
31
+ readonly kind: 'integration';
32
+ });
33
+ export declare function createCodeTask(target: GraphTarget, identity: {
34
+ readonly moduleId: string;
35
+ readonly nodeId: string;
36
+ }, name: string, module?: Pick<CodeModule, 'imports' | 'source'>, ports?: Pick<Extract<TaskDefinition, {
37
+ readonly moduleId: string;
38
+ }>, 'inputs' | 'outputs'>): readonly ChangeOperation[];
39
+ export declare function createManagedTask(target: GraphTarget, identity: {
40
+ readonly nodeId: string;
41
+ readonly taskId: string;
42
+ }, task: Extract<TaskDefinition, {
43
+ readonly executor: unknown;
44
+ }>): readonly ChangeOperation[];
45
+ export declare function createLlmTask(target: GraphTarget, identity: {
46
+ readonly nodeId: string;
47
+ readonly taskId: string;
48
+ }, name: string, mode: 'chat' | 'json', outputDescription: string, options?: LlmTaskOptions): readonly ChangeOperation[];
49
+ export declare function createCondition(target: GraphTarget, nodeId: string, name: string): readonly ChangeOperation[];
50
+ export declare function createValue(target: GraphTarget, nodeId: string, name: string): readonly ChangeOperation[];
51
+ export declare function createBuiltinTrigger(target: {
52
+ readonly id: string;
53
+ readonly kind: 'flow';
54
+ }, nodeId: string, node: Extract<TriggerNode, {
55
+ readonly kind: 'cron' | 'webhook';
56
+ }>): readonly ChangeOperation[];
57
+ export declare function createProviderTrigger(target: {
58
+ readonly id: string;
59
+ readonly kind: 'flow';
60
+ }, identity: {
61
+ readonly bindingId: string;
62
+ readonly nodeId: string;
63
+ }, definition: TriggerKeySnapshot, options: {
64
+ readonly config: Readonly<Record<string, JsonValue>>;
65
+ readonly connectionId: string;
66
+ readonly name?: string;
67
+ readonly schedule?: readonly TriggerSchedule[];
68
+ }): readonly ChangeOperation[];
69
+ export declare function deleteNodes(content: RevisionContent, target: GraphTarget, nodeIds: readonly string[]): readonly ChangeOperation[];
70
+ export declare function updateSettings(content: RevisionContent, target: GraphTarget, nodeId: string, settings: Settings): readonly ChangeOperation[] | undefined;
71
+ export declare function setInputValue(content: RevisionContent, target: GraphTarget, nodeId: string, handle: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
72
+ export declare function setInputValues(content: RevisionContent, target: GraphTarget, nodeId: string, values: Readonly<Record<string, JsonValue | undefined>>): readonly ChangeOperation[] | undefined;
73
+ export declare function setConnectorConnection(content: RevisionContent, taskId: string, connectionId: string): readonly ChangeOperation[] | undefined;
74
+ export declare function updateTrigger(content: RevisionContent, target: {
75
+ readonly id: string;
76
+ readonly kind: 'flow';
77
+ }, nodeId: string, settings: TriggerSettings): readonly ChangeOperation[] | undefined;
78
+ export declare function updateTriggerConfig(content: RevisionContent, target: {
79
+ readonly id: string;
80
+ readonly kind: 'flow';
81
+ }, nodeId: string, name: string, value: JsonValue | undefined): readonly ChangeOperation[] | undefined;
82
+ export declare function updateTriggerSchedule(content: RevisionContent, target: {
83
+ readonly id: string;
84
+ readonly kind: 'flow';
85
+ }, nodeId: string, schedule: readonly TriggerSchedule[]): readonly ChangeOperation[] | undefined;
86
+ export declare function setTriggerConnection(content: RevisionContent, target: {
87
+ readonly id: string;
88
+ readonly kind: 'flow';
89
+ }, nodeId: string, connectionId: string): readonly ChangeOperation[] | undefined;
90
+ export {};
@@ -0,0 +1,4 @@
1
+ export { connect, disconnect } from './project-authoring-edge.js';
2
+ export { createFlow, deleteFlow, renameFlow } from './project-authoring-flow.js';
3
+ export { imports as moduleImports, rename as renameModule, replaceSource as replaceModuleSource } from './project-authoring-module.js';
4
+ export { createBuiltinTrigger, createCodeTask, createCondition, createLlmTask, createManagedTask, createProviderTrigger, createValue, deleteNodes, setConnectorConnection, setInputValues, setTriggerConnection, updateSettings, updateTrigger, } from './project-authoring-node.js';
@@ -0,0 +1,426 @@
1
+ //#region src/project/common/edgeChanges.ts
2
+ function e(e, t, r) {
3
+ let i = {
4
+ source: r.source,
5
+ sourceHandle: r.sourceHandle,
6
+ target: r.target,
7
+ targetHandle: r.targetHandle
8
+ }, a = n(e, t)?.nodes[r.target], o = a != null && "inputs" in a ? a.inputs[r.targetHandle] : void 0;
9
+ return o?.kind == "sources" && o.sources.some((e) => e.kind == "node" && e.nodeId == r.source && e.output == r.sourceHandle) ? [] : [{
10
+ edge: i,
11
+ kind: "graph.edge.connect",
12
+ target: t
13
+ }];
14
+ }
15
+ function t(e, t, r) {
16
+ let i = {
17
+ source: r.source,
18
+ sourceHandle: r.sourceHandle,
19
+ target: r.target,
20
+ targetHandle: r.targetHandle
21
+ }, a = n(e, t)?.nodes[r.target], o = a != null && "inputs" in a ? a.inputs[r.targetHandle] : void 0;
22
+ return o?.kind != "sources" || !o.sources.some((e) => e.kind == "node" && e.nodeId == r.source && e.output == r.sourceHandle) ? [] : [{
23
+ edge: i,
24
+ kind: "graph.edge.disconnect",
25
+ target: t
26
+ }];
27
+ }
28
+ function n(e, t) {
29
+ return t.kind == "flow" ? e.document.flows[t.id]?.graph : e.document.subflows[t.id]?.graph;
30
+ }
31
+ //#endregion
32
+ //#region src/project/common/flowChanges.ts
33
+ function r(e, t) {
34
+ return [{
35
+ flow: {
36
+ graph: { nodes: {} },
37
+ name: t
38
+ },
39
+ flowId: e,
40
+ kind: "flow.create"
41
+ }];
42
+ }
43
+ function i(e, t) {
44
+ return [{
45
+ flowId: e,
46
+ kind: "flow.rename",
47
+ name: t
48
+ }];
49
+ }
50
+ function a(e) {
51
+ return [{
52
+ flowId: e,
53
+ kind: "flow.delete"
54
+ }];
55
+ }
56
+ //#endregion
57
+ //#region src/project/common/moduleChanges.ts
58
+ async function o(e) {
59
+ try {
60
+ let { parse: t } = await import("./lib-S4ccuMeT.js"), n = t(e, {
61
+ errorRecovery: !0,
62
+ sourceType: "module"
63
+ }).program, r = /* @__PURE__ */ new Set();
64
+ for (let e of n.body) {
65
+ if (e.type != "ImportDeclaration") continue;
66
+ let t = /^\.\/(.+)\.mjs$/.exec(e.source.value);
67
+ t?.[1] != null && r.add(t[1]);
68
+ }
69
+ return [...r].toSorted();
70
+ } catch {
71
+ return [];
72
+ }
73
+ }
74
+ function s(e, t, n) {
75
+ return [{
76
+ imports: n,
77
+ kind: "module.source.replace",
78
+ moduleId: e,
79
+ source: t
80
+ }];
81
+ }
82
+ function c(e, t) {
83
+ return [{
84
+ kind: "module.rename",
85
+ moduleId: e,
86
+ name: t
87
+ }];
88
+ }
89
+ //#endregion
90
+ //#region src/project/common/nodeChanges.ts
91
+ function l(e, t, n, r = {
92
+ imports: [],
93
+ source: "export default function run(input) {\n return { result: input.value }\n}\n"
94
+ }, i = {
95
+ inputs: { value: {
96
+ jsonSchema: {},
97
+ nullable: !0,
98
+ value: null
99
+ } },
100
+ outputs: { result: {
101
+ jsonSchema: {},
102
+ nullable: !0
103
+ } }
104
+ }) {
105
+ return [{
106
+ kind: "module.create",
107
+ module: {
108
+ ...r,
109
+ name: n
110
+ },
111
+ moduleId: t.moduleId
112
+ }, {
113
+ kind: "graph.node.create",
114
+ node: {
115
+ concurrency: 1,
116
+ inputs: C(i.inputs),
117
+ kind: "task",
118
+ name: n,
119
+ task: {
120
+ inputs: i.inputs,
121
+ moduleId: t.moduleId,
122
+ name: n,
123
+ outputs: i.outputs
124
+ }
125
+ },
126
+ nodeId: t.nodeId,
127
+ target: e
128
+ }];
129
+ }
130
+ function u(e, t, n) {
131
+ return [{
132
+ kind: "task.create",
133
+ task: n,
134
+ taskId: t.taskId
135
+ }, {
136
+ kind: "graph.node.create",
137
+ node: {
138
+ concurrency: 1,
139
+ inputs: C(n.inputs),
140
+ kind: "task",
141
+ name: n.name,
142
+ taskId: t.taskId
143
+ },
144
+ nodeId: t.nodeId,
145
+ target: e
146
+ }];
147
+ }
148
+ function d(e, t, n, r, i, a = {}) {
149
+ let o = a.inputs ?? {};
150
+ return u(e, t, {
151
+ executor: {
152
+ kind: "llm",
153
+ mode: r
154
+ },
155
+ inputs: {
156
+ messages: {
157
+ jsonSchema: {
158
+ items: { type: "object" },
159
+ type: "array"
160
+ },
161
+ nullable: !0,
162
+ value: w(o, "messages", null)
163
+ },
164
+ input: {
165
+ jsonSchema: { type: "string" },
166
+ nullable: !1,
167
+ value: w(o, "input", "Alex")
168
+ },
169
+ template: {
170
+ jsonSchema: {
171
+ items: { type: "object" },
172
+ minItems: 1,
173
+ type: "array"
174
+ },
175
+ nullable: !1,
176
+ value: w(o, "template", [{
177
+ content: "Hello, I'm {{input}}",
178
+ role: "user"
179
+ }])
180
+ },
181
+ model: {
182
+ jsonSchema: { type: "object" },
183
+ nullable: !1,
184
+ value: w(o, "model", { model: "deepseek-v4-flash" })
185
+ }
186
+ },
187
+ name: n,
188
+ outputs: { output: a.output ?? {
189
+ description: i,
190
+ jsonSchema: r == "chat" ? { type: "string" } : {},
191
+ nullable: !1
192
+ } }
193
+ });
194
+ }
195
+ function f(e, t, n) {
196
+ return [{
197
+ kind: "graph.node.create",
198
+ node: {
199
+ cases: [{
200
+ expressions: [{
201
+ input: "value",
202
+ operator: "isTrue"
203
+ }],
204
+ output: "true",
205
+ relation: "all"
206
+ }],
207
+ concurrency: 1,
208
+ defaultOutput: "false",
209
+ input: {
210
+ handle: "value",
211
+ jsonSchema: {},
212
+ nullable: !0,
213
+ value: null
214
+ },
215
+ inputs: { value: {
216
+ kind: "value",
217
+ value: null
218
+ } },
219
+ kind: "condition",
220
+ name: n
221
+ },
222
+ nodeId: t,
223
+ target: e
224
+ }];
225
+ }
226
+ function p(e, t, n) {
227
+ return [{
228
+ kind: "graph.node.create",
229
+ node: {
230
+ concurrency: 1,
231
+ inputs: {},
232
+ kind: "value",
233
+ name: n,
234
+ values: { value: {
235
+ jsonSchema: {},
236
+ nullable: !0,
237
+ value: null
238
+ } }
239
+ },
240
+ nodeId: t,
241
+ target: e
242
+ }];
243
+ }
244
+ function m(e, t, n) {
245
+ return [{
246
+ kind: "graph.node.create",
247
+ node: n,
248
+ nodeId: t,
249
+ target: e
250
+ }];
251
+ }
252
+ function h(e, t, n, r) {
253
+ let i = r.name ?? n.displayName, a = n.type == "poll" ? {
254
+ bindingId: t.bindingId,
255
+ config: r.config,
256
+ definition: n,
257
+ kind: "poll",
258
+ name: i,
259
+ pollTimes: r.schedule ?? [{
260
+ type: "every",
261
+ unit: "minute",
262
+ value: 5
263
+ }]
264
+ } : {
265
+ bindingId: t.bindingId,
266
+ config: r.config,
267
+ definition: n,
268
+ kind: "integration",
269
+ name: i
270
+ };
271
+ return [{
272
+ binding: {
273
+ kind: "connection",
274
+ target: r.connectionId
275
+ },
276
+ bindingId: t.bindingId,
277
+ kind: "binding.create"
278
+ }, {
279
+ kind: "graph.node.create",
280
+ node: a,
281
+ nodeId: t.nodeId,
282
+ target: e
283
+ }];
284
+ }
285
+ function g(e, t, n) {
286
+ let r = S(e, t)?.nodes;
287
+ if (r == null) return [];
288
+ let i = new Set(n), a = n.flatMap((e) => {
289
+ let n = r[e];
290
+ return n == null ? [] : [{
291
+ kind: "graph.node.delete",
292
+ nodeId: e,
293
+ target: t
294
+ }, ...n.kind == "task" && n.task != null ? [{
295
+ kind: "module.delete",
296
+ moduleId: n.task.moduleId
297
+ }] : []];
298
+ });
299
+ if (t.kind == "subflow") return a;
300
+ let o = new Set(n.flatMap((e) => {
301
+ let t = r[e];
302
+ return t?.kind == "poll" || t?.kind == "integration" ? [t.bindingId] : [];
303
+ }));
304
+ for (let n of o) Object.entries(e.document.flows).some(([e, r]) => Object.entries(r.graph.nodes).some(([r, a]) => !(e == t.id && i.has(r)) && (a.kind == "poll" || a.kind == "integration") && a.bindingId == n)) || a.push({
305
+ bindingId: n,
306
+ kind: "binding.delete"
307
+ });
308
+ return a;
309
+ }
310
+ function _(e, t, n, r) {
311
+ let i = S(e, t)?.nodes[n];
312
+ if (i == null || !("inputs" in i)) return;
313
+ let { concurrency: a, name: o, timeoutMs: s, ...c } = i;
314
+ return T(t, n, {
315
+ ...c,
316
+ ...r
317
+ });
318
+ }
319
+ function v(e, t, n, r) {
320
+ let i = S(e, t)?.nodes[n];
321
+ if (i == null || !("inputs" in i)) return;
322
+ let a = { ...i.inputs };
323
+ for (let [e, t] of Object.entries(r)) t === void 0 ? delete a[e] : a[e] = {
324
+ kind: "value",
325
+ value: t
326
+ };
327
+ return T(t, n, {
328
+ ...i,
329
+ inputs: a
330
+ });
331
+ }
332
+ function y(e, t, n) {
333
+ let r = e.document.tasks[t];
334
+ if (!(r == null || !("executor" in r) || r.executor.kind != "connector")) return [{
335
+ kind: "task.replace",
336
+ task: {
337
+ ...r,
338
+ executor: {
339
+ ...r.executor,
340
+ connectionId: n
341
+ }
342
+ },
343
+ taskId: t
344
+ }];
345
+ }
346
+ function b(e, t, n, r) {
347
+ let i = e.document.flows[t.id]?.graph.nodes[n];
348
+ if (i == null) return;
349
+ let a = {
350
+ ...r.description == null ? {} : { description: r.description },
351
+ name: r.name
352
+ }, o;
353
+ switch (r.kind) {
354
+ case "webhook":
355
+ if (i.kind != "webhook") return;
356
+ o = Object.keys(r.options).length == 0 ? {
357
+ ...a,
358
+ inputsDef: r.inputs,
359
+ kind: "webhook"
360
+ } : {
361
+ ...a,
362
+ inputsDef: r.inputs,
363
+ kind: "webhook",
364
+ options: r.options
365
+ };
366
+ break;
367
+ case "cron":
368
+ if (i.kind != "cron") return;
369
+ o = {
370
+ ...a,
371
+ cronTimes: r.schedule,
372
+ kind: "cron"
373
+ };
374
+ break;
375
+ case "poll":
376
+ if (i.kind != "poll") return;
377
+ o = {
378
+ ...i,
379
+ ...a,
380
+ config: r.config,
381
+ pollTimes: r.schedule
382
+ };
383
+ break;
384
+ case "integration":
385
+ if (i.kind != "integration") return;
386
+ o = {
387
+ ...i,
388
+ ...a,
389
+ config: r.config
390
+ };
391
+ }
392
+ return T(t, n, o);
393
+ }
394
+ function x(e, t, n, r) {
395
+ let i = e.document.flows[t.id]?.graph.nodes[n];
396
+ if (!(i == null || i.kind != "poll" && i.kind != "integration") && e.document.bindings[i.bindingId]?.kind == "connection") return [{
397
+ binding: {
398
+ kind: "connection",
399
+ target: r
400
+ },
401
+ bindingId: i.bindingId,
402
+ kind: "binding.replace"
403
+ }];
404
+ }
405
+ function S(e, t) {
406
+ return t.kind == "flow" ? e.document.flows[t.id]?.graph : e.document.subflows[t.id]?.graph;
407
+ }
408
+ function C(e) {
409
+ return Object.fromEntries(Object.entries(e).flatMap(([e, t]) => Object.hasOwn(t, "value") ? [[e, {
410
+ kind: "value",
411
+ value: t.value
412
+ }]] : []));
413
+ }
414
+ function w(e, t, n) {
415
+ return e != null && Object.hasOwn(e, t) ? e[t] : n;
416
+ }
417
+ function T(e, t, n) {
418
+ return [{
419
+ kind: "graph.node.replace",
420
+ node: n,
421
+ nodeId: t,
422
+ target: e
423
+ }];
424
+ }
425
+ //#endregion
426
+ export { e as connect, m as createBuiltinTrigger, l as createCodeTask, f as createCondition, r as createFlow, d as createLlmTask, u as createManagedTask, h as createProviderTrigger, p as createValue, a as deleteFlow, g as deleteNodes, t as disconnect, o as moduleImports, i as renameFlow, c as renameModule, s as replaceModuleSource, y as setConnectorConnection, v as setInputValues, x as setTriggerConnection, _ as updateSettings, b as updateTrigger };
@@ -8,7 +8,6 @@ export interface WorkbenchNotification {
8
8
  readonly message: string;
9
9
  }
10
10
  export interface WorkbenchHost {
11
- readonly returnUrl: string;
12
11
  notify(notification: WorkbenchNotification | undefined): void;
13
12
  openExternalPage(resolveUrl: () => Promise<string>): Promise<boolean>;
14
13
  request(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;