@fractal-solutions/qflow 1.0.62 → 1.0.64

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 (199) hide show
  1. package/dist/agent/tools.d.ts +1 -5378
  2. package/dist/agent/tools.js +145 -1171
  3. package/dist/nodes/browser_control.d.ts +31 -0
  4. package/dist/nodes/browser_control.js +33 -0
  5. package/dist/nodes/code_interpreter.d.ts +29 -0
  6. package/dist/nodes/code_interpreter.js +29 -0
  7. package/dist/nodes/data_extractor.d.ts +35 -0
  8. package/dist/nodes/data_extractor.js +37 -0
  9. package/dist/nodes/data_validation.d.ts +27 -0
  10. package/dist/nodes/data_validation.js +29 -0
  11. package/dist/nodes/database.d.ts +44 -0
  12. package/dist/nodes/database.js +46 -0
  13. package/dist/nodes/display_image.d.ts +14 -0
  14. package/dist/nodes/display_image.js +16 -0
  15. package/dist/nodes/embedding.d.ts +22 -0
  16. package/dist/nodes/embedding.js +24 -0
  17. package/dist/nodes/filesystem.d.ts +64 -0
  18. package/dist/nodes/filesystem.js +72 -0
  19. package/dist/nodes/gis.d.ts +25 -0
  20. package/dist/nodes/gis.js +27 -0
  21. package/dist/nodes/git.d.ts +42 -0
  22. package/dist/nodes/git.js +44 -0
  23. package/dist/nodes/github.d.ts +56 -0
  24. package/dist/nodes/github.js +60 -0
  25. package/dist/nodes/hackernews.d.ts +28 -0
  26. package/dist/nodes/hackernews.js +32 -0
  27. package/dist/nodes/hardware_interaction.d.ts +31 -0
  28. package/dist/nodes/hardware_interaction.js +33 -0
  29. package/dist/nodes/http.d.ts +51 -0
  30. package/dist/nodes/http.js +53 -0
  31. package/dist/nodes/http_server.d.ts +37 -0
  32. package/dist/nodes/http_server.js +33 -0
  33. package/dist/nodes/image_gallery.d.ts +29 -0
  34. package/dist/nodes/image_gallery.js +29 -0
  35. package/dist/nodes/interactive_input.d.ts +22 -0
  36. package/dist/nodes/interactive_input.js +24 -0
  37. package/dist/nodes/interactive_webview.d.ts +59 -0
  38. package/dist/nodes/interactive_webview.js +59 -0
  39. package/dist/nodes/iterator.d.ts +18 -0
  40. package/dist/nodes/iterator.js +20 -0
  41. package/dist/nodes/llm.d.ts +142 -0
  42. package/dist/nodes/llm.js +152 -0
  43. package/dist/nodes/memory.d.ts +31 -0
  44. package/dist/nodes/memory.js +80 -38
  45. package/dist/nodes/multimedia_processing.d.ts +47 -0
  46. package/dist/nodes/multimedia_processing.js +49 -0
  47. package/dist/nodes/openrouter_llm.d.ts +30 -0
  48. package/dist/nodes/openrouter_llm.js +32 -0
  49. package/dist/nodes/pdf_processor.d.ts +39 -0
  50. package/dist/nodes/pdf_processor.js +37 -0
  51. package/dist/nodes/remote_execution.d.ts +47 -0
  52. package/dist/nodes/remote_execution.js +49 -0
  53. package/dist/nodes/s3.d.ts +67 -0
  54. package/dist/nodes/s3.js +69 -0
  55. package/dist/nodes/scheduler.d.ts +31 -0
  56. package/dist/nodes/scheduler.js +33 -0
  57. package/dist/nodes/search.d.ts +36 -0
  58. package/dist/nodes/search.js +40 -0
  59. package/dist/nodes/semantic_memory.d.ts +47 -0
  60. package/dist/nodes/semantic_memory.js +49 -0
  61. package/dist/nodes/shell.d.ts +14 -0
  62. package/dist/nodes/shell.js +16 -0
  63. package/dist/nodes/speech_synthesis.d.ts +27 -0
  64. package/dist/nodes/speech_synthesis.js +29 -0
  65. package/dist/nodes/spreadsheet.d.ts +51 -0
  66. package/dist/nodes/spreadsheet.js +53 -0
  67. package/dist/nodes/stripe.d.ts +44 -0
  68. package/dist/nodes/stripe.js +48 -0
  69. package/dist/nodes/subflow.d.ts +18 -0
  70. package/dist/nodes/subflow.js +20 -0
  71. package/dist/nodes/summarize.d.ts +14 -0
  72. package/dist/nodes/summarize.js +20 -0
  73. package/dist/nodes/system_notification.d.ts +22 -0
  74. package/dist/nodes/system_notification.js +24 -0
  75. package/dist/nodes/transform.d.ts +18 -0
  76. package/dist/nodes/transform.js +20 -0
  77. package/dist/nodes/user.d.ts +14 -0
  78. package/dist/nodes/user.js +16 -0
  79. package/dist/nodes/webhook.d.ts +34 -0
  80. package/dist/nodes/webhook.js +36 -0
  81. package/dist/nodes/webscraper.d.ts +14 -0
  82. package/dist/nodes/webscraper.js +16 -0
  83. package/dist/nodes/websockets.d.ts +23 -0
  84. package/dist/nodes/websockets.js +25 -0
  85. package/dist/nodes/webview.d.ts +26 -0
  86. package/dist/nodes/webview.js +28 -0
  87. package/package.json +3 -2
  88. package/dist/qflow.config.d.ts +0 -5
  89. package/dist/qflow.config.js +0 -16
  90. package/dist/src/agent/agent.d.ts +0 -23
  91. package/dist/src/agent/agent.js +0 -365
  92. package/dist/src/agent/base_agent.d.ts +0 -21
  93. package/dist/src/agent/base_agent.js +0 -206
  94. package/dist/src/agent/logger.d.ts +0 -9
  95. package/dist/src/agent/logger.js +0 -45
  96. package/dist/src/agent/lpavrl_agent.d.ts +0 -5
  97. package/dist/src/agent/lpavrl_agent.js +0 -178
  98. package/dist/src/agent/ooda_agent.d.ts +0 -5
  99. package/dist/src/agent/ooda_agent.js +0 -167
  100. package/dist/src/agent/pema_agent.d.ts +0 -5
  101. package/dist/src/agent/pema_agent.js +0 -171
  102. package/dist/src/agent/raor_agent.d.ts +0 -5
  103. package/dist/src/agent/raor_agent.js +0 -164
  104. package/dist/src/agent/tools.d.ts +0 -1
  105. package/dist/src/agent/tools.js +0 -148
  106. package/dist/src/logger.d.ts +0 -9
  107. package/dist/src/logger.js +0 -107
  108. package/dist/src/nodes/agent_llm.d.ts +0 -31
  109. package/dist/src/nodes/agent_llm.js +0 -302
  110. package/dist/src/nodes/browser_control.d.ts +0 -35
  111. package/dist/src/nodes/browser_control.js +0 -106
  112. package/dist/src/nodes/code_interpreter.d.ts +0 -38
  113. package/dist/src/nodes/code_interpreter.js +0 -150
  114. package/dist/src/nodes/data_extractor.d.ts +0 -40
  115. package/dist/src/nodes/data_extractor.js +0 -118
  116. package/dist/src/nodes/data_validation.d.ts +0 -36
  117. package/dist/src/nodes/data_validation.js +0 -77
  118. package/dist/src/nodes/database.d.ts +0 -50
  119. package/dist/src/nodes/database.js +0 -135
  120. package/dist/src/nodes/display_image.d.ts +0 -18
  121. package/dist/src/nodes/display_image.js +0 -63
  122. package/dist/src/nodes/embedding.d.ts +0 -29
  123. package/dist/src/nodes/embedding.js +0 -69
  124. package/dist/src/nodes/filesystem.d.ts +0 -105
  125. package/dist/src/nodes/filesystem.js +0 -160
  126. package/dist/src/nodes/gis.d.ts +0 -62
  127. package/dist/src/nodes/gis.js +0 -133
  128. package/dist/src/nodes/git.d.ts +0 -46
  129. package/dist/src/nodes/git.js +0 -99
  130. package/dist/src/nodes/github.d.ts +0 -83
  131. package/dist/src/nodes/github.js +0 -135
  132. package/dist/src/nodes/hackernews.d.ts +0 -47
  133. package/dist/src/nodes/hackernews.js +0 -79
  134. package/dist/src/nodes/hardware_interaction.d.ts +0 -39
  135. package/dist/src/nodes/hardware_interaction.js +0 -131
  136. package/dist/src/nodes/http.d.ts +0 -77
  137. package/dist/src/nodes/http.js +0 -120
  138. package/dist/src/nodes/http_server.d.ts +0 -54
  139. package/dist/src/nodes/http_server.js +0 -223
  140. package/dist/src/nodes/image_gallery.d.ts +0 -37
  141. package/dist/src/nodes/image_gallery.js +0 -129
  142. package/dist/src/nodes/index.d.ts +0 -48
  143. package/dist/src/nodes/index.js +0 -48
  144. package/dist/src/nodes/interactive_input.d.ts +0 -26
  145. package/dist/src/nodes/interactive_input.js +0 -95
  146. package/dist/src/nodes/interactive_webview.d.ts +0 -78
  147. package/dist/src/nodes/interactive_webview.js +0 -369
  148. package/dist/src/nodes/iterator.d.ts +0 -23
  149. package/dist/src/nodes/iterator.js +0 -43
  150. package/dist/src/nodes/llm.d.ts +0 -160
  151. package/dist/src/nodes/llm.js +0 -367
  152. package/dist/src/nodes/memory.d.ts +0 -43
  153. package/dist/src/nodes/memory.js +0 -90
  154. package/dist/src/nodes/multimedia_processing.d.ts +0 -57
  155. package/dist/src/nodes/multimedia_processing.js +0 -129
  156. package/dist/src/nodes/openrouter_llm.d.ts +0 -38
  157. package/dist/src/nodes/openrouter_llm.js +0 -156
  158. package/dist/src/nodes/pdf_processor.d.ts +0 -43
  159. package/dist/src/nodes/pdf_processor.js +0 -112
  160. package/dist/src/nodes/remote_execution.d.ts +0 -51
  161. package/dist/src/nodes/remote_execution.js +0 -132
  162. package/dist/src/nodes/s3.d.ts +0 -73
  163. package/dist/src/nodes/s3.js +0 -107
  164. package/dist/src/nodes/scheduler.d.ts +0 -51
  165. package/dist/src/nodes/scheduler.js +0 -131
  166. package/dist/src/nodes/search.d.ts +0 -61
  167. package/dist/src/nodes/search.js +0 -118
  168. package/dist/src/nodes/semantic_memory.d.ts +0 -64
  169. package/dist/src/nodes/semantic_memory.js +0 -160
  170. package/dist/src/nodes/shell.d.ts +0 -25
  171. package/dist/src/nodes/shell.js +0 -45
  172. package/dist/src/nodes/speech_synthesis.d.ts +0 -72
  173. package/dist/src/nodes/speech_synthesis.js +0 -171
  174. package/dist/src/nodes/spreadsheet.d.ts +0 -61
  175. package/dist/src/nodes/spreadsheet.js +0 -294
  176. package/dist/src/nodes/stripe.d.ts +0 -67
  177. package/dist/src/nodes/stripe.js +0 -117
  178. package/dist/src/nodes/subflow.d.ts +0 -23
  179. package/dist/src/nodes/subflow.js +0 -36
  180. package/dist/src/nodes/summarize.d.ts +0 -26
  181. package/dist/src/nodes/summarize.js +0 -51
  182. package/dist/src/nodes/system_notification.d.ts +0 -26
  183. package/dist/src/nodes/system_notification.js +0 -74
  184. package/dist/src/nodes/transform.d.ts +0 -23
  185. package/dist/src/nodes/transform.js +0 -52
  186. package/dist/src/nodes/user.d.ts +0 -25
  187. package/dist/src/nodes/user.js +0 -48
  188. package/dist/src/nodes/webhook.d.ts +0 -49
  189. package/dist/src/nodes/webhook.js +0 -161
  190. package/dist/src/nodes/webscraper.d.ts +0 -25
  191. package/dist/src/nodes/webscraper.js +0 -49
  192. package/dist/src/nodes/websockets.d.ts +0 -27
  193. package/dist/src/nodes/websockets.js +0 -98
  194. package/dist/src/nodes/webview.d.ts +0 -38
  195. package/dist/src/nodes/webview.js +0 -55
  196. package/dist/src/qflow.d.ts +0 -69
  197. package/dist/src/qflow.js +0 -320
  198. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  199. /package/dist/{src/types.js → types.js} +0 -0
