langflower 0.3.0 → 0.4.0
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/README.md +25 -24
- package/dist/{chunk-KOS7BXAM.js → chunk-32BC3YXC.js} +1 -1
- package/dist/{chunk-26UB55E5.js → chunk-5B3555QF.js} +2 -0
- package/dist/{chunk-X3FU465E.js → chunk-P3QJHZO7.js} +1 -1
- package/dist/{chunk-3Z7Q6SQ5.js → chunk-VVJLF47H.js} +93 -10
- package/dist/index.js +8869 -7828
- package/docs/{public → assets/public}/README.md +8 -1
- package/docs/{public → assets/public}/configuration.md +7 -0
- package/docs/{public → assets/public}/extending.md +9 -2
- package/docs/{public → assets/public}/getting-started.md +11 -4
- package/docs/{public → assets/public}/how-it-works.md +7 -0
- package/docs/{public → assets/public}/launcher.md +11 -2
- package/docs/{public → assets/public}/product.md +10 -1
- package/docs/{public → assets/public}/using-the-editor.md +7 -0
- package/docs/{public → assets/public}/workflows.md +7 -0
- package/package.json +2 -2
- package/ui-dist/{chunk-B3D35SQ5.js → chunk-33CXNPF2.js} +1 -1
- package/ui-dist/chunk-SNO65Y6K.js +4 -0
- package/ui-dist/index.html +2 -2
- package/ui-dist/main-GN43PQD5.js +323 -0
- package/ui-dist/styles-DMRPMU4V.css +1 -0
- package/vendor/node-sdk/dist/node-factory/define-llm-node/default-llm-ports.d.ts +11 -1
- package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.d.ts +1 -1
- package/vendor/node-sdk/dist/node-factory/define-llm-node/steer-control.d.ts +5 -2
- package/vendor/node-sdk/dist/node-factory/define-llm-node/steer-control.js +3 -2
- package/vendor/node-sdk/dist/node-factory/define-node/define-node.d.ts +2 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/capabilities.d.ts +32 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.d.ts +2 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.js +1 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/hitl-config.d.ts +14 -0
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/hitl-config.js +24 -1
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/io-helpers.d.ts +7 -4
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/port-meta.d.ts +7 -2
- package/vendor/node-sdk/dist/node-factory/define-reactive-node/ui-schema-inference.d.ts +18 -0
- package/vendor/node-sdk/package.json +1 -1
- package/vendor/runtime/dist/runtime-editor.js +9 -2
- package/vendor/runtime/dist/runtime-runner.js +2 -1
- package/vendor/runtime/dist/runtime.d.ts +2 -0
- package/vendor/runtime/dist/runtime.js +1 -0
- package/vendor/runtime/dist/types.d.ts +7 -1
- package/vendor/runtime/dist/wire-type.d.ts +12 -0
- package/vendor/runtime/dist/wire-type.js +18 -0
- package/vendor/server/skeleton/nodes/hello-embed/README.md +1 -1
- package/vendor/server/skeleton/nodes/hello-embed/package.json +1 -1
- package/vendor/server/skeleton/nodes/my-nodes/package.json +1 -1
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +88 -49
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +13 -3
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +8 -0
- package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +3 -0
- package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +1 -1
- package/vendor/server/skeleton/workflows/agents-dialog.json +1 -1
- package/vendor/server/skeleton/workflows/kb-rag.json +1 -1
- package/ui-dist/chunk-2F7UKSIL.js +0 -4
- package/ui-dist/main-TL5G57BL.js +0 -323
- package/ui-dist/styles-O74ATCGZ.css +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# Langflower
|
|
2
2
|
|
|
3
|
-
> **Disclaimer:** Langflower is currently in internal testing. Anyone can download and try it, but some functions may not be stable.
|
|
4
|
-
|
|
5
3
|
**AI workflows where the graph controls what happens next.**
|
|
6
4
|
|
|
7
5
|
Langflower is a local visual workflow for a project folder: a node graph that runs agents, tools, checks, and human gates on your machine.
|
|
@@ -10,7 +8,7 @@ You build the workflow on a canvas in the browser you already have. The LLM is a
|
|
|
10
8
|
|
|
11
9
|
> **Not another chat harness. A local node graph.**
|
|
12
10
|
|
|
13
|
-

