@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
@@ -1,4 +1,35 @@
1
1
  export class BrowserControlNode 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
+ url: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ selector: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ text: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ path: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ };
30
+ required: string[];
31
+ };
32
+ };
2
33
  execAsync(prepRes: any, shared: any): Promise<{}>;
3
34
  }
4
35
  import { AsyncNode } from '../qflow.js';
@@ -1,6 +1,39 @@
1
1
  import { AsyncNode } from '../qflow.js';
2
2
  import { chromium, firefox, webkit } from 'playwright';
3
3
  export class BrowserControlNode extends AsyncNode {
4
+ static getToolDefinition() {
5
+ return {
6
+ name: "browser_control",
7
+ description: "Controls a web browser to navigate pages, interact with elements, and take screenshots.",
8
+ parameters: {
9
+ type: "object",
10
+ properties: {
11
+ action: {
12
+ type: "string",
13
+ enum: ["goto", "click", "type", "screenshot", "close"],
14
+ description: "The browser action to perform."
15
+ },
16
+ url: {
17
+ type: "string",
18
+ description: "The URL to navigate to (for 'goto' action)."
19
+ },
20
+ selector: {
21
+ type: "string",
22
+ description: "A CSS selector to target an element (for 'click' and 'type' actions)."
23
+ },
24
+ text: {
25
+ type: "string",
26
+ description: "The text to type into an input field (for 'type' action)."
27
+ },
28
+ path: {
29
+ type: "string",
30
+ description: "The file path to save a screenshot (for 'screenshot' action)."
31
+ }
32
+ },
33
+ required: ["action"]
34
+ }
35
+ };
36
+ }
4
37
  async execAsync(prepRes, shared) {
5
38
  const { action, url, selector, text, path, script, browserType = 'chromium', launchOptions = { headless: true }, } = this.params;
6
39
  let browser = shared.browser;
@@ -1,4 +1,33 @@
1
1
  export class CodeInterpreterNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ code: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ timeout: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ args: {
17
+ type: string;
18
+ items: {
19
+ type: string;
20
+ };
21
+ description: string;
22
+ };
23
+ requireConfirmation: {
24
+ type: string;
25
+ description: string;
26
+ };
27
+ };
28
+ required: string[];
29
+ };
30
+ };
2
31
  execAsync(): Promise<{
3
32
  stdout: string;
4
33
  stderr: string;
@@ -21,6 +21,35 @@ function syntaxHighlight(code) {
21
21
  .replace(/\b(self|cls)\b/g, chalk.hex('#ffb86c').italic('$1'));
22
22
  }
23
23
  export class CodeInterpreterNode extends AsyncNode {
24
+ static getToolDefinition() {
25
+ return {
26
+ name: "code_interpreter",
27
+ description: "Executes Python code (requires user confirmation).",
28
+ parameters: {
29
+ type: "object",
30
+ properties: {
31
+ code: {
32
+ type: "string",
33
+ description: "The Python code snippet to execute."
34
+ },
35
+ timeout: {
36
+ type: "number",
37
+ description: "Optional. Maximum execution time in milliseconds. Defaults to 30000 (30 seconds)."
38
+ },
39
+ args: {
40
+ type: "array",
41
+ items: { type: "string" },
42
+ description: "Optional. Command-line arguments to pass to the script."
43
+ },
44
+ requireConfirmation: {
45
+ type: "boolean",
46
+ description: "Optional. If true, the user will be prompted for confirmation before executing the code. Defaults to true."
47
+ }
48
+ },
49
+ required: ["code"]
50
+ }
51
+ };
52
+ }
24
53
  async execAsync() {
25
54
  const { code, timeout = 30000, args = [], requireConfirmation = true, interpreterPath } = this.params;
26
55
  if (!code) {
@@ -1,4 +1,39 @@
1
1
  export class DataExtractorNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ input: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ type: {
13
+ type: string;
14
+ enum: string[];
15
+ description: string;
16
+ };
17
+ selector: {
18
+ type: string;
19
+ description: string;
20
+ };
21
+ jsonPath: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ regex: {
26
+ type: string;
27
+ description: string;
28
+ };
29
+ group: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ };
34
+ required: string[];
35
+ };
36
+ };
2
37
  execAsync(): Promise<any>;
3
38
  postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
4
39
  }