package/dist/nodes/llm.js CHANGED
@@ -2,6 +2,38 @@ import { AsyncNode } from '../qflow.js';
2
2
  import { log } from '../logger.js';
3
3
  // --- Reusable LLM Node for DeepSeek ---
4
4
  export class DeepSeekLLMNode extends AsyncNode {
5
+ static getToolDefinition() {
6
+ return {
7
+ name: "deepseek_llm",
8
+ description: "Interacts with the DeepSeek API to generate text.",
9
+ parameters: {
10
+ type: "object",
11
+ properties: {
12
+ prompt: {
13
+ type: "string",
14
+ description: "The prompt or question to send to the language model."
15
+ },
16
+ apiKey: {
17
+ type: "string",
18
+ description: "Your DeepSeek API Key."
19
+ },
20
+ model: {
21
+ type: "string",
22
+ description: "Optional. The DeepSeek model to use. Defaults to 'deepseek-chat'."
23
+ },
24
+ max_tokens: {
25
+ type: "number",
26
+ description: "Optional. The maximum number of tokens to generate. Defaults to 2048."
27
+ },
28
+ temperature: {
29
+ type: "number",
30
+ description: "Optional. Controls randomness. Defaults to 0.7."
31
+ }
32
+ },
33
+ required: ["prompt", "apiKey"]
34
+ }
35
+ };
36
+ }
5
37
  constructor(maxRetries = 3, wait = 2) {
6
38
  super(maxRetries, wait);
7
39
  }
@@ -46,6 +78,38 @@ export class DeepSeekLLMNode extends AsyncNode {
46
78
  }
47
79
  }