|
|
11
|
+

|
|
14
12
|
|
|
15
13
|
A chat loop is just a graph.
|
|
16
14
|
|
|
@@ -30,7 +28,7 @@ Agent-to-agent dialogue is just another graph pattern.
|
|
|
30
28
|
|
|
31
29
|
Connect one agent's output to another agent's input. Add feedback paths when the second agent needs to challenge or refine the first.
|
|
32
30
|
|
|
33
|
-

|
|
31
|
+

|
|
34
32
|
|
|
35
33
|
There is no special "multi-agent mode".
|
|
36
34
|
|
|
@@ -44,7 +42,7 @@ Start with an agent. Then add the capabilities your workflow needs.
|
|
|
44
42
|
|
|
45
43
|
Skills, tools, and specialized sub-agents can become parts of the same graph.
|
|
46
44
|
|
|
47
|
-

|
|
45
|
+

|
|
48
46
|
|
|
49
47
|
Tools live on the graph too. Wire a pack, an MCP server, or a sub-agent only to the agent that needs it.
|
|
50
48
|
|
|
@@ -58,7 +56,7 @@ Don't ask an agent to certify its own work.
|
|
|
58
56
|
|
|
59
57
|
Put the check in the graph.
|
|
60
58
|
|
|
61
|
-

|
|
59
|
+

|
|
62
60
|
|
|
63
61
|
A check can:
|
|
64
62
|
|
|
@@ -79,10 +77,12 @@ Graphs don't have to be linear.
|
|
|
79
77
|
|
|
80
78
|
A workflow can fan out into several independent pieces of work and later merge their results.
|
|
81
79
|
|
|
82
|
-

|
|
80
|
+

|
|
83
81
|
|
|
84
82
|
**Parallel work is a graph, too.**
|
|
85
83
|
|
|
84
|
+
That picture is three agent nodes on one question. They start together. `common-loop` is a different pattern: it paces one body, one item at a time ([research fan-out](docs/product/use-cases/research-fanout-merge.md)).
|
|
85
|
+
|
|
86
86
|
---
|
|
87
87
|
|
|
88
88
|
### Give each agent only the capabilities it needs
|
|
@@ -91,7 +91,7 @@ Don't give every agent every tool.
|
|
|
91
91
|
|
|
92
92
|
Give each stage the capabilities it needs.
|
|
93
93
|
|
|
94
|
-

|
|
94
|
+

|
|
95
95
|
|
|
96
96
|
A planning agent can inspect a project without being allowed to modify it.
|
|
97
97
|
|
|
@@ -116,7 +116,7 @@ The same primitives can be combined into a complete development workflow:
|
|
|
116
116
|
- parallel work;
|
|
117
117
|
- controlled capabilities.
|
|
118
118
|
|
|
119
|
-

|
|
119
|
+

|
|
120
120
|
|
|
121
121
|
The graph remains the same abstraction whether the workflow has three nodes or thirty.
|
|
122
122
|
|
|
@@ -128,7 +128,7 @@ The graph is not just where you design the workflow.
|
|
|
128
128
|
|
|
129
129
|
**It's where you watch it run.**
|
|
130
130
|
|
|
131
|
-

|
|
131
|
+

|
|
132
132
|
|
|
133
133
|
### See execution on the graph
|
|
134
134
|
|
|
@@ -158,7 +158,7 @@ Its output ports can represent different event streams:
|
|
|
158
158
|
|
|
159
159
|
As the agent runs, those events can appear in the Work log as they happen.
|
|
160
160
|
|
|
161
|
-

|
|
161
|
+

|
|
162
162
|
|
|
163
163
|
This makes intermediate work observable without turning it into a separate tracing system.
|
|
164
164
|
|
|
@@ -172,7 +172,7 @@ Inspect it.
|
|
|
172
172
|
|
|
173
173
|
Any connection can be routed through a Preview node to see the payload of the event flowing through it.
|
|
174
174
|
|
|
175
|
-

|
|
175
|
+