@@ -2,6 +2,43 @@ import { AsyncNode } from '../qflow.js';
2
2
  import * as cheerio from 'cheerio';
3
3
  import { log } from '../logger.js';
4
4
  export class DataExtractorNode extends AsyncNode {
5
+ static getToolDefinition() {
6
+ return {
7
+ name: "data_extractor",
8
+ description: "Extracts structured data from HTML, JSON, or text.",
9
+ parameters: {
10
+ type: "object",
11
+ properties: {
12
+ input: {
13
+ type: "string",
14
+ description: "The content string from which to extract data."
15
+ },
16
+ type: {
17
+ type: "string",
18
+ enum: ["html", "json", "text"],
19
+ description: "The type of content to extract from (html, json, or text)."
20
+ },
21
+ selector: {
22
+ type: "string",
23
+ description: "Required for 'html' type. A CSS selector to target elements."
24
+ },
25
+ jsonPath: {
26
+ type: "string",
27
+ description: "Required for 'json' type. A dot-notation path to extract data (e.g., 'data.items[0].name')."
28
+ },
29
+ regex: {
30
+ type: "string",
31
+ description: "Required for 'text' type. A regular expression to match and extract data."
32
+ },
33
+ group: {
34
+ type: "number",
35
+ description: "Optional for 'text' type. The capturing group index to return from the regex match."
36
+ }
37
+ },
38
+ required: ["input", "type"]
39
+ }
40
+ };
41
+ }
5
42
  async execAsync() {
6
43
  const { input, type, selector, jsonPath, regex, group } = this.params;
7
44
  if (!input) {
@@ -1,4 +1,31 @@
1
1
  export class DataValidationNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ data: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ schema: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ schemaPath: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ action: {
21
+ type: string;
22
+ enum: string[];
23
+ description: string;
24
+ };
25
+ };
26
+ required: string[];
27
+ };
28
+ };
2
29
  ajv: Ajv;
3
30
  execAsync(): Promise<{
4
31
  isValid: boolean;
@@ -3,6 +3,35 @@ import { promises as fs } from 'fs';
3
3
  import Ajv from 'ajv'; // npm install ajv
4
4
  import addFormats from 'ajv-formats'; // npm install ajv-formats
5
5
  export class DataValidationNode extends AsyncNode {
6
+ static getToolDefinition() {
7
+ return {
8
+ name: "data_validation",
9
+ description: "Validates structured data against a JSON Schema.",
10
+ parameters: {
11
+ type: "object",
12
+ properties: {
13
+ data: {
14
+ type: "object", // Can be any JSON-compatible type
15
+ description: "The data to be validated."
16
+ },
17
+ schema: {
18
+ type: "object",
19
+ description: "The JSON Schema object directly."
20
+ },
21
+ schemaPath: {
22
+ type: "string",
23
+ description: "Optional. Path to a JSON Schema file. If provided, 'schema' parameter is ignored."
24
+ },
25
+ action: {
26
+ type: "string",
27
+ enum: ["validate"],
28
+ description: "The action to perform. Currently only 'validate' is supported."
29
+ }
30
+ },
31
+ required: ["data"]
32
+ }
33
+ };
34
+ }
6
35
  constructor(maxRetries = 1, wait = 0) {
7
36
  super(maxRetries, wait);
8
37
  this.ajv = new Ajv({ allErrors: true, verbose: true }); // Configure AJV for detailed errors
@@ -1,4 +1,48 @@
1
1
  export class DatabaseNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ adapter: {
9
+ type: string;
10
+ enum: string[];
11
+ description: string;
12
+ };
13
+ connection: {
14
+ type: string;
15
+ description: string;
16
+ };
17
+ action: {
18
+ type: string;
19
+ enum: string[];
20
+ description: string;
21
+ };
22
+ query: {
23
+ type: string;
24
+ description: string;
25
+ };
26
+ table: {
27
+ type: string;
28
+ description: string;
29
+ };
30
+ data: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ where: {
35
+ type: string;
36
+ description: string;
37
+ };
38
+ operations: {
39
+ type: string;
40
+ description: string;
41
+ };
42
+ };
43
+ required: string[];
44
+ };
45
+ };
2
46
  execAsync(prepRes: any, shared: any): Promise<any>;