48
80
  export class OpenAILLMNode extends AsyncNode {
81
+ static getToolDefinition() {
82
+ return {
83
+ name: "openai_llm",
84
+ description: "Interacts with the OpenAI API to generate text.",
85
+ parameters: {
86
+ type: "object",
87
+ properties: {
88
+ prompt: {
89
+ type: "string",
90
+ description: "The prompt or question to send to the language model."
91
+ },
92
+ apiKey: {
93
+ type: "string",
94
+ description: "Your OpenAI API Key."
95
+ },
96
+ model: {
97
+ type: "string",
98
+ description: "Optional. The OpenAI model to use. Defaults to 'gpt-3.5-turbo'."
99
+ },
100
+ max_tokens: {
101
+ type: "number",
102
+ description: "Optional. The maximum number of tokens to generate. Defaults to 150."
103
+ },
104
+ temperature: {
105
+ type: "number",
106
+ description: "Optional. Controls randomness. Defaults to 0.7."
107
+ }
108
+ },
109
+ required: ["prompt", "apiKey"]
110
+ }
111
+ };
112
+ }
49
113
  async execAsync() {
50
114
  const { prompt, apiKey } = this.params; // prompt and apiKey passed via node params
51
115
  if (!prompt) {
@@ -84,6 +148,34 @@ export class OpenAILLMNode extends AsyncNode {
84
148
  }
85
149
  }
86
150
  export class GeminiLLMNode extends AsyncNode {
151
+ static getToolDefinition() {
152
+ return {
153
+ name: "gemini_llm",
154
+ description: "Interacts with the Google Gemini API to generate text.",
155
+ parameters: {
156
+ type: "object",
157
+ properties: {
158
+ prompt: {
159
+ type: "string",
160
+ description: "The prompt or question to send to the language model."
161
+ },
162
+ apiKey: {
163
+ type: "string",
164
+ description: "Your Google Gemini API Key."
165
+ },
166
+ model: {
167
+ type: "string",
168
+ description: "Optional. The Gemini model to use. Defaults to 'gemini-pro'."
169
+ },
170
+ temperature: {
171
+ type: "number",
172
+ description: "Optional. Controls randomness. Defaults to 0.7."
173
+ }
174
+ },
175
+ required: ["prompt", "apiKey"]
176
+ }
177
+ };
178
+ }
87
179
  async execAsync() {
88
180
  const { prompt, apiKey } = this.params; // prompt and apiKey passed via node params
89
181
  if (!prompt) {
@@ -119,6 +211,30 @@ export class GeminiLLMNode extends AsyncNode {
119
211
  }
120
212
  }
121
213
  export class OllamaLLMNode extends AsyncNode {
214
+ static getToolDefinition() {
215
+ return {
216
+ name: "ollama_llm_reasoning",
217
+ description: "Generates human-like text, reasons, and plans locally via Ollama. Not for external actions.",
218
+ parameters: {
219
+ type: "object",
220
+ properties: {
221
+ prompt: {
222
+ type: "string",
223
+ description: "The prompt or question to send to the local Ollama language model."
224
+ },
225
+ model: {
226
+ type: "string",
227
+ description: "The Ollama model name to use (e.g., 'llama2', 'gemma:2b'). Defaults to 'llama2'."
228
+ },
229
+ baseUrl: {
230
+ type: "string",
231
+ description: "The base URL of the Ollama API (e.g., 'http://localhost:11434'). Defaults to 'http://localhost:11434'."
232
+ }
233
+ },
234
+ required: ["prompt"]
235
+ }
236
+ };
237
+ }
122
238
  constructor(maxRetries = 3, wait = 2) {
123
239
  super(maxRetries, wait);
124
240
  }
@@ -161,6 +277,42 @@ export class OllamaLLMNode extends AsyncNode {
161
277
  }
162
278
  }
163
279
  export class HuggingFaceLLMNode extends AsyncNode {
280
+ static getToolDefinition() {
281
+ return {
282
+ name: "huggingface_llm_reasoning",
283
+ description: "Generates human-like text, reasons, and plans. Not for external actions.",
284
+ parameters: {
285
+ type: "object",
286
+ properties: {
287
+ prompt: {
288
+ type: "string",
289
+ description: "The prompt or question to send to the language model."
290
+ },
291
+ model: {
292
+ type: "string",
293
+ description: "The Hugging Face model ID (e.g., 'HuggingFaceH4/zephyr-7b-beta', 'openai/gpt-oss-20b:novita')."
294
+ },
295
+ hfToken: {
296
+ type: "string",
297
+ description: "Your Hugging Face API token."
298
+ },
299
+ temperature: {
300
+ type: "number",
301
+ description: "Optional. Controls randomness. Defaults to 0.7."
302
+ },
303
+ max_new_tokens: {
304
+ type: "number",
305
+ description: "Optional. Maximum number of tokens to generate. Defaults to 500."
306
+ },
307
+ baseUrl: {
308
+ type: "string",
309
+ description: "Optional. The base URL of the Hugging Face router API. Defaults to 'https://router.huggingface.co/v1'."
310
+ }
311
+ },
312
+ required: ["prompt", "model", "hfToken"]
313
+ }
314
+ };
315
+ }
164
316
  constructor(maxRetries = 3, wait = 2) {
165
317
  super(maxRetries, wait);
166
318
  }
@@ -1,4 +1,35 @@
1
1
  export class MemoryNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ action: {
9
+ type: string;
10
+ enum: string[];
11
+ description: string;
12
+ };
13
+ content: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ query: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ id: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ memoryPath: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ };
30
+ required: string[];
31
+ };
32
+ };
2
33
  execAsync(): Promise<{
3
34
  status: string;
4
35
  id: any;
@@ -2,47 +2,89 @@ import { AsyncNode } from '../qflow.js';
2
2
  import { promises as fs } from 'fs';
3
3
  import path from 'path';
4
4
  export class MemoryNode extends AsyncNode {
5
- async execAsync() { const { action, content, query, id, memoryPath = './agent_memories' } = this.params; if (!action) {
6
- throw new Error('MemoryNode requires an `action` (store or retrieve).');
7
- } const fullMemoryPath = path.resolve(memoryPath); switch (action) {
8
- case 'store':
9
- if (!content) {
10
- throw new Error('Store action requires `content`.');
11
- }
12
- const memoryId = id || `mem_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
13
- const filePath = path.join(fullMemoryPath, `${memoryId}.txt`);
14
- await fs.mkdir(fullMemoryPath, { recursive: true });
15
- await fs.writeFile(filePath, content, 'utf-8');
16
- console.log(`[MemoryNode] Stored memory: ${memoryId}`);
17
- return { status: 'stored', id: memoryId, filePath };
18
- case 'retrieve':
19
- if (!query) {
20
- throw new Error('Retrieve action requires a `query`.');
5
+ static getToolDefinition() {
6
+ return {
7
+ name: "memory_node",
8
+ description: "Stores and retrieves text memories (keyword-based).",
9
+ parameters: {
10
+ type: "object",
11
+ properties: {
12
+ action: {
13
+ type: "string",
14
+ enum: ["store", "retrieve"],
15
+ description: "The action to perform: 'store' a new memory or 'retrieve' existing ones."
16
+ },
17
+ content: {
18
+ type: "string",
19
+ description: "Required for 'store' action. The text content of the memory to store."
20
+ },
21
+ query: {
22
+ type: "string",
23
+ description: "Required for 'retrieve' action. Keywords to search for within stored memories."
24
+ },
25
+ id: {
26
+ type: "string",
27
+ description: "Optional for 'store' action. A unique identifier for the memory. If not provided, one will be generated."
28
+ },
29
+ memoryPath: {
30
+ type: "string",
31
+ description: "Optional. The directory path where memories are stored. Defaults to './agent_memories'."
32
+ }
33
+ },
34
+ required: ["action"]
21
35
  }
22
- console.log(`[MemoryNode] Retrieving memories for query: "${query}"...`);
23
- const retrievedMemories = [];
24
- try {
25
- const files = await fs.readdir(fullMemoryPath);
26
- for (const file of files) {
27
- if (file.endsWith('.txt')) {
28
- const filePath = path.join(fullMemoryPath, file);
29
- const fileContent = await fs.readFile(filePath, 'utf-8');
30
- if (fileContent.toLowerCase().includes(query.toLowerCase())) {
31
- retrievedMemories.push({ id: file.replace('.txt', ''), content: fileContent });
36
+ };
37
+ }
38
+ async execAsync() {
39
+ const { action, content, query, id, memoryPath = './agent_memories' } = this.params;
40
+ if (!action) {
41
+ throw new Error('MemoryNode requires an `action` (store or retrieve).');
42
+ }
43
+ const fullMemoryPath = path.resolve(memoryPath);
44
+ switch (action) {
45
+ case 'store':
46
+ if (!content) {
47
+ throw new Error('Store action requires `content`.');
48
+ }
49
+ const memoryId = id || `mem_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
50
+ const filePath = path.join(fullMemoryPath, `${memoryId}.txt`);
51
+ await fs.mkdir(fullMemoryPath, { recursive: true });
52
+ await fs.writeFile(filePath, content, 'utf-8');
53
+ console.log(`[MemoryNode] Stored memory: ${memoryId}`);
54
+ return { status: 'stored', id: memoryId, filePath };
55
+ case 'retrieve':
56
+ if (!query) {
57
+ throw new Error('Retrieve action requires a `query`.');
58
+ }
59
+ console.log(`[MemoryNode] Retrieving memories for query: "${query}"...`);
60
+ const retrievedMemories = [];
61
+ try {
62
+ const files = await fs.readdir(fullMemoryPath);
63
+ for (const file of files) {
64
+ if (file.endsWith('.txt')) {
65
+ const filePath = path.join(fullMemoryPath, file);
66
+ const fileContent = await fs.readFile(filePath, 'utf-8');
67
+ if (fileContent.toLowerCase().includes(query.toLowerCase())) {
68
+ retrievedMemories.push({ id: file.replace('.txt', ''), content: fileContent });
69
+ }
32
70
  }
33
71
  }
34
72
  }
35
- }
36
- catch (error) {
37
- if (error.code === 'ENOENT') {
38
- console.log(`[MemoryNode] Memory path ${fullMemoryPath} does not exist. No memories to retrieve.`);
39
- return [];
73
+ catch (error) {
74
+ if (error.code === 'ENOENT') {
75
+ console.log(`[MemoryNode] Memory path ${fullMemoryPath} does not exist. No memories to retrieve.`);
76
+ return [];
77
+ }
78
+ throw error;
40
79
  }
41
- throw error;
42
- }
43
- console.log(`[MemoryNode] Retrieved ${retrievedMemories.length} memories.`);
44
- return retrievedMemories;
45
- default: throw new Error(`Unsupported action: ${action}`);
46
- } }
47
- async postAsync(shared, prepRes, execRes) { shared.memoryResult = execRes; return 'default'; }
80
+ console.log(`[MemoryNode] Retrieved ${retrievedMemories.length} memories.`);
81
+ return retrievedMemories;
82
+ default:
83
+ throw new Error(`Unsupported action: ${action}`);
84
+ }
85
+ }
86
+ async postAsync(shared, prepRes, execRes) {
87
+ shared.memoryResult = execRes;
88
+ return 'default';
89
+ }
48
90
  }
@@ -1,4 +1,51 @@
1
1
  export class MultimediaProcessingNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ action: {
9
+ type: string;
10
+ enum: string[];
11
+ description: string;
12
+ };
13
+ inputPath: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ outputPath: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ format: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ startTime: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ duration: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ resolution: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ frameTime: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ ffmpegArgs: {
42
+ type: string;
43
+ description: string;
44
+ };
45
+ };
46
+ required: string[];
47
+ };
48
+ };
2
49
  execAsync(): Promise<{
3
50
  status: string;
4
51
  action: any;
@@ -5,6 +5,55 @@ import os from 'os';
5
5
  import { promises as fs } from 'fs';
6
6
  import { log } from '../logger.js';
7
7
  export class MultimediaProcessingNode extends AsyncNode {
8
+ static getToolDefinition() {
9
+ return {
10
+ name: "multimedia_processing",
11
+ description: "Performs various multimedia operations on audio and video files using ffmpeg.",
12
+ parameters: {
13
+ type: "object",
14
+ properties: {
15
+ action: {
16
+ type: "string",
17
+ enum: ["convert", "trim", "extract_audio", "extract_frame", "custom"],
18
+ description: "The multimedia operation to perform."
19
+ },
20
+ inputPath: {
21
+ type: "string",
22
+ description: "Path to the input multimedia file."
23
+ },
24
+ outputPath: {
25
+ type: "string",
26
+ description: "Path for the output file."
27
+ },
28
+ format: {
29
+ type: "string",
30
+ description: "Required for 'convert' and 'extract_audio'. The output format (e.g., 'mp4', 'mp3', 'gif', 'wav')."
31
+ },
32
+ startTime: {
33
+ type: "string",
34
+ description: "Required for 'trim'. Start time in HH:MM:SS or seconds (e.g., '00:00:10', '10')."
35
+ },
36
+ duration: {
37
+ type: "string",
38
+ description: "Required for 'trim'. Duration in HH:MM:SS or seconds (e.g., '00:00:05', '5')."
39
+ },
40
+ resolution: {
41
+ type: "string",
42
+ description: "Optional for video 'convert'. Resolution (e.g., '1280x720')."
43
+ },
44
+ frameTime: {
45
+ type: "string",
46
+ description: "Required for 'extract_frame'. Time to extract frame from in HH:MM:SS or seconds (e.g., '00:00:05')."
47
+ },
48
+ ffmpegArgs: {
49
+ type: "string",
50
+ description: "Required for 'custom'. Raw ffmpeg arguments to execute directly."
51
+ }
52
+ },
53
+ required: ["action", "inputPath", "outputPath"]
54
+ }
55
+ };
56
+ }
8
57
  constructor(maxRetries = 1, wait = 0) {
9
58
  super(maxRetries, wait);
10
59
  }
@@ -1,4 +1,34 @@
1
1
  export class OpenRouterLLMNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ prompt: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ model: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ apiKey: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ siteUrl: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ siteTitle: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ };
29
+ required: string[];
30
+ };
31
+ };
2
32
  execAsync(): Promise<any>;
