@fractal-solutions/qflow 1.0.29 → 1.0.30

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 (37) hide show
  1. package/LICENSE +504 -0
  2. package/README.md +170 -30
  3. package/dist/agent/tools.d.ts +3114 -181
  4. package/dist/agent/tools.js +492 -0
  5. package/dist/nodes/browser_control.d.ts +4 -0
  6. package/dist/nodes/browser_control.js +73 -0
  7. package/dist/nodes/data_validation.d.ts +9 -0
  8. package/dist/nodes/data_validation.js +48 -0
  9. package/dist/nodes/display_image.d.ts +4 -0
  10. package/dist/nodes/display_image.js +46 -0
  11. package/dist/nodes/gis.d.ts +37 -0
  12. package/dist/nodes/gis.js +106 -0
  13. package/dist/nodes/git.d.ts +4 -0
  14. package/dist/nodes/git.js +55 -0
  15. package/dist/nodes/hardware_interaction.d.ts +8 -0
  16. package/dist/nodes/hardware_interaction.js +97 -0
  17. package/dist/nodes/image_gallery.d.ts +8 -0
  18. package/dist/nodes/image_gallery.js +99 -0
  19. package/dist/nodes/index.d.ts +12 -0
  20. package/dist/nodes/index.js +12 -0
  21. package/dist/nodes/multimedia_processing.d.ts +10 -0
  22. package/dist/nodes/multimedia_processing.js +79 -0
  23. package/dist/nodes/pdf_processor.d.ts +4 -0
  24. package/dist/nodes/pdf_processor.js +75 -0
  25. package/dist/nodes/remote_execution.d.ts +4 -0
  26. package/dist/nodes/remote_execution.js +82 -0
  27. package/dist/nodes/scheduler.d.ts +20 -0
  28. package/dist/nodes/scheduler.js +97 -0
  29. package/dist/nodes/speech_synthesis.d.ts +45 -0
  30. package/dist/nodes/speech_synthesis.js +142 -0
  31. package/dist/nodes/spreadsheet.d.ts +10 -0
  32. package/dist/nodes/spreadsheet.js +241 -0
  33. package/dist/nodes/webhook.d.ts +15 -0
  34. package/dist/nodes/webhook.js +110 -0
  35. package/dist/nodes/websockets.d.ts +4 -0
  36. package/dist/nodes/websockets.js +73 -0
  37. package/package.json +11 -2
@@ -253,6 +253,402 @@ export function getToolDefinitions() {
253
253
  required: ["input", "type"]
254
254
  }
255
255
  },