3
47
  postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
4
48
  #private;
@@ -2,6 +2,52 @@ import { AsyncNode } from '../qflow.js';
2
2
  import { SQL } from 'bun';
3
3
  import { Database as SQLiteDatabase } from 'bun:sqlite';
4
4
  export class DatabaseNode extends AsyncNode {
5
+ static getToolDefinition() {
6
+ return {
7
+ name: "database",
8
+ description: "Interacts with a database.",
9
+ parameters: {
10
+ type: "object",
11
+ properties: {
12
+ adapter: {
13
+ type: "string",
14
+ enum: ["sqlite", "postgres", "mysql"],
15
+ description: "The database adapter to use."
16
+ },
17
+ connection: {
18
+ type: "string",
19
+ description: "The connection string for the database."
20
+ },
21
+ action: {
22
+ type: "string",
23
+ enum: ["query", "insert", "bulk_insert", "update", "delete", "transaction"],
24
+ description: "The action to perform."
25
+ },
26
+ query: {
27
+ type: "string",
28
+ description: "The SQL query to execute (for the 'query' action)."
29
+ },
30
+ table: {
31
+ type: "string",
32
+ description: "The name of the table to operate on."
33
+ },
34
+ data: {
35
+ type: "object",
36
+ description: "The data to insert or update."
37
+ },
38
+ where: {
39
+ type: "string",
40
+ description: "The WHERE clause for 'update' and 'delete' actions."
41
+ },
42
+ operations: {
43
+ type: "array",
44
+ description: "An array of operations to execute within a transaction."
45
+ }
46
+ },
47
+ required: ["adapter", "connection", "action"]
48
+ }
49
+ };
50
+ }
5
51
  #db = null;
6
52
  async prepAsync(shared) {
7
53
  const { connection, adapter } = this.params;
@@ -1,4 +1,18 @@
1
1
  export class DisplayImageNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ imagePath: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ };
13
+ required: string[];
14
+ };
15
+ };
2
16
  execAsync(): Promise<any>;
3
17
  }
4
18
  import { AsyncNode } from '../qflow.js';
@@ -3,6 +3,22 @@ import { exec } from 'child_process';
3
3
  import os from 'os';
4
4
  import { log } from '../logger.js';
