@illuma-ai/agents 1.0.81 → 1.0.83
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/cjs/graphs/Graph.cjs +38 -26
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/tools/CodeExecutor.cjs +7 -0
- package/dist/cjs/tools/CodeExecutor.cjs.map +1 -1
- package/dist/cjs/tools/ToolNode.cjs +19 -11
- package/dist/cjs/tools/ToolNode.cjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +38 -26
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/tools/CodeExecutor.mjs +7 -0
- package/dist/esm/tools/CodeExecutor.mjs.map +1 -1
- package/dist/esm/tools/ToolNode.mjs +19 -11
- package/dist/esm/tools/ToolNode.mjs.map +1 -1
- package/package.json +1 -1
- package/src/graphs/Graph.ts +40 -31
- package/src/tools/CodeExecutor.ts +8 -0
- package/src/tools/ToolNode.ts +20 -11
|
@@ -1477,34 +1477,46 @@ If I seem to be missing something we discussed earlier, just give me a quick rem
|
|
|
1477
1477
|
const artifact = output.artifact;
|
|
1478
1478
|
const newFiles = artifact?.files ?? [];
|
|
1479
1479
|
const hasNewFiles = newFiles.length > 0;
|
|
1480
|
-
if (
|
|
1481
|
-
artifact?.session_id != null &&
|
|
1482
|
-
artifact.session_id !== '') {
|
|
1483
|
-
/**
|
|
1484
|
-
* Stamp each new file with its source session_id.
|
|
1485
|
-
* This enables files from different executions (parallel or sequential)
|
|
1486
|
-
* to be tracked and passed to subsequent calls.
|
|
1487
|
-
*/
|
|
1488
|
-
const filesWithSession = newFiles.map((file) => ({
|
|
1489
|
-
...file,
|
|
1490
|
-
session_id: artifact.session_id,
|
|
1491
|
-
}));
|
|
1480
|
+
if (artifact?.session_id != null && artifact.session_id !== '') {
|
|
1492
1481
|
const existingSession = this.sessions.get(_enum.Constants.EXECUTE_CODE);
|
|
1493
1482
|
const existingFiles = existingSession?.files ?? [];
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
/**
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1483
|
+
if (hasNewFiles) {
|
|
1484
|
+
/**
|
|
1485
|
+
* Stamp each new file with its source session_id.
|
|
1486
|
+
* This enables files from different executions (parallel or sequential)
|
|
1487
|
+
* to be tracked and passed to subsequent calls.
|
|
1488
|
+
*/
|
|
1489
|
+
const filesWithSession = newFiles.map((file) => ({
|
|
1490
|
+
...file,
|
|
1491
|
+
session_id: artifact.session_id,
|
|
1492
|
+
}));
|
|
1493
|
+
/**
|
|
1494
|
+
* Merge files, preferring latest versions by name.
|
|
1495
|
+
* If a file with the same name exists, replace it with the new version.
|
|
1496
|
+
* This handles cases where files are edited/recreated in subsequent executions.
|
|
1497
|
+
*/
|
|
1498
|
+
const newFileNames = new Set(filesWithSession.map((f) => f.name));
|
|
1499
|
+
const filteredExisting = existingFiles.filter((f) => !newFileNames.has(f.name));
|
|
1500
|
+
this.sessions.set(_enum.Constants.EXECUTE_CODE, {
|
|
1501
|
+
/** Keep latest session_id for reference/fallback */
|
|
1502
|
+
session_id: artifact.session_id,
|
|
1503
|
+
/** Accumulated files with latest versions preferred */
|
|
1504
|
+
files: [...filteredExisting, ...filesWithSession],
|
|
1505
|
+
lastUpdated: Date.now(),
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
else {
|
|
1509
|
+
/**
|
|
1510
|
+
* Even when execution produces no files (e.g., error or print-only),
|
|
1511
|
+
* store the session_id so retries can reuse the same workspace
|
|
1512
|
+
* and access any files written to disk during the failed execution.
|
|
1513
|
+
*/
|
|
1514
|
+
this.sessions.set(_enum.Constants.EXECUTE_CODE, {
|
|
1515
|
+
session_id: artifact.session_id,
|
|
1516
|
+
files: existingFiles,
|
|
1517
|
+
lastUpdated: Date.now(),
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1508
1520
|
}
|
|
1509
1521
|
}
|
|
1510
1522
|
const dispatchedOutput = typeof output.content === 'string'
|