|
|
176
176
|
|
|
177
177
|
This is useful when building and debugging workflows:
|
|
178
178
|
|
|
@@ -190,7 +190,7 @@ The Work log is not just a text stream detached from the canvas.
|
|
|
190
190
|
|
|
191
191
|
Hover an event in the Work log and Langflower highlights the node that produced the event.
|
|
192
192
|
|
|
193
|
-

|
|
193
|
+

|
|
194
194
|
|
|
195
195
|
You can move from:
|
|
196
196
|
|
|
@@ -431,7 +431,7 @@ Langflower is developed using Langflower.
|
|
|
431
431
|
|
|
432
432
|
The project itself uses a workflow to coordinate planning, coding, review, tests, tools, and human gates.
|
|
433
433
|
|
|
434
|
-

|
|
434
|
+

|
|
435
435
|
|
|
436
436
|
The development workflow combines memory tools, MCP, custom Langflower development tools, review gates, and coding agents.
|
|
437
437
|
|
|
@@ -445,7 +445,7 @@ The point is simple:
|
|
|
445
445
|
|
|
446
446
|
If you don't want to start Langflower from a terminal, use the desktop launcher.
|
|
447
447
|
|
|
448
|
-

|
|
448
|
+

|
|
449
449
|
|
|
450
450
|
Pick a project folder, start Langflower, and the editor opens in the browser you already have.
|
|
451
451
|
|
|
@@ -568,7 +568,8 @@ Langflower is intentionally still small, and some things are not implemented yet
|
|
|
568
568
|
|
|
569
569
|
### Image and video
|
|
570
570
|
|
|
571
|
-
There is no asset
|
|
571
|
+
There is no asset gallery and no video. A chat turn can attach png,
|
|
572
|
+
jpeg, gif, webp, wav, mp3, or pdf. Other types are not uploaded.
|
|
572
573
|
|
|
573
574
|
### Built-in IDE or Git UI
|
|
574
575
|
|
|
@@ -580,14 +581,14 @@ Use the tools you already have for editing, reviewing, committing, and navigatin
|
|
|
580
581
|
|
|
581
582
|
# Learn more
|
|
582
583
|
|
|
583
|
-
- [Getting started](https://github.com/earthdmitriy/langflower/blob/master/docs/public/getting-started.md) — installation and first run
|
|
584
|
-
- [Product overview](https://github.com/earthdmitriy/langflower/blob/master/docs/public/product.md) — the product model and core concepts
|
|
585
|
-
- [Using the editor](https://github.com/earthdmitriy/langflower/blob/master/docs/public/using-the-editor.md) — canvas, workflows, and runs
|
|
586
|
-
- [Workflow ideas](https://github.com/earthdmitriy/langflower/blob/master/docs/public/workflows.md) — examples of workflows you can build
|
|
587
|
-
- [Configuration](https://github.com/earthdmitriy/langflower/blob/master/docs/public/configuration.md) — providers, keys, ports, and project configuration
|
|
588
|
-
- [Extending Langflower](https://github.com/earthdmitriy/langflower/blob/master/docs/public/extending.md) — custom nodes, node packs, MCP, and skills
|
|
589
|
-
- [How it works](https://github.com/earthdmitriy/langflower/blob/master/docs/public/how-it-works.md) — the builder/runtime architecture
|
|
590
|
-
- [Desktop launcher](https://github.com/earthdmitriy/langflower/blob/master/docs/public/launcher.md) — running Langflower without the CLI
|
|
584
|
+
- [Getting started](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/getting-started.md) — installation and first run
|
|
585
|
+
- [Product overview](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/product.md) — the product model and core concepts
|
|
586
|
+
- [Using the editor](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/using-the-editor.md) — canvas, workflows, and runs
|
|
587
|
+
- [Workflow ideas](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/workflows.md) — examples of workflows you can build
|
|
588
|
+
- [Configuration](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/configuration.md) — providers, keys, ports, and project configuration
|
|
589
|
+
- [Extending Langflower](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/extending.md) — custom nodes, node packs, MCP, and skills
|
|
590
|
+
- [How it works](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/how-it-works.md) — the builder/runtime architecture
|
|
591
|
+
- [Desktop launcher](https://github.com/earthdmitriy/langflower/blob/master/docs/assets/public/launcher.md) — running Langflower without the CLI
|
|
591
592
|
|
|
592
593
|
---
|
|
593
594
|
|
|
@@ -304,7 +304,12 @@ var invoke = async (ctx, args) => {
|
|
|
304
304
|
if (ctx.askUser === void 0) {
|
|
305
305
|
throw new Error("ask_user requires a live HITL host. No askUser hook is bound on this harness.");
|
|
306
306
|
}
|
|
307
|
-
|
|
307
|
+
const answer = await invokeWithAbort(ctx.askUser(request), ctx.signal);
|
|
308
|
+
if (typeof answer === "string") {
|
|
309
|
+
return answer;
|
|
310
|
+
}
|
|
311
|
+
ctx.recordStagedFiles?.(answer.files);
|
|
312
|
+
return answer.text;
|
|
308
313
|
};
|
|
309
314
|
var askUserTool = {
|
|
310
315
|
id: "ask_user",
|
|
@@ -662,7 +667,7 @@ import path5 from "node:path";
|
|
|
662
667
|
|
|
663
668
|
// packages/tools/dist/post-process.js
|
|
664
669
|
import vm from "node:vm";
|
|
665
|
-
var DEFAULT_TIMEOUT_MS =
|
|
670
|
+
var DEFAULT_TIMEOUT_MS = 500;
|
|
666
671
|
var DEFAULT_MAX_OUTPUT_CHARS = 2e5;
|
|
667
672
|
var runReadClassPostProcess = (source, input, options = {}) => {
|
|
668
673
|
const trimmed = source.trim();
|
|
@@ -1428,7 +1433,29 @@ var moveTool = {
|
|
|
1428
1433
|
|
|
1429
1434
|
// packages/tools/dist/builtins/read/tool.js
|
|
1430
1435
|
import fs10 from "node:fs/promises";
|
|
1436
|
+
import path9 from "node:path";
|
|
1437
|
+
import { isSessionUploadMime, SESSION_UPLOAD_MAX_BYTES } from "@langflower/node-sdk";
|
|
1431
1438
|
var MAX_READ_CHARS = 2e5;
|
|
1439
|
+
var isUnderSessionUploadCeiling = (size) => Number.isSafeInteger(size) && size >= 0 && size < SESSION_UPLOAD_MAX_BYTES;
|
|
1440
|
+
var MEDIA_MIME_BY_EXTENSION = {
|
|
1441
|
+
".png": "image/png",
|
|
1442
|
+
".jpg": "image/jpeg",
|
|
1443
|
+
".jpeg": "image/jpeg",
|
|
1444
|
+
".gif": "image/gif",
|
|
1445
|
+
".webp": "image/webp",
|
|
1446
|
+
".wav": "audio/wav",
|
|
1447
|
+
".mp3": "audio/mpeg",
|
|
1448
|
+
".pdf": "application/pdf"
|
|
1449
|
+
};
|
|
1450
|
+
var mediaMimeForPath = (userPath) => {
|
|
1451
|
+
const mimeType = MEDIA_MIME_BY_EXTENSION[path9.extname(userPath).toLowerCase()];
|
|
1452
|
+
if (mimeType === void 0 || !isSessionUploadMime(mimeType)) {
|
|
1453
|
+
return void 0;
|
|
1454
|
+
}
|
|
1455
|
+
return mimeType;
|
|
1456
|
+
};
|
|
1457
|
+
var readErrorCode = (error) => error !== null && typeof error === "object" && "code" in error ? String(error.code) : "";
|
|
1458
|
+
var mediaSummary = (userPath, mimeType, size) => `${userPath} (${mimeType}, ${size} bytes)`;
|
|
1432
1459
|
var sliceLines = (content, args) => {
|
|
1433
1460
|
const lines = content.split(/\r?\n/);
|
|
1434
1461
|
const startLine = asNumber(args, "startLine");
|
|
@@ -1457,18 +1484,51 @@ var sliceLines = (content, args) => {
|
|
|
1457
1484
|
}
|
|
1458
1485
|
return truncated;
|
|
1459
1486
|
};
|
|
1487
|
+
var readMedia = async (ctx, userPath, absolute, mimeType, args) => {
|
|
1488
|
+
let info;
|
|
1489
|
+
try {
|
|
1490
|
+
info = await fs10.stat(absolute);
|
|
1491
|
+
} catch (error) {
|
|
1492
|
+
if (readErrorCode(error) === "ENOENT") {
|
|
1493
|
+
throw new Error(await formatNotFound(absolute, userPath));
|
|
1494
|
+
}
|
|
1495
|
+
throw error;
|
|
1496
|
+
}
|
|
1497
|
+
if (!info.isFile()) {
|
|
1498
|
+
throw new Error(`read refuses "${userPath}": not a file.`);
|
|
1499
|
+
}
|
|
1500
|
+
if (!isUnderSessionUploadCeiling(info.size)) {
|
|
1501
|
+
throw new Error(`read refuses "${userPath}": file must be under ${SESSION_UPLOAD_MAX_BYTES} bytes.`);
|
|
1502
|
+
}
|
|
1503
|
+
if (ctx.stageSessionUpload === void 0) {
|
|
1504
|
+
throw new Error(`read cannot stage ${mimeType} for "${userPath}": no session upload hook is bound.`);
|
|
1505
|
+
}
|
|
1506
|
+
const bytes = await fs10.readFile(absolute);
|
|
1507
|
+
if (!isUnderSessionUploadCeiling(bytes.byteLength)) {
|
|
1508
|
+
throw new Error(`read refuses "${userPath}": file must be under ${SESSION_UPLOAD_MAX_BYTES} bytes.`);
|
|
1509
|
+
}
|
|
1510
|
+
const staged = await ctx.stageSessionUpload({
|
|
1511
|
+
name: path9.basename(userPath),
|
|
1512
|
+
mimeType,
|
|
1513
|
+
bytes
|
|
1514
|
+
});
|
|
1515
|
+
return applyPostProcess(args, mediaSummary(userPath, staged.mimeType, staged.size));
|
|
1516
|
+
};
|
|
1460
1517
|
var invoke9 = async (ctx, args) => {
|
|
1461
1518
|
const userPath = asString(args, "path");
|
|
1462
1519
|
if (userPath === void 0) {
|
|
1463
1520
|
throw new Error("read requires string argument \xABpath\xBB.");
|
|
1464
1521
|
}
|
|
1465
1522
|
const absolute = resolveProjectPath(ctx.projectRoot, userPath, fenceOptions(ctx));
|
|
1523
|
+
const mediaMime = mediaMimeForPath(userPath);
|
|
1524
|
+
if (mediaMime !== void 0) {
|
|
1525
|
+
return readMedia(ctx, userPath, absolute, mediaMime, args);
|
|
1526
|
+
}
|
|
1466
1527
|
let content;
|
|
1467
1528
|
try {
|
|
1468
1529
|
content = await fs10.readFile(absolute, "utf8");
|
|
1469
1530
|
} catch (error) {
|
|
1470
|
-
|
|
1471
|
-
if (code === "ENOENT") {
|
|
1531
|
+
if (readErrorCode(error) === "ENOENT") {
|
|
1472
1532
|
throw new Error(await formatNotFound(absolute, userPath));
|
|
1473
1533
|
}
|
|
1474
1534
|
throw error;
|
|
@@ -1480,7 +1540,7 @@ var readTool = {
|
|
|
1480
1540
|
registration: {
|
|
1481
1541
|
toolId: "read",
|
|
1482
1542
|
name: "read",
|
|
1483
|
-
description: "Read a file under the project root. Optional startLine/endLine (1-based) or offset/limit (byte-ish line slices). Optional postProcess: source of (res: string) => string.",
|
|
1543
|
+
description: "Read a file under the project root. Optional startLine/endLine (1-based) or offset/limit (byte-ish line slices). Optional postProcess: source of (res: string) => string. png, jpg, jpeg, gif, webp, wav, mp3, and pdf are staged as session uploads; the result is one line with the path, MIME, and size. Other files, including video, stay UTF-8 text.",
|
|
1484
1544
|
inputSchema: {
|
|
1485
1545
|
type: "object",
|
|
1486
1546
|
properties: {
|
|
@@ -1571,7 +1631,7 @@ var sleepTool = {
|
|
|
1571
1631
|
|
|
1572
1632
|
// packages/tools/dist/builtins/write/tool.js
|
|
1573
1633
|
import fs11 from "node:fs/promises";
|
|
1574
|
-
import
|
|
1634
|
+
import path10 from "node:path";
|
|
1575
1635
|
var invoke11 = async (ctx, args) => {
|
|
1576
1636
|
const userPath = asString(args, "path");
|
|
1577
1637
|
const content = asString(args, "content");
|
|
@@ -1579,7 +1639,7 @@ var invoke11 = async (ctx, args) => {
|
|
|
1579
1639
|
throw new Error("write requires string arguments \xABpath\xBB and \xABcontent\xBB.");
|
|
1580
1640
|
}
|
|
1581
1641
|
const absolute = resolveProjectPath(ctx.projectRoot, userPath, fenceOptions(ctx));
|
|
1582
|
-
await fs11.mkdir(
|
|
1642
|
+
await fs11.mkdir(path10.dirname(absolute), { recursive: true });
|
|
1583
1643
|
await fs11.writeFile(absolute, content, "utf8");
|
|
1584
1644
|
return `Wrote \xAB${userPath}\xBB (${content.length} chars).`;
|
|
1585
1645
|
};
|
|
@@ -1688,6 +1748,9 @@ var wrapBuiltinToolHandles = (harness, permission) => {
|
|
|
1688
1748
|
if (!result.ok) {
|
|
1689
1749
|
throw new Error(result.text);
|
|
1690
1750
|
}
|
|
1751
|
+
if (result.stagedFiles !== void 0 && hostCtx?.stagedSessionUpload !== void 0) {
|
|
1752
|
+
hostCtx.stagedSessionUpload.files.push(...result.stagedFiles);
|
|
1753
|
+
}
|
|
1691
1754
|
return result.text;
|
|
1692
1755
|
}
|
|
1693
1756
|
}));
|
|
@@ -1700,7 +1763,8 @@ var createProjectHarness = (options) => {
|
|
|
1700
1763
|
denyPaths: options.denyPaths ?? [],
|
|
1701
1764
|
allowedRoots: options.allowedRoots ?? [],
|
|
1702
1765
|
bashEnabled: options.bashEnabled === true,
|
|
1703
|
-
...options.askUser !== void 0 ? { askUser: options.askUser } : {}
|
|
1766
|
+
...options.askUser !== void 0 ? { askUser: options.askUser } : {},
|
|
1767
|
+
...options.stageSessionUpload !== void 0 ? { stageSessionUpload: options.stageSessionUpload } : {}
|
|
1704
1768
|
};
|
|
1705
1769
|
const permission = {
|
|
1706
1770
|
...DEFAULT_PERMISSION_CONFIG,
|
|
@@ -1740,9 +1804,28 @@ var createProjectHarness = (options) => {
|
|
|
1740
1804
|
return deniedToolResult(toolId, deniedDetail(toolId, details));
|
|
1741
1805
|
}
|
|
1742
1806
|
try {
|
|
1743
|
-
const
|
|
1807
|
+
const stagedFiles = [];
|
|
1808
|
+
const stage = ctx.stageSessionUpload;
|
|
1809
|
+
const invokeCtx = {
|
|
1810
|
+
...ctx,
|
|
1811
|
+
...call.signal !== void 0 ? { signal: call.signal } : {},
|
|
1812
|
+
...stage !== void 0 ? {
|
|
1813
|
+
stageSessionUpload: async (input) => {
|
|
1814
|
+
const file = await stage(input);
|
|
1815
|
+
stagedFiles.push(file);
|
|
1816
|
+
return file;
|
|
1817
|
+
}
|
|
1818
|
+
} : {},
|
|
1819
|
+
recordStagedFiles: (files) => {
|
|
1820
|
+
stagedFiles.push(...files);
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1744
1823
|
const text = await invokeBuiltin(toolId, invokeCtx, call.args);
|
|
1745
|
-
return {
|
|
1824
|
+
return {
|
|
1825
|
+
ok: true,
|
|
1826
|
+
text,
|
|
1827
|
+
...stagedFiles.length > 0 ? { stagedFiles } : {}
|
|
1828
|
+
};
|
|
1746
1829
|
} catch (error) {
|
|
1747
1830
|
const text = error instanceof Error ? error.message : String(error);
|
|
1748
1831
|
return { ok: false, text };
|