5
5
  export class DisplayImageNode extends AsyncNode {
6
+ static getToolDefinition() {
7
+ return {
8
+ name: "display_image",
9
+ description: "Displays an image file using the system's default image viewer.",
10
+ parameters: {
11
+ type: "object",
12
+ properties: {
13
+ imagePath: {
14
+ type: "string",
15
+ description: "The absolute path to the image file to display."
16
+ }
17
+ },
18
+ required: ["imagePath"]
19
+ }
20
+ };
21
+ }
6
22
  constructor(maxRetries = 1, wait = 0) {
7
23
  super(maxRetries, wait);
8
24
  }
@@ -1,4 +1,26 @@
1
1
  export class EmbeddingNode extends AsyncNode {
2
+ static getToolDefinition(): {
3
+ name: string;
4
+ description: string;
5
+ parameters: {
6
+ type: string;
7
+ properties: {
8
+ text: {
9
+ type: string;
10
+ description: string;
11
+ };
12
+ model: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ baseUrl: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ };
21
+ required: string[];
22
+ };
23
+ };
2
24
  execAsync(): Promise<{
3
25
  embedding: any;
4
26
  }>;
@@ -1,6 +1,30 @@
1
1
  import { AsyncNode } from '../qflow.js';
2
2
  import { log } from '../logger.js';
3
3
  export class EmbeddingNode extends AsyncNode {
4
+ static getToolDefinition() {
5
+ return {
6
+ name: "generate_embedding",
7
+ description: "Generates vector embeddings for text (requires Ollama).",
8
+ parameters: {
9
+ type: "object",
10
+ properties: {
11
+ text: {
12
+ type: "string",
13
+ description: "The text string to generate an embedding for."
14
+ },
15
+ model: {
16
+ type: "string",
17
+ description: "Optional. The Ollama embedding model name to use (e.g., 'nomic-embed-text'). Defaults to 'nomic-embed-text'."
18
+ },
19
+ baseUrl: {
20
+ type: "string",
21
+ description: "Optional. The base URL of the Ollama API (e.g., 'http://localhost:11434'). Defaults to 'http://localhost:11434'."
22
+ }
23
+ },
24
+ required: ["text"]
25
+ }
26
+ };
27
+ }
4
28
  constructor(maxRetries = 3, wait = 2) {
5
29
  super(maxRetries, wait);
6
30
  }
@@ -5,6 +5,20 @@
5
5
  * @returns {Promise<string>} A promise that resolves to the content of the file.
6
6
  */
7
7
  export class ReadFileNode extends AsyncNode {
8
+ static getToolDefinition(): {
9
+ name: string;
10
+ description: string;
11
+ parameters: {
12
+ type: string;
13
+ properties: {
14
+ filePath: {
15
+ type: string;
16
+ description: string;
17
+ };
18
+ };
19
+ required: string[];
20
+ };
21
+ };
8
22
  execAsync(): Promise<string>;
9
23
  postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
10
24
  }
@@ -16,6 +30,24 @@ export class ReadFileNode extends AsyncNode {
16
30
  * @returns {Promise<void>} A promise that resolves when the file has been written.
17
31
  */
18
32
  export class WriteFileNode extends AsyncNode {
33
+ static getToolDefinition(): {
34
+ name: string;
35
+ description: string;
36
+ parameters: {
37
+ type: string;
38
+ properties: {
39
+ filePath: {
40
+ type: string;
41
+ description: string;
42
+ };
43
+ content: {
44
+ type: string;
45
+ description: string;
46
+ };
47
+ };
48
+ required: string[];
49
+ };
50
+ };
19
51
  execAsync(): Promise<string>;
20
52
  }
21
53
  /**
@@ -26,6 +58,24 @@ export class WriteFileNode extends AsyncNode {
26
58
  * @returns {Promise<void>} A promise that resolves when the content has been appended.
27
59
  */
28
60
  export class AppendFileNode extends AsyncNode {
61
+ static getToolDefinition(): {
62
+ name: string;
63
+ description: string;
64
+ parameters: {
65
+ type: string;
66
+ properties: {
67
+ filePath: {
68
+ type: string;
69
+ description: string;
70
+ };
71
+ content: {
72
+ type: string;
73
+ description: string;
74
+ };
75
+ };
76
+ required: string[];
77
+ };
78
+ };
29
79
  execAsync(): Promise<string>;
30
80
  }
31
81
  /**
@@ -35,6 +85,20 @@ export class AppendFileNode extends AsyncNode {
35
85
  * @returns {Promise<string[]>} A promise that resolves to an array of file names.
36
86
  */
37
87
  export class ListDirectoryNode extends AsyncNode {
88
+ static getToolDefinition(): {
89
+ name: string;
90
+ description: string;
91
+ parameters: {
92
+ type: string;
93
+ properties: {
94
+ directoryPath: {
95
+ type: string;
96
+ description: string;
97
+ };
98
+ };
99
+ required: string[];
100
+ };
101
+ };
38
102
  execAsync(): Promise<string[]>;
39
103
  postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
40
104
  }