@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.
- package/dist/agent/tools.d.ts +1 -5378
- package/dist/agent/tools.js +145 -1171
- package/dist/nodes/browser_control.d.ts +31 -0
- package/dist/nodes/browser_control.js +33 -0
- package/dist/nodes/code_interpreter.d.ts +29 -0
- package/dist/nodes/code_interpreter.js +29 -0
- package/dist/nodes/data_extractor.d.ts +35 -0
- package/dist/nodes/data_extractor.js +37 -0
- package/dist/nodes/data_validation.d.ts +27 -0
- package/dist/nodes/data_validation.js +29 -0
- package/dist/nodes/database.d.ts +44 -0
- package/dist/nodes/database.js +46 -0
- package/dist/nodes/display_image.d.ts +14 -0
- package/dist/nodes/display_image.js +16 -0
- package/dist/nodes/embedding.d.ts +22 -0
- package/dist/nodes/embedding.js +24 -0
- package/dist/nodes/filesystem.d.ts +64 -0
- package/dist/nodes/filesystem.js +72 -0
- package/dist/nodes/gis.d.ts +25 -0
- package/dist/nodes/gis.js +27 -0
- package/dist/nodes/git.d.ts +42 -0
- package/dist/nodes/git.js +44 -0
- package/dist/nodes/github.d.ts +56 -0
- package/dist/nodes/github.js +60 -0
- package/dist/nodes/hackernews.d.ts +28 -0
- package/dist/nodes/hackernews.js +32 -0
- package/dist/nodes/hardware_interaction.d.ts +31 -0
- package/dist/nodes/hardware_interaction.js +33 -0
- package/dist/nodes/http.d.ts +51 -0
- package/dist/nodes/http.js +53 -0
- package/dist/nodes/http_server.d.ts +37 -0
- package/dist/nodes/http_server.js +33 -0
- package/dist/nodes/image_gallery.d.ts +29 -0
- package/dist/nodes/image_gallery.js +29 -0
- package/dist/nodes/interactive_input.d.ts +22 -0
- package/dist/nodes/interactive_input.js +24 -0
- package/dist/nodes/interactive_webview.d.ts +59 -0
- package/dist/nodes/interactive_webview.js +59 -0
- package/dist/nodes/iterator.d.ts +18 -0
- package/dist/nodes/iterator.js +20 -0
- package/dist/nodes/llm.d.ts +142 -0
- package/dist/nodes/llm.js +152 -0
- package/dist/nodes/memory.d.ts +31 -0
- package/dist/nodes/memory.js +80 -38
- package/dist/nodes/multimedia_processing.d.ts +47 -0
- package/dist/nodes/multimedia_processing.js +49 -0
- package/dist/nodes/openrouter_llm.d.ts +30 -0
- package/dist/nodes/openrouter_llm.js +32 -0
- package/dist/nodes/pdf_processor.d.ts +39 -0
- package/dist/nodes/pdf_processor.js +37 -0
- package/dist/nodes/remote_execution.d.ts +47 -0
- package/dist/nodes/remote_execution.js +49 -0
- package/dist/nodes/s3.d.ts +67 -0
- package/dist/nodes/s3.js +69 -0
- package/dist/nodes/scheduler.d.ts +31 -0
- package/dist/nodes/scheduler.js +33 -0
- package/dist/nodes/search.d.ts +36 -0
- package/dist/nodes/search.js +40 -0
- package/dist/nodes/semantic_memory.d.ts +47 -0
- package/dist/nodes/semantic_memory.js +49 -0
- package/dist/nodes/shell.d.ts +14 -0
- package/dist/nodes/shell.js +16 -0
- package/dist/nodes/speech_synthesis.d.ts +27 -0
- package/dist/nodes/speech_synthesis.js +29 -0
- package/dist/nodes/spreadsheet.d.ts +51 -0
- package/dist/nodes/spreadsheet.js +53 -0
- package/dist/nodes/stripe.d.ts +44 -0
- package/dist/nodes/stripe.js +48 -0
- package/dist/nodes/subflow.d.ts +18 -0
- package/dist/nodes/subflow.js +20 -0
- package/dist/nodes/summarize.d.ts +14 -0
- package/dist/nodes/summarize.js +20 -0
- package/dist/nodes/system_notification.d.ts +22 -0
- package/dist/nodes/system_notification.js +24 -0
- package/dist/nodes/transform.d.ts +18 -0
- package/dist/nodes/transform.js +20 -0
- package/dist/nodes/user.d.ts +14 -0
- package/dist/nodes/user.js +16 -0
- package/dist/nodes/webhook.d.ts +34 -0
- package/dist/nodes/webhook.js +36 -0
- package/dist/nodes/webscraper.d.ts +14 -0
- package/dist/nodes/webscraper.js +16 -0
- package/dist/nodes/websockets.d.ts +23 -0
- package/dist/nodes/websockets.js +25 -0
- package/dist/nodes/webview.d.ts +26 -0
- package/dist/nodes/webview.js +28 -0
- package/package.json +3 -2
- package/dist/qflow.config.d.ts +0 -5
- package/dist/qflow.config.js +0 -16
- package/dist/src/agent/agent.d.ts +0 -23
- package/dist/src/agent/agent.js +0 -365
- package/dist/src/agent/base_agent.d.ts +0 -21
- package/dist/src/agent/base_agent.js +0 -206
- package/dist/src/agent/logger.d.ts +0 -9
- package/dist/src/agent/logger.js +0 -45
- package/dist/src/agent/lpavrl_agent.d.ts +0 -5
- package/dist/src/agent/lpavrl_agent.js +0 -178
- package/dist/src/agent/ooda_agent.d.ts +0 -5
- package/dist/src/agent/ooda_agent.js +0 -167
- package/dist/src/agent/pema_agent.d.ts +0 -5
- package/dist/src/agent/pema_agent.js +0 -171
- package/dist/src/agent/raor_agent.d.ts +0 -5
- package/dist/src/agent/raor_agent.js +0 -164
- package/dist/src/agent/tools.d.ts +0 -1
- package/dist/src/agent/tools.js +0 -148
- package/dist/src/logger.d.ts +0 -9
- package/dist/src/logger.js +0 -107
- package/dist/src/nodes/agent_llm.d.ts +0 -31
- package/dist/src/nodes/agent_llm.js +0 -302
- package/dist/src/nodes/browser_control.d.ts +0 -35
- package/dist/src/nodes/browser_control.js +0 -106
- package/dist/src/nodes/code_interpreter.d.ts +0 -38
- package/dist/src/nodes/code_interpreter.js +0 -150
- package/dist/src/nodes/data_extractor.d.ts +0 -40
- package/dist/src/nodes/data_extractor.js +0 -118
- package/dist/src/nodes/data_validation.d.ts +0 -36
- package/dist/src/nodes/data_validation.js +0 -77
- package/dist/src/nodes/database.d.ts +0 -50
- package/dist/src/nodes/database.js +0 -135
- package/dist/src/nodes/display_image.d.ts +0 -18
- package/dist/src/nodes/display_image.js +0 -63
- package/dist/src/nodes/embedding.d.ts +0 -29
- package/dist/src/nodes/embedding.js +0 -69
- package/dist/src/nodes/filesystem.d.ts +0 -105
- package/dist/src/nodes/filesystem.js +0 -160
- package/dist/src/nodes/gis.d.ts +0 -62
- package/dist/src/nodes/gis.js +0 -133
- package/dist/src/nodes/git.d.ts +0 -46
- package/dist/src/nodes/git.js +0 -99
- package/dist/src/nodes/github.d.ts +0 -83
- package/dist/src/nodes/github.js +0 -135
- package/dist/src/nodes/hackernews.d.ts +0 -47
- package/dist/src/nodes/hackernews.js +0 -79
- package/dist/src/nodes/hardware_interaction.d.ts +0 -39
- package/dist/src/nodes/hardware_interaction.js +0 -131
- package/dist/src/nodes/http.d.ts +0 -77
- package/dist/src/nodes/http.js +0 -120
- package/dist/src/nodes/http_server.d.ts +0 -54
- package/dist/src/nodes/http_server.js +0 -223
- package/dist/src/nodes/image_gallery.d.ts +0 -37
- package/dist/src/nodes/image_gallery.js +0 -129
- package/dist/src/nodes/index.d.ts +0 -48
- package/dist/src/nodes/index.js +0 -48
- package/dist/src/nodes/interactive_input.d.ts +0 -26
- package/dist/src/nodes/interactive_input.js +0 -95
- package/dist/src/nodes/interactive_webview.d.ts +0 -78
- package/dist/src/nodes/interactive_webview.js +0 -369
- package/dist/src/nodes/iterator.d.ts +0 -23
- package/dist/src/nodes/iterator.js +0 -43
- package/dist/src/nodes/llm.d.ts +0 -160
- package/dist/src/nodes/llm.js +0 -367
- package/dist/src/nodes/memory.d.ts +0 -43
- package/dist/src/nodes/memory.js +0 -90
- package/dist/src/nodes/multimedia_processing.d.ts +0 -57
- package/dist/src/nodes/multimedia_processing.js +0 -129
- package/dist/src/nodes/openrouter_llm.d.ts +0 -38
- package/dist/src/nodes/openrouter_llm.js +0 -156
- package/dist/src/nodes/pdf_processor.d.ts +0 -43
- package/dist/src/nodes/pdf_processor.js +0 -112
- package/dist/src/nodes/remote_execution.d.ts +0 -51
- package/dist/src/nodes/remote_execution.js +0 -132
- package/dist/src/nodes/s3.d.ts +0 -73
- package/dist/src/nodes/s3.js +0 -107
- package/dist/src/nodes/scheduler.d.ts +0 -51
- package/dist/src/nodes/scheduler.js +0 -131
- package/dist/src/nodes/search.d.ts +0 -61
- package/dist/src/nodes/search.js +0 -118
- package/dist/src/nodes/semantic_memory.d.ts +0 -64
- package/dist/src/nodes/semantic_memory.js +0 -160
- package/dist/src/nodes/shell.d.ts +0 -25
- package/dist/src/nodes/shell.js +0 -45
- package/dist/src/nodes/speech_synthesis.d.ts +0 -72
- package/dist/src/nodes/speech_synthesis.js +0 -171
- package/dist/src/nodes/spreadsheet.d.ts +0 -61
- package/dist/src/nodes/spreadsheet.js +0 -294
- package/dist/src/nodes/stripe.d.ts +0 -67
- package/dist/src/nodes/stripe.js +0 -117
- package/dist/src/nodes/subflow.d.ts +0 -23
- package/dist/src/nodes/subflow.js +0 -36
- package/dist/src/nodes/summarize.d.ts +0 -26
- package/dist/src/nodes/summarize.js +0 -51
- package/dist/src/nodes/system_notification.d.ts +0 -26
- package/dist/src/nodes/system_notification.js +0 -74
- package/dist/src/nodes/transform.d.ts +0 -23
- package/dist/src/nodes/transform.js +0 -52
- package/dist/src/nodes/user.d.ts +0 -25
- package/dist/src/nodes/user.js +0 -48
- package/dist/src/nodes/webhook.d.ts +0 -49
- package/dist/src/nodes/webhook.js +0 -161
- package/dist/src/nodes/webscraper.d.ts +0 -25
- package/dist/src/nodes/webscraper.js +0 -49
- package/dist/src/nodes/websockets.d.ts +0 -27
- package/dist/src/nodes/websockets.js +0 -98
- package/dist/src/nodes/webview.d.ts +0 -38
- package/dist/src/nodes/webview.js +0 -55
- package/dist/src/qflow.d.ts +0 -69
- package/dist/src/qflow.js +0 -320
- /package/dist/{src/types.d.ts → types.d.ts} +0 -0
- /package/dist/{src/types.js → types.js} +0 -0
package/dist/src/nodes/s3.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export class S3CloudStorageNode extends AsyncNode {
|
|
2
|
-
static getToolDefinition(): {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
parameters: {
|
|
6
|
-
type: string;
|
|
7
|
-
properties: {
|
|
8
|
-
accessKeyId: {
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
secretAccessKey: {
|
|
13
|
-
type: string;
|
|
14
|
-
description: string;
|
|
15
|
-
};
|
|
16
|
-
bucket: {
|
|
17
|
-
type: string;
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
endpoint: {
|
|
21
|
-
type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
};
|
|
24
|
-
region: {
|
|
25
|
-
type: string;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
action: {
|
|
29
|
-
type: string;
|
|
30
|
-
enum: string[];
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
key: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
content: {
|
|
38
|
-
type: string;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
acl: {
|
|
42
|
-
type: string;
|
|
43
|
-
description: string;
|
|
44
|
-
};
|
|
45
|
-
expiresIn: {
|
|
46
|
-
type: string;
|
|
47
|
-
description: string;
|
|
48
|
-
};
|
|
49
|
-
method: {
|
|
50
|
-
type: string;
|
|
51
|
-
description: string;
|
|
52
|
-
};
|
|
53
|
-
prefix: {
|
|
54
|
-
type: string;
|
|
55
|
-
description: string;
|
|
56
|
-
};
|
|
57
|
-
maxKeys: {
|
|
58
|
-
type: string;
|
|
59
|
-
description: string;
|
|
60
|
-
};
|
|
61
|
-
startAfter: {
|
|
62
|
-
type: string;
|
|
63
|
-
description: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
required: string[];
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
execAsync(prepRes: any, shared: any): Promise<any>;
|
|
70
|
-
postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
|
|
71
|
-
#private;
|
|
72
|
-
}
|
|
73
|
-
import { AsyncNode } from '../qflow.js';
|
package/dist/src/nodes/s3.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { AsyncNode } from '../qflow.js';
|
|
2
|
-
import { S3Client } from 'bun';
|
|
3
|
-
export class S3CloudStorageNode extends AsyncNode {
|
|
4
|
-
static getToolDefinition() {
|
|
5
|
-
return {
|
|
6
|
-
name: "s3",
|
|
7
|
-
description: "Interacts with an S3-compatible object storage service.",
|
|
8
|
-
parameters: {
|
|
9
|
-
type: "object",
|
|
10
|
-
properties: {
|
|
11
|
-
accessKeyId: {
|
|
12
|
-
type: "string",
|
|
13
|
-
description: "Your S3 access key ID."
|
|
14
|
-
},
|
|
15
|
-
secretAccessKey: {
|
|
16
|
-
type: "string",
|
|
17
|
-
description: "Your S3 secret access key."
|
|
18
|
-
},
|
|
19
|
-
bucket: {
|
|
20
|
-
type: "string",
|
|
21
|
-
description: "The name of your S3 bucket."
|
|
22
|
-
},
|
|
23
|
-
endpoint: {
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "The S3 endpoint URL."
|
|
26
|
-
},
|
|
27
|
-
region: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "The S3 region."
|
|
30
|
-
},
|
|
31
|
-
action: {
|
|
32
|
-
type: "string",
|
|
33
|
-
enum: ["upload", "download", "delete", "presign", "list"],
|
|
34
|
-
description: "The action to perform."
|
|
35
|
-
},
|
|
36
|
-
key: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "The key of the object to operate on."
|
|
39
|
-
},
|
|
40
|
-
content: {
|
|
41
|
-
type: "string",
|
|
42
|
-
description: "The content to upload."
|
|
43
|
-
},
|
|
44
|
-
acl: {
|
|
45
|
-
type: "string",
|
|
46
|
-
description: "The access control list for presigned URLs."
|
|
47
|
-
},
|
|
48
|
-
expiresIn: {
|
|
49
|
-
type: "number",
|
|
50
|
-
description: "The expiration time for presigned URLs."
|
|
51
|
-
},
|
|
52
|
-
method: {
|
|
53
|
-
type: "string",
|
|
54
|
-
description: "The HTTP method for presigned URLs."
|
|
55
|
-
},
|
|
56
|
-
prefix: {
|
|
57
|
-
type: "string",
|
|
58
|
-
description: "The prefix for listing files."
|
|
59
|
-
},
|
|
60
|
-
maxKeys: {
|
|
61
|
-
type: "number",
|
|
62
|
-
description: "The maximum number of keys to return when listing files."
|
|
63
|
-
},
|
|
64
|
-
startAfter: {
|
|
65
|
-
type: "string",
|
|
66
|
-
description: "The key to start after when listing files."
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
required: ["accessKeyId", "secretAccessKey", "bucket", "endpoint", "action", "key"]
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
#s3 = null;
|
|
74
|
-
async prepAsync(shared) {
|
|
75
|
-
const { accessKeyId, secretAccessKey, bucket, endpoint, region } = this.params;
|
|
76
|
-
if (!this.#s3) {
|
|
77
|
-
this.#s3 = new S3Client({
|
|
78
|
-
accessKeyId,
|
|
79
|
-
secretAccessKey,
|
|
80
|
-
bucket,
|
|
81
|
-
endpoint,
|
|
82
|
-
region,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async execAsync(prepRes, shared) {
|
|
87
|
-
const { action, key, content, acl, expiresIn, method, prefix, maxKeys, startAfter } = this.params;
|
|
88
|
-
switch (action) {
|
|
89
|
-
case 'upload':
|
|
90
|
-
return this.#s3.file(key).write(content);
|
|
91
|
-
case 'download':
|
|
92
|
-
return this.#s3.file(key).json();
|
|
93
|
-
case 'delete':
|
|
94
|
-
return this.#s3.file(key).delete();
|
|
95
|
-
case 'presign':
|
|
96
|
-
return this.#s3.file(key).presign({ acl, expiresIn, method });
|
|
97
|
-
case 'list':
|
|
98
|
-
return this.#s3.list({ prefix, maxKeys, startAfter });
|
|
99
|
-
default:
|
|
100
|
-
throw new Error(`Unsupported S3 action: ${action}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async postAsync(shared, prepRes, execRes) {
|
|
104
|
-
shared.s3_result = execRes;
|
|
105
|
-
return 'default';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export class SchedulerNode 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
|
-
schedule: {
|
|
14
|
-
type: string[];
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
flow: {
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
flowParams: {
|
|
22
|
-
type: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
id: {
|
|
26
|
-
type: string;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
required: string[];
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
static activeTasks: Map<any, any>;
|
|
34
|
-
execAsync(): Promise<{
|
|
35
|
-
status: string;
|
|
36
|
-
type: string;
|
|
37
|
-
schedule: string;
|
|
38
|
-
id: any;
|
|
39
|
-
} | {
|
|
40
|
-
status: string;
|
|
41
|
-
type: string;
|
|
42
|
-
schedule: number;
|
|
43
|
-
id: any;
|
|
44
|
-
} | {
|
|
45
|
-
status: string;
|
|
46
|
-
id: any;
|
|
47
|
-
type?: undefined;
|
|
48
|
-
schedule?: undefined;
|
|
49
|
-
} | undefined>;
|
|
50
|
-
}
|
|
51
|
-
import { AsyncNode } from '../qflow.js';
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { AsyncNode, AsyncFlow } from '../qflow.js';
|
|
2
|
-
// You would need to install the 'node-cron' library: npm install node-cron
|
|
3
|
-
import * as cron from 'node-cron';
|
|
4
|
-
import { log } from '../logger.js';
|
|
5
|
-
export class SchedulerNode extends AsyncNode {
|
|
6
|
-
static getToolDefinition() {
|
|
7
|
-
return {
|
|
8
|
-
name: "scheduler",
|
|
9
|
-
description: "Schedules qflow flows for future or recurring execution using cron syntax or a delay.",
|
|
10
|
-
parameters: {
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
action: {
|
|
14
|
-
type: "string",
|
|
15
|
-
enum: ["start", "stop"],
|
|
16
|
-
description: "The action to perform: 'start' a new schedule or 'stop' an existing one."
|
|
17
|
-
},
|
|
18
|
-
schedule: {
|
|
19
|
-
type: ["string", "number"],
|
|
20
|
-
description: "Required for 'start'. A cron string (e.g., '0 3 * * *') or a number in milliseconds for a one-time delay."
|
|
21
|
-
},
|
|
22
|
-
flow: {
|
|
23
|
-
type: "string", // This will be the name of a flow in the flowRegistry
|
|
24
|
-
description: "Required for 'start'. The name of the qflow AsyncFlow instance to trigger."
|
|
25
|
-
},
|
|
26
|
-
flowParams: {
|
|
27
|
-
type: "object",
|
|
28
|
-
description: "Optional. Parameters (shared object) to pass to the triggered flow's runAsync."
|
|
29
|
-
},
|
|
30
|
-
id: {
|
|
31
|
-
type: "string",
|
|
32
|
-
description: "Optional. A unique ID for the scheduled task (required for 'stop' action). If not provided for 'start', a random one will be generated."
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
required: ["action"]
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Static map to hold all active scheduled tasks
|
|
40
|
-
static activeTasks = new Map();
|
|
41
|
-
constructor(maxRetries = 1, wait = 0) {
|
|
42
|
-
super(maxRetries, wait);
|
|
43
|
-
}
|
|
44
|
-
async execAsync() {
|
|
45
|
-
const { schedule, flow, flowParams, action, id = `qflow_scheduled_task_${Math.random().toString(16).substr(2, 8)}` // Generate ID if not provided
|
|
46
|
-
} = this.params;
|
|
47
|
-
if (!action || !['start', 'stop'].includes(action)) {
|
|
48
|
-
throw new Error('SchedulerNode requires an `action`: "start" or "stop".');
|
|
49
|
-
}
|
|
50
|
-
if (action === 'start') {
|
|
51
|
-
if (!schedule) {
|
|
52
|
-
throw new Error('SchedulerNode "start" action requires a `schedule`.');
|
|
53
|
-
}
|
|
54
|
-
// Flow can be an AsyncFlow instance or a string (name from flowRegistry)
|
|
55
|
-
if (!flow) {
|
|
56
|
-
throw new Error('SchedulerNode "start" action requires a `flow` parameter.');
|
|
57
|
-
}
|
|
58
|
-
// Stop any existing task with the same ID
|
|
59
|
-
if (SchedulerNode.activeTasks.has(id)) {
|
|
60
|
-
const existingTask = SchedulerNode.activeTasks.get(id);
|
|
61
|
-
existingTask.stop();
|
|
62
|
-
SchedulerNode.activeTasks.delete(id);
|
|
63
|
-
log(`[SchedulerNode] Stopped existing task with ID: ${id}`, this.params.logging);
|
|
64
|
-
}
|
|
65
|
-
let task;
|
|
66
|
-
if (typeof schedule === 'string') { // Cron string
|
|
67
|
-
task = cron.schedule(schedule, async () => {
|
|
68
|
-
log(`[SchedulerNode] Scheduled cron task triggered for ID: ${id}`, this.params.logging);
|
|
69
|
-
try {
|
|
70
|
-
// If flow is a string, assume it's a flow name from a global registry
|
|
71
|
-
// This would require the SchedulerNode to have access to the flowRegistry
|
|
72
|
-
// For now, assume 'flow' is an AsyncFlow instance directly passed.
|
|
73
|
-
const flowInstance = flow; // Assuming flow is an AsyncFlow instance
|
|
74
|
-
const taskShared = { ...flowParams };
|
|
75
|
-
const result = await flowInstance.runAsync(taskShared);
|
|
76
|
-
log(`[SchedulerNode] Scheduled flow (ID: ${id}) completed successfully. Result: ${JSON.stringify(result)}`, this.params.logging);
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
log(`[SchedulerNode] Scheduled flow (ID: ${id}) failed: ${e.message}`, this.params.logging, { type: 'error' });
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
scheduled: true,
|
|
83
|
-
timezone: 'America/New_York' // Example timezone
|
|
84
|
-
});
|
|
85
|
-
log(`[SchedulerNode] Started cron job (ID: ${id}) with schedule: ${schedule}`, this.params.logging);
|
|
86
|
-
SchedulerNode.activeTasks.set(id, task);
|
|
87
|
-
return { status: 'scheduled', type: 'cron', schedule: schedule, id: id };
|
|
88
|
-
}
|
|
89
|
-
else if (typeof schedule === 'number') { // Milliseconds for setTimeout
|
|
90
|
-
const timerId = setTimeout(async () => {
|
|
91
|
-
log(`[SchedulerNode] Scheduled one-time task triggered for ID: ${id}`, this.params.logging);
|
|
92
|
-
try {
|
|
93
|
-
const flowInstance = flow; // Assuming flow is an AsyncFlow instance
|
|
94
|
-
const taskShared = { ...flowParams };
|
|
95
|
-
const result = await flowInstance.runAsync(taskShared);
|
|
96
|
-
log(`[SchedulerNode] Scheduled flow (ID: ${id}) completed successfully. Result: ${JSON.stringify(result)}`, this.params.logging);
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
log(`[SchedulerNode] Scheduled flow (ID: ${id}) failed: ${e.message}`, this.params.logging, { type: 'error' });
|
|
100
|
-
}
|
|
101
|
-
finally {
|
|
102
|
-
SchedulerNode.activeTasks.delete(id); // Remove one-time task after execution
|
|
103
|
-
}
|
|
104
|
-
}, schedule);
|
|
105
|
-
task = { id: id, stop: () => clearTimeout(timerId) }; // Simple wrapper for setTimeout
|
|
106
|
-
log(`[SchedulerNode] Started one-time task (ID: ${id}) in ${schedule}ms`, this.params.logging);
|
|
107
|
-
SchedulerNode.activeTasks.set(id, task);
|
|
108
|
-
return { status: 'scheduled', type: 'timeout', schedule: schedule, id: id };
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
throw new Error('Invalid schedule type. Must be a cron string or a number (milliseconds).');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (action === 'stop') {
|
|
115
|
-
if (!id) {
|
|
116
|
-
throw new Error('SchedulerNode "stop" action requires an `id` to identify the task to stop.');
|
|
117
|
-
}
|
|
118
|
-
if (SchedulerNode.activeTasks.has(id)) {
|
|
119
|
-
const taskToStop = SchedulerNode.activeTasks.get(id);
|
|
120
|
-
taskToStop.stop();
|
|
121
|
-
SchedulerNode.activeTasks.delete(id);
|
|
122
|
-
log(`[SchedulerNode] Stopped task with ID: ${id}`, this.params.logging);
|
|
123
|
-
return { status: 'stopped', id: id };
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
log(`[SchedulerNode] No active task found with ID: ${id}`, this.params.logging, { type: 'warn' });
|
|
127
|
-
return { status: 'not_found', id: id };
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performs a web search using DuckDuckGo's HTML-only interface.
|
|
3
|
-
* This node does not require an API key and is designed for reliability without heavy dependencies.
|
|
4
|
-
* @param {object} params - The parameters for the node.
|
|
5
|
-
* @param {string} params.query - The search query.
|
|
6
|
-
* @returns {Promise<object[]>} A promise that resolves to an array of search result objects.
|
|
7
|
-
*/
|
|
8
|
-
export class DuckDuckGoSearchNode extends AsyncNode {
|
|
9
|
-
static getToolDefinition(): {
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
parameters: {
|
|
13
|
-
type: string;
|
|
14
|
-
properties: {
|
|
15
|
-
query: {
|
|
16
|
-
type: string;
|
|
17
|
-
description: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
required: string[];
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
execAsync(): Promise<any[]>;
|
|
24
|
-
postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Performs a web search using the Google Custom Search JSON API.
|
|
28
|
-
* This node requires a Google API Key and a Custom Search Engine ID.
|
|
29
|
-
* @param {object} params - The parameters for the node.
|
|
30
|
-
* @param {string} params.query - The search query.
|
|
31
|
-
* @param {string} params.apiKey - Your Google API Key.
|
|
32
|
-
* @param {string} params.cseId - Your Custom Search Engine ID.
|
|
33
|
-
* @returns {Promise<object[]>} A promise that resolves to an array of search result objects.
|
|
34
|
-
*/
|
|
35
|
-
export class GoogleSearchNode extends AsyncNode {
|
|
36
|
-
static getToolDefinition(): {
|
|
37
|
-
name: string;
|
|
38
|
-
description: string;
|
|
39
|
-
parameters: {
|
|
40
|
-
type: string;
|
|
41
|
-
properties: {
|
|
42
|
-
query: {
|
|
43
|
-
type: string;
|
|
44
|
-
description: string;
|
|
45
|
-
};
|
|
46
|
-
apiKey: {
|
|
47
|
-
type: string;
|
|
48
|
-
description: string;
|
|
49
|
-
};
|
|
50
|
-
cseId: {
|
|
51
|
-
type: string;
|
|
52
|
-
description: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
required: string[];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
execAsync(): Promise<any>;
|
|
59
|
-
postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
|
|
60
|
-
}
|
|
61
|
-
import { AsyncNode } from '../qflow.js';
|
package/dist/src/nodes/search.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { AsyncNode } from '../qflow.js';
|
|
2
|
-
import * as cheerio from 'cheerio';
|
|
3
|
-
import { log } from '../logger.js';
|
|
4
|
-
/**
|
|
5
|
-
* Performs a web search using DuckDuckGo's HTML-only interface.
|
|
6
|
-
* This node does not require an API key and is designed for reliability without heavy dependencies.
|
|
7
|
-
* @param {object} params - The parameters for the node.
|
|
8
|
-
* @param {string} params.query - The search query.
|
|
9
|
-
* @returns {Promise<object[]>} A promise that resolves to an array of search result objects.
|
|
10
|
-
*/
|
|
11
|
-
export class DuckDuckGoSearchNode extends AsyncNode {
|
|
12
|
-
static getToolDefinition() {
|
|
13
|
-
return {
|
|
14
|
-
name: "duckduckgo_search",
|
|
15
|
-
description: "Performs web searches via DuckDuckGo.",
|
|
16
|
-
parameters: {
|
|
17
|
-
type: "object",
|
|
18
|
-
properties: {
|
|
19
|
-
query: {
|
|
20
|
-
type: "string",
|
|
21
|
-
description: "The search query."
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
required: ["query"]
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
async execAsync() {
|
|
29
|
-
const { query } = this.params;
|
|
30
|
-
if (!query) {
|
|
31
|
-
throw new Error('DuckDuckGoSearchNode requires a `query` parameter.');
|
|
32
|
-
}
|
|
33
|
-
const url = `https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`;
|
|
34
|
-
log(`[DuckDuckGo] Searching for: "${query}"`, this.params.logging);
|
|
35
|
-
const response = await fetch(url);
|
|
36
|
-
if (!response.ok) {
|
|
37
|
-
throw new Error(`DuckDuckGo HTML search failed with status ${response.status}`);
|
|
38
|
-
}
|
|
39
|
-
const html = await response.text();
|
|
40
|
-
const $ = cheerio.load(html);
|
|
41
|
-
const results = [];
|
|
42
|
-
$('.result__body').each((i, el) => {
|
|
43
|
-
const title = $(el).find('.result__title a').text().trim();
|
|
44
|
-
const link = $(el).find('.result__url').attr('href');
|
|
45
|
-
const snippet = $(el).find('.result__snippet').text().trim();
|
|
46
|
-
if (title && link) {
|
|
47
|
-
results.push({
|
|
48
|
-
title,
|
|
49
|
-
link,
|
|
50
|
-
snippet,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return results;
|
|
55
|
-
}
|
|
56
|
-
async postAsync(shared, prepRes, execRes) {
|
|
57
|
-
shared.searchResults = execRes;
|
|
58
|
-
return 'default';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Performs a web search using the Google Custom Search JSON API.
|
|
63
|
-
* This node requires a Google API Key and a Custom Search Engine ID.
|
|
64
|
-
* @param {object} params - The parameters for the node.
|
|
65
|
-
* @param {string} params.query - The search query.
|
|
66
|
-
* @param {string} params.apiKey - Your Google API Key.
|
|
67
|
-
* @param {string} params.cseId - Your Custom Search Engine ID.
|
|
68
|
-
* @returns {Promise<object[]>} A promise that resolves to an array of search result objects.
|
|
69
|
-
*/
|
|
70
|
-
export class GoogleSearchNode extends AsyncNode {
|
|
71
|
-
static getToolDefinition() {
|
|
72
|
-
return {
|
|
73
|
-
name: "google_search",
|
|
74
|
-
description: "Performs web searches via Google Custom Search (requires API key).",
|
|
75
|
-
parameters: {
|
|
76
|
-
type: "object",
|
|
77
|
-
properties: {
|
|
78
|
-
query: {
|
|
79
|
-
type: "string",
|
|
80
|
-
description: "The search query."
|
|
81
|
-
},
|
|
82
|
-
apiKey: {
|
|
83
|
-
type: "string",
|
|
84
|
-
description: "Your Google API Key."
|
|
85
|
-
},
|
|
86
|
-
cseId: {
|
|
87
|
-
type: "string",
|
|
88
|
-
description: "Your Custom Search Engine ID."
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
required: ["query", "apiKey", "cseId"]
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
async execAsync() {
|
|
96
|
-
const { query, apiKey, cseId } = this.params;
|
|
97
|
-
if (!query || !apiKey || !cseId) {
|
|
98
|
-
throw new Error('GoogleSearchNode requires `query`, `apiKey`, and `cseId` parameters.');
|
|
99
|
-
}
|
|
100
|
-
const url = `https://www.googleapis.com/customsearch/v1?key=${apiKey}&cx=${cseId}&q=${encodeURIComponent(query)}`;
|
|
101
|
-
log(`[Google Search] Searching for: "${query}"`, this.params.logging);
|
|
102
|
-
const response = await fetch(url);
|
|
103
|
-
if (!response.ok) {
|
|
104
|
-
const errorData = await response.json();
|
|
105
|
-
throw new Error(`Google Search API error: ${response.status} - ${errorData.error.message}`);
|
|
106
|
-
}
|
|
107
|
-
const data = await response.json();
|
|
108
|
-
return (data.items || []).map(item => ({
|
|
109
|
-
title: item.title,
|
|
110
|
-
link: item.link,
|
|
111
|
-
snippet: item.snippet,
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
async postAsync(shared, prepRes, execRes) {
|
|
115
|
-
shared.searchResults = execRes;
|
|
116
|
-
return 'default';
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
export class SemanticMemoryNode 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
|
-
metadata: {
|
|
26
|
-
type: string;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
memoryPath: {
|
|
30
|
-
type: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
embeddingModel: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
};
|
|
37
|
-
embeddingBaseUrl: {
|
|
38
|
-
type: string;
|
|
39
|
-
description: string;
|
|
40
|
-
};
|
|
41
|
-
topK: {
|
|
42
|
-
type: string;
|
|
43
|
-
description: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
required: string[];
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
constructor();
|
|
50
|
-
memoryIndex: {};
|
|
51
|
-
indexFilePath: string;
|
|
52
|
-
memoriesDir: string;
|
|
53
|
-
execAsync(): Promise<{
|
|
54
|
-
id: string;
|
|
55
|
-
content: any;
|
|
56
|
-
metadata: any;
|
|
57
|
-
similarity: number;
|
|
58
|
-
}[] | {
|
|
59
|
-
status: string;
|
|
60
|
-
id: any;
|
|
61
|
-
}>;
|
|
62
|
-
postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
|
|
63
|
-
}
|
|
64
|
-
import { AsyncNode } from '../qflow.js';
|