@fractal-solutions/qflow 1.0.60 → 1.0.62

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 (114) hide show
  1. package/README.md +75 -74
  2. package/dist/qflow.config.d.ts +5 -0
  3. package/dist/qflow.config.js +16 -0
  4. package/dist/src/agent/agent.d.ts +23 -0
  5. package/dist/src/agent/agent.js +365 -0
  6. package/dist/src/agent/base_agent.d.ts +21 -0
  7. package/dist/src/agent/base_agent.js +206 -0
  8. package/dist/src/agent/logger.d.ts +9 -0
  9. package/dist/src/agent/logger.js +45 -0
  10. package/dist/src/agent/lpavrl_agent.d.ts +5 -0
  11. package/dist/src/agent/lpavrl_agent.js +178 -0
  12. package/dist/src/agent/ooda_agent.d.ts +5 -0
  13. package/dist/src/agent/ooda_agent.js +167 -0
  14. package/dist/src/agent/pema_agent.d.ts +5 -0
  15. package/dist/src/agent/pema_agent.js +171 -0
  16. package/dist/src/agent/raor_agent.d.ts +5 -0
  17. package/dist/src/agent/raor_agent.js +164 -0
  18. package/dist/src/agent/tools.d.ts +1 -0
  19. package/dist/src/agent/tools.js +148 -0
  20. package/dist/src/logger.d.ts +9 -0
  21. package/dist/src/logger.js +107 -0
  22. package/dist/src/nodes/agent_llm.d.ts +31 -0
  23. package/dist/src/nodes/agent_llm.js +302 -0
  24. package/dist/src/nodes/browser_control.d.ts +35 -0
  25. package/dist/src/nodes/browser_control.js +106 -0
  26. package/dist/src/nodes/code_interpreter.d.ts +38 -0
  27. package/dist/src/nodes/code_interpreter.js +150 -0
  28. package/dist/src/nodes/data_extractor.d.ts +40 -0
  29. package/dist/src/nodes/data_extractor.js +118 -0
  30. package/dist/src/nodes/data_validation.d.ts +36 -0
  31. package/dist/src/nodes/data_validation.js +77 -0
  32. package/dist/src/nodes/database.d.ts +50 -0
  33. package/dist/src/nodes/database.js +135 -0
  34. package/dist/src/nodes/display_image.d.ts +18 -0
  35. package/dist/src/nodes/display_image.js +63 -0
  36. package/dist/src/nodes/embedding.d.ts +29 -0
  37. package/dist/src/nodes/embedding.js +69 -0
  38. package/dist/src/nodes/filesystem.d.ts +105 -0
  39. package/dist/src/nodes/filesystem.js +160 -0
  40. package/dist/src/nodes/gis.d.ts +62 -0
  41. package/dist/src/nodes/gis.js +133 -0
  42. package/dist/src/nodes/git.d.ts +46 -0
  43. package/dist/src/nodes/git.js +99 -0
  44. package/dist/src/nodes/github.d.ts +83 -0
  45. package/dist/src/nodes/github.js +135 -0
  46. package/dist/src/nodes/hackernews.d.ts +47 -0
  47. package/dist/src/nodes/hackernews.js +79 -0
  48. package/dist/src/nodes/hardware_interaction.d.ts +39 -0
  49. package/dist/src/nodes/hardware_interaction.js +131 -0
  50. package/dist/src/nodes/http.d.ts +77 -0
  51. package/dist/src/nodes/http.js +120 -0
  52. package/dist/src/nodes/http_server.d.ts +54 -0
  53. package/dist/src/nodes/http_server.js +223 -0
  54. package/dist/src/nodes/image_gallery.d.ts +37 -0
  55. package/dist/src/nodes/image_gallery.js +129 -0
  56. package/dist/src/nodes/index.d.ts +48 -0
  57. package/dist/src/nodes/index.js +48 -0
  58. package/dist/src/nodes/interactive_input.d.ts +26 -0
  59. package/dist/src/nodes/interactive_input.js +95 -0
  60. package/dist/src/nodes/interactive_webview.d.ts +78 -0
  61. package/dist/src/nodes/interactive_webview.js +369 -0
  62. package/dist/src/nodes/iterator.d.ts +23 -0
  63. package/dist/src/nodes/iterator.js +43 -0
  64. package/dist/src/nodes/llm.d.ts +160 -0
  65. package/dist/src/nodes/llm.js +367 -0
  66. package/dist/src/nodes/memory.d.ts +43 -0
  67. package/dist/src/nodes/memory.js +90 -0
  68. package/dist/src/nodes/multimedia_processing.d.ts +57 -0
  69. package/dist/src/nodes/multimedia_processing.js +129 -0
  70. package/dist/src/nodes/openrouter_llm.d.ts +38 -0
  71. package/dist/src/nodes/openrouter_llm.js +156 -0
  72. package/dist/src/nodes/pdf_processor.d.ts +43 -0
  73. package/dist/src/nodes/pdf_processor.js +112 -0
  74. package/dist/src/nodes/remote_execution.d.ts +51 -0
  75. package/dist/src/nodes/remote_execution.js +132 -0
  76. package/dist/src/nodes/s3.d.ts +73 -0
  77. package/dist/src/nodes/s3.js +107 -0
  78. package/dist/src/nodes/scheduler.d.ts +51 -0
  79. package/dist/src/nodes/scheduler.js +131 -0
  80. package/dist/src/nodes/search.d.ts +61 -0
  81. package/dist/src/nodes/search.js +118 -0
  82. package/dist/src/nodes/semantic_memory.d.ts +64 -0
  83. package/dist/src/nodes/semantic_memory.js +160 -0
  84. package/dist/src/nodes/shell.d.ts +25 -0
  85. package/dist/src/nodes/shell.js +45 -0
  86. package/dist/src/nodes/speech_synthesis.d.ts +72 -0
  87. package/dist/src/nodes/speech_synthesis.js +171 -0
  88. package/dist/src/nodes/spreadsheet.d.ts +61 -0
  89. package/dist/src/nodes/spreadsheet.js +294 -0
  90. package/dist/src/nodes/stripe.d.ts +67 -0
  91. package/dist/src/nodes/stripe.js +117 -0
  92. package/dist/src/nodes/subflow.d.ts +23 -0
  93. package/dist/src/nodes/subflow.js +36 -0
  94. package/dist/src/nodes/summarize.d.ts +26 -0
  95. package/dist/src/nodes/summarize.js +51 -0
  96. package/dist/src/nodes/system_notification.d.ts +26 -0
  97. package/dist/src/nodes/system_notification.js +74 -0
  98. package/dist/src/nodes/transform.d.ts +23 -0
  99. package/dist/src/nodes/transform.js +52 -0
  100. package/dist/src/nodes/user.d.ts +25 -0
  101. package/dist/src/nodes/user.js +48 -0
  102. package/dist/src/nodes/webhook.d.ts +49 -0
  103. package/dist/src/nodes/webhook.js +161 -0
  104. package/dist/src/nodes/webscraper.d.ts +25 -0
  105. package/dist/src/nodes/webscraper.js +49 -0
  106. package/dist/src/nodes/websockets.d.ts +27 -0
  107. package/dist/src/nodes/websockets.js +98 -0
  108. package/dist/src/nodes/webview.d.ts +38 -0
  109. package/dist/src/nodes/webview.js +55 -0
  110. package/dist/src/qflow.d.ts +69 -0
  111. package/dist/src/qflow.js +320 -0
  112. package/dist/src/types.d.ts +6 -0
  113. package/dist/src/types.js +5 -0
  114. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ /**
2
+ * A node that displays a webview window with the given HTML content.
3
+ * @param {object} params - The parameters for the node.
4
+ * @param {string} params.html - The HTML content to display in the webview.
5
+ * @param {string} [params.title='Qflow Webview'] - The title of the webview window.
6
+ * @param {number} [params.width=800] - The width of the webview window.
7
+ * @param {number} [params.height=600] - The height of the webview window.
8
+ */
9
+ export class WebviewNode extends AsyncNode {
10
+ static getToolDefinition(): {
11
+ name: string;
12
+ description: string;
13
+ parameters: {
14
+ type: string;
15
+ properties: {
16
+ html: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ title: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ width: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ height: {
29
+ type: string;
30
+ description: string;
31
+ };
32
+ };
33
+ required: string[];
34
+ };
35
+ };
36
+ execAsync(): Promise<string>;
37
+ }
38
+ import { AsyncNode } from '../qflow.js';
@@ -0,0 +1,55 @@
1
+ import { AsyncNode } from '../qflow.js';
2
+ import { Webview, SizeHint } from 'webview-bun';
3
+ import { log } from '../logger.js';
4
+ /**
5
+ * A node that displays a webview window with the given HTML content.
6
+ * @param {object} params - The parameters for the node.
7
+ * @param {string} params.html - The HTML content to display in the webview.
8
+ * @param {string} [params.title='Qflow Webview'] - The title of the webview window.
9
+ * @param {number} [params.width=800] - The width of the webview window.
10
+ * @param {number} [params.height=600] - The height of the webview window.
11
+ */
12
+ export class WebviewNode extends AsyncNode {
13
+ static getToolDefinition() {
14
+ return {
15
+ name: "webview",
16
+ description: "Displays a webview window with custom HTML content.",
17
+ parameters: {
18
+ type: "object",
19
+ properties: {
20
+ html: {
21
+ type: "string",
22
+ description: "The HTML content to display in the webview."
23
+ },
24
+ title: {
25
+ type: "string",
26
+ description: "Optional. The title of the webview window. Defaults to 'Qflow Webview'."
27
+ },
28
+ width: {
29
+ type: "number",
30
+ description: "Optional. The width of the webview window. Defaults to 800."
31
+ },
32
+ height: {
33
+ type: "number",
34
+ description: "Optional. The height of the webview window. Defaults to 600."
35
+ }
36
+ },
37
+ required: ["html"]
38
+ }
39
+ };
40
+ }
41
+ async execAsync() {
42
+ const { html, title = 'Qflow Webview', width = 800, height = 600 } = this.params;
43
+ if (!html) {
44
+ throw new Error('WebviewNode requires an `html` parameter.');
45
+ }
46
+ log(`[WebviewNode] Creating webview window with title: "${title}"`, this.params.logging);
47
+ const webview = new Webview();
48
+ webview.title = title;
49
+ webview.size = { width, height, hint: SizeHint.NONE };
50
+ webview.setHTML(html);
51
+ webview.run();
52
+ log(`[WebviewNode] Webview window closed.`, this.params.logging);
53
+ return 'default';
54
+ }
55
+ }
@@ -0,0 +1,69 @@
1
+ export class BaseNode {
2
+ params: {};
3
+ successors: {};
4
+ setParams(params: any): void;
5
+ next(node: any, action?: string): any;
6
+ prep(shared: any): void;
7
+ exec(prepRes: any): void;
8
+ post(shared: any, prepRes: any, execRes: any): any;
9
+ _exec(prepRes: any): void;
10
+ _run(shared: any): any;
11
+ run(shared: any): any;
12
+ transition(action: any): ConditionalTransition;
13
+ }
14
+ export class Node extends BaseNode {
15
+ constructor(maxRetries?: number, wait?: number);
16
+ maxRetries: number;
17
+ wait: number;
18
+ execFallback(prepRes: any, error: any): void;
19
+ _exec(prepRes: any, shared: any): void;
20
+ }
21
+ export class BatchNode extends Node {
22
+ _exec(items: any): any;
23
+ }
24
+ export class Flow extends BaseNode {
25
+ constructor(start?: null);
26
+ startNode: any;
27
+ start(startNode: any): any;
28
+ getNextNode(curr: any, action: any): any;
29
+ _orch(shared: any, params?: {}): any;
30
+ }
31
+ export class BatchFlow extends Flow {
32
+ }
33
+ export class AsyncNode extends Node {
34
+ prepAsync(shared: any): Promise<void>;
35
+ execAsync(prepRes: any): Promise<void>;
36
+ execFallbackAsync(prepRes: any, error: any): Promise<void>;
37
+ postAsync(shared: any, prepRes: any, execRes: any): Promise<void>;
38
+ _exec(prepRes: any, shared: any, observer?: {}): Promise<void>;
39
+ runAsync(shared: any): Promise<void>;
40
+ _runAsync(shared: any): Promise<void>;
41
+ _run(): void;
42
+ }
43
+ export class AsyncBatchNode extends AsyncNode {
44
+ _exec(items: any, shared: any, observer: any): Promise<void[]>;
45
+ }
46
+ export class AsyncParallelBatchNode extends AsyncNode {
47
+ _exec(items: any, shared: any, observer: any): Promise<any[]>;
48
+ }
49
+ export class AsyncFlow extends Flow {
50
+ listeners: {};
51
+ on(eventName: any, callback: any): void;
52
+ emit(eventName: any, payload: any): void;
53
+ prepAsync(shared: any): Promise<void>;
54
+ postAsync(shared: any, prepRes: any, execRes: any): Promise<any>;
55
+ _orchAsync(flowId: any, shared: any, params?: {}, initialNode?: any): Promise<any>;
56
+ _runAsync(shared: any): Promise<any>;
57
+ run(): void;
58
+ runAsync(shared?: {}): Promise<any>;
59
+ }
60
+ export class AsyncBatchFlow extends AsyncFlow {
61
+ }
62
+ export class AsyncParallelBatchFlow extends AsyncFlow {
63
+ }
64
+ export class ConditionalTransition {
65
+ constructor(src: any, action: any);
66
+ src: any;
67
+ action: any;
68
+ to(tgt: any): any;
69
+ }
@@ -0,0 +1,320 @@
1
+ class BaseNode {
2
+ constructor() {
3
+ this.params = {};
4
+ this.successors = {};
5
+ }
6
+ setParams(params) {
7
+ this.params = { ...this.params, ...params };
8
+ }
9
+ next(node, action = "default") {
10
+ if (this.successors[action]) {
11
+ console.warn(`Overwriting successor for action '${action}'`);
12
+ }
13
+ this.successors[action] = node;
14
+ return node;
15
+ }
16
+ prep(shared) { }
17
+ exec(prepRes) { }
18
+ post(shared, prepRes, execRes) {
19
+ return execRes;
20
+ }
21
+ _exec(prepRes) {
22
+ return this.exec(prepRes);
23
+ }
24
+ _run(shared) {
25
+ const prepRes = this.prep(shared);
26
+ const execRes = this._exec(prepRes, shared);
27
+ return this.post(shared, prepRes, execRes);
28
+ }
29
+ run(shared) {
30
+ if (Object.keys(this.successors).length) {
31
+ console.warn("Node won't run successors. Use Flow.");
32
+ }
33
+ return this._run(shared);
34
+ }
35
+ transition(action) {
36
+ return new ConditionalTransition(this, action);
37
+ }
38
+ }
39
+ class ConditionalTransition {
40
+ constructor(src, action) {
41
+ this.src = src;
42
+ this.action = action;
43
+ }
44
+ to(tgt) {
45
+ return this.src.next(tgt, this.action);
46
+ }
47
+ }
48
+ class Node extends BaseNode {
49
+ constructor(maxRetries = 1, wait = 0) {
50
+ super();
51
+ this.maxRetries = maxRetries;
52
+ this.wait = wait;
53
+ }
54
+ execFallback(prepRes, error) {
55
+ throw error;
56
+ }
57
+ _exec(prepRes, shared) {
58
+ for (let i = 0; i < this.maxRetries; i++) {
59
+ try {
60
+ return this.exec(prepRes, shared);
61
+ }
62
+ catch (e) {
63
+ if (i === this.maxRetries - 1)
64
+ return this.execFallback(prepRes, e);
65
+ if (this.wait > 0)
66
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, this.wait * 1000);
67
+ }
68
+ }
69
+ }
70
+ }
71
+ class BatchNode extends Node {
72
+ _exec(items) {
73
+ return (items || []).map(item => super._exec(item));
74
+ }
75
+ }
76
+ class Flow extends BaseNode {
77
+ constructor(start = null) {
78
+ super();
79
+ this.startNode = start;
80
+ }
81
+ start(startNode) {
82
+ this.startNode = startNode;
83
+ return startNode;
84
+ }
85
+ getNextNode(curr, action) {
86
+ const nxt = curr.successors[action || "default"];
87
+ if (!nxt && Object.keys(curr.successors).length) {
88
+ console.warn(`Flow ends: '${action}' not found in [${Object.keys(curr.successors)}]`);
89
+ }
90
+ return nxt;
91
+ }
92
+ _orch(shared, params = {}) {
93
+ let curr = this.startNode;
94
+ let lastAction = null;
95
+ let p = { ...this.params, ...params };
96
+ while (curr) {
97
+ curr.setParams(p);
98
+ lastAction = curr._run(shared);
99
+ curr = this.getNextNode(curr, lastAction);
100
+ }
101
+ return lastAction;
102
+ }
103
+ _run(shared) {
104
+ const prepRes = this.prep(shared);
105
+ const out = this._orch(shared);
106
+ return this.post(shared, prepRes, out);
107
+ }
108
+ post(shared, prepRes, execRes) {
109
+ return execRes;
110
+ }
111
+ }
112
+ class BatchFlow extends Flow {
113
+ _run(shared) {
114
+ const prepResults = this.prep(shared) || [];
115
+ const results = [];
116
+ for (const bp of prepResults) {
117
+ results.push(this._orch(shared, { ...this.params, ...bp }));
118
+ }
119
+ return this.post(shared, prepResults, results);
120
+ }
121
+ }
122
+ // ----------- ASYNC VERSIONS ------------
123
+ class AsyncNode extends Node {
124
+ async prepAsync(shared) { }
125
+ async execAsync(prepRes) { }
126
+ async execFallbackAsync(prepRes, error) {
127
+ throw error;
128
+ }
129
+ async postAsync(shared, prepRes, execRes) { }
130
+ async _exec(prepRes, shared, observer = {}) {
131
+ const { emit, flowId } = observer;
132
+ const nodeClass = this.constructor.name;
133
+ const nodeStartTime = performance.now();
134
+ if (emit) {
135
+ emit('node:start', {
136
+ flowId,
137
+ nodeClass,
138
+ startTime: Date.now(),
139
+ params: this.params
140
+ });
141
+ }
142
+ let finalResult;
143
+ let finalError = null;
144
+ try {
145
+ for (let i = 0; i < this.maxRetries; i++) {
146
+ try {
147
+ finalResult = await this.execAsync(prepRes, shared);
148
+ finalError = null; // Succeeded, clear any error from previous attempt
149
+ break; // Exit retry loop
150
+ }
151
+ catch (e) {
152
+ finalError = e;
153
+ if (emit) {
154
+ emit('node:retry', {
155
+ flowId,
156
+ nodeClass,
157
+ attempt: i + 1,
158
+ maxRetries: this.maxRetries,
159
+ error: { message: e.message }
160
+ });
161
+ }
162
+ if (i >= this.maxRetries - 1) {
163
+ // On the last attempt, let fallback handle it.
164
+ // The fallback is expected to throw if it cannot recover.
165
+ finalResult = await this.execFallbackAsync(prepRes, e);
166
+ finalError = null; // If fallback doesn't throw, it "succeeded" in recovering
167
+ }
168
+ if (this.wait > 0)
169
+ await new Promise(resolve => setTimeout(resolve, this.wait * 1000));
170
+ }
171
+ }
172
+ }
173
+ catch (e) {
174
+ finalError = e;
175
+ // Re-throw to stop the flow execution in _orchAsync
176
+ throw e;
177
+ }
178
+ finally {
179
+ if (emit) {
180
+ const nodeEndTime = performance.now();
181
+ emit('node:end', {
182
+ flowId,
183
+ nodeClass,
184
+ endTime: Date.now(),
185
+ duration: nodeEndTime - nodeStartTime,
186
+ status: finalError ? 'error' : 'success',
187
+ error: finalError ? { message: finalError.message, stack: finalError.stack } : null,
188
+ result: finalResult
189
+ });
190
+ }
191
+ }
192
+ return finalResult;
193
+ }
194
+ async runAsync(shared) {
195
+ if (Object.keys(this.successors).length) {
196
+ console.warn("Node won't run successors. Use AsyncFlow.");
197
+ }
198
+ return await this._runAsync(shared);
199
+ }
200
+ async _runAsync(shared) {
201
+ const prepRes = await this.prepAsync(shared);
202
+ const execRes = await this._exec(prepRes, shared);
203
+ return await this.postAsync(shared, prepRes, execRes);
204
+ }
205
+ _run() {
206
+ throw new Error("Use runAsync instead.");
207
+ }
208
+ }
209
+ class AsyncBatchNode extends AsyncNode {
210
+ async _exec(items, shared, observer) {
211
+ const results = [];
212
+ for (const item of items) {
213
+ results.push(await super._exec(item, shared, observer));
214
+ }
215
+ return results;
216
+ }
217
+ }
218
+ class AsyncParallelBatchNode extends AsyncNode {
219
+ async _exec(items, shared, observer) {
220
+ return await Promise.all(items.map(item => super._exec(item, shared, observer)));
221
+ }
222
+ }
223
+ class AsyncFlow extends Flow {
224
+ constructor(start = null) {
225
+ super(start);
226
+ this.listeners = {};
227
+ }
228
+ on(eventName, callback) {
229
+ if (!this.listeners[eventName]) {
230
+ this.listeners[eventName] = [];
231
+ }
232
+ this.listeners[eventName].push(callback);
233
+ }
234
+ emit(eventName, payload) {
235
+ if (this.listeners[eventName]) {
236
+ for (const callback of this.listeners[eventName]) {
237
+ try {
238
+ callback(payload);
239
+ }
240
+ catch (e) {
241
+ console.error(`Error in event listener for '${eventName}':`, e);
242
+ }
243
+ }
244
+ }
245
+ }
246
+ async prepAsync(shared) { }
247
+ async postAsync(shared, prepRes, execRes) {
248
+ return execRes;
249
+ }
250
+ async _orchAsync(flowId, shared, params = {}, initialNode = this.startNode) {
251
+ let curr = initialNode;
252
+ let lastAction = null;
253
+ let lastExecRes = null;
254
+ let p = { ...this.params, ...params };
255
+ while (curr) {
256
+ curr.setParams(p);
257
+ const observerContext = { emit: this.emit.bind(this), flowId };
258
+ const prepRes = curr instanceof AsyncNode ? await curr.prepAsync(shared) : curr.prep(shared);
259
+ const execRes = curr instanceof AsyncNode ? await curr._exec(prepRes, shared, observerContext) : curr._exec(prepRes, shared);
260
+ lastAction = curr instanceof AsyncNode ? await curr.postAsync(shared, prepRes, execRes) : curr.post(shared, prepRes, execRes);
261
+ lastExecRes = execRes;
262
+ curr = this.getNextNode(curr, lastAction);
263
+ }
264
+ return lastExecRes;
265
+ }
266
+ async _runAsync(shared) {
267
+ const flowId = crypto.randomUUID();
268
+ const flowStartTime = performance.now();
269
+ this.emit('flow:start', { flowId, startTime: Date.now() });
270
+ let result;
271
+ let flowError = null;
272
+ try {
273
+ const prepRes = await this.prepAsync(shared);
274
+ result = await this._orchAsync(flowId, shared);
275
+ return await this.postAsync(shared, prepRes, result);
276
+ }
277
+ catch (e) {
278
+ flowError = e;
279
+ throw e; // Re-throw so the caller knows the flow failed
280
+ }
281
+ finally {
282
+ const flowEndTime = performance.now();
283
+ this.emit('flow:end', {
284
+ flowId,
285
+ endTime: Date.now(),
286
+ duration: flowEndTime - flowStartTime,
287
+ status: flowError ? 'error' : 'success',
288
+ error: flowError ? { message: flowError.message, stack: flowError.stack } : null,
289
+ });
290
+ }
291
+ }
292
+ run() {
293
+ throw new Error("Use runAsync instead.");
294
+ }
295
+ async runAsync(shared = {}) {
296
+ return await this._runAsync(shared);
297
+ }
298
+ }
299
+ class AsyncBatchFlow extends AsyncFlow {
300
+ async _runAsync(shared) {
301
+ const prepResults = await this.prepAsync(shared) || [];
302
+ const results = [];
303
+ for (const bp of prepResults) {
304
+ results.push(await this._orchAsync(crypto.randomUUID(), shared, { ...this.params, ...bp }));
305
+ }
306
+ return await this.postAsync(shared, prepResults, results);
307
+ }
308
+ }
309
+ class AsyncParallelBatchFlow extends AsyncFlow {
310
+ async _runAsync(shared) {
311
+ const prepResults = await this.prepAsync(shared) || [];
312
+ const results = await Promise.all(prepResults.map(bp => {
313
+ const newStartNode = new this.startNode.constructor();
314
+ Object.assign(newStartNode.successors, this.startNode.successors);
315
+ return this._orchAsync(crypto.randomUUID(), shared, { ...this.params, ...bp }, newStartNode);
316
+ }));
317
+ return await this.postAsync(shared, prepResults, results);
318
+ }
319
+ }
320
+ export { BaseNode, Node, BatchNode, Flow, BatchFlow, AsyncNode, AsyncBatchNode, AsyncParallelBatchNode, AsyncFlow, AsyncBatchFlow, AsyncParallelBatchFlow, ConditionalTransition };
@@ -0,0 +1,6 @@
1
+ export type QFlowConfig = {
2
+ /**
3
+ * - An array of paths to custom node files.
4
+ */
5
+ customNodePaths?: string[] | undefined;
6
+ };
@@ -0,0 +1,5 @@
1
+ export {};
2
+ /**
3
+ * @typedef {object} QFlowConfig
4
+ * @property {string[]} [customNodePaths] - An array of paths to custom node files.
5
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fractal-solutions/qflow",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "description": "A lightweight and flexible JavaScript library for creating and managing workflows and agents.",
5
5
  "main": "dist/qflow.js",
6
6
  "types": "dist/qflow.d.ts",