@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,5 +1,5 @@
|
|
|
1
1
|
import { AsyncNode } from '../qflow.js';
|
|
2
|
-
import {
|
|
2
|
+
import { loadOptional } from '../optional.js';
|
|
3
3
|
import { log } from '../logger.js';
|
|
4
4
|
/**
|
|
5
5
|
* A node that displays an interactive webview window.
|
|
@@ -80,11 +80,12 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
80
80
|
multilineInput = false, // New parameter for multi-line input
|
|
81
81
|
} = this.params;
|
|
82
82
|
log(`[InteractiveWebviewNode] Creating '${mode}' webview with title: "${title}"`, this.params.logging);
|
|
83
|
+
const { Webview, SizeHint } = await loadOptional('webview-bun');
|
|
83
84
|
return new Promise((resolve) => {
|
|
84
85
|
const webview = new Webview(false, {
|
|
85
86
|
width,
|
|
86
87
|
height,
|
|
87
|
-
hint:
|
|
88
|
+
hint: SizeHint.FIXED,
|
|
88
89
|
});
|
|
89
90
|
webview.title = title;
|
|
90
91
|
this._webviewInstance = webview; // Always store the instance
|
|
@@ -103,16 +104,16 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
103
104
|
throw new Error('InteractiveWebviewNode in custom mode requires an `html` parameter.');
|
|
104
105
|
}
|
|
105
106
|
// Inject a helper function for custom HTML to send data back
|
|
106
|
-
const injectedScript = `
|
|
107
|
-
<script>
|
|
108
|
-
function sendResultToQflow(data) {
|
|
109
|
-
if (typeof qflow === 'function') {
|
|
110
|
-
qflow(data);
|
|
111
|
-
} else {
|
|
112
|
-
console.error("qflow function not available in webview context.");
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
</script>
|
|
107
|
+
const injectedScript = `
|
|
108
|
+
<script>
|
|
109
|
+
function sendResultToQflow(data) {
|
|
110
|
+
if (typeof qflow === 'function') {
|
|
111
|
+
qflow(data);
|
|
112
|
+
} else {
|
|
113
|
+
console.error("qflow function not available in webview context.");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
116
117
|
`;
|
|
117
118
|
contentHtml = html.replace('</body>', `${injectedScript}</body>`);
|
|
118
119
|
if (!html.includes('</body>')) {
|
|
@@ -154,191 +155,191 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
154
155
|
}
|
|
155
156
|
generateHTML(mode, params) {
|
|
156
157
|
const { message, options, prompt, title, theme, multilineInput, html } = params;
|
|
157
|
-
const lightTheme = `
|
|
158
|
-
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
|
|
159
|
-
:root {
|
|
160
|
-
--primary-color: #007bff;
|
|
161
|
-
--bg-color: #f4f6f8;
|
|
162
|
-
--border-color: #d1d9e0;
|
|
163
|
-
--text-color: #212529;
|
|
164
|
-
--title-color: #212529;
|
|
165
|
-
--shadow-color: #007bff40;
|
|
166
|
-
}
|
|
167
|
-
body {
|
|
168
|
-
font-family: 'Orbitron', sans-serif;
|
|
169
|
-
background-color: var(--bg-color);
|
|
170
|
-
color: var(--text-color);
|
|
171
|
-
margin: 0;
|
|
172
|
-
padding: 1px;
|
|
173
|
-
overflow: auto;
|
|
174
|
-
user-select: none;
|
|
175
|
-
}
|
|
176
|
-
.container {
|
|
177
|
-
border: 1px solid var(--border-color);
|
|
178
|
-
height: calc(100vh - 2px);
|
|
179
|
-
width: calc(100vw - 2px);
|
|
180
|
-
display: flex;
|
|
181
|
-
flex-direction: column;
|
|
182
|
-
background-color: #ffffff;
|
|
183
|
-
box-shadow: 0 0 20px #0000001a;
|
|
184
|
-
}
|
|
185
|
-
.title-bar {
|
|
186
|
-
background-color: #e9ecef;
|
|
187
|
-
color: var(--title-color);
|
|
188
|
-
padding: 0.5rem;
|
|
189
|
-
text-align: center;
|
|
190
|
-
font-weight: bold;
|
|
191
|
-
border-bottom: 1px solid var(--border-color);
|
|
192
|
-
text-transform: uppercase;
|
|
193
|
-
letter-spacing: 2px;
|
|
194
|
-
}
|
|
195
|
-
.content {
|
|
196
|
-
flex-grow: 1;
|
|
197
|
-
padding: 1.5rem;
|
|
198
|
-
display: flex;
|
|
199
|
-
flex-direction: column;
|
|
200
|
-
justify-content: center;
|
|
201
|
-
align-items: center;
|
|
202
|
-
text-align: center;
|
|
203
|
-
}
|
|
204
|
-
h1 {
|
|
205
|
-
font-size: 1.2rem;
|
|
206
|
-
margin-bottom: 1rem;
|
|
207
|
-
color: var(--title-color);
|
|
208
|
-
}
|
|
209
|
-
.button-group {
|
|
210
|
-
display: flex;
|
|
211
|
-
flex-wrap: wrap; /* Allow buttons to wrap */
|
|
212
|
-
justify-content: center; /* Center buttons */
|
|
213
|
-
gap: 1rem;
|
|
214
|
-
margin-top: 1rem;
|
|
215
|
-
}
|
|
216
|
-
button {
|
|
217
|
-
background-color: var(--primary-color);
|
|
218
|
-
color: white;
|
|
219
|
-
border: 1px solid var(--primary-color);
|
|
220
|
-
padding: 0.6rem 1.2rem;
|
|
221
|
-
font-family: 'Orbitron', sans-serif;
|
|
222
|
-
font-size: 0.9rem;
|
|
223
|
-
font-weight: bold;
|
|
224
|
-
cursor: pointer;
|
|
225
|
-
transition: all 0.3s ease;
|
|
226
|
-
text-transform: uppercase;
|
|
227
|
-
}
|
|
228
|
-
button:hover {
|
|
229
|
-
background-color: #0056b3;
|
|
230
|
-
border-color: #0056b3;
|
|
231
|
-
}
|
|
232
|
-
input, textarea { /* Apply styles to textarea as well */
|
|
233
|
-
background-color: #ffffff;
|
|
234
|
-
border: 1px solid var(--border-color);
|
|
235
|
-
color: var(--text-color);
|
|
236
|
-
padding: 0.6rem;
|
|
237
|
-
width: 80%;
|
|
238
|
-
font-family: 'Orbitron', sans-serif;
|
|
239
|
-
font-size: 1rem;
|
|
240
|
-
margin-bottom: 1rem;
|
|
241
|
-
}
|
|
242
|
-
input:focus, textarea:focus {
|
|
243
|
-
outline: none;
|
|
244
|
-
border-color: var(--primary-color);
|
|
245
|
-
box-shadow: 0 0 8px var(--shadow-color);
|
|
246
|
-
}
|
|
158
|
+
const lightTheme = `
|
|
159
|
+
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
|
|
160
|
+
:root {
|
|
161
|
+
--primary-color: #007bff;
|
|
162
|
+
--bg-color: #f4f6f8;
|
|
163
|
+
--border-color: #d1d9e0;
|
|
164
|
+
--text-color: #212529;
|
|
165
|
+
--title-color: #212529;
|
|
166
|
+
--shadow-color: #007bff40;
|
|
167
|
+
}
|
|
168
|
+
body {
|
|
169
|
+
font-family: 'Orbitron', sans-serif;
|
|
170
|
+
background-color: var(--bg-color);
|
|
171
|
+
color: var(--text-color);
|
|
172
|
+
margin: 0;
|
|
173
|
+
padding: 1px;
|
|
174
|
+
overflow: auto;
|
|
175
|
+
user-select: none;
|
|
176
|
+
}
|
|
177
|
+
.container {
|
|
178
|
+
border: 1px solid var(--border-color);
|
|
179
|
+
height: calc(100vh - 2px);
|
|
180
|
+
width: calc(100vw - 2px);
|
|
181
|
+
display: flex;
|
|
182
|
+
flex-direction: column;
|
|
183
|
+
background-color: #ffffff;
|
|
184
|
+
box-shadow: 0 0 20px #0000001a;
|
|
185
|
+
}
|
|
186
|
+
.title-bar {
|
|
187
|
+
background-color: #e9ecef;
|
|
188
|
+
color: var(--title-color);
|
|
189
|
+
padding: 0.5rem;
|
|
190
|
+
text-align: center;
|
|
191
|
+
font-weight: bold;
|
|
192
|
+
border-bottom: 1px solid var(--border-color);
|
|
193
|
+
text-transform: uppercase;
|
|
194
|
+
letter-spacing: 2px;
|
|
195
|
+
}
|
|
196
|
+
.content {
|
|
197
|
+
flex-grow: 1;
|
|
198
|
+
padding: 1.5rem;
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
align-items: center;
|
|
203
|
+
text-align: center;
|
|
204
|
+
}
|
|
205
|
+
h1 {
|
|
206
|
+
font-size: 1.2rem;
|
|
207
|
+
margin-bottom: 1rem;
|
|
208
|
+
color: var(--title-color);
|
|
209
|
+
}
|
|
210
|
+
.button-group {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-wrap: wrap; /* Allow buttons to wrap */
|
|
213
|
+
justify-content: center; /* Center buttons */
|
|
214
|
+
gap: 1rem;
|
|
215
|
+
margin-top: 1rem;
|
|
216
|
+
}
|
|
217
|
+
button {
|
|
218
|
+
background-color: var(--primary-color);
|
|
219
|
+
color: white;
|
|
220
|
+
border: 1px solid var(--primary-color);
|
|
221
|
+
padding: 0.6rem 1.2rem;
|
|
222
|
+
font-family: 'Orbitron', sans-serif;
|
|
223
|
+
font-size: 0.9rem;
|
|
224
|
+
font-weight: bold;
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
transition: all 0.3s ease;
|
|
227
|
+
text-transform: uppercase;
|
|
228
|
+
}
|
|
229
|
+
button:hover {
|
|
230
|
+
background-color: #0056b3;
|
|
231
|
+
border-color: #0056b3;
|
|
232
|
+
}
|
|
233
|
+
input, textarea { /* Apply styles to textarea as well */
|
|
234
|
+
background-color: #ffffff;
|
|
235
|
+
border: 1px solid var(--border-color);
|
|
236
|
+
color: var(--text-color);
|
|
237
|
+
padding: 0.6rem;
|
|
238
|
+
width: 80%;
|
|
239
|
+
font-family: 'Orbitron', sans-serif;
|
|
240
|
+
font-size: 1rem;
|
|
241
|
+
margin-bottom: 1rem;
|
|
242
|
+
}
|
|
243
|
+
input:focus, textarea:focus {
|
|
244
|
+
outline: none;
|
|
245
|
+
border-color: var(--primary-color);
|
|
246
|
+
box-shadow: 0 0 8px var(--shadow-color);
|
|
247
|
+
}
|
|
247
248
|
`;
|
|
248
|
-
const darkTheme = `
|
|
249
|
-
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
|
|
250
|
-
:root {
|
|
251
|
-
--primary-color: #00ffff;
|
|
252
|
-
--bg-color: #0a0a1a;
|
|
253
|
-
--border-color: #00ffff80;
|
|
254
|
-
--text-color: #e0e0e0;
|
|
255
|
-
--title-color: #ffffff;
|
|
256
|
-
--shadow-color: #00ffff40;
|
|
257
|
-
}
|
|
258
|
-
body {
|
|
259
|
-
font-family: 'Orbitron', sans-serif;
|
|
260
|
-
background-color: var(--bg-color);
|
|
261
|
-
color: var(--text-color);
|
|
262
|
-
margin: 0;
|
|
263
|
-
padding: 1px;
|
|
264
|
-
overflow: auto; /* Allow scrolling */
|
|
265
|
-
user-select: none;
|
|
266
|
-
}
|
|
267
|
-
.container {
|
|
268
|
-
border: 1px solid var(--border-color);
|
|
269
|
-
height: calc(100vh - 2px);
|
|
270
|
-
width: calc(100vw - 2px);
|
|
271
|
-
display: flex;
|
|
272
|
-
flex-direction: column;
|
|
273
|
-
background: radial-gradient(circle, rgba(10, 10, 26, 0.95) 0%, rgba(10, 10, 26, 0.85) 100%);
|
|
274
|
-
box-shadow: 0 0 20px var(--shadow-color);
|
|
275
|
-
}
|
|
276
|
-
.title-bar {
|
|
277
|
-
background-color: #00000030;
|
|
278
|
-
color: var(--title-color);
|
|
279
|
-
padding: 0.5rem;
|
|
280
|
-
text-align: center;
|
|
281
|
-
font-weight: bold;
|
|
282
|
-
border-bottom: 1px solid var(--border-color);
|
|
283
|
-
text-transform: uppercase;
|
|
284
|
-
letter-spacing: 2px;
|
|
285
|
-
text-shadow: 0 0 5px var(--primary-color);
|
|
286
|
-
}
|
|
287
|
-
.content {
|
|
288
|
-
flex-grow: 1;
|
|
289
|
-
padding: 1.5rem;
|
|
290
|
-
display: flex;
|
|
291
|
-
flex-direction: column;
|
|
292
|
-
justify-content: center;
|
|
293
|
-
align-items: center;
|
|
294
|
-
text-align: center;
|
|
295
|
-
}
|
|
296
|
-
h1 {
|
|
297
|
-
font-size: 1.2rem;
|
|
298
|
-
margin-bottom: 1rem;
|
|
299
|
-
color: var(--title-color);
|
|
300
|
-
text-shadow: 0 0 8px var(--shadow-color);
|
|
301
|
-
}
|
|
302
|
-
.button-group {
|
|
303
|
-
display: flex;
|
|
304
|
-
flex-wrap: wrap; /* Allow buttons to wrap */
|
|
305
|
-
justify-content: center; /* Center buttons */
|
|
306
|
-
gap: 1rem;
|
|
307
|
-
margin-top: 1rem;
|
|
308
|
-
}
|
|
309
|
-
button {
|
|
310
|
-
background-color: transparent;
|
|
311
|
-
color: var(--primary-color);
|
|
312
|
-
border: 1px solid var(--primary-color);
|
|
313
|
-
padding: 0.6rem 1.2rem;
|
|
314
|
-
font-family: 'Orbitron', sans-serif;
|
|
315
|
-
font-size: 0.9rem;
|
|
316
|
-
font-weight: bold;
|
|
317
|
-
cursor: pointer;
|
|
318
|
-
transition: all 0.3s ease;
|
|
319
|
-
text-transform: uppercase;
|
|
320
|
-
box-shadow: 0 0 10px var(--shadow-color) inset;
|
|
321
|
-
}
|
|
322
|
-
button:hover {
|
|
323
|
-
background-color: var(--primary-color);
|
|
324
|
-
color: var(--bg-color);
|
|
325
|
-
box-shadow: 0 0 20px var(--shadow-color);
|
|
326
|
-
}
|
|
327
|
-
input, textarea { /* Apply styles to textarea as well */
|
|
328
|
-
background-color: #00000030;
|
|
329
|
-
border: 1px solid var(--border-color);
|
|
330
|
-
color: var(--text-color);
|
|
331
|
-
padding: 0.6rem;
|
|
332
|
-
width: 80%;
|
|
333
|
-
font-family: 'Orbitron', sans-serif;
|
|
334
|
-
font-size: 1rem;
|
|
335
|
-
margin-bottom: 1rem;
|
|
336
|
-
}
|
|
337
|
-
input:focus, textarea:focus {
|
|
338
|
-
outline: none;
|
|
339
|
-
border-color: var(--primary-color);
|
|
340
|
-
box-shadow: 0 0 10px var(--shadow-color);
|
|
341
|
-
}
|
|
249
|
+
const darkTheme = `
|
|
250
|
+
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
|
|
251
|
+
:root {
|
|
252
|
+
--primary-color: #00ffff;
|
|
253
|
+
--bg-color: #0a0a1a;
|
|
254
|
+
--border-color: #00ffff80;
|
|
255
|
+
--text-color: #e0e0e0;
|
|
256
|
+
--title-color: #ffffff;
|
|
257
|
+
--shadow-color: #00ffff40;
|
|
258
|
+
}
|
|
259
|
+
body {
|
|
260
|
+
font-family: 'Orbitron', sans-serif;
|
|
261
|
+
background-color: var(--bg-color);
|
|
262
|
+
color: var(--text-color);
|
|
263
|
+
margin: 0;
|
|
264
|
+
padding: 1px;
|
|
265
|
+
overflow: auto; /* Allow scrolling */
|
|
266
|
+
user-select: none;
|
|
267
|
+
}
|
|
268
|
+
.container {
|
|
269
|
+
border: 1px solid var(--border-color);
|
|
270
|
+
height: calc(100vh - 2px);
|
|
271
|
+
width: calc(100vw - 2px);
|
|
272
|
+
display: flex;
|
|
273
|
+
flex-direction: column;
|
|
274
|
+
background: radial-gradient(circle, rgba(10, 10, 26, 0.95) 0%, rgba(10, 10, 26, 0.85) 100%);
|
|
275
|
+
box-shadow: 0 0 20px var(--shadow-color);
|
|
276
|
+
}
|
|
277
|
+
.title-bar {
|
|
278
|
+
background-color: #00000030;
|
|
279
|
+
color: var(--title-color);
|
|
280
|
+
padding: 0.5rem;
|
|
281
|
+
text-align: center;
|
|
282
|
+
font-weight: bold;
|
|
283
|
+
border-bottom: 1px solid var(--border-color);
|
|
284
|
+
text-transform: uppercase;
|
|
285
|
+
letter-spacing: 2px;
|
|
286
|
+
text-shadow: 0 0 5px var(--primary-color);
|
|
287
|
+
}
|
|
288
|
+
.content {
|
|
289
|
+
flex-grow: 1;
|
|
290
|
+
padding: 1.5rem;
|
|
291
|
+
display: flex;
|
|
292
|
+
flex-direction: column;
|
|
293
|
+
justify-content: center;
|
|
294
|
+
align-items: center;
|
|
295
|
+
text-align: center;
|
|
296
|
+
}
|
|
297
|
+
h1 {
|
|
298
|
+
font-size: 1.2rem;
|
|
299
|
+
margin-bottom: 1rem;
|
|
300
|
+
color: var(--title-color);
|
|
301
|
+
text-shadow: 0 0 8px var(--shadow-color);
|
|
302
|
+
}
|
|
303
|
+
.button-group {
|
|
304
|
+
display: flex;
|
|
305
|
+
flex-wrap: wrap; /* Allow buttons to wrap */
|
|
306
|
+
justify-content: center; /* Center buttons */
|
|
307
|
+
gap: 1rem;
|
|
308
|
+
margin-top: 1rem;
|
|
309
|
+
}
|
|
310
|
+
button {
|
|
311
|
+
background-color: transparent;
|
|
312
|
+
color: var(--primary-color);
|
|
313
|
+
border: 1px solid var(--primary-color);
|
|
314
|
+
padding: 0.6rem 1.2rem;
|
|
315
|
+
font-family: 'Orbitron', sans-serif;
|
|
316
|
+
font-size: 0.9rem;
|
|
317
|
+
font-weight: bold;
|
|
318
|
+
cursor: pointer;
|
|
319
|
+
transition: all 0.3s ease;
|
|
320
|
+
text-transform: uppercase;
|
|
321
|
+
box-shadow: 0 0 10px var(--shadow-color) inset;
|
|
322
|
+
}
|
|
323
|
+
button:hover {
|
|
324
|
+
background-color: var(--primary-color);
|
|
325
|
+
color: var(--bg-color);
|
|
326
|
+
box-shadow: 0 0 20px var(--shadow-color);
|
|
327
|
+
}
|
|
328
|
+
input, textarea { /* Apply styles to textarea as well */
|
|
329
|
+
background-color: #00000030;
|
|
330
|
+
border: 1px solid var(--border-color);
|
|
331
|
+
color: var(--text-color);
|
|
332
|
+
padding: 0.6rem;
|
|
333
|
+
width: 80%;
|
|
334
|
+
font-family: 'Orbitron', sans-serif;
|
|
335
|
+
font-size: 1rem;
|
|
336
|
+
margin-bottom: 1rem;
|
|
337
|
+
}
|
|
338
|
+
input:focus, textarea:focus {
|
|
339
|
+
outline: none;
|
|
340
|
+
border-color: var(--primary-color);
|
|
341
|
+
box-shadow: 0 0 10px var(--shadow-color);
|
|
342
|
+
}
|
|
342
343
|
`;
|
|
343
344
|
let contentHtml = '';
|
|
344
345
|
let interactiveElements = '';
|
|
@@ -351,10 +352,10 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
351
352
|
switch (mode) {
|
|
352
353
|
case 'dialog':
|
|
353
354
|
case 'custom-dialog':
|
|
354
|
-
interactiveElements = `
|
|
355
|
-
<div class="button-group">
|
|
356
|
-
${options.map(option => `<button onclick="qflow('${option}')">${option}</button>`).join('')}
|
|
357
|
-
</div>
|
|
355
|
+
interactiveElements = `
|
|
356
|
+
<div class="button-group">
|
|
357
|
+
${options.map(option => `<button onclick="qflow('${option}')">${option}</button>`).join('')}
|
|
358
|
+
</div>
|
|
358
359
|
`;
|
|
359
360
|
break;
|
|
360
361
|
case 'input':
|
|
@@ -362,30 +363,30 @@ export class InteractiveWebviewNode extends AsyncNode {
|
|
|
362
363
|
const inputElement = multilineInput ?
|
|
363
364
|
`<textarea id="userInput" rows="10" style="margin-top: 20px;"></textarea>` :
|
|
364
365
|
`<input type="text" id="userInput" onkeydown="if(event.key==='Enter') document.getElementById('submitBtn').click()" style="margin-top: 20px;"/>`;
|
|
365
|
-
interactiveElements = `
|
|
366
|
-
${inputElement}
|
|
367
|
-
<button id="submitBtn" onclick="qflow(document.getElementById('userInput').value)">Submit</button>
|
|
366
|
+
interactiveElements = `
|
|
367
|
+
${inputElement}
|
|
368
|
+
<button id="submitBtn" onclick="qflow(document.getElementById('userInput').value)">Submit</button>
|
|
368
369
|
`;
|
|
369
370
|
break;
|
|
370
371
|
case 'notification':
|
|
371
372
|
default:
|
|
372
|
-
interactiveElements = `
|
|
373
|
-
<div class="button-group">
|
|
374
|
-
<button onclick="qflow('closed')">${theme === 'dark' ? 'Acknowledge' : 'Close'}</button>
|
|
375
|
-
</div>
|
|
373
|
+
interactiveElements = `
|
|
374
|
+
<div class="button-group">
|
|
375
|
+
<button onclick="qflow('closed')">${theme === 'dark' ? 'Acknowledge' : 'Close'}</button>
|
|
376
|
+
</div>
|
|
376
377
|
`;
|
|
377
378
|
break;
|
|
378
379
|
}
|
|
379
380
|
const container = `<div class="container"><div class="title-bar">${title}</div><div class="content">${mode === 'custom-dialog' || mode === 'custom-input' ? mainContent : `<h1>${mainContent}</h1>`}${interactiveElements}</div></div>`;
|
|
380
|
-
return `
|
|
381
|
-
<html>
|
|
382
|
-
<head>
|
|
383
|
-
<style>${theme === 'dark' ? darkTheme : lightTheme}</style>
|
|
384
|
-
</head>
|
|
385
|
-
<body>
|
|
386
|
-
${container}
|
|
387
|
-
</body>
|
|
388
|
-
</html>
|
|
381
|
+
return `
|
|
382
|
+
<html>
|
|
383
|
+
<head>
|
|
384
|
+
<style>${theme === 'dark' ? darkTheme : lightTheme}</style>
|
|
385
|
+
</head>
|
|
386
|
+
<body>
|
|
387
|
+
${container}
|
|
388
|
+
</body>
|
|
389
|
+
</html>
|
|
389
390
|
`;
|
|
390
391
|
}
|
|
391
392
|
}
|
|
@@ -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';
|
|
@@ -153,6 +153,7 @@ export class NavigatorNode extends AsyncNode {
|
|
|
153
153
|
resolvePinchTabBinaryPath(): Promise<any>;
|
|
154
154
|
startPinchTabProcess(env: any): Promise<void>;
|
|
155
155
|
requestJson(baseUrl: any, route: any, method: string | undefined, body: any): Promise<unknown>;
|
|
156
|
+
requestJsonWithLegacyFallback(baseUrl: any, primaryRoute: any, legacyRoute: any, method: string | undefined, body: any, legacyBody: any): Promise<unknown>;
|
|
156
157
|
requestText(baseUrl: any, route: any, method?: string): Promise<string>;
|
|
157
158
|
requestBinary(baseUrl: any, route: any, options?: {}): Promise<{
|
|
158
159
|
contentType: string | null;
|
|
@@ -160,5 +161,11 @@ export class NavigatorNode extends AsyncNode {
|
|
|
160
161
|
outputPath: any;
|
|
161
162
|
extension: any;
|
|
162
163
|
}>;
|
|
164
|
+
requestBinaryWithLegacyFallback(baseUrl: any, primaryRoute: any, legacyRoute: any, options?: {}): Promise<{
|
|
165
|
+
contentType: string | null;
|
|
166
|
+
sizeBytes: number;
|
|
167
|
+
outputPath: any;
|
|
168
|
+
extension: any;
|
|
169
|
+
}>;
|
|
163
170
|
}
|
|
164
171
|
import { AsyncNode } from '../qflow.js';
|
package/dist/nodes/navigator.js
CHANGED
|
@@ -267,7 +267,13 @@ export class NavigatorNode extends AsyncNode {
|
|
|
267
267
|
case 'navigate':
|
|
268
268
|
this.requireParam('tabId');
|
|
269
269
|
this.requireParam('url');
|
|
270
|
-
return await this.
|
|
270
|
+
return await this.requestJsonWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/navigate`, '/navigate', 'POST', {
|
|
271
|
+
url: this.params.url,
|
|
272
|
+
timeout: this.params.timeout,
|
|
273
|
+
blockImages: this.params.blockImages,
|
|
274
|
+
blockAds: this.params.blockAds
|
|
275
|
+
}, {
|
|
276
|
+
tabId: this.params.tabId,
|
|
271
277
|
url: this.params.url,
|
|
272
278
|
timeout: this.params.timeout,
|
|
273
279
|
blockImages: this.params.blockImages,
|
|
@@ -283,28 +289,38 @@ export class NavigatorNode extends AsyncNode {
|
|
|
283
289
|
maxTokens: options.maxTokens,
|
|
284
290
|
filter: options.filter
|
|
285
291
|
});
|
|
286
|
-
return await this.
|
|
292
|
+
return await this.requestJsonWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/snapshot${query}`, `/snapshot${query}`);
|
|
287
293
|
}
|
|
288
294
|
case 'text': {
|
|
289
295
|
this.requireParam('tabId');
|
|
290
296
|
const query = buildQuery({ raw: this.params.raw });
|
|
291
|
-
return await this.
|
|
297
|
+
return await this.requestJsonWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/text${query}`, `/text${query}`);
|
|
292
298
|
}
|
|
293
299
|
case 'evaluate':
|
|
294
300
|
this.requireParam('tabId');
|
|
295
301
|
this.requireParam('expression');
|
|
296
|
-
return await this.
|
|
302
|
+
return await this.requestJsonWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/evaluate`, '/evaluate', 'POST', {
|
|
303
|
+
expression: this.params.expression,
|
|
304
|
+
await: this.params.awaitExpression
|
|
305
|
+
}, {
|
|
306
|
+
tabId: this.params.tabId,
|
|
297
307
|
expression: this.params.expression,
|
|
298
308
|
await: this.params.awaitExpression
|
|
299
309
|
});
|
|
300
310
|
case 'action':
|
|
301
311
|
this.requireParam('tabId');
|
|
302
312
|
this.requireParam('interaction');
|
|
303
|
-
return await this.
|
|
313
|
+
return await this.requestJsonWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/action`, '/action', 'POST', this.params.interaction, {
|
|
314
|
+
tabId: this.params.tabId,
|
|
315
|
+
...this.params.interaction
|
|
316
|
+
});
|
|
304
317
|
case 'actions':
|
|
305
318
|
this.requireParam('tabId');
|
|
306
319
|
this.requireParam('interactions');
|
|
307
|
-
return await this.
|
|
320
|
+
return await this.requestJsonWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/actions`, '/actions', 'POST', {
|
|
321
|
+
actions: this.params.interactions
|
|
322
|
+
}, {
|
|
323
|
+
tabId: this.params.tabId,
|
|
308
324
|
actions: this.params.interactions
|
|
309
325
|
});
|
|
310
326
|
case 'screenshot': {
|
|
@@ -314,7 +330,7 @@ export class NavigatorNode extends AsyncNode {
|
|
|
314
330
|
format: options.format,
|
|
315
331
|
quality: options.quality
|
|
316
332
|
});
|
|
317
|
-
return await this.
|
|
333
|
+
return await this.requestBinaryWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/screenshot${query}`, `/screenshot${query}`, {
|
|
318
334
|
defaultFileExtension: options.format === 'jpeg' ? 'jpg' : 'png'
|
|
319
335
|
});
|
|
320
336
|
}
|
|
@@ -327,7 +343,7 @@ export class NavigatorNode extends AsyncNode {
|
|
|
327
343
|
scale: options.scale,
|
|
328
344
|
pages: options.pages
|
|
329
345
|
});
|
|
330
|
-
return await this.
|
|
346
|
+
return await this.requestBinaryWithLegacyFallback(baseUrl, `/tabs/${encodeURIComponent(this.params.tabId)}/pdf${query}`, `/pdf${query}`, {
|
|
331
347
|
defaultFileExtension: 'pdf'
|
|
332
348
|
});
|
|
333
349
|
}
|
|
@@ -550,6 +566,18 @@ export class NavigatorNode extends AsyncNode {
|
|
|
550
566
|
}
|
|
551
567
|
return await response.json();
|
|
552
568
|
}
|
|
569
|
+
async requestJsonWithLegacyFallback(baseUrl, primaryRoute, legacyRoute, method = 'GET', body, legacyBody) {
|
|
570
|
+
try {
|
|
571
|
+
return await this.requestJson(baseUrl, primaryRoute, method, body);
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
const message = String(error?.message || '');
|
|
575
|
+
if (legacyRoute && message.includes('HTTP 404') && message.includes(primaryRoute)) {
|
|
576
|
+
return await this.requestJson(baseUrl, legacyRoute, method, legacyBody === undefined ? body : legacyBody);
|
|
577
|
+
}
|
|
578
|
+
throw error;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
553
581
|
async requestText(baseUrl, route, method = 'GET') {
|
|
554
582
|
const response = await fetch(`${baseUrl}${route}`, { method });
|
|
555
583
|
if (!response.ok) {
|
|
@@ -582,4 +610,16 @@ export class NavigatorNode extends AsyncNode {
|
|
|
582
610
|
}
|
|
583
611
|
return result;
|
|
584
612
|
}
|
|
613
|
+
async requestBinaryWithLegacyFallback(baseUrl, primaryRoute, legacyRoute, options = {}) {
|
|
614
|
+
try {
|
|
615
|
+
return await this.requestBinary(baseUrl, primaryRoute, options);
|
|
616
|
+
}
|
|
617
|
+
catch (error) {
|
|
618
|
+
const message = String(error?.message || '');
|
|
619
|
+
if (legacyRoute && message.includes('HTTP 404') && message.includes(primaryRoute)) {
|
|
620
|
+
return await this.requestBinary(baseUrl, legacyRoute, options);
|
|
621
|
+
}
|
|
622
|
+
throw error;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
585
625
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AsyncNode, AsyncFlow } from '../qflow.js';
|
|
2
|
-
import { ShellCommandNode
|
|
2
|
+
import { ShellCommandNode } from './shell.js';
|
|
3
|
+
import { ReadFileNode } from './filesystem.js';
|
|
3
4
|
import path from 'path';
|
|
4
5
|
import os from 'os';
|
|
5
6
|
import { promises as fs } from 'fs';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AsyncNode } from '../qflow.js';
|
|
2
|
-
|
|
3
|
-
import { Client } from 'ssh2';
|
|
2
|
+
import { loadOptional } from '../optional.js';
|
|
4
3
|
import { log } from '../logger.js';
|
|
5
4
|
export class RemoteExecutionNode extends AsyncNode {
|
|
6
5
|
static getToolDefinition() {
|
|
@@ -75,6 +74,7 @@ export class RemoteExecutionNode extends AsyncNode {
|
|
|
75
74
|
if (!password && !privateKey) {
|
|
76
75
|
throw new Error('RemoteExecutionNode requires either `password` or `privateKey` for authentication.');
|
|
77
76
|
}
|
|
77
|
+
const { Client } = await loadOptional('ssh2');
|
|
78
78
|
const conn = new Client();
|
|
79
79
|
let result = {};
|
|
80
80
|
try {
|
package/dist/nodes/s3.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export class S3CloudStorageNode extends AsyncNode {
|
|
|
66
66
|
required: string[];
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
+
prepAsync(shared: any): Promise<void>;
|
|
69
70
|
execAsync(prepRes: any, shared: any): Promise<any>;
|
|
70
71
|
postAsync(shared: any, prepRes: any, execRes: any): Promise<string>;
|
|
71
72
|
#private;
|