3
33
  }
4
34
  export class AgentOpenRouterLLMNode extends OpenRouterLLMNode {
@@ -1,6 +1,38 @@
1
1
  import { AsyncNode } from '../qflow.js';
2
2
  import { log } from '../logger.js';
3
3
  export class OpenRouterLLMNode extends AsyncNode {
4
+ static getToolDefinition() {
5
+ return {
6
+ name: "openrouter_llm_reasoning",
7
+ description: "Generates human-like text, reasons, and plans via OpenRouter. Not for external actions.",
8
+ parameters: {
9
+ type: "object",
10
+ properties: {
11
+ prompt: {
12
+ type: "string",
13
+ description: "The prompt or question to send to the language model."
14
+ },
15
+ model: {
16
+ type: "string",
17
+ description: "The OpenRouter model ID (e.g., 'openai/gpt-4o', 'mistralai/mistral-7b-instruct')."
18
+ },
19
+ apiKey: {
20
+ type: "string",
21
+ description: "Your OpenRouter API key."
22
+ },
23
+ siteUrl: {
24
+ type: "string",
25
+ description: "Optional. Site URL for rankings on openrouter.ai."
26
+ },
27
+ siteTitle: {
28
+ type: "string",
29
+ description: "Optional. Site title for rankings on openrouter.ai."
30
+ }
31
+ },
32
+ required: ["prompt", "model", "apiKey"]
33
+ }
34
+ };
35
+ }
4
36
  constructor(maxRetries = 3, wait = 2) {
5
37
  super(maxRetries, wait);
6
38
  }
@@ -1,4 +1,43 @@
1
1
  export class PDFProcessorNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ filePath: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ action: {
13
+ type: string;
14
+ enum: string[];
15
+ description: string;
16
+ };
17
+ outputDir: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ pageRange: {
22
+ type: string;
23
+ properties: {
24
+ start: {
25
+ type: string;
26
+ };
27
+ end: {
28
+ type: string;
29
+ };
30
+ };
31
+ description: string;
32
+ };
33
+ password: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ };
38
+ required: string[];
39
+ };
40
+ };
2
41
  execAsync(): Promise<{}>;