256
+ {
257
+ name: "pdf_processor",
258
+ description: "Extracts text or images from PDF documents.",
259
+ parameters: {
260
+ type: "object",
261
+ properties: {
262
+ filePath: {
263
+ type: "string",
264
+ description: "The absolute path to the PDF file."
265
+ },
266
+ action: {
267
+ type: "string",
268
+ enum: ["extract_text", "extract_images"],
269
+ description: "The action to perform: 'extract_text' or 'extract_images'."
270
+ },
271
+ outputDir: {
272
+ type: "string",
273
+ description: "Optional. Directory to save extracted files. If not provided, a temporary directory will be used."
274
+ },
275
+ pageRange: {
276
+ type: "object",
277
+ properties: {
278
+ start: { type: "number" },
279
+ end: { type: "number" }
280
+ },
281
+ description: "Optional. Page range to process (e.g., {start: 1, end: 5})."
282
+ },
283
+ password: {
284
+ type: "string",
285
+ description: "Optional. Password for encrypted PDFs."
286
+ }
287
+ },
288
+ required: ["filePath", "action"]
289
+ }
290
+ },
291
+ {
292
+ name: "gis",
293
+ description: "Performs Geographic Information System (GIS) operations like geocoding and reverse geocoding.",
294
+ parameters: {
295
+ type: "object",
296
+ properties: {
297
+ operation: {
298
+ type: "string",
299
+ enum: ["geocode", "reverseGeocode"],
300
+ description: "The GIS operation to perform: 'geocode' (address to coordinates) or 'reverseGeocode' (coordinates to address)."
301
+ },
302
+ provider: {
303
+ type: "string",
304
+ enum: ["google", "openstreetmap"],
305
+ default: "openstreetmap",
306
+ description: "The GIS service provider to use. Defaults to 'openstreetmap' (free, open-source)."
307
+ },
308
+ params: {
309
+ type: "object",
310
+ description: "Parameters specific to the operation. For 'geocode', requires { address: string }. For 'reverseGeocode', requires { lat: number, lng: number }."
311
+ }
312
+ },
313
+ required: ["operation", "params"]
314
+ }
315
+ },
316
+ {
317
+ name: "display_image",
318
+ description: "Displays an image file using the system's default image viewer.",
319
+ parameters: {
320
+ type: "object",
321
+ properties: {
322
+ imagePath: {
323
+ type: "string",
324
+ description: "The absolute path to the image file to display."
325
+ }
326
+ },
327
+ required: ["imagePath"]
328
+ }
329
+ },
330
+ {
331
+ name: "hardware_interaction",
332
+ description: "Communicates with local hardware via serial port (UART).",
333
+ parameters: {
334
+ type: "object",
335
+ properties: {
336
+ action: {
337
+ type: "string",
338
+ enum: ["write", "read_line", "list_ports"],
339
+ description: "The action to perform: 'write' data, 'read_line' from port, or 'list_ports' available."
340
+ },
341
+ portPath: {
342
+ type: "string",
343
+ description: "Required for 'write'/'read_line'. The path to the serial port (e.g., '/dev/ttyUSB0', 'COM1')."
344
+ },
345
+ baudRate: {
346
+ type: "number",
347
+ description: "Optional. The baud rate for serial communication. Defaults to 9600."
348
+ },
349
+ dataToWrite: {
350
+ type: "string",
351
+ description: "Required for 'write'. The data string to send to the serial port."
352
+ },
353
+ timeout: {
354
+ type: "number",
355
+ description: "Optional. Timeout in milliseconds for 'read_line' action. Defaults to 5000."
356
+ }
357
+ },
358
+ required: ["action"]
359
+ }
360
+ },
361
+ {
362
+ name: "webhook",
363
+ description: "Exposes an HTTP endpoint to receive webhooks, triggering a specified qflow flow.",
364
+ parameters: {
365
+ type: "object",
366
+ properties: {
367
+ port: {
368
+ type: "number",
369
+ description: "Optional. The port number to listen on. Defaults to 3000."
370
+ },
371
+ path: {
372
+ type: "string",
373
+ description: "Optional. The URL path for the webhook endpoint. Defaults to '/webhook'."
374
+ },
375
+ flow: {
376
+ type: "string", // This will be the name of a flow in the flowRegistry
377
+ description: "The name of the qflow AsyncFlow instance to trigger when a webhook is received."
378
+ },
379
+ sharedSecret: {
380
+ type: "string",
381
+ description: "Optional. A shared secret for HMAC verification of incoming webhooks."
382
+ },
383
+ responseStatus: {
384
+ type: "number",
385
+ description: "Optional. The HTTP status code to send back to the webhook sender. Defaults to 200."
386
+ },
387
+ responseBody: {
388
+ type: "object",
389
+ description: "Optional. The JSON body to send back to the webhook sender. Defaults to { status: 'received' }."
390
+ }
391
+ },
392
+ required: ["flow"]
393
+ }
394
+ },
395
+ {
396
+ name: "scheduler",
397
+ description: "Schedules qflow flows for future or recurring execution using cron syntax or a delay.",
398
+ parameters: {
399
+ type: "object",
400
+ properties: {
401
+ action: {
402
+ type: "string",
403
+ enum: ["start", "stop"],
404
+ description: "The action to perform: 'start' a new schedule or 'stop' an existing one."
405
+ },
406
+ schedule: {
407
+ type: ["string", "number"],
408
+ description: "Required for 'start'. A cron string (e.g., '0 3 * * *') or a number in milliseconds for a one-time delay."
409
+ },
410
+ flow: {
411
+ type: "string", // This will be the name of a flow in the flowRegistry
412
+ description: "Required for 'start'. The name of the qflow AsyncFlow instance to trigger."
413
+ },
414
+ flowParams: {
415
+ type: "object",
416
+ description: "Optional. Parameters (shared object) to pass to the triggered flow's runAsync."
417
+ },
418
+ id: {
419
+ type: "string",
420
+ description: "Optional. A unique ID for the scheduled task (required for 'stop' action). If not provided for 'start', a random one will be generated."
421
+ }
422
+ },
423
+ required: ["action"]
424
+ }
425
+ },
426
+ {
427
+ name: "image_gallery",
428
+ description: "Generates an HTML gallery from multiple image files and opens it in a web browser.",
429
+ parameters: {
430
+ type: "object",
431
+ properties: {
432
+ imagePaths: {
433
+ type: "array",
434
+ items: { type: "string" },
435
+ description: "An array of absolute paths to the image files to display in the gallery."
436
+ },
437
+ title: {
438
+ type: "string",
439
+ description: "Optional. The title of the HTML gallery page. Defaults to 'Image Gallery'."
440
+ },
441
+ description: {
442
+ type: "string",
443
+ description: "Optional. A short description to display on the gallery page. Defaults to 'Generated by QFlow Agent'."
444
+ },
445
+ outputDir: {
446
+ type: "string",
447
+ description: "Optional. Directory to save the generated HTML file and copied images. Defaults to a temporary directory."
448
+ }
449
+ },
450
+ required: ["imagePaths"]
451
+ }
452
+ },
453
+ {
454
+ name: "speech_synthesis",
455
+ description: "Converts text to spoken audio using OS capabilities or cloud APIs.",
456
+ parameters: {
457
+ type: "object",
458
+ properties: {
459
+ text: {
460
+ type: "string",
461
+ description: "The text to convert to speech."
462
+ },
463
+ provider: {
464
+ type: "string",
465
+ enum: ["macos", "linux", "windows", "google"],
466
+ description: "Optional. The speech synthesis provider to use. Defaults to OS-specific. 'google' requires GOOGLE_TTS_API_KEY."
467
+ },
468
+ voice: {
469
+ type: "string",
470
+ description: "Optional. The specific voice to use (e.g., 'Alex' for macOS, 'en-us' for espeak, 'en-US-Wavenet-D' for Google)."
471
+ },
472
+ outputFilePath: {
473
+ type: "string",
474
+ description: "Optional. If provided, saves the audio to this file path instead of playing it directly."
475
+ }
476
+ },
477
+ required: ["text"]
478
+ }
479
+ },
480
+ {
481
+ name: "multimedia_processing",
482
+ description: "Performs various multimedia operations on audio and video files using ffmpeg.",
483
+ parameters: {
484
+ type: "object",
485
+ properties: {
486
+ action: {
487
+ type: "string",
488
+ enum: ["convert", "trim", "extract_audio", "extract_frame", "custom"],
489
+ description: "The multimedia operation to perform."
490
+ },
491
+ inputPath: {
492
+ type: "string",
493
+ description: "Path to the input multimedia file."
494
+ },
495
+ outputPath: {
496
+ type: "string",
497
+ description: "Path for the output file."
498
+ },
499
+ format: {
500
+ type: "string",
501
+ description: "Required for 'convert' and 'extract_audio'. The output format (e.g., 'mp4', 'mp3', 'gif', 'wav')."
502
+ },
503
+ startTime: {
504
+ type: "string",
505
+ description: "Required for 'trim'. Start time in HH:MM:SS or seconds (e.g., '00:00:10', '10')."
506
+ },
507
+ duration: {
508
+ type: "string",
509
+ description: "Required for 'trim'. Duration in HH:MM:SS or seconds (e.g., '00:00:05', '5')."
510
+ },
511
+ resolution: {
512
+ type: "string",
513
+ description: "Optional for video 'convert'. Resolution (e.g., '1280x720')."
514
+ },
515
+ frameTime: {
516
+ type: "string",
517
+ description: "Required for 'extract_frame'. Time to extract frame from in HH:MM:SS or seconds (e.g., '00:00:05')."
518
+ },
519
+ ffmpegArgs: {
520
+ type: "string",
521
+ description: "Required for 'custom'. Raw ffmpeg arguments to execute directly."
522
+ }
523
+ },
524
+ required: ["action", "inputPath", "outputPath"]
525
+ }
526
+ },
527
+ {
528
+ name: "remote_execution",
529
+ description: "Executes commands on remote machines via SSH.",
530
+ parameters: {
531
+ type: "object",
532
+ properties: {
533
+ host: {
534
+ type: "string",
535
+ description: "The hostname or IP address of the remote machine."
536
+ },
537
+ port: {
538
+ type: "number",
539
+ description: "Optional. The SSH port. Defaults to 22."
540
+ },
541
+ username: {
542
+ type: "string",
543
+ description: "The username for SSH authentication."
544
+ },
545
+ password: {
546
+ type: "string",
547
+ description: "Optional. The password for SSH authentication (use with caution, prefer privateKey)."
548
+ },
549
+ privateKey: {
550
+ type: "string",
551
+ description: "Optional. The content of the private SSH key or its absolute path."
552
+ },
553
+ passphrase: {
554
+ type: "string",
555
+ description: "Optional. The passphrase for an encrypted private key."
556
+ },
557
+ action: {
558
+ type: "string",
559
+ enum: ["execute_command"],
560
+ description: "The action to perform. Currently only 'execute_command' is supported."
561
+ },
562
+ command: {
563
+ type: "string",
564
+ description: "The command string to execute on the remote machine."
565
+ },
566
+ timeout: {
567
+ type: "number",
568
+ description: "Optional. Timeout in milliseconds for the command execution. Defaults to 30000 (30 seconds)."
569
+ }
570
+ },
571
+ required: ["host", "username", "action", "command"]
572
+ }
573
+ },
574
+ {
575
+ name: "data_validation",
576
+ description: "Validates structured data against a JSON Schema.",
577
+ parameters: {
578
+ type: "object",
579
+ properties: {
580
+ data: {
581
+ type: "object", // Can be any JSON-compatible type
582
+ description: "The data to be validated."
583
+ },
584
+ schema: {
585
+ type: "object",
586
+ description: "The JSON Schema object directly."
587
+ },
588
+ schemaPath: {
589
+ type: "string",
590
+ description: "Optional. Path to a JSON Schema file. If provided, 'schema' parameter is ignored."
591
+ },
592
+ action: {
593
+ type: "string",
594
+ enum: ["validate"],
595
+ description: "The action to perform. Currently only 'validate' is supported."
596
+ }
597
+ },
598
+ required: ["data"]
599
+ }
600
+ },
601
+ {
602
+ name: "spreadsheet",
603
+ description: "Reads from and writes to spreadsheet files (.xlsx, .xls, .csv) with advanced manipulation.",
604
+ parameters: {
605
+ type: "object",
606
+ properties: {
607
+ action: {
608
+ type: "string",
609
+ enum: ["read", "write", "list_sheets", "read_range", "write_range", "append_rows", "delete_rows", "insert_rows", "add_sheet", "delete_sheet", "rename_sheet", "format_cells"],
610
+ description: "The action to perform."
611
+ },
612
+ filePath: {
613
+ type: "string",
614
+ description: "The absolute path to the spreadsheet file."
615
+ },
616
+ sheetName: {
617
+ type: "string",
618
+ description: "Required for .xlsx/.xls files and sheet-specific actions. The name of the sheet."
619
+ },
620
+ data: {
621
+ type: "array",
622
+ description: "Required for 'write', 'write_range', 'append_rows'. The data to write (array of arrays or array of objects)."
623
+ },
624
+ headerRow: {
625
+ type: "boolean",
626
+ description: "Optional. True if the first row is a header. Defaults to true."
627
+ },
628
+ range: {
629
+ type: "string",
630
+ description: "Required for 'read_range', 'write_range', 'format_cells'. A1 notation (e.g., 'Sheet1!A1:C10')."
631
+ },
632
+ startRow: {
633
+ type: "number",
634
+ description: "Required for 'delete_rows', 'insert_rows'. The 1-indexed starting row."
635
+ },
636
+ numRows: {
637
+ type: "number",
638
+ description: "Required for 'delete_rows', 'insert_rows'. The number of rows to delete/insert."
639
+ },
640
+ newSheetName: {
641
+ type: "string",
642
+ description: "Required for 'add_sheet', 'rename_sheet'. The name of the new sheet."
643
+ },
644
+ formats: {
645
+ type: "object",
646
+ description: "Required for 'format_cells'. Formatting options (conceptual, basic XLSX.js has limited styling)."
647
+ }
648
+ },
649
+ required: ["action", "filePath"]
650
+ }
651
+ },
256
652
  {
257
653
  name: "code_interpreter",
258
654
  description: "Executes Python code (requires user confirmation).",
@@ -553,6 +949,102 @@ export function getToolDefinitions() {
553
949
  required: ["items", "flow"]
554
950
  }
555
951
  },
