xab 9.0.0 → 10.0.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 +80 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -448,7 +448,28 @@ async function runStreamedWithProgress(thread, prompt, onProgress, turnOpts) {
448
448
  const cmd = item.command ?? "";
449
449
  const status = item.status;
450
450
  if (status === "in_progress") {
451
- onProgress("exec", `$ ${cmd}`);
451
+ const inner = cmd.replace(/^\/bin\/(?:ba)?sh\s+-\w+\s+['"](.*)['"]$/s, "$1") || cmd;
452
+ const readMatch = inner.match(/\b(?:cat|head|tail|less|bat|nl)\s+(?:-\w+\s+)*['"]?([^\s'"|\]]+)/);
453
+ const sedMatch = inner.match(/\bsed\s+-n\s+['"]?\d+.*?['"]?\s+['"]?([^\s'"]+)/);
454
+ const rgMatch = inner.match(/\brg\s+(?:-[^\s]+\s+)*['"]?(.+?)['"]?\s+(\S+)/);
455
+ const gitShowMatch = inner.match(/\bgit\s+show\s+(\S+)/);
456
+ const gitDiffMatch = inner.match(/\bgit\s+diff\b/);
457
+ const gitLogMatch = inner.match(/\bgit\s+log\b/);
458
+ if (readMatch) {
459
+ onProgress("read", readMatch[1]);
460
+ } else if (sedMatch) {
461
+ onProgress("read", sedMatch[1]);
462
+ } else if (rgMatch) {
463
+ onProgress("grep", `"${rgMatch[1]}" in ${rgMatch[2]}`);
464
+ } else if (gitShowMatch) {
465
+ onProgress("read", `git show ${gitShowMatch[1]}`);
466
+ } else if (gitDiffMatch) {
467
+ onProgress("exec", `$ ${inner.slice(0, 120)}`);
468
+ } else if (gitLogMatch) {
469
+ onProgress("exec", `$ ${inner.slice(0, 120)}`);
470
+ } else {
471
+ onProgress("exec", `$ ${inner.slice(0, 120)}`);
472
+ }
452
473
  } else if (status === "completed") {
453
474
  const output = item.aggregated_output ?? "";
454
475
  if (output) {
@@ -468,17 +489,45 @@ async function runStreamedWithProgress(thread, prompt, onProgress, turnOpts) {
468
489
  }
469
490
  break;
470
491
  }
492
+ case "mcp_tool_call": {
493
+ const tool = item.tool ?? "";
494
+ const args = item.arguments ?? {};
495
+ const status = item.status;
496
+ if (status === "in_progress") {
497
+ if (tool.toLowerCase().includes("read")) {
498
+ onProgress("read", (args.file_path ?? args.path ?? tool).slice(0, 120));
499
+ } else if (tool.toLowerCase().includes("grep") || tool.toLowerCase().includes("search")) {
500
+ onProgress("grep", `"${(args.pattern ?? "").slice(0, 60)}" ${args.path ?? ""}`);
501
+ } else if (tool.toLowerCase().includes("glob") || tool.toLowerCase().includes("find")) {
502
+ onProgress("glob", (args.pattern ?? args.path ?? tool).slice(0, 120));
503
+ } else {
504
+ onProgress("tool", `${tool} ${JSON.stringify(args).slice(0, 80)}`);
505
+ }
506
+ }
507
+ break;
508
+ }
471
509
  case "reasoning": {
472
510
  const text = item.text ?? "";
473
- if (text && event.type === "item.completed") {
474
- onProgress("think", text.split(`
475
- `)[0].slice(0, 120));
511
+ if (text) {
512
+ const lines = text.split(`
513
+ `).filter(Boolean);
514
+ for (const line of lines.slice(0, 3)) {
515
+ onProgress("think", line.slice(0, 150));
516
+ }
476
517
  }
477
518
  break;
478
519
  }
479
520
  case "agent_message": {
521
+ const text = item.text ?? "";
480
522
  if (event.type === "item.completed") {
481
- finalResponse = item.text ?? "";
523
+ finalResponse = text;
524
+ }
525
+ if (event.type === "item.updated" && text) {
526
+ const lastLine = text.split(`
527
+ `).filter(Boolean).pop();
528
+ if (lastLine && lastLine.length > 10) {
529
+ onProgress("think", lastLine.slice(0, 150));
530
+ }
482
531
  }
483
532
  break;
484
533
  }
@@ -1998,8 +2047,32 @@ async function runBatch(opts) {
1998
2047
  onProgress(phase, msg) {
1999
2048
  if (jsonl)
2000
2049
  emitJsonl({ event: "progress", phase, msg });
2050
+ const subMatch = msg.match(/^\[(\w+)\]\s*(.*)/);
2051
+ const sub = subMatch ? subMatch[1] : phase;
2052
+ const text = subMatch ? subMatch[2] : msg;
2001
2053
  let icon;
2002
- switch (phase) {
2054
+ switch (sub) {
2055
+ case "read":
2056
+ icon = chalk.cyan("\uD83D\uDCD6");
2057
+ break;
2058
+ case "grep":
2059
+ icon = chalk.cyan("\uD83D\uDD0D");
2060
+ break;
2061
+ case "glob":
2062
+ icon = chalk.cyan("\uD83D\uDCC2");
2063
+ break;
2064
+ case "exec":
2065
+ icon = chalk.yellow("\u26A1");
2066
+ break;
2067
+ case "file":
2068
+ icon = chalk.green("\u270F\uFE0F");
2069
+ break;
2070
+ case "think":
2071
+ icon = chalk.blue("\uD83D\uDCAD");
2072
+ break;
2073
+ case "tool":
2074
+ icon = chalk.dim("\uD83D\uDD27");
2075
+ break;
2003
2076
  case "analyze":
2004
2077
  icon = chalk.blue("\u25C6");
2005
2078
  break;
@@ -2013,7 +2086,7 @@ async function runBatch(opts) {
2013
2086
  icon = chalk.dim("\xB7");
2014
2087
  break;
2015
2088
  }
2016
- log(` ${ts()} ${icon} ${chalk.dim(msg)}`);
2089
+ log(` ${ts()} ${icon} ${chalk.dim(text)}`);
2017
2090
  },
2018
2091
  onLog(msg, color) {
2019
2092
  if (jsonl)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xab",
3
- "version": "9.0.0",
3
+ "version": "10.0.0",
4
4
  "description": "AI-powered curated branch reconciliation engine",
5
5
  "type": "module",
6
6
  "bin": {