3
42
  }
4
43
  import { AsyncNode } from '../qflow.js';
@@ -4,6 +4,43 @@ import path from 'path';
4
4
  import os from 'os';
5
5
  import { promises as fs } from 'fs';
6
6
  export class PDFProcessorNode extends AsyncNode {
7
+ static getToolDefinition() {
8
+ return {
9
+ name: "pdf_processor",
10
+ description: "Extracts text or images from PDF documents.",
11
+ parameters: {
12
+ type: "object",
13
+ properties: {
14
+ filePath: {
15
+ type: "string",
16
+ description: "The absolute path to the PDF file."
17
+ },
18
+ action: {
19
+ type: "string",
20
+ enum: ["extract_text", "extract_images"],
21
+ description: "The action to perform: 'extract_text' or 'extract_images'."
22
+ },
23
+ outputDir: {
24
+ type: "string",
25
+ description: "Optional. Directory to save extracted files. If not provided, a temporary directory will be used."
26
+ },
27
+ pageRange: {
28
+ type: "object",
29
+ properties: {
30
+ start: { type: "number" },
31
+ end: { type: "number" }
32
+ },
33
+ description: "Optional. Page range to process (e.g., {start: 1, end: 5})."
34
+ },
35
+ password: {
36
+ type: "string",
37
+ description: "Optional. Password for encrypted PDFs."
38
+ }
39
+ },
40
+ required: ["filePath", "action"]
41
+ }
42
+ };
43
+ }
7
44
  constructor(maxRetries = 1, wait = 0) {
8
45
  super(maxRetries, wait);
9
46
  }
@@ -1,4 +1,51 @@
1
1
  export class RemoteExecutionNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ host: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ port: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ username: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ password: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ privateKey: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ passphrase: {
29
+ type: string;
30
+ description: string;
31
+ };
32
+ action: {
33
+ type: string;
34
+ enum: string[];
35
+ description: string;
36
+ };
37
+ command: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ timeout: {
42
+ type: string;
43
+ description: string;
44
+ };
45
+ };
46
+ required: string[];
47
+ };
48
+ };
2
49
  execAsync(): Promise<{}>;
3
50
  }
4
51
  import { AsyncNode } from '../qflow.js';