@fractal-solutions/qflow 1.0.83 → 2.0.0-canary.4
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/CHANGELOG.md +107 -0
- package/LICENSE +21 -504
- package/MIGRATION.md +1130 -0
- package/README.md +1432 -823
- package/dist/agent/agent.d.ts +4 -22
- package/dist/agent/agent.js +4 -364
- package/dist/agent/base_agent.d.ts +8 -20
- package/dist/agent/base_agent.js +8 -205
- package/dist/agent/control_nodes.d.ts +61 -0
- package/dist/agent/control_nodes.js +164 -0
- package/dist/agent/engine.d.ts +45 -0
- package/dist/agent/engine.js +415 -0
- package/dist/agent/flow.d.ts +77 -0
- package/dist/agent/flow.js +148 -0
- package/dist/agent/index.d.ts +12 -0
- package/dist/agent/index.js +12 -0
- package/dist/agent/lpavrl_agent.d.ts +1 -2
- package/dist/agent/lpavrl_agent.js +2 -175
- package/dist/agent/ooda_agent.d.ts +1 -2
- package/dist/agent/ooda_agent.js +2 -164
- package/dist/agent/pema_agent.d.ts +1 -2
- package/dist/agent/pema_agent.js +2 -168
- package/dist/agent/raor_agent.d.ts +1 -2
- package/dist/agent/raor_agent.js +2 -161
- package/dist/agent/strategies.d.ts +126 -0
- package/dist/agent/strategies.js +159 -0
- package/dist/agent/tools.d.ts +1 -0
- package/dist/agent/tools.js +42 -24
- package/dist/approval.d.ts +42 -0
- package/dist/approval.js +86 -0
- package/dist/budget.d.ts +103 -0
- package/dist/budget.js +133 -0
- package/dist/bun_nodes.d.ts +119 -0
- package/dist/bun_nodes.js +331 -0
- package/dist/contracts.d.ts +30 -0
- package/dist/contracts.js +103 -0
- package/dist/durable.d.ts +278 -0
- package/dist/durable.js +730 -0
- package/dist/eval.d.ts +165 -0
- package/dist/eval.js +263 -0
- package/dist/graph.d.ts +157 -0
- package/dist/graph.js +330 -0
- package/dist/llm/index.d.ts +359 -0
- package/dist/llm/index.js +924 -0
- package/dist/logger.js +7 -3
- package/dist/mcp/client.d.ts +55 -0
- package/dist/mcp/client.js +145 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/server.d.ts +106 -0
- package/dist/mcp/server.js +154 -0
- package/dist/mcp/stdio.d.ts +2 -0
- package/dist/mcp/stdio.js +3 -0
- package/dist/memory.d.ts +101 -0
- package/dist/memory.js +217 -0
- package/dist/nodes/browser_control.js +5 -4
- package/dist/nodes/data_extractor.js +2 -1
- package/dist/nodes/data_validation.d.ts +3 -3
- package/dist/nodes/data_validation.js +19 -5
- package/dist/nodes/database.d.ts +2 -1
- package/dist/nodes/database.js +71 -58
- package/dist/nodes/gis.js +1 -1
- package/dist/nodes/git.d.ts +1 -1
- package/dist/nodes/git.js +65 -51
- package/dist/nodes/github.d.ts +1 -0
- package/dist/nodes/hardware_interaction.d.ts +2 -4
- package/dist/nodes/hardware_interaction.js +4 -3
- package/dist/nodes/http.d.ts +1 -7
- package/dist/nodes/http.js +46 -33
- package/dist/nodes/image_gallery.js +45 -45
- package/dist/nodes/index.d.ts +8 -0
- package/dist/nodes/index.js +8 -0
- package/dist/nodes/interactive_webview.d.ts +1 -2
- package/dist/nodes/interactive_webview.js +217 -216
- package/dist/nodes/multimedia_processing.js +1 -1
- package/dist/nodes/navigator.d.ts +7 -0
- package/dist/nodes/navigator.js +48 -8
- package/dist/nodes/pdf_processor.js +2 -1
- package/dist/nodes/remote_execution.js +2 -2
- package/dist/nodes/s3.d.ts +1 -0
- package/dist/nodes/scheduler.js +2 -2
- package/dist/nodes/search.d.ts +1 -1
- package/dist/nodes/search.js +3 -2
- package/dist/nodes/speech_synthesis.js +2 -1
- package/dist/nodes/spreadsheet.d.ts +1 -7
- package/dist/nodes/spreadsheet.js +2 -1
- package/dist/nodes/streaming_llm.d.ts +51 -0
- package/dist/nodes/streaming_llm.js +120 -0
- package/dist/nodes/webhook.d.ts +1 -5
- package/dist/nodes/webhook.js +106 -93
- package/dist/nodes/websockets.js +5 -3
- package/dist/nodes/webview.js +3 -2
- package/dist/optional.d.ts +32 -0
- package/dist/optional.js +61 -0
- package/dist/qflow.d.ts +25 -14
- package/dist/qflow.js +140 -49
- package/dist/schedule.d.ts +41 -0
- package/dist/schedule.js +149 -0
- package/dist/side_effects.d.ts +50 -0
- package/dist/side_effects.js +94 -0
- package/dist/streaming.d.ts +35 -0
- package/dist/streaming.js +199 -0
- package/dist/testing.d.ts +47 -0
- package/dist/testing.js +130 -0
- package/dist/tool_spec.d.ts +76 -0
- package/dist/tool_spec.js +321 -0
- package/dist/trace.d.ts +28 -0
- package/dist/trace.js +190 -0
- package/dist/util.d.ts +57 -0
- package/dist/util.js +122 -0
- package/package.json +153 -67
- package/qflow.config.js +18 -18
- package/scripts/postinstall.js +50 -0
- package/scripts/verify-package.js +114 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AsyncNode } from '../qflow.js';
|
|
2
|
-
|
|
3
|
-
import { SerialPort } from 'serialport';
|
|
4
|
-
import { ReadlineParser } from '@serialport/parser-readline'; // For reading line-by-line
|
|
2
|
+
import { loadOptional } from '../optional.js';
|
|
5
3
|
import { log } from '../logger.js';
|
|
6
4
|
export class HardwareInteractionNode extends AsyncNode {
|
|
7
5
|
static getToolDefinition() {
|
|
@@ -56,6 +54,7 @@ export class HardwareInteractionNode extends AsyncNode {
|
|
|
56
54
|
case 'list_ports':
|
|
57
55
|
// List available serial ports
|
|
58
56
|
try {
|
|
57
|
+
const { SerialPort } = await loadOptional('serialport');
|
|
59
58
|
const ports = await SerialPort.list();
|
|
60
59
|
result = ports.map(p => ({
|
|
61
60
|
path: p.path,
|
|
@@ -76,6 +75,7 @@ export class HardwareInteractionNode extends AsyncNode {
|
|
|
76
75
|
throw new Error('For "write" or "read_line" action, `portPath` is required.');
|
|
77
76
|
}
|
|
78
77
|
try {
|
|
78
|
+
const { SerialPort } = await loadOptional('serialport');
|
|
79
79
|
this.port = new SerialPort({ path: portPath, baudRate: baudRate });
|
|
80
80
|
await new Promise((resolve, reject) => {
|
|
81
81
|
this.port.on('open', resolve);
|
|
@@ -97,6 +97,7 @@ export class HardwareInteractionNode extends AsyncNode {
|
|
|
97
97
|
result = { status: 'data_written', data: dataToWrite };
|
|
98
98
|
}
|
|
99
99
|
else if (action === 'read_line') {
|
|
100
|
+
const { ReadlineParser } = await loadOptional('@serialport/parser-readline');
|
|
100
101
|
this.parser = this.port.pipe(new ReadlineParser({ delimiter: '\n' }));
|
|
101
102
|
result = await new Promise((resolve, reject) => {
|
|
102
103
|
const timer = setTimeout(() => {
|
package/dist/nodes/http.d.ts
CHANGED
|
@@ -64,13 +64,7 @@ export class HttpRequestNode extends AsyncNode {
|
|
|
64
64
|
required: string[];
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
-
execAsync(): Promise<
|
|
68
|
-
status: number;
|
|
69
|
-
headers: {
|
|
70
|
-
[k: string]: string;
|
|
71
|
-
};
|
|
72
|
-
body: any;
|
|
73
|
-
}>;
|
|
67
|
+
execAsync(prepRes: any, shared?: {}, observer?: {}): Promise<any>;
|
|
74
68
|
parseResponseBody(response: any): Promise<any>;
|
|
75
69
|
postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
|
|
76
70
|
}
|
package/dist/nodes/http.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AsyncNode } from '../qflow.js';
|
|
2
2
|
import { log } from '../logger.js';
|
|
3
|
+
import { withReplaySafeSideEffect } from '../side_effects.js';
|
|
3
4
|
/**
|
|
4
5
|
* A flexible node for making generic HTTP requests to any REST API.
|
|
5
6
|
* @param {object} params - The parameters for the node.
|
|
@@ -68,43 +69,55 @@ export class HttpRequestNode extends AsyncNode {
|
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
|
-
async execAsync() {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const fetchOptions = {
|
|
77
|
-
method,
|
|
78
|
-
headers: { ...headers }, // Create a mutable copy
|
|
79
|
-
};
|
|
80
|
-
// Handle Authentication
|
|
81
|
-
if (auth) {
|
|
82
|
-
if (auth.type === 'bearer' && auth.token) {
|
|
83
|
-
fetchOptions.headers['Authorization'] = `Bearer ${auth.token}`;
|
|
84
|
-
}
|
|
85
|
-
else if (auth.type === 'basic' && auth.username && auth.password) {
|
|
86
|
-
const credentials = btoa(`${auth.username}:${auth.password}`);
|
|
87
|
-
fetchOptions.headers['Authorization'] = `Basic ${credentials}`;
|
|
72
|
+
async execAsync(prepRes, shared = {}, observer = {}) {
|
|
73
|
+
const execute = async () => {
|
|
74
|
+
const { url, method = 'GET', headers = {}, body, auth } = this.params;
|
|
75
|
+
if (!url) {
|
|
76
|
+
throw new Error('HttpRequestNode requires a `url` parameter.');
|
|
88
77
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
const fetchOptions = {
|
|
79
|
+
method,
|
|
80
|
+
headers: { ...headers }, // Create a mutable copy
|
|
81
|
+
};
|
|
82
|
+
// Handle Authentication
|
|
83
|
+
if (auth) {
|
|
84
|
+
if (auth.type === 'bearer' && auth.token) {
|
|
85
|
+
fetchOptions.headers['Authorization'] = `Bearer ${auth.token}`;
|
|
86
|
+
}
|
|
87
|
+
else if (auth.type === 'basic' && auth.username && auth.password) {
|
|
88
|
+
const credentials = btoa(`${auth.username}:${auth.password}`);
|
|
89
|
+
fetchOptions.headers['Authorization'] = `Basic ${credentials}`;
|
|
90
|
+
}
|
|
95
91
|
}
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
// Handle Body
|
|
93
|
+
if (body) {
|
|
94
|
+
if (typeof body === 'object' && !fetchOptions.headers['Content-Type']) {
|
|
95
|
+
fetchOptions.headers['Content-Type'] = 'application/json';
|
|
96
|
+
fetchOptions.body = JSON.stringify(body);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
fetchOptions.body = body;
|
|
100
|
+
}
|
|
98
101
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
log(`[HTTP] ${method} ${url}`, this.params.logging);
|
|
103
|
+
const response = await fetch(url, fetchOptions);
|
|
104
|
+
const responseBody = await this.parseResponseBody(response);
|
|
105
|
+
return {
|
|
106
|
+
status: response.status,
|
|
107
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
108
|
+
body: responseBody,
|
|
109
|
+
};
|
|
107
110
|
};
|
|
111
|
+
const outcome = await withReplaySafeSideEffect({
|
|
112
|
+
params: this.params,
|
|
113
|
+
shared,
|
|
114
|
+
observer,
|
|
115
|
+
kind: 'http',
|
|
116
|
+
operationId: this.params.operationId,
|
|
117
|
+
onPending: this.params.onPendingSideEffect ?? 'error',
|
|
118
|
+
execute,
|
|
119
|
+
});
|
|
120
|
+
return outcome.result;
|
|
108
121
|
}
|
|
109
122
|
async parseResponseBody(response) {
|
|
110
123
|
const contentType = response.headers.get('content-type') || '';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncNode, AsyncFlow } from '../qflow.js';
|
|
2
|
-
import { ShellCommandNode } from './
|
|
2
|
+
import { ShellCommandNode } from './shell.js';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import os from 'os';
|
|
5
5
|
import { promises as fs } from 'fs';
|
|
@@ -69,50 +69,50 @@ export class ImageGalleryNode extends AsyncNode {
|
|
|
69
69
|
log(`[ImageGalleryNode] Could not copy image ${imagePath}: ${e.message}. Skipping.`, this.params.logging, { type: 'warn' });
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const htmlContent = `
|
|
73
|
-
<!DOCTYPE html>
|
|
74
|
-
<html lang="en">
|
|
75
|
-
<head>
|
|
76
|
-
<meta charset="UTF-8">
|
|
77
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
78
|
-
<title>${title}</title>
|
|
79
|
-
<style>
|
|
80
|
-
body { font-family: sans-serif; margin: 20px; background-color: #f0f0f0; }
|
|
81
|
-
h1 { color: #333; }
|
|
82
|
-
p { color: #666; }
|
|
83
|
-
.gallery-container {
|
|
84
|
-
display: grid;
|
|
85
|
-
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
86
|
-
gap: 20px;
|
|
87
|
-
padding: 20px;
|
|
88
|
-
background-color: #fff;
|
|
89
|
-
border-radius: 8px;
|
|
90
|
-
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
91
|
-
}
|
|
92
|
-
.gallery-item {
|
|
93
|
-
border: 1px solid #ddd;
|
|
94
|
-
border-radius: 4px;
|
|
95
|
-
padding: 10px;
|
|
96
|
-
text-align: center;
|
|
97
|
-
background-color: #f9f9f9;
|
|
98
|
-
}
|
|
99
|
-
.gallery-item img {
|
|
100
|
-
max-width: 100%;
|
|
101
|
-
height: auto;
|
|
102
|
-
display: block;
|
|
103
|
-
margin: 0 auto 10px auto;
|
|
104
|
-
border-radius: 4px;
|
|
105
|
-
}
|
|
106
|
-
</style>
|
|
107
|
-
</head>
|
|
108
|
-
<body>
|
|
109
|
-
<h1>${title}</h1>
|
|
110
|
-
<p>${description}</p>
|
|
111
|
-
<div class="gallery-container">
|
|
112
|
-
${imageHtml}
|
|
113
|
-
</div>
|
|
114
|
-
</body>
|
|
115
|
-
</html>
|
|
72
|
+
const htmlContent = `
|
|
73
|
+
<!DOCTYPE html>
|
|
74
|
+
<html lang="en">
|
|
75
|
+
<head>
|
|
76
|
+
<meta charset="UTF-8">
|
|
77
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
78
|
+
<title>${title}</title>
|
|
79
|
+
<style>
|
|
80
|
+
body { font-family: sans-serif; margin: 20px; background-color: #f0f0f0; }
|
|
81
|
+
h1 { color: #333; }
|
|
82
|
+
p { color: #666; }
|
|
83
|
+
.gallery-container {
|
|
84
|
+
display: grid;
|
|
85
|
+
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
86
|
+
gap: 20px;
|
|
87
|
+
padding: 20px;
|
|
88
|
+
background-color: #fff;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
91
|
+
}
|
|
92
|
+
.gallery-item {
|
|
93
|
+
border: 1px solid #ddd;
|
|
94
|
+
border-radius: 4px;
|
|
95
|
+
padding: 10px;
|
|
96
|
+
text-align: center;
|
|
97
|
+
background-color: #f9f9f9;
|
|
98
|
+
}
|
|
99
|
+
.gallery-item img {
|
|
100
|
+
max-width: 100%;
|
|
101
|
+
height: auto;
|
|
102
|
+
display: block;
|
|
103
|
+
margin: 0 auto 10px auto;
|
|
104
|
+
border-radius: 4px;
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
107
|
+
</head>
|
|
108
|
+
<body>
|
|
109
|
+
<h1>${title}</h1>
|
|
110
|
+
<p>${description}</p>
|
|
111
|
+
<div class="gallery-container">
|
|
112
|
+
${imageHtml}
|
|
113
|
+
</div>
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
116
116
|
`;
|
|
117
117
|
await fs.writeFile(htmlFilePath, htmlContent);
|
|
118
118
|
log(`[ImageGalleryNode] Generated HTML gallery at: ${htmlFilePath}`, this.params.logging);
|
package/dist/nodes/index.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
export * from "../llm/index.js";
|
|
2
|
+
export * from "../side_effects.js";
|
|
3
|
+
export * from "../bun_nodes.js";
|
|
4
|
+
export * from "../approval.js";
|
|
5
|
+
export * from "../schedule.js";
|
|
6
|
+
export * from "../budget.js";
|
|
7
|
+
export * from "../memory.js";
|
|
1
8
|
export * from "./llm.js";
|
|
9
|
+
export * from "./streaming_llm.js";
|
|
2
10
|
export * from "./agent_llm.js";
|
|
3
11
|
export * from "./data_extractor.js";
|
|
4
12
|
export * from "./code_interpreter.js";
|
package/dist/nodes/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
export * from '../llm/index.js';
|
|
2
|
+
export * from '../side_effects.js';
|
|
3
|
+
export * from '../bun_nodes.js';
|
|
4
|
+
export * from '../approval.js';
|
|
5
|
+
export * from '../schedule.js';
|
|
6
|
+
export * from '../budget.js';
|
|
7
|
+
export * from '../memory.js';
|
|
1
8
|
export * from './llm.js';
|
|
9
|
+
export * from './streaming_llm.js';
|
|
2
10
|
export * from './agent_llm.js';
|
|
3
11
|
export * from './data_extractor.js';
|
|
4
12
|
export * from './code_interpreter.js';
|
|
@@ -64,7 +64,7 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
constructor();
|
|
67
|
-
_webviewInstance:
|
|
67
|
+
_webviewInstance: any;
|
|
68
68
|
execAsync(): Promise<any>;
|
|
69
69
|
/**
|
|
70
70
|
* Sends data or executes JavaScript within an open persistent webview.
|
|
@@ -75,4 +75,3 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
75
75
|
generateHTML(mode: any, params: any): string;
|
|
76
76
|
}
|
|
77
77
|
import { AsyncNode } from '../qflow.js';
|
|
78
|
-
import { Webview } from 'webview-bun';
|