952
+ {
953
+ name: "browser_control",
954
+ description: "Controls a web browser to navigate pages, interact with elements, and take screenshots.",
955
+ parameters: {
956
+ type: "object",
957
+ properties: {
958
+ action: {
959
+ type: "string",
960
+ enum: ["goto", "click", "type", "screenshot", "close"],
961
+ description: "The browser action to perform."
962
+ },
963
+ url: {
964
+ type: "string",
965
+ description: "The URL to navigate to (for 'goto' action)."
966
+ },
967
+ selector: {
968
+ type: "string",
969
+ description: "A CSS selector to target an element (for 'click' and 'type' actions)."
970
+ },
971
+ text: {
972
+ type: "string",
973
+ description: "The text to type into an input field (for 'type' action)."
974
+ },
975
+ path: {
976
+ type: "string",
977
+ description: "The file path to save a screenshot (for 'screenshot' action)."
978
+ }
979
+ },
980
+ required: ["action"]
981
+ }
982
+ },
983
+ {
984
+ name: "git",
985
+ description: "Performs Git operations like clone, add, commit, and push.",
986
+ parameters: {
987
+ type: "object",
988
+ properties: {
989
+ action: {
990
+ type: "string",
991
+ enum: ["clone", "init", "add", "commit", "push", "pull", "status"],
992
+ description: "The Git action to perform."
993
+ },
994
+ repoPath: {
995
+ type: "string",
996
+ description: "The local path to the repository."
997
+ },
998
+ remoteUrl: {
999
+ type: "string",
1000
+ description: "The URL of the remote repository (for 'clone' action)."
1001
+ },
1002
+ files: {
1003
+ type: "array",
1004
+ items: {
1005
+ type: "string"
1006
+ },
1007
+ description: "An array of file paths to add to the staging area (for 'add' action)."
1008
+ },
1009
+ message: {
1010
+ type: "string",
1011
+ description: "The commit message (for 'commit' action)."
1012
+ },
1013
+ branch: {
1014
+ type: "string",
1015
+ description: "The branch to push to or pull from."
1016
+ },
1017
+ remote: {
1018
+ type: "string",
1019
+ description: "The name of the remote (e.g., 'origin')."
1020
+ }
1021
+ },
1022
+ required: ["action"]
1023
+ }
1024
+ },
1025
+ {
1026
+ name: "websockets",
1027
+ description: "Establishes and manages WebSocket connections.",
1028
+ parameters: {
1029
+ type: "object",
1030
+ properties: {
1031
+ action: {
1032
+ type: "string",
1033
+ enum: ["connect", "send", "receive", "close"],
1034
+ description: "The WebSocket action to perform."
1035
+ },
1036
+ url: {
1037
+ type: "string",
1038
+ description: "The URL of the WebSocket server (for 'connect' action)."
1039
+ },
1040
+ message: {
1041
+ type: "string",
1042
+ description: "The message to send to the server (for 'send' action)."
1043
+ }
1044
+ },
1045
+ required: ["action"]
1046
+ }
1047
+ },
556
1048
  {
557
1049
  name: "finish",
558
1050
  description: "Ends agent execution, returns final output.",
@@ -0,0 +1,4 @@
1
+ export class BrowserControlNode extends AsyncNode {
2
+ execAsync(prepRes: any, shared: any): Promise<{}>;
3
+ }
4
+ import { AsyncNode } from '../qflow.js';
@@ -0,0 +1,73 @@
1
+ import { AsyncNode } from '../qflow.js';
2
+ import { chromium, firefox, webkit } from 'playwright';
3
+ export class BrowserControlNode extends AsyncNode {
4
+ async execAsync(prepRes, shared) {
5
+ const { action, url, selector, text, path, script, browserType = 'chromium', launchOptions = { headless: true }, } = this.params;
6
+ let browser = shared.browser;
7
+ let page = shared.page;
8
+ try {
9
+ if (!browser || !browser.isConnected()) {
10
+ const browserLauncher = { chromium, firefox, webkit }[browserType];
11
+ if (!browserLauncher) {
12
+ throw new Error(`Unsupported browser type: ${browserType}`);
13
+ }
14
+ browser = await browserLauncher.launch(launchOptions);
15
+ const context = await browser.newContext();
16
+ page = await context.newPage();
17
+ shared.browser = browser;
18
+ shared.page = page;
19
+ }
20
+ let result = {};
21
+ switch (action) {
22
+ case 'goto':
23
+ if (!url)
24
+ throw new Error('`url` parameter is required for `goto` action.');
25
+ await page.goto(url);
26
+ result = { message: `Navigated to ${url}` };
27
+ break;
28
+ case 'click':
29
+ if (!selector)
30
+ throw new Error('`selector` parameter is required for `click` action.');
31
+ await page.click(selector);
32
+ result = { message: `Clicked on ${selector}` };
33
+ break;
34
+ case 'type':
35
+ if (!selector || text === undefined)
36
+ throw new Error('`selector` and `text` parameters are required for `type` action.');
37
+ await page.fill(selector, text);
38
+ result = { message: `Typed into ${selector}` };
39
+ break;
40
+ case 'screenshot':
41
+ if (!path)
42
+ throw new Error('`path` parameter is required for `screenshot` action.');
43
+ await page.screenshot({ path });
44
+ result = { message: `Screenshot saved to ${path}` };
45
+ break;
46
+ case 'evaluate':
47
+ if (!script)
48
+ throw new Error('`script` parameter is required for `evaluate` action.');
49
+ result = await page.evaluate(script);
50
+ break;
51
+ case 'close':
52
+ if (browser && browser.isConnected()) {
53
+ await browser.close();
54
+ delete shared.browser;
55
+ delete shared.page;
56
+ }
57
+ result = { message: 'Browser closed' };
58
+ break;
59
+ default:
60
+ throw new Error(`Unsupported browser action: ${action}`);
61
+ }
62
+ return result;
63
+ }
64
+ catch (error) {
65
+ if (browser && browser.isConnected() && action !== 'close') {
66
+ await browser.close();
67
+ delete shared.browser;
68
+ delete shared.page;
69
+ }
70
+ throw new Error(`BrowserControlNode failed during '${action}' action: ${error.message}`);
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,9 @@
1
+ export class DataValidationNode extends AsyncNode {
2
+ ajv: Ajv;
3
+ execAsync(): Promise<{
4
+ isValid: boolean;
5
+ errors: import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined;
6
+ }>;
7
+ }
8
+ import { AsyncNode } from '../qflow.js';
9
+ import Ajv from 'ajv';
@@ -0,0 +1,48 @@
1
+ import { AsyncNode } from '../qflow.js';
2
+ import { promises as fs } from 'fs';
3
+ import Ajv from 'ajv'; // npm install ajv
4
+ import addFormats from 'ajv-formats'; // npm install ajv-formats
5
+ export class DataValidationNode extends AsyncNode {
6
+ constructor(maxRetries = 1, wait = 0) {
7
+ super(maxRetries, wait);
8
+ this.ajv = new Ajv({ allErrors: true, verbose: true }); // Configure AJV for detailed errors
9
+ addFormats(this.ajv); // Add format validators
10
+ }
11
+ async execAsync() {
12
+ const { data, // The data to be validated
13
+ schema, // The JSON Schema object directly
14
+ schemaPath, // Optional: Path to a JSON Schema file
15
+ action = 'validate' // Currently only 'validate'
16
+ } = this.params;
17
+ if (action !== 'validate') {
18
+ throw new Error('DataValidationNode currently only supports `action: "validate"`.');
19
+ }
20
+ if (!data) {
21
+ throw new Error('DataValidationNode requires `data` to validate.');
22
+ }
23
+ if (!schema && !schemaPath) {
24
+ throw new Error('DataValidationNode requires either `schema` or `schemaPath`.');
25
+ }
26
+ let validationSchema;
27
+ if (schema) {
28
+ validationSchema = schema;
29
+ }
30
+ else if (schemaPath) {
31
+ try {
32
+ const schemaContent = await fs.readFile(schemaPath, 'utf8');
33
+ validationSchema = JSON.parse(schemaContent);
34
+ }
35
+ catch (e) {
36
+ throw new Error(`Failed to read or parse schema file from ${schemaPath}: ${e.message}`);
37
+ }
38
+ }
39
+ const validate = this.ajv.compile(validationSchema);
40
+ const isValid = validate(data);
41
+ if (isValid) {
42
+ return { isValid: true, errors: null };
43
+ }
44
+ else {
45
+ return { isValid: false, errors: validate.errors };
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,4 @@
1
+ export class DisplayImageNode extends AsyncNode {
2
+ execAsync(): Promise<any>;
3
+ }
4
+ import { AsyncNode } from '../qflow.js';