open-agents-ai 0.96.0 → 0.96.1
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/index.js +56 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1467,6 +1467,30 @@ ${stderr}` : ""),
|
|
|
1467
1467
|
// packages/execution/dist/tools/file-read.js
|
|
1468
1468
|
import { readFile } from "node:fs/promises";
|
|
1469
1469
|
import { resolve } from "node:path";
|
|
1470
|
+
function extractPath(args) {
|
|
1471
|
+
if (typeof args["path"] === "string" && args["path"].trim()) {
|
|
1472
|
+
return args["path"].trim();
|
|
1473
|
+
}
|
|
1474
|
+
for (const key of ["file", "file_path", "filename", "filepath", "filePath"]) {
|
|
1475
|
+
if (typeof args[key] === "string" && args[key].trim()) {
|
|
1476
|
+
return args[key].trim();
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
if (typeof args["_raw"] === "string") {
|
|
1480
|
+
const raw = args["_raw"].trim();
|
|
1481
|
+
const match = raw.match(/["']?(?:path|file|filename)["']?\s*[:=]\s*["']([^"'\s}]+)["']/i);
|
|
1482
|
+
if (match?.[1])
|
|
1483
|
+
return match[1];
|
|
1484
|
+
if (raw && !raw.includes("{") && !raw.includes(":") && raw.length < 500) {
|
|
1485
|
+
return raw;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
const stringVals = Object.values(args).filter((v) => typeof v === "string" && v.trim().length > 0 && v.length < 500);
|
|
1489
|
+
if (stringVals.length === 1 && /[./]/.test(stringVals[0])) {
|
|
1490
|
+
return stringVals[0].trim();
|
|
1491
|
+
}
|
|
1492
|
+
return null;
|
|
1493
|
+
}
|
|
1470
1494
|
var FileReadTool;
|
|
1471
1495
|
var init_file_read = __esm({
|
|
1472
1496
|
"packages/execution/dist/tools/file-read.js"() {
|
|
@@ -1493,15 +1517,15 @@ var init_file_read = __esm({
|
|
|
1493
1517
|
this._contextWindowSize = size;
|
|
1494
1518
|
}
|
|
1495
1519
|
async execute(args) {
|
|
1496
|
-
const filePath = args
|
|
1520
|
+
const filePath = extractPath(args);
|
|
1497
1521
|
const offset = args["offset"];
|
|
1498
1522
|
const limit = args["limit"];
|
|
1499
1523
|
const start = performance.now();
|
|
1500
|
-
if (!filePath
|
|
1524
|
+
if (!filePath) {
|
|
1501
1525
|
return {
|
|
1502
1526
|
success: false,
|
|
1503
1527
|
output: "",
|
|
1504
|
-
error: "
|
|
1528
|
+
error: `file_read requires "path" parameter. Call: file_read({"path": "src/example.ts"})`,
|
|
1505
1529
|
durationMs: performance.now() - start
|
|
1506
1530
|
};
|
|
1507
1531
|
}
|
|
@@ -1549,6 +1573,14 @@ var init_file_read = __esm({
|
|
|
1549
1573
|
// packages/execution/dist/tools/file-write.js
|
|
1550
1574
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
1551
1575
|
import { resolve as resolve2, dirname } from "node:path";
|
|
1576
|
+
function extractWritePath(args) {
|
|
1577
|
+
for (const key of ["path", "file", "file_path", "filename", "filepath", "filePath"]) {
|
|
1578
|
+
if (typeof args[key] === "string" && args[key].trim()) {
|
|
1579
|
+
return args[key].trim();
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
return null;
|
|
1583
|
+
}
|
|
1552
1584
|
var FileWriteTool;
|
|
1553
1585
|
var init_file_write = __esm({
|
|
1554
1586
|
"packages/execution/dist/tools/file-write.js"() {
|
|
@@ -1569,14 +1601,14 @@ var init_file_write = __esm({
|
|
|
1569
1601
|
this.workingDir = workingDir;
|
|
1570
1602
|
}
|
|
1571
1603
|
async execute(args) {
|
|
1572
|
-
const filePath = args
|
|
1573
|
-
const content = args["content"];
|
|
1604
|
+
const filePath = extractWritePath(args);
|
|
1605
|
+
const content = args["content"] ?? args["text"] ?? args["data"];
|
|
1574
1606
|
const start = performance.now();
|
|
1575
|
-
if (!filePath
|
|
1607
|
+
if (!filePath) {
|
|
1576
1608
|
return {
|
|
1577
1609
|
success: false,
|
|
1578
1610
|
output: "",
|
|
1579
|
-
error: "
|
|
1611
|
+
error: `file_write requires "path" parameter. Call: file_write({"path": "src/file.ts", "content": "..."})`,
|
|
1580
1612
|
durationMs: performance.now() - start
|
|
1581
1613
|
};
|
|
1582
1614
|
}
|
|
@@ -1584,7 +1616,7 @@ var init_file_write = __esm({
|
|
|
1584
1616
|
return {
|
|
1585
1617
|
success: false,
|
|
1586
1618
|
output: "",
|
|
1587
|
-
error: "
|
|
1619
|
+
error: `file_write requires "content" parameter. Call: file_write({"path": "${filePath}", "content": "..."})`,
|
|
1588
1620
|
durationMs: performance.now() - start
|
|
1589
1621
|
};
|
|
1590
1622
|
}
|
|
@@ -2425,6 +2457,14 @@ Meta: ${metaKeys.map((k) => `${k}="${meta[k]?.slice(0, 80)}"`).join(", ")}`);
|
|
|
2425
2457
|
// packages/execution/dist/tools/file-edit.js
|
|
2426
2458
|
import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
2427
2459
|
import { resolve as resolve5 } from "node:path";
|
|
2460
|
+
function extractEditPath(args) {
|
|
2461
|
+
for (const key of ["path", "file", "file_path", "filename", "filepath", "filePath"]) {
|
|
2462
|
+
if (typeof args[key] === "string" && args[key].trim()) {
|
|
2463
|
+
return args[key].trim();
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
return null;
|
|
2467
|
+
}
|
|
2428
2468
|
function countOccurrences(haystack, needle) {
|
|
2429
2469
|
let count = 0;
|
|
2430
2470
|
let pos = 0;
|
|
@@ -2478,16 +2518,16 @@ var init_file_edit = __esm({
|
|
|
2478
2518
|
this.workingDir = workingDir;
|
|
2479
2519
|
}
|
|
2480
2520
|
async execute(args) {
|
|
2481
|
-
const filePath = args
|
|
2482
|
-
const oldString = args["old_string"];
|
|
2483
|
-
const newString = args["new_string"];
|
|
2484
|
-
const replaceAll = args["replace_all"] === true;
|
|
2521
|
+
const filePath = extractEditPath(args);
|
|
2522
|
+
const oldString = args["old_string"] ?? args["oldString"] ?? args["search"] ?? args["find"];
|
|
2523
|
+
const newString = args["new_string"] ?? args["newString"] ?? args["replace"] ?? args["replacement"];
|
|
2524
|
+
const replaceAll = args["replace_all"] === true || args["replaceAll"] === true;
|
|
2485
2525
|
const start = performance.now();
|
|
2486
|
-
if (!filePath
|
|
2526
|
+
if (!filePath) {
|
|
2487
2527
|
return {
|
|
2488
2528
|
success: false,
|
|
2489
2529
|
output: "",
|
|
2490
|
-
error: "
|
|
2530
|
+
error: `file_edit requires "path" parameter. Call: file_edit({"path": "src/file.ts", "old_string": "...", "new_string": "..."})`,
|
|
2491
2531
|
durationMs: performance.now() - start
|
|
2492
2532
|
};
|
|
2493
2533
|
}
|
|
@@ -2495,7 +2535,7 @@ var init_file_edit = __esm({
|
|
|
2495
2535
|
return {
|
|
2496
2536
|
success: false,
|
|
2497
2537
|
output: "",
|
|
2498
|
-
error: "
|
|
2538
|
+
error: `file_edit requires "old_string" parameter. Call: file_edit({"path": "${filePath}", "old_string": "text to find", "new_string": "replacement"})`,
|
|
2499
2539
|
durationMs: performance.now() - start
|
|
2500
2540
|
};
|
|
2501
2541
|
}
|
|
@@ -2503,7 +2543,7 @@ var init_file_edit = __esm({
|
|
|
2503
2543
|
return {
|
|
2504
2544
|
success: false,
|
|
2505
2545
|
output: "",
|
|
2506
|
-
error: "
|
|
2546
|
+
error: `file_edit requires "new_string" parameter. Call: file_edit({"path": "${filePath}", "old_string": "...", "new_string": "replacement text"})`,
|
|
2507
2547
|
durationMs: performance.now() - start
|
|
2508
2548
|
};
|
|
2509
2549
|
}
|
package/package.json
CHANGED