open-agents-ai 0.95.1 → 0.96.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/dist/index.js +78 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1497,6 +1497,14 @@ var init_file_read = __esm({
|
|
|
1497
1497
|
const offset = args["offset"];
|
|
1498
1498
|
const limit = args["limit"];
|
|
1499
1499
|
const start = performance.now();
|
|
1500
|
+
if (!filePath || typeof filePath !== "string" || !filePath.trim()) {
|
|
1501
|
+
return {
|
|
1502
|
+
success: false,
|
|
1503
|
+
output: "",
|
|
1504
|
+
error: "Missing required parameter: path. Provide the file path to read.",
|
|
1505
|
+
durationMs: performance.now() - start
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1500
1508
|
try {
|
|
1501
1509
|
const fullPath = resolve(this.workingDir, filePath);
|
|
1502
1510
|
const content = await readFile(fullPath, "utf-8");
|
|
@@ -1564,6 +1572,22 @@ var init_file_write = __esm({
|
|
|
1564
1572
|
const filePath = args["path"];
|
|
1565
1573
|
const content = args["content"];
|
|
1566
1574
|
const start = performance.now();
|
|
1575
|
+
if (!filePath || typeof filePath !== "string" || !filePath.trim()) {
|
|
1576
|
+
return {
|
|
1577
|
+
success: false,
|
|
1578
|
+
output: "",
|
|
1579
|
+
error: "Missing required parameter: path. Provide the file path to write.",
|
|
1580
|
+
durationMs: performance.now() - start
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
if (content === void 0 || content === null || typeof content !== "string") {
|
|
1584
|
+
return {
|
|
1585
|
+
success: false,
|
|
1586
|
+
output: "",
|
|
1587
|
+
error: "Missing required parameter: content. Provide the content to write.",
|
|
1588
|
+
durationMs: performance.now() - start
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1567
1591
|
try {
|
|
1568
1592
|
const fullPath = resolve2(this.workingDir, filePath);
|
|
1569
1593
|
await mkdir(dirname(fullPath), { recursive: true });
|
|
@@ -2459,6 +2483,30 @@ var init_file_edit = __esm({
|
|
|
2459
2483
|
const newString = args["new_string"];
|
|
2460
2484
|
const replaceAll = args["replace_all"] === true;
|
|
2461
2485
|
const start = performance.now();
|
|
2486
|
+
if (!filePath || typeof filePath !== "string" || !filePath.trim()) {
|
|
2487
|
+
return {
|
|
2488
|
+
success: false,
|
|
2489
|
+
output: "",
|
|
2490
|
+
error: "Missing required parameter: path. Provide the file path to edit.",
|
|
2491
|
+
durationMs: performance.now() - start
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
if (!oldString || typeof oldString !== "string") {
|
|
2495
|
+
return {
|
|
2496
|
+
success: false,
|
|
2497
|
+
output: "",
|
|
2498
|
+
error: "Missing required parameter: old_string. Provide the text to find and replace.",
|
|
2499
|
+
durationMs: performance.now() - start
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2502
|
+
if (newString === void 0 || newString === null || typeof newString !== "string") {
|
|
2503
|
+
return {
|
|
2504
|
+
success: false,
|
|
2505
|
+
output: "",
|
|
2506
|
+
error: "Missing required parameter: new_string. Provide the replacement text.",
|
|
2507
|
+
durationMs: performance.now() - start
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2462
2510
|
try {
|
|
2463
2511
|
const fullPath = resolve5(this.workingDir, filePath);
|
|
2464
2512
|
const content = await readFile2(fullPath, "utf-8");
|
|
@@ -3121,7 +3169,8 @@ var init_list_directory = __esm({
|
|
|
3121
3169
|
this.workingDir = workingDir;
|
|
3122
3170
|
}
|
|
3123
3171
|
async execute(args) {
|
|
3124
|
-
const
|
|
3172
|
+
const rawPath = args["path"];
|
|
3173
|
+
const dirPath = typeof rawPath === "string" && rawPath.trim() ? rawPath : ".";
|
|
3125
3174
|
const start = performance.now();
|
|
3126
3175
|
try {
|
|
3127
3176
|
const fullPath = resolve9(this.workingDir, dirPath);
|
|
@@ -23647,6 +23696,29 @@ function ansi2(code, text) {
|
|
|
23647
23696
|
function fg256(code, text) {
|
|
23648
23697
|
return isTTY2 ? `\x1B[38;5;${code}m${text}\x1B[0m` : text;
|
|
23649
23698
|
}
|
|
23699
|
+
function hyperlink(url, text) {
|
|
23700
|
+
if (!isTTY2)
|
|
23701
|
+
return text;
|
|
23702
|
+
return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
|
|
23703
|
+
}
|
|
23704
|
+
function fileLink(filePath) {
|
|
23705
|
+
if (!isTTY2)
|
|
23706
|
+
return filePath;
|
|
23707
|
+
if (filePath.startsWith("/") || filePath.startsWith("~")) {
|
|
23708
|
+
const absPath = filePath.startsWith("~") ? filePath.replace("~", process.env["HOME"] ?? "") : filePath;
|
|
23709
|
+
return hyperlink(`file://${absPath}`, filePath);
|
|
23710
|
+
}
|
|
23711
|
+
return filePath;
|
|
23712
|
+
}
|
|
23713
|
+
function linkifyPaths(text) {
|
|
23714
|
+
if (!isTTY2)
|
|
23715
|
+
return text;
|
|
23716
|
+
return text.replace(/(\/[\w./\-@+]+)/g, (match) => {
|
|
23717
|
+
if (match.length < 3 || match.endsWith("/"))
|
|
23718
|
+
return match;
|
|
23719
|
+
return hyperlink(`file://${match}`, match);
|
|
23720
|
+
});
|
|
23721
|
+
}
|
|
23650
23722
|
function setEmojisEnabled(enabled) {
|
|
23651
23723
|
_emojisEnabled = enabled;
|
|
23652
23724
|
}
|
|
@@ -23786,7 +23858,7 @@ function renderToolResult(toolName, success, output, verbose) {
|
|
|
23786
23858
|
case "file_write": {
|
|
23787
23859
|
const summary = extractFirstLine(output, maxW);
|
|
23788
23860
|
if (success) {
|
|
23789
|
-
process.stdout.write(`${prefix}${c2.dim(summary)}
|
|
23861
|
+
process.stdout.write(`${prefix}${c2.dim(linkifyPaths(summary))}
|
|
23790
23862
|
`);
|
|
23791
23863
|
} else {
|
|
23792
23864
|
process.stdout.write(`${prefix}${c2.red(summary)}
|
|
@@ -23797,7 +23869,7 @@ function renderToolResult(toolName, success, output, verbose) {
|
|
|
23797
23869
|
case "file_edit": {
|
|
23798
23870
|
const summary = extractFirstLine(output, maxW);
|
|
23799
23871
|
if (success) {
|
|
23800
|
-
process.stdout.write(`${prefix}${c2.dim(summary)}
|
|
23872
|
+
process.stdout.write(`${prefix}${c2.dim(linkifyPaths(summary))}
|
|
23801
23873
|
`);
|
|
23802
23874
|
} else {
|
|
23803
23875
|
process.stdout.write(`${prefix}${c2.red(summary)}
|
|
@@ -24230,17 +24302,17 @@ function formatToolArgs(toolName, args, verbose) {
|
|
|
24230
24302
|
case "file_read":
|
|
24231
24303
|
case "file_write":
|
|
24232
24304
|
case "file_edit":
|
|
24233
|
-
return String(args["path"] ?? "");
|
|
24305
|
+
return fileLink(String(args["path"] ?? ""));
|
|
24234
24306
|
case "shell": {
|
|
24235
24307
|
const cmd = truncStr(String(args["command"] ?? ""), maxArg);
|
|
24236
24308
|
return args["stdin"] ? `${cmd} ${c2.dim("(with stdin)")}` : cmd;
|
|
24237
24309
|
}
|
|
24238
24310
|
case "grep_search":
|
|
24239
|
-
return `${c2.yellow(String(args["pattern"] ?? ""))}${args["path"] ? ` in ${args["path"]}` : ""}`;
|
|
24311
|
+
return `${c2.yellow(String(args["pattern"] ?? ""))}${args["path"] ? ` in ${fileLink(String(args["path"]))}` : ""}`;
|
|
24240
24312
|
case "find_files":
|
|
24241
24313
|
return String(args["pattern"] ?? "");
|
|
24242
24314
|
case "list_directory":
|
|
24243
|
-
return String(args["path"] ?? ".");
|
|
24315
|
+
return fileLink(String(args["path"] ?? "."));
|
|
24244
24316
|
case "web_search":
|
|
24245
24317
|
return `"${truncStr(String(args["query"] ?? ""), maxArg - 2)}"`;
|
|
24246
24318
|
case "web_fetch":
|
package/package.json
CHANGED