open-agents-ai 0.95.0 → 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.
Files changed (2) hide show
  1. package/dist/index.js +83 -24
  2. 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 dirPath = args["path"] ?? ".";
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":
@@ -33180,7 +33252,6 @@ var init_voice = __esm({
33180
33252
  // 5 min — may need to compile
33181
33253
  });
33182
33254
  this.mlxInstalled = true;
33183
- renderInfo("MLX Audio installed successfully.");
33184
33255
  } catch (err) {
33185
33256
  try {
33186
33257
  execSync27(`${py} -m pip install mlx-audio --user --quiet`, {
@@ -33188,7 +33259,6 @@ var init_voice = __esm({
33188
33259
  timeout: 3e5
33189
33260
  });
33190
33261
  this.mlxInstalled = true;
33191
- renderInfo("MLX Audio installed successfully (user site-packages).");
33192
33262
  } catch (err2) {
33193
33263
  throw new Error(`Failed to install mlx-audio. Try manually: pip install mlx-audio
33194
33264
  Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
@@ -33342,18 +33412,8 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
33342
33412
  try {
33343
33413
  const result = execSync27(`node -e "try { require('onnxruntime-node'); console.log('OK'); } catch(e) { console.log('FAIL:' + e.message); }"`, { cwd: voiceDir(), stdio: "pipe", timeout: 15e3, env: { ...process.env, NODE_PATH: join41(voiceDir(), "node_modules") } });
33344
33414
  const output = result.toString().trim();
33345
- if (output === "OK")
33346
- return true;
33347
- if (output.startsWith("FAIL:")) {
33348
- renderWarning(`ONNX runtime probe failed: ${output.slice(5)}`);
33349
- return false;
33350
- }
33351
- return false;
33352
- } catch (err) {
33353
- const msg = err instanceof Error ? err.message : String(err);
33354
- if (msg.includes("CPUID") || msg.includes("unknown cpu") || msg.includes("signal")) {
33355
- renderWarning(`ONNX runtime is not compatible with this CPU (${process.platform}-${arch}).`);
33356
- }
33415
+ return output === "OK";
33416
+ } catch {
33357
33417
  return false;
33358
33418
  }
33359
33419
  };
@@ -33446,10 +33506,11 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
33446
33506
  received += value.length;
33447
33507
  if (contentLength > 0) {
33448
33508
  const pct = Math.round(received / contentLength * 100);
33449
- process.stdout.write(`\r ${c2.dim(` ${pct}% (${formatBytes2(received)} / ${formatBytes2(contentLength)})`)}`);
33509
+ if (pct === 25 || pct === 50 || pct === 75 || pct === 100) {
33510
+ renderInfo(` ${pct}% (${formatBytes2(received)} / ${formatBytes2(contentLength)})`);
33511
+ }
33450
33512
  }
33451
33513
  }
33452
- process.stdout.write("\r" + " ".repeat(60) + "\r");
33453
33514
  const fullBuffer = Buffer.concat(chunks);
33454
33515
  writeFileSync11(onnxPath, fullBuffer);
33455
33516
  renderInfo(`${model.label} model downloaded (${formatBytes2(fullBuffer.length)}).`);
@@ -33467,12 +33528,10 @@ Error: ${err instanceof Error ? err.message : String(err)}`);
33467
33528
  throw new Error(`Model files not found for ${this.modelId}`);
33468
33529
  }
33469
33530
  this.config = JSON.parse(readFileSync22(configPath, "utf8"));
33470
- renderInfo("Loading voice model...");
33471
33531
  this.session = await this.ort.InferenceSession.create(onnxPath, {
33472
33532
  executionProviders: ["cpu"],
33473
33533
  graphOptimizationLevel: "all"
33474
33534
  });
33475
- renderInfo("Voice model loaded.");
33476
33535
  }
33477
33536
  };
33478
33537
  narration = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.95.0",
3
+ "version": "0.96.0",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",