open-agents-ai 0.187.225 → 0.187.227

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 +170 -83
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -110824,7 +110824,7 @@ var require_timers = __commonJS({
110824
110824
  var fastTimers = [];
110825
110825
  var NOT_IN_LIST = -2;
110826
110826
  var TO_BE_CLEARED = -1;
110827
- var PENDING = 0;
110827
+ var PENDING2 = 0;
110828
110828
  var ACTIVE = 1;
110829
110829
  function onTick() {
110830
110830
  fastNow += TICK_MS;
@@ -110832,7 +110832,7 @@ var require_timers = __commonJS({
110832
110832
  let len = fastTimers.length;
110833
110833
  while (idx < len) {
110834
110834
  const timer = fastTimers[idx];
110835
- if (timer._state === PENDING) {
110835
+ if (timer._state === PENDING2) {
110836
110836
  timer._idleStart = fastNow - TICK_MS;
110837
110837
  timer._state = ACTIVE;
110838
110838
  } else if (timer._state === ACTIVE && fastNow >= timer._idleStart + timer._idleTimeout) {
@@ -110935,7 +110935,7 @@ var require_timers = __commonJS({
110935
110935
  if (!fastNowTimeout || fastTimers.length === 1) {
110936
110936
  refreshTimeout();
110937
110937
  }
110938
- this._state = PENDING;
110938
+ this._state = PENDING2;
110939
110939
  }
110940
110940
  /**
110941
110941
  * The `clear` method cancels the timer, preventing it from executing.
@@ -287697,6 +287697,13 @@ var init_braille_spinner = __esm({
287697
287697
  });
287698
287698
 
287699
287699
  // packages/cli/src/tui/system-metrics.ts
287700
+ var system_metrics_exports = {};
287701
+ __export(system_metrics_exports, {
287702
+ SystemMetricsCollector: () => SystemMetricsCollector,
287703
+ formatRate: () => formatRate,
287704
+ getInstantSnapshot: () => getInstantSnapshot,
287705
+ instantaneousCpuPct: () => instantaneousCpuPct
287706
+ });
287700
287707
  import { loadavg as loadavg2, cpus as cpus3, totalmem as totalmem4, freemem as freemem3, platform as platform2 } from "node:os";
287701
287708
  import { exec as exec3 } from "node:child_process";
287702
287709
  import { readFile as readFile22 } from "node:fs/promises";
@@ -287824,14 +287831,39 @@ function getInstantSnapshot() {
287824
287831
  network: { rxBytesPerSec: 0, txBytesPerSec: 0 }
287825
287832
  };
287826
287833
  }
287834
+ function readCpuTimes() {
287835
+ let idle = 0;
287836
+ let total = 0;
287837
+ for (const cpu of cpus3()) {
287838
+ const t2 = cpu.times;
287839
+ idle += t2.idle;
287840
+ total += t2.user + t2.nice + t2.sys + t2.idle + t2.irq;
287841
+ }
287842
+ return { idle, total };
287843
+ }
287844
+ function instantaneousCpuPct() {
287845
+ const cur = readCpuTimes();
287846
+ const prev = _cpuPrevSnapshot;
287847
+ _cpuPrevSnapshot = cur;
287848
+ if (!prev) return -1;
287849
+ const idleDelta = cur.idle - prev.idle;
287850
+ const totalDelta = cur.total - prev.total;
287851
+ if (totalDelta <= 0) return 0;
287852
+ const usage = 1 - idleDelta / totalDelta;
287853
+ return Math.max(0, Math.min(100, Math.round(usage * 100)));
287854
+ }
287827
287855
  function collectCpuRam() {
287828
- const [l1] = loadavg2();
287829
287856
  const cores = cpus3().length;
287830
287857
  const cpuModel = cpus3()[0]?.model ?? "";
287831
287858
  const totalMem = totalmem4();
287832
287859
  const usedMem = totalMem - freemem3();
287860
+ let cpuUtil = instantaneousCpuPct();
287861
+ if (cpuUtil < 0) {
287862
+ const [l1] = loadavg2();
287863
+ cpuUtil = Math.max(0, Math.min(100, Math.round(l1 / cores * 100)));
287864
+ }
287833
287865
  return {
287834
- cpuUtil: Math.min(100, Math.round(l1 / cores * 100)),
287866
+ cpuUtil,
287835
287867
  cpuCores: cores,
287836
287868
  cpuModel,
287837
287869
  memUtil: Math.round(usedMem / totalMem * 100),
@@ -287863,12 +287895,13 @@ async function collectLocalMetrics() {
287863
287895
  network
287864
287896
  };
287865
287897
  }
287866
- var _lastNetSnapshot, _nvidiaSmiAvailable, SystemMetricsCollector;
287898
+ var _lastNetSnapshot, _nvidiaSmiAvailable, _cpuPrevSnapshot, SystemMetricsCollector;
287867
287899
  var init_system_metrics = __esm({
287868
287900
  "packages/cli/src/tui/system-metrics.ts"() {
287869
287901
  "use strict";
287870
287902
  _lastNetSnapshot = null;
287871
287903
  _nvidiaSmiAvailable = null;
287904
+ _cpuPrevSnapshot = null;
287872
287905
  SystemMetricsCollector = class {
287873
287906
  _timer = null;
287874
287907
  _source = "local";
@@ -288488,6 +288521,7 @@ __export(tui_tasks_renderer_exports, {
288488
288521
  onTuiTasksHeightChange: () => onTuiTasksHeightChange,
288489
288522
  refreshTuiTasks: () => refreshTuiTasks,
288490
288523
  refreshTuiTasksSync: () => refreshTuiTasksSync,
288524
+ refreshTuiTasksThemeVars: () => refreshTuiTasksThemeVars,
288491
288525
  setTuiTasksEnabled: () => setTuiTasksEnabled,
288492
288526
  setTuiTasksScope: () => setTuiTasksScope,
288493
288527
  setTuiTasksSession: () => setTuiTasksSession,
@@ -288651,16 +288685,27 @@ function applyHeightChange(nextHeight) {
288651
288685
  }
288652
288686
  }
288653
288687
  }
288688
+ function fg2562(idx, fallback = -1) {
288689
+ const n2 = idx < 0 ? fallback : idx;
288690
+ return n2 < 0 ? "\x1B[39m" : `\x1B[38;5;${n2}m`;
288691
+ }
288692
+ function refreshTuiTasksThemeVars() {
288693
+ BG = tuiBgSeq();
288694
+ DIM_LABEL = fg2562(tuiTextDim(), 240);
288695
+ ACCENT = tuiAccentFg();
288696
+ DONE2 = fg2562(tuiTextDim(), 240);
288697
+ PENDING = fg2562(tuiTextDim(), 240);
288698
+ }
288654
288699
  function statusToAnsi(status) {
288655
288700
  switch (status) {
288656
288701
  case "completed":
288657
- return { mark: "◉", color: MUTED_GREEN, box: GREEN };
288702
+ return { mark: "◉", color: DONE2 };
288658
288703
  case "in_progress":
288659
- return { mark: "◐", color: GOLD, box: GOLD };
288704
+ return { mark: "◐", color: ACCENT };
288660
288705
  case "blocked":
288661
- return { mark: "◍", color: RED, box: RED };
288706
+ return { mark: "◍", color: BLOCKED };
288662
288707
  default:
288663
- return { mark: "○", color: GREY, box: GREY };
288708
+ return { mark: "○", color: PENDING };
288664
288709
  }
288665
288710
  }
288666
288711
  function truncate2(s2, max) {
@@ -288684,7 +288729,7 @@ function render() {
288684
288729
  const cols = Math.max(20, termCols());
288685
288730
  const completed = _lastTodos.filter((t2) => t2.status === "completed").length;
288686
288731
  const total = _lastTodos.length;
288687
- const headerColor = completed === total ? GREEN : GOLD;
288732
+ const headerColor = ACCENT;
288688
288733
  const lines = [];
288689
288734
  const headerText = `tasks ${headerColor}${completed}/${total}${RESET}${DIM_LABEL} (todo_write)${RESET}`;
288690
288735
  lines.push(headerText);
@@ -288743,11 +288788,12 @@ function clearLastPaintedRows() {
288743
288788
  _lastPaintedTop = -1;
288744
288789
  _lastPaintedBottom = -1;
288745
288790
  }
288746
- var _activeSessionId, _watcher, _lastTodos, _enabled, _redrawScheduled, _onResizeChange, _scopeOverlayActive, _scopeMainViewActive, _scopeNeovimActive, _scopePagerActive, _lastPaintedTop, _lastPaintedBottom, MAX_VISIBLE_ROWS, SAVE, RESTORE, HIDE, SHOW, CLEAR_LINE, RESET, BG, DIM_LABEL, GOLD, GREEN, MUTED_GREEN, GREY, RED;
288791
+ var _activeSessionId, _watcher, _lastTodos, _enabled, _redrawScheduled, _onResizeChange, _scopeOverlayActive, _scopeMainViewActive, _scopeNeovimActive, _scopePagerActive, _lastPaintedTop, _lastPaintedBottom, MAX_VISIBLE_ROWS, SAVE, RESTORE, HIDE, SHOW, CLEAR_LINE, RESET, BG, DIM_LABEL, ACCENT, DONE2, PENDING, BLOCKED;
288747
288792
  var init_tui_tasks_renderer = __esm({
288748
288793
  "packages/cli/src/tui/tui-tasks-renderer.ts"() {
288749
288794
  "use strict";
288750
288795
  init_layout2();
288796
+ init_theme();
288751
288797
  _activeSessionId = null;
288752
288798
  _watcher = null;
288753
288799
  _lastTodos = [];
@@ -288767,13 +288813,13 @@ var init_tui_tasks_renderer = __esm({
288767
288813
  SHOW = "\x1B[?25h";
288768
288814
  CLEAR_LINE = "\x1B[2K";
288769
288815
  RESET = "\x1B[0m";
288770
- BG = "\x1B[48;2;23;23;26m";
288771
- DIM_LABEL = "\x1B[38;2;68;68;68m";
288772
- GOLD = "\x1B[38;2;178;146;10m";
288773
- GREEN = "\x1B[38;2;95;165;95m";
288774
- MUTED_GREEN = "\x1B[38;2;74;122;74m";
288775
- GREY = "\x1B[38;2;102;102;102m";
288776
- RED = "\x1B[38;2;178;95;95m";
288816
+ BG = tuiBgSeq();
288817
+ DIM_LABEL = "";
288818
+ ACCENT = "";
288819
+ DONE2 = "";
288820
+ PENDING = "";
288821
+ BLOCKED = "\x1B[38;5;196m";
288822
+ refreshTuiTasksThemeVars();
288777
288823
  }
288778
288824
  });
288779
288825
 
@@ -291659,7 +291705,7 @@ ${CONTENT_BG_SEQ}`);
291659
291705
  function ansi3(code8, text) {
291660
291706
  return isTTY3 ? `\x1B[${code8}m${text}\x1B[0m` : text;
291661
291707
  }
291662
- function fg2562(code8, text) {
291708
+ function fg2563(code8, text) {
291663
291709
  return isTTY3 ? `\x1B[38;5;${code8}m${text}\x1B[0m` : text;
291664
291710
  }
291665
291711
  function stripAnsi2(s2) {
@@ -292245,15 +292291,15 @@ var init_tui_select = __esm({
292245
292291
  init_layout2();
292246
292292
  isTTY3 = process.stdout.isTTY ?? false;
292247
292293
  selectColors = {
292248
- orange: (t2) => fg2562(208, t2),
292294
+ orange: (t2) => fg2563(208, t2),
292249
292295
  green: (t2) => ansi3("32", t2),
292250
292296
  dim: (t2) => ansi3("2", t2),
292251
292297
  bold: (t2) => ansi3("1", t2),
292252
292298
  cyan: (t2) => ansi3("36", t2),
292253
292299
  /** Lighter grey for filter matches (252 = near-white) */
292254
- matchLight: (t2) => fg2562(252, t2),
292300
+ matchLight: (t2) => fg2563(252, t2),
292255
292301
  /** Dark grey for non-matching items (240 = dark grey) */
292256
- matchDark: (t2) => fg2562(240, t2)
292302
+ matchDark: (t2) => fg2563(240, t2)
292257
292303
  };
292258
292304
  }
292259
292305
  });
@@ -303346,6 +303392,12 @@ async function showColorMenu(ctx3) {
303346
303392
  if (!result || result.key === "cancel") return;
303347
303393
  setThemeMode(result.key);
303348
303394
  refreshThemeVars();
303395
+ try {
303396
+ const tasksRenderer = await Promise.resolve().then(() => (init_tui_tasks_renderer(), tui_tasks_renderer_exports));
303397
+ tasksRenderer.refreshTuiTasksThemeVars?.();
303398
+ tasksRenderer.refreshTuiTasks?.();
303399
+ } catch {
303400
+ }
303349
303401
  ctx3.refreshBanner?.();
303350
303402
  renderInfo(`Theme set to: ${result.key}`);
303351
303403
  try {
@@ -308078,7 +308130,7 @@ var init_carousel_descriptors = __esm({
308078
308130
  });
308079
308131
 
308080
308132
  // packages/cli/src/tui/stream-renderer.ts
308081
- function fg2563(code8, text) {
308133
+ function fg2564(code8, text) {
308082
308134
  return isTTY8 ? `\x1B[38;5;${code8}m${text}\x1B[0m` : text;
308083
308135
  }
308084
308136
  function dimText(text) {
@@ -308479,12 +308531,12 @@ var init_stream_renderer = __esm({
308479
308531
  const colorKey = dim ? PASTEL.toolArg : PASTEL.key;
308480
308532
  const colorStr = dim ? PASTEL.toolArg : PASTEL.string;
308481
308533
  let result = line;
308482
- result = result.replace(/"([^"]*)"(\s*:)/g, (_m, key, colon) => fg2563(colorKey, `"${key}"`) + fg2563(PASTEL.colon, colon));
308483
- result = result.replace(/(:\s*)"([^"]*)"/g, (_m, prefix, val) => fg2563(PASTEL.colon, prefix) + fg2563(colorStr, `"${val}"`));
308484
- result = result.replace(/(:\s*)(\d+\.?\d*)/g, (_m, prefix, num) => fg2563(PASTEL.colon, prefix) + fg2563(PASTEL.number, num));
308485
- result = result.replace(/(:\s*)(true|false)/g, (_m, prefix, bool) => fg2563(PASTEL.colon, prefix) + fg2563(PASTEL.boolean, bool));
308486
- result = result.replace(/(:\s*)(null)/g, (_m, prefix, n2) => fg2563(PASTEL.colon, prefix) + fg2563(PASTEL.null, n2));
308487
- result = result.replace(/([{}[\]])/g, (_m, b) => fg2563(PASTEL.bracket, b));
308534
+ result = result.replace(/"([^"]*)"(\s*:)/g, (_m, key, colon) => fg2564(colorKey, `"${key}"`) + fg2564(PASTEL.colon, colon));
308535
+ result = result.replace(/(:\s*)"([^"]*)"/g, (_m, prefix, val) => fg2564(PASTEL.colon, prefix) + fg2564(colorStr, `"${val}"`));
308536
+ result = result.replace(/(:\s*)(\d+\.?\d*)/g, (_m, prefix, num) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.number, num));
308537
+ result = result.replace(/(:\s*)(true|false)/g, (_m, prefix, bool) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.boolean, bool));
308538
+ result = result.replace(/(:\s*)(null)/g, (_m, prefix, n2) => fg2564(PASTEL.colon, prefix) + fg2564(PASTEL.null, n2));
308539
+ result = result.replace(/([{}[\]])/g, (_m, b) => fg2564(PASTEL.bracket, b));
308488
308540
  return dim ? dimText(result) : result;
308489
308541
  }
308490
308542
  /**
@@ -308492,16 +308544,16 @@ var init_stream_renderer = __esm({
308492
308544
  */
308493
308545
  highlightCode(line) {
308494
308546
  let result = line;
308495
- result = result.replace(/"([^"]*)"/g, (_m, s2) => fg2563(PASTEL.string, `"${s2}"`));
308496
- result = result.replace(/'([^']*)'/g, (_m, s2) => fg2563(PASTEL.string, `'${s2}'`));
308497
- result = result.replace(/\b(\d+\.?\d*)\b/g, (_m, n2) => fg2563(PASTEL.number, n2));
308498
- result = result.replace(/\b(true|false|null|undefined|None|True|False)\b/g, (_m, kw) => fg2563(PASTEL.boolean, kw));
308547
+ result = result.replace(/"([^"]*)"/g, (_m, s2) => fg2564(PASTEL.string, `"${s2}"`));
308548
+ result = result.replace(/'([^']*)'/g, (_m, s2) => fg2564(PASTEL.string, `'${s2}'`));
308549
+ result = result.replace(/\b(\d+\.?\d*)\b/g, (_m, n2) => fg2564(PASTEL.number, n2));
308550
+ result = result.replace(/\b(true|false|null|undefined|None|True|False)\b/g, (_m, kw) => fg2564(PASTEL.boolean, kw));
308499
308551
  result = result.replace(
308500
308552
  /\b(function|const|let|var|return|if|else|for|while|import|export|from|class|async|await|def|self|try|catch|finally|throw|new|typeof|instanceof|type|interface|enum|struct|impl|fn|pub|mod|use|match|trait|where|mut|ref|move|yield|switch|case|default|break|continue|do|in|of|extends|implements|super|this|static|abstract|override|readonly|declare|namespace|package|func|go|chan|select|defer|range|map)\b/g,
308501
- (_m, kw) => fg2563(PASTEL.keyword, kw)
308553
+ (_m, kw) => fg2564(PASTEL.keyword, kw)
308502
308554
  );
308503
- result = result.replace(/:\s*([A-Z]\w*)/g, (_m, t2) => ": " + fg2563(147, t2));
308504
- result = result.replace(/(\/\/.*$|#.*$)/gm, (_m, cm) => fg2563(PASTEL.comment, cm));
308555
+ result = result.replace(/:\s*([A-Z]\w*)/g, (_m, t2) => ": " + fg2564(147, t2));
308556
+ result = result.replace(/(\/\/.*$|#.*$)/gm, (_m, cm) => fg2564(PASTEL.comment, cm));
308505
308557
  return result;
308506
308558
  }
308507
308559
  // -------------------------------------------------------------------------
@@ -308513,30 +308565,30 @@ var init_stream_renderer = __esm({
308513
308565
  */
308514
308566
  highlightDiff(line) {
308515
308567
  if (/^[-]{3}\s/.test(line) || /^[+]{3}\s/.test(line)) {
308516
- return boldText(fg2563(PASTEL.diffMeta, line));
308568
+ return boldText(fg2564(PASTEL.diffMeta, line));
308517
308569
  }
308518
308570
  if (line.startsWith("@@")) {
308519
- return fg2563(PASTEL.diffHunk, line);
308571
+ return fg2564(PASTEL.diffHunk, line);
308520
308572
  }
308521
308573
  if (line.startsWith("diff ") || line.startsWith("index ")) {
308522
- return fg2563(PASTEL.diffMeta, line);
308574
+ return fg2564(PASTEL.diffMeta, line);
308523
308575
  }
308524
308576
  if (line.startsWith("+")) {
308525
- return fg2563(PASTEL.diffAdded, line);
308577
+ return fg2564(PASTEL.diffAdded, line);
308526
308578
  }
308527
308579
  if (line.startsWith("-")) {
308528
- return fg2563(PASTEL.diffRemoved, line);
308580
+ return fg2564(PASTEL.diffRemoved, line);
308529
308581
  }
308530
308582
  if (/^\s*\d+\s*[+-]\s/.test(line)) {
308531
308583
  const match = line.match(/^(\s*\d+\s*)([+-])(\s.*)$/);
308532
308584
  if (match) {
308533
- const num = fg2563(PASTEL.diffContext, match[1]);
308534
- const sign2 = match[2] === "+" ? fg2563(PASTEL.diffAdded, "+") : fg2563(PASTEL.diffRemoved, "-");
308535
- const rest = match[2] === "+" ? fg2563(PASTEL.diffAdded, match[3]) : fg2563(PASTEL.diffRemoved, match[3]);
308585
+ const num = fg2564(PASTEL.diffContext, match[1]);
308586
+ const sign2 = match[2] === "+" ? fg2564(PASTEL.diffAdded, "+") : fg2564(PASTEL.diffRemoved, "-");
308587
+ const rest = match[2] === "+" ? fg2564(PASTEL.diffAdded, match[3]) : fg2564(PASTEL.diffRemoved, match[3]);
308536
308588
  return num + sign2 + rest;
308537
308589
  }
308538
308590
  }
308539
- return fg2563(PASTEL.diffContext, line);
308591
+ return fg2564(PASTEL.diffContext, line);
308540
308592
  }
308541
308593
  // -------------------------------------------------------------------------
308542
308594
  // Shell / bash highlighting
@@ -308546,19 +308598,19 @@ var init_stream_renderer = __esm({
308546
308598
  */
308547
308599
  highlightShell(line) {
308548
308600
  if (/^\s*#/.test(line)) {
308549
- return fg2563(PASTEL.comment, line);
308601
+ return fg2564(PASTEL.comment, line);
308550
308602
  }
308551
308603
  let result = line;
308552
- result = result.replace(/"([^"]*)"/g, (_m, s2) => fg2563(PASTEL.string, `"${s2}"`));
308553
- result = result.replace(/'([^']*)'/g, (_m, s2) => fg2563(PASTEL.string, `'${s2}'`));
308554
- result = result.replace(/(\$\{[^}]+\}|\$[A-Za-z_]\w*|\$[0-9?@#*!$-])/g, (_m, v) => fg2563(PASTEL.shellVar, v));
308555
- result = result.replace(/((?:^|\s))(--?[a-zA-Z][\w-]*)/g, (_m, ws, flag) => ws + fg2563(PASTEL.shellFlag, flag));
308556
- result = result.replace(/(\|{1,2}|>{1,2}|<{1,2}|&{1,2}|;)/g, (_m, op) => fg2563(PASTEL.shellOp, op));
308604
+ result = result.replace(/"([^"]*)"/g, (_m, s2) => fg2564(PASTEL.string, `"${s2}"`));
308605
+ result = result.replace(/'([^']*)'/g, (_m, s2) => fg2564(PASTEL.string, `'${s2}'`));
308606
+ result = result.replace(/(\$\{[^}]+\}|\$[A-Za-z_]\w*|\$[0-9?@#*!$-])/g, (_m, v) => fg2564(PASTEL.shellVar, v));
308607
+ result = result.replace(/((?:^|\s))(--?[a-zA-Z][\w-]*)/g, (_m, ws, flag) => ws + fg2564(PASTEL.shellFlag, flag));
308608
+ result = result.replace(/(\|{1,2}|>{1,2}|<{1,2}|&{1,2}|;)/g, (_m, op) => fg2564(PASTEL.shellOp, op));
308557
308609
  result = result.replace(
308558
308610
  /^(\s*)(npm|npx|node|pnpm|yarn|git|docker|kubectl|curl|wget|cat|grep|find|ls|cd|cp|mv|rm|mkdir|chmod|chown|echo|printf|sed|awk|sort|uniq|head|tail|wc|tar|gzip|make|cargo|go|pip|python|python3|ruby|gem|brew|apt|yum|dnf|pacman|sudo|ssh|scp|rsync|man)\b/,
308559
- (_m, ws, cmd) => ws + boldText(fg2563(PASTEL.keyword, cmd))
308611
+ (_m, ws, cmd) => ws + boldText(fg2564(PASTEL.keyword, cmd))
308560
308612
  );
308561
- result = result.replace(/(#[^{].*$)/gm, (_m, cm) => fg2563(PASTEL.comment, cm));
308613
+ result = result.replace(/(#[^{].*$)/gm, (_m, cm) => fg2564(PASTEL.comment, cm));
308562
308614
  return result;
308563
308615
  }
308564
308616
  // -------------------------------------------------------------------------
@@ -308573,23 +308625,23 @@ var init_stream_renderer = __esm({
308573
308625
  const level = headingMatch[1].length;
308574
308626
  const text = headingMatch[2];
308575
308627
  const colors2 = [PASTEL.heading1, PASTEL.heading2, PASTEL.heading3, PASTEL.heading3, 183, 183];
308576
- return boldText(fg2563(colors2[level - 1] ?? 147, text));
308628
+ return boldText(fg2564(colors2[level - 1] ?? 147, text));
308577
308629
  }
308578
308630
  if (/^[-*_]{3,}\s*$/.test(line)) {
308579
308631
  const w = termCols() - 10;
308580
- return fg2563(PASTEL.hr, "─".repeat(Math.min(w, 60)));
308632
+ return fg2564(PASTEL.hr, "─".repeat(Math.min(w, 60)));
308581
308633
  }
308582
308634
  if (/^>\s?/.test(line)) {
308583
308635
  const content = line.replace(/^>\s?/, "");
308584
- return fg2563(PASTEL.blockquote, "│ ") + italicText(fg2563(PASTEL.blockquote, this.highlightInline(content)));
308636
+ return fg2564(PASTEL.blockquote, "│ ") + italicText(fg2564(PASTEL.blockquote, this.highlightInline(content)));
308585
308637
  }
308586
308638
  const ulMatch = line.match(/^(\s*)([-*+])\s+(.*)/);
308587
308639
  if (ulMatch) {
308588
- return ulMatch[1] + fg2563(PASTEL.blockquote, "○") + " " + this.highlightInline(ulMatch[3]);
308640
+ return ulMatch[1] + fg2564(PASTEL.blockquote, "○") + " " + this.highlightInline(ulMatch[3]);
308589
308641
  }
308590
308642
  const olMatch = line.match(/^(\s*)(\d+[.)])\s+(.*)/);
308591
308643
  if (olMatch) {
308592
- return olMatch[1] + fg2563(PASTEL.blockquote, olMatch[2]) + " " + this.highlightInline(olMatch[3]);
308644
+ return olMatch[1] + fg2564(PASTEL.blockquote, olMatch[2]) + " " + this.highlightInline(olMatch[3]);
308593
308645
  }
308594
308646
  return this.highlightInline(line);
308595
308647
  }
@@ -308598,11 +308650,11 @@ var init_stream_renderer = __esm({
308598
308650
  */
308599
308651
  highlightInline(text) {
308600
308652
  let result = text;
308601
- result = result.replace(/`([^`]+)`/g, (_m, code8) => fg2563(PASTEL.inlineCode, code8));
308653
+ result = result.replace(/`([^`]+)`/g, (_m, code8) => fg2564(PASTEL.inlineCode, code8));
308602
308654
  result = result.replace(/\*{3}([^*]+)\*{3}/g, (_m, t2) => boldText(italicText(t2)));
308603
308655
  result = result.replace(/\*{2}([^*]+)\*{2}/g, (_m, t2) => boldText(t2));
308604
308656
  result = result.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_m, t2) => italicText(t2));
308605
- result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => boldText(fg2563(PASTEL.link, label)) + " " + dimText(fg2563(PASTEL.link, `(${url})`)));
308657
+ result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => boldText(fg2564(PASTEL.link, label)) + " " + dimText(fg2564(PASTEL.link, `(${url})`)));
308606
308658
  result = result.replace(/__([^_]+)__/g, (_m, t2) => boldText(t2));
308607
308659
  result = result.replace(/(?<!_)_([^_]+)_(?!_)/g, (_m, t2) => italicText(t2));
308608
308660
  result = result.replace(/~~([^~]+)~~/g, (_m, t2) => dimText(t2));
@@ -318887,7 +318939,10 @@ async function sendMessage() {
318887
318939
  actions.appendChild(copyBtn);
318888
318940
  msgDiv.appendChild(actions);
318889
318941
  } catch (err) {
318890
- msgDiv.innerHTML = '<span style="color:#ff4444">Error: ' + escHtml(err.message) + '</span>';
318942
+ // Match the red left-border styling used by failed tool_result
318943
+ // and the stop-button. Sits inside the assistant bubble so it
318944
+ // visually parents to the same turn the user initiated.
318945
+ msgDiv.innerHTML = '<div style="background:#2a1e1e;border-left:3px solid #ff4444;color:#ff4444;padding:6px 10px 6px 14px;margin:3px 0;font-family:inherit"><div style="color:#ff4444;font-size:0.6rem;text-transform:uppercase;letter-spacing:0.08em;margin-bottom:2px">\\u25B8 error</div><div style="color:#ff7777;white-space:pre-wrap;word-break:break-word">' + escHtml(err.message) + '</div></div>';
318891
318946
  }
318892
318947
 
318893
318948
  streaming = false;
@@ -319193,7 +319248,7 @@ async function submitAgentTask() {
319193
319248
  }
319194
319249
  }
319195
319250
  } catch (err) {
319196
- eventsDiv.innerHTML += '<div style="color:#ff4444">Error: ' + escHtml(err.message) + '</div>';
319251
+ eventsDiv.innerHTML += '<div style="background:#2a1e1e;border-left:3px solid #ff4444;color:#ff7777;padding:6px 10px 6px 14px;margin:3px 0"><div style="color:#ff4444;font-size:0.6rem;text-transform:uppercase;letter-spacing:0.08em;margin-bottom:2px">\\u25B8 error</div>' + escHtml(err.message) + '</div>';
319197
319252
  }
319198
319253
  document.getElementById('agent-submit').style.display = 'inline-block';
319199
319254
  document.getElementById('agent-abort').style.display = 'none';
@@ -320404,13 +320459,39 @@ function hideProcPopover() {
320404
320459
  procPopover.classList.remove('visible');
320405
320460
  }
320406
320461
 
320462
+ // Render a transient error toast in the conversation with the same
320463
+ // red-left-border styling used by failed tool_result entries. Replaces
320464
+ // alert() popups so users can see "Task not found" inline with the
320465
+ // rest of the agent's activity instead of in a modal.
320466
+ function renderInlineError(message) {
320467
+ const conv = document.getElementById('conversation');
320468
+ if (!conv) {
320469
+ // Fallback if conversation doesn't exist (config tab, etc.)
320470
+ console.error(message);
320471
+ return;
320472
+ }
320473
+ const wrap = document.createElement('div');
320474
+ wrap.className = 'msg assistant';
320475
+ wrap.innerHTML = '<div style="background:#2a1e1e;border-left:3px solid #ff4444;color:#ff7777;padding:6px 10px 6px 14px;margin:3px 0;font-family:inherit"><div style="color:#ff4444;font-size:0.6rem;text-transform:uppercase;letter-spacing:0.08em;margin-bottom:2px">\\u25B8 error</div><div style="color:#ff7777;white-space:pre-wrap;word-break:break-word">' + escHtml(message) + '</div></div>';
320476
+ conv.appendChild(wrap);
320477
+ maybeAutoScroll();
320478
+ }
320479
+
320407
320480
  async function killRun(id) {
320408
320481
  try {
320409
320482
  const r = await fetch('/v1/runs/' + encodeURIComponent(id), { method: 'DELETE', headers: headers() });
320410
320483
  const text = await r.text().catch(() => '');
320411
- alert('Kill ' + id + ': ' + r.status + (text ? ' — ' + text.slice(0, 100) : ''));
320484
+ if (!r.ok) {
320485
+ // Try to extract a clean error message from the response body
320486
+ let msg = 'Kill ' + id + ' (HTTP ' + r.status + ')';
320487
+ try {
320488
+ const j = JSON.parse(text);
320489
+ if (j.error) msg = String(j.error);
320490
+ } catch { if (text) msg = text.slice(0, 200); }
320491
+ renderInlineError(msg);
320492
+ }
320412
320493
  } catch (e) {
320413
- alert('Kill failed: ' + e.message);
320494
+ renderInlineError('Kill failed: ' + (e && e.message || String(e)));
320414
320495
  }
320415
320496
  hideProcPopover();
320416
320497
  }
@@ -320418,10 +320499,21 @@ async function killRun(id) {
320418
320499
  async function viewRun(id) {
320419
320500
  try {
320420
320501
  const r = await fetch('/v1/runs/' + encodeURIComponent(id), { headers: headers() });
320502
+ if (!r.ok) {
320503
+ const text = await r.text().catch(() => '');
320504
+ let msg = 'View ' + id + ' (HTTP ' + r.status + ')';
320505
+ try { const j = JSON.parse(text); if (j.error) msg = String(j.error); }
320506
+ catch { if (text) msg = text.slice(0, 200); }
320507
+ renderInlineError(msg);
320508
+ return;
320509
+ }
320421
320510
  const j = await r.json();
320511
+ // Detail rendering still uses alert because the JSON dump is huge
320512
+ // and overflowing the conversation isn't useful — but errors fall
320513
+ // through to the inline path.
320422
320514
  alert(JSON.stringify(j, null, 2).slice(0, 1500));
320423
320515
  } catch (e) {
320424
- alert('Fetch failed: ' + e.message);
320516
+ renderInlineError('Fetch failed: ' + (e && e.message || String(e)));
320425
320517
  }
320426
320518
  }
320427
320519
 
@@ -324203,8 +324295,12 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
324203
324295
  const freeMem = os8.freemem();
324204
324296
  const totalMem = os8.totalmem();
324205
324297
  const ramUsedPct = Math.round((1 - freeMem / totalMem) * 100);
324206
- const cpuLoad = os8.loadavg()[0] ?? 0;
324207
- const cpuPct = Math.min(100, Math.round(cpuLoad / os8.cpus().length * 100));
324298
+ const { instantaneousCpuPct: instantaneousCpuPct2 } = await Promise.resolve().then(() => (init_system_metrics(), system_metrics_exports));
324299
+ let cpuPct = instantaneousCpuPct2();
324300
+ if (cpuPct < 0) {
324301
+ const cpuLoad = os8.loadavg()[0] ?? 0;
324302
+ cpuPct = Math.max(0, Math.min(100, Math.round(cpuLoad / os8.cpus().length * 100)));
324303
+ }
324208
324304
  let gpuUtil = [];
324209
324305
  try {
324210
324306
  const util2 = es("nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits", { encoding: "utf8", timeout: 3e3, stdio: "pipe" });
@@ -324706,7 +324802,8 @@ ${historyLines}
324706
324802
  addCheckinMessage(checkinSession, body.message);
324707
324803
  } catch {
324708
324804
  }
324709
- let acknowledgment = "Got it, adapting course.";
324805
+ const truncatedInput = body.message.length > 80 ? body.message.slice(0, 77) + "..." : body.message;
324806
+ let acknowledgment = `Acknowledged: ${truncatedInput}`;
324710
324807
  let steering = body.message;
324711
324808
  try {
324712
324809
  const cfg = loadConfig();
@@ -327496,8 +327593,10 @@ async function startInteractive(config, repoPath) {
327496
327593
  try {
327497
327594
  const { setThemeMode: setThemeMode2 } = await Promise.resolve().then(() => (init_theme(), theme_exports));
327498
327595
  const { refreshThemeVars: refreshThemeVars2 } = await Promise.resolve().then(() => (init_status_bar(), status_bar_exports));
327596
+ const { refreshTuiTasksThemeVars: refreshTuiTasksThemeVars2 } = await Promise.resolve().then(() => (init_tui_tasks_renderer(), tui_tasks_renderer_exports));
327499
327597
  setThemeMode2(savedSettings.colorTheme);
327500
327598
  refreshThemeVars2();
327599
+ refreshTuiTasksThemeVars2();
327501
327600
  } catch {
327502
327601
  }
327503
327602
  }
@@ -330537,20 +330636,8 @@ ${result.text}`;
330537
330636
  `- summary: expanded instruction for the main agent (e.g. "The user wants X instead of Y. Adjust your approach to prioritize Z. Specifically, they are asking you to...")`
330538
330637
  ].join("\n");
330539
330638
  const result = await steerAgent.run(steerPrompt, "Steering sub-agent — interpret user input and produce instruction.");
330540
- const STEER_FALLBACKS = [
330541
- `Noted, changing course.`,
330542
- `On it, shifting approach.`,
330543
- `Understood, recalibrating.`,
330544
- `Right, let me rework that.`,
330545
- `Okay, taking a different angle.`,
330546
- `Heard you, pivoting now.`,
330547
- `Sure thing, rethinking this.`,
330548
- `Copy that, adapting.`,
330549
- `Makes sense, re-routing.`,
330550
- `Roger, new plan.`
330551
- ];
330552
- const fbIdx = Math.floor(Math.random() * STEER_FALLBACKS.length);
330553
- let acknowledgment = STEER_FALLBACKS[fbIdx];
330639
+ const truncatedInputForAck = input.length > 80 ? input.slice(0, 77) + "..." : input;
330640
+ let acknowledgment = `Acknowledged: ${truncatedInputForAck}`;
330554
330641
  let steering = input;
330555
330642
  try {
330556
330643
  const parsed = JSON.parse(result.summary || "{}");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.225",
3
+ "version": "0.187.227",
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",