open-agents-ai 0.104.6 → 0.104.8

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 +144 -69
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34578,11 +34578,20 @@ async function startNeovimMode(opts) {
34578
34578
  }
34579
34579
  const ptyCols = opts.cols;
34580
34580
  const ptyRows = Math.max(5, opts.contentRows);
34581
+ const initVimCmd = "set mouse= autoread updatetime=300 signcolumn=no noswapfile";
34582
+ const luaBootstrap = [
34583
+ 'lua local lp = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"',
34584
+ 'if not vim.loop.fs_stat(lp) then pcall(vim.fn.system, {"git", "clone", "--filter=blob:none", "--depth=1", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lp}) end',
34585
+ "vim.opt.rtp:prepend(lp)",
34586
+ 'pcall(function() require("lazy").setup({{"nvim-neo-tree/neo-tree.nvim", branch="v3.x", dependencies={"nvim-lua/plenary.nvim","MunifTanjim/nui.nvim"},config=function() require("neo-tree").setup({close_if_last_window=true,filesystem={follow_current_file={enabled=true},use_libuv_file_watcher=true},window={position="left",width=30}}) end}},{install={colorscheme={}},checker={enabled=false}}) end)'
34587
+ ].join(" | ");
34581
34588
  const nvimArgs = [
34582
34589
  "--listen",
34583
34590
  socketPath,
34584
34591
  "--cmd",
34585
- "set autoread updatetime=300 signcolumn=no"
34592
+ initVimCmd,
34593
+ "-c",
34594
+ luaBootstrap
34586
34595
  ];
34587
34596
  if (opts.initialFile) {
34588
34597
  nvimArgs.push(opts.initialFile);
@@ -34605,16 +34614,20 @@ async function startNeovimMode(opts) {
34605
34614
  opts,
34606
34615
  stdinHandler: null,
34607
34616
  savedRlListeners: [],
34617
+ installedFilteredListeners: [],
34608
34618
  cleanedUp: false
34609
34619
  };
34610
34620
  _state = state;
34611
34621
  nvimPty.onData((data) => {
34612
34622
  if (state.cleanedUp)
34613
34623
  return;
34624
+ const filtered = data.replace(PTY_MODE_ENABLE_RE, "");
34625
+ if (!filtered)
34626
+ return;
34614
34627
  if (!state.focused) {
34615
- process.stdout.write("\x1B7" + data + "\x1B8");
34628
+ process.stdout.write("\x1B7" + filtered + "\x1B8");
34616
34629
  } else {
34617
- process.stdout.write(data);
34630
+ process.stdout.write(filtered);
34618
34631
  }
34619
34632
  });
34620
34633
  nvimPty.onExit(() => {
@@ -34660,14 +34673,15 @@ function stopNeovimMode() {
34660
34673
  if (!_state || _state.cleanedUp)
34661
34674
  return;
34662
34675
  try {
34663
- _state.pty?.write(":qa!\r");
34676
+ _state.pty?.write("\x1B:qa!\r");
34664
34677
  } catch {
34665
34678
  }
34679
+ const s = _state;
34666
34680
  setTimeout(() => {
34667
- if (_state && !_state.cleanedUp) {
34668
- doCleanup(_state);
34681
+ if (s && !s.cleanedUp) {
34682
+ doCleanup(s);
34669
34683
  }
34670
- }, 500);
34684
+ }, 300);
34671
34685
  }
34672
34686
  function writeToNeovimOutput(text) {
34673
34687
  if (!_state || _state.cleanedUp || !_state.nvim || !_state.outputChanId)
@@ -34734,6 +34748,8 @@ async function connectRPC(state, neovimPkg, cols) {
34734
34748
  await nvim.command("wincmd h");
34735
34749
  await nvim.command("set autoread");
34736
34750
  await nvim.command("autocmd FocusGained,BufEnter,CursorHold * silent! checktime");
34751
+ await nvim.command("set mouse=");
34752
+ await nvim.command("autocmd BufEnter,WinEnter * set mouse=");
34737
34753
  } catch {
34738
34754
  }
34739
34755
  }
@@ -34741,14 +34757,38 @@ function toggleFocus(state) {
34741
34757
  const stdin = process.stdin;
34742
34758
  if (state.focused) {
34743
34759
  state.focused = false;
34760
+ process.stdout.write("\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1004l\x1B[?1006l\x1B[?1015l\x1B[?2004l");
34744
34761
  if (state.stdinHandler) {
34745
34762
  stdin.removeListener("data", state.stdinHandler);
34746
34763
  }
34747
34764
  if (typeof stdin.setRawMode === "function") {
34748
34765
  stdin.setRawMode(false);
34749
34766
  }
34767
+ state.installedFilteredListeners = [];
34750
34768
  for (const { event, fn } of state.savedRlListeners) {
34751
- stdin.on(event, fn);
34769
+ if (event === "data") {
34770
+ const filtered = (...args) => {
34771
+ if (args[0] instanceof Buffer) {
34772
+ const raw = args[0].toString("utf8");
34773
+ const clean = raw.replace(STDIN_MOUSE_FOCUS_RE, "");
34774
+ if (!clean)
34775
+ return;
34776
+ fn(Buffer.from(clean));
34777
+ } else if (typeof args[0] === "string") {
34778
+ const clean = args[0].replace(STDIN_MOUSE_FOCUS_RE, "");
34779
+ if (!clean)
34780
+ return;
34781
+ fn(clean);
34782
+ } else {
34783
+ fn(...args);
34784
+ }
34785
+ };
34786
+ stdin.on(event, filtered);
34787
+ state.installedFilteredListeners.push({ event, fn: filtered });
34788
+ } else {
34789
+ stdin.on(event, fn);
34790
+ state.installedFilteredListeners.push({ event, fn });
34791
+ }
34752
34792
  }
34753
34793
  if (state.opts.rl) {
34754
34794
  state.opts.rl.resume();
@@ -34759,6 +34799,10 @@ function toggleFocus(state) {
34759
34799
  if (state.opts.rl) {
34760
34800
  state.opts.rl.pause();
34761
34801
  }
34802
+ for (const { event, fn } of state.installedFilteredListeners) {
34803
+ stdin.removeListener(event, fn);
34804
+ }
34805
+ state.installedFilteredListeners = [];
34762
34806
  state.savedRlListeners = [];
34763
34807
  for (const event of ["keypress", "data"]) {
34764
34808
  const listeners = stdin.listeners(event);
@@ -34775,7 +34819,7 @@ function toggleFocus(state) {
34775
34819
  stdin.on("data", state.stdinHandler);
34776
34820
  }
34777
34821
  if (state.nvim) {
34778
- state.nvim.command("echo ''").catch(() => {
34822
+ state.nvim.command("redraw!").catch(() => {
34779
34823
  });
34780
34824
  }
34781
34825
  }
@@ -34808,6 +34852,10 @@ function doCleanup(state) {
34808
34852
  stdin.removeListener("data", state.stdinHandler);
34809
34853
  state.stdinHandler = null;
34810
34854
  }
34855
+ for (const { event, fn } of state.installedFilteredListeners) {
34856
+ stdin.removeListener(event, fn);
34857
+ }
34858
+ state.installedFilteredListeners = [];
34811
34859
  if (typeof stdin.setRawMode === "function") {
34812
34860
  try {
34813
34861
  stdin.setRawMode(false);
@@ -34822,15 +34870,17 @@ function doCleanup(state) {
34822
34870
  state.opts.rl.prompt(false);
34823
34871
  }
34824
34872
  _state = null;
34825
- process.stdout.write("\x1B[H\x1B[J");
34873
+ process.stdout.write("\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?1004l\x1B[?2004l\x1B[H\x1B[J");
34826
34874
  state.opts.onExit?.();
34827
34875
  }
34828
- var isTTY5, _state;
34876
+ var isTTY5, PTY_MODE_ENABLE_RE, STDIN_MOUSE_FOCUS_RE, _state;
34829
34877
  var init_neovim_mode = __esm({
34830
34878
  "packages/cli/dist/tui/neovim-mode.js"() {
34831
34879
  "use strict";
34832
34880
  init_setup();
34833
34881
  isTTY5 = process.stdout.isTTY ?? false;
34882
+ PTY_MODE_ENABLE_RE = /\x1B\[\?(?:1000|1002|1003|1004|1005|1006|1015|2004)h/g;
34883
+ STDIN_MOUSE_FOCUS_RE = /\x1B\[<[\d;]+[Mm]|\x1B\[M[\s\S]{3}|\x1B\[[IO]/g;
34834
34884
  _state = null;
34835
34885
  }
34836
34886
  });
@@ -49340,12 +49390,6 @@ ${entry.fullContent}`
49340
49390
  }
49341
49391
  }
49342
49392
  }
49343
- if (isNeovimActive()) {
49344
- const toolName = event.toolName ?? "unknown";
49345
- const argSummary = Object.keys(event.toolArgs ?? {}).join(", ");
49346
- writeToNeovimOutput(`\x1B[33m\u25B6 ${toolName}\x1B[0m(${argSummary})\r
49347
- `);
49348
- }
49349
49393
  getActivityFeed().push({
49350
49394
  ts: Date.now(),
49351
49395
  source: "main",
@@ -49357,16 +49401,23 @@ ${entry.fullContent}`
49357
49401
  statusBar?.recordSpeedToolCall(event.toolName ?? "unknown");
49358
49402
  toolCallStartMs = Date.now();
49359
49403
  statusBar?.setActiveTool(event.toolName ?? null);
49360
- contentWrite(() => {
49361
- if (voice?.enabled && (voice.voiceMode === "action" || voice.voiceMode === "verbose")) {
49362
- const emoState = emotionEngine?.getState();
49363
- const emoCtx = emoState ? { valence: emoState.valence, arousal: emoState.arousal, label: emoState.label, emoji: emoState.emoji } : void 0;
49364
- const desc = describeToolCall(event.toolName ?? "unknown", event.toolArgs ?? {}, vLevel, emoCtx, isStark);
49365
- renderVoiceText(desc);
49366
- voice.speakSubordinate(desc, emoCtx);
49367
- }
49368
- renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {}, config.verbose);
49369
- });
49404
+ if (isNeovimActive()) {
49405
+ const toolName = event.toolName ?? "unknown";
49406
+ const argSummary = Object.keys(event.toolArgs ?? {}).join(", ");
49407
+ writeToNeovimOutput(`\x1B[33m\u25B6 ${toolName}\x1B[0m(${argSummary})\r
49408
+ `);
49409
+ } else {
49410
+ contentWrite(() => {
49411
+ if (voice?.enabled && (voice.voiceMode === "action" || voice.voiceMode === "verbose")) {
49412
+ const emoState = emotionEngine?.getState();
49413
+ const emoCtx = emoState ? { valence: emoState.valence, arousal: emoState.arousal, label: emoState.label, emoji: emoState.emoji } : void 0;
49414
+ const desc = describeToolCall(event.toolName ?? "unknown", event.toolArgs ?? {}, vLevel, emoCtx, isStark);
49415
+ renderVoiceText(desc);
49416
+ voice.speakSubordinate(desc, emoCtx);
49417
+ }
49418
+ renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {}, config.verbose);
49419
+ });
49420
+ }
49370
49421
  break;
49371
49422
  case "tool_result": {
49372
49423
  if (lastToolCall) {
@@ -49388,57 +49439,63 @@ ${entry.fullContent}`
49388
49439
  statusBar?.setActiveTool(null);
49389
49440
  const toolDurationMs = toolCallStartMs > 0 ? Date.now() - toolCallStartMs : 0;
49390
49441
  toolCallStartMs = 0;
49391
- contentWrite(() => {
49392
- renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "", config.verbose);
49393
- if (config.verbose && toolDurationMs > 0) {
49394
- const durStr = toolDurationMs < 1e3 ? `${toolDurationMs}ms` : `${(toolDurationMs / 1e3).toFixed(1)}s`;
49395
- const sizeStr = resultLen > 0 ? ` | ${resultLen.toLocaleString()} chars (~${Math.ceil(resultLen / 4).toLocaleString()} tokens)` : "";
49396
- renderVerbose(`${event.toolName ?? "unknown"}: ${durStr}${sizeStr}`);
49397
- }
49398
- if (voice?.enabled && event.toolName !== "task_complete" && (voice.voiceMode === "action" || voice.voiceMode === "verbose")) {
49399
- const emoState2 = emotionEngine?.getState();
49400
- const emoCtx2 = emoState2 ? { valence: emoState2.valence, arousal: emoState2.arousal, label: emoState2.label, emoji: emoState2.emoji } : void 0;
49401
- const desc = describeToolResult(event.toolName ?? "unknown", event.success ?? false, vLevel, event.content ?? void 0, emoCtx2, isStark);
49402
- if (desc) {
49403
- renderVoiceText(desc);
49404
- voice.speakSubordinate(desc, emoCtx2);
49405
- }
49406
- }
49407
- });
49408
49442
  if (isNeovimActive()) {
49409
49443
  const ok = event.success ?? false;
49410
49444
  const prefix = ok ? "\x1B[32m\u2713\x1B[0m" : "\x1B[31m\u2717\x1B[0m";
49411
49445
  const preview = (event.content ?? "").slice(0, 120).replace(/\n/g, " ");
49412
49446
  writeToNeovimOutput(` ${prefix} ${preview}\r
49413
49447
  `);
49448
+ } else {
49449
+ contentWrite(() => {
49450
+ renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "", config.verbose);
49451
+ if (config.verbose && toolDurationMs > 0) {
49452
+ const durStr = toolDurationMs < 1e3 ? `${toolDurationMs}ms` : `${(toolDurationMs / 1e3).toFixed(1)}s`;
49453
+ const sizeStr = resultLen > 0 ? ` | ${resultLen.toLocaleString()} chars (~${Math.ceil(resultLen / 4).toLocaleString()} tokens)` : "";
49454
+ renderVerbose(`${event.toolName ?? "unknown"}: ${durStr}${sizeStr}`);
49455
+ }
49456
+ if (voice?.enabled && event.toolName !== "task_complete" && (voice.voiceMode === "action" || voice.voiceMode === "verbose")) {
49457
+ const emoState2 = emotionEngine?.getState();
49458
+ const emoCtx2 = emoState2 ? { valence: emoState2.valence, arousal: emoState2.arousal, label: emoState2.label, emoji: emoState2.emoji } : void 0;
49459
+ const desc = describeToolResult(event.toolName ?? "unknown", event.success ?? false, vLevel, event.content ?? void 0, emoCtx2, isStark);
49460
+ if (desc) {
49461
+ renderVoiceText(desc);
49462
+ voice.speakSubordinate(desc, emoCtx2);
49463
+ }
49464
+ }
49465
+ });
49414
49466
  }
49415
49467
  break;
49416
49468
  }
49417
49469
  case "model_response":
49418
49470
  statusBar?.recordSpeedTurn();
49419
- if (config.verbose && !stream?.enabled && event.content) {
49471
+ if (!isNeovimActive() && config.verbose && !stream?.enabled && event.content) {
49420
49472
  contentWrite(() => renderAssistantText(event.content));
49421
49473
  }
49422
49474
  break;
49423
49475
  case "stream_start":
49424
49476
  streamStartMs = Date.now();
49425
49477
  streamTextBuffer = "";
49426
- if (stream?.enabled) {
49427
- if (statusBar?.isActive)
49428
- statusBar.beginContentWrite();
49429
- stream.renderer.onStreamStart();
49430
- }
49431
- if (config.verbose) {
49432
- contentWrite(() => renderVerbose(`Stream started (turn ${event.turn ?? "?"})`));
49478
+ if (!isNeovimActive()) {
49479
+ if (stream?.enabled) {
49480
+ if (statusBar?.isActive)
49481
+ statusBar.beginContentWrite();
49482
+ stream.renderer.onStreamStart();
49483
+ }
49484
+ if (config.verbose) {
49485
+ contentWrite(() => renderVerbose(`Stream started (turn ${event.turn ?? "?"})`));
49486
+ }
49487
+ } else {
49488
+ writeToNeovimOutput("\r\n\x1B[36m\u2500\u2500 Stream \u2500\u2500\x1B[0m\r\n");
49433
49489
  }
49434
49490
  break;
49435
49491
  case "stream_token":
49436
- if (stream?.enabled) {
49492
+ if (isNeovimActive()) {
49493
+ if (event.content && (event.streamKind ?? "content") === "content") {
49494
+ writeToNeovimOutput(event.content);
49495
+ }
49496
+ } else if (stream?.enabled) {
49437
49497
  stream.renderer.write(event.content ?? "", event.streamKind ?? "content");
49438
49498
  }
49439
- if (isNeovimActive() && event.content && (event.streamKind ?? "content") === "content") {
49440
- writeToNeovimOutput(event.content);
49441
- }
49442
49499
  if (voice?.enabled && (voice.voiceMode === "chat" || voice.voiceMode === "verbose")) {
49443
49500
  if (event.content && (event.streamKind ?? "content") === "content") {
49444
49501
  streamTextBuffer += event.content;
@@ -49452,10 +49509,20 @@ ${entry.fullContent}`
49452
49509
  case "stream_end": {
49453
49510
  const streamDurationMs = streamStartMs > 0 ? Date.now() - streamStartMs : 0;
49454
49511
  streamStartMs = 0;
49455
- if (stream?.enabled) {
49456
- stream.renderer.onStreamEnd();
49457
- if (statusBar?.isActive)
49458
- statusBar.endContentWrite();
49512
+ if (isNeovimActive()) {
49513
+ writeToNeovimOutput("\r\n");
49514
+ } else {
49515
+ if (stream?.enabled) {
49516
+ stream.renderer.onStreamEnd();
49517
+ if (statusBar?.isActive)
49518
+ statusBar.endContentWrite();
49519
+ }
49520
+ if (config.verbose && streamDurationMs > 0) {
49521
+ const streamChars = event.content?.length ?? 0;
49522
+ const estTokens = Math.ceil(streamChars / 4);
49523
+ const tokPerSec = streamDurationMs > 0 ? (estTokens / (streamDurationMs / 1e3)).toFixed(1) : "?";
49524
+ contentWrite(() => renderVerbose(`Stream ended: ~${estTokens.toLocaleString()} tokens in ${(streamDurationMs / 1e3).toFixed(1)}s (${tokPerSec} tok/s)`));
49525
+ }
49459
49526
  }
49460
49527
  if (voice?.enabled && (voice.voiceMode === "chat" || voice.voiceMode === "verbose")) {
49461
49528
  const chatText = (streamTextBuffer || event.content || "").trim();
@@ -49464,26 +49531,34 @@ ${entry.fullContent}`
49464
49531
  voice.speak(chatText);
49465
49532
  }
49466
49533
  }
49467
- if (config.verbose && streamDurationMs > 0) {
49468
- const streamChars = event.content?.length ?? 0;
49469
- const estTokens = Math.ceil(streamChars / 4);
49470
- const tokPerSec = streamDurationMs > 0 ? (estTokens / (streamDurationMs / 1e3)).toFixed(1) : "?";
49471
- contentWrite(() => renderVerbose(`Stream ended: ~${estTokens.toLocaleString()} tokens in ${(streamDurationMs / 1e3).toFixed(1)}s (${tokPerSec} tok/s)`));
49472
- }
49473
49534
  break;
49474
49535
  }
49475
49536
  case "user_interrupt":
49476
49537
  break;
49477
49538
  case "compaction":
49478
- contentWrite(() => renderWarning(`Context compacted: ${event.content}`));
49539
+ if (isNeovimActive()) {
49540
+ writeToNeovimOutput("\x1B[33m\u26A0 Context compacted\x1B[0m\r\n");
49541
+ } else {
49542
+ contentWrite(() => renderWarning(`Context compacted: ${event.content}`));
49543
+ }
49479
49544
  if (onCompaction)
49480
49545
  onCompaction();
49481
49546
  break;
49482
49547
  case "status":
49483
- contentWrite(() => renderInfo(event.content ?? ""));
49548
+ if (isNeovimActive()) {
49549
+ writeToNeovimOutput(`\x1B[2m${event.content ?? ""}\x1B[0m\r
49550
+ `);
49551
+ } else {
49552
+ contentWrite(() => renderInfo(event.content ?? ""));
49553
+ }
49484
49554
  break;
49485
49555
  case "error":
49486
- contentWrite(() => renderError(event.content ?? "Unknown error"));
49556
+ if (isNeovimActive()) {
49557
+ writeToNeovimOutput(`\x1B[31m\u2717 ${event.content ?? "Unknown error"}\x1B[0m\r
49558
+ `);
49559
+ } else {
49560
+ contentWrite(() => renderError(event.content ?? "Unknown error"));
49561
+ }
49487
49562
  break;
49488
49563
  case "token_usage":
49489
49564
  if (statusBar && event.tokenUsage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.104.6",
3
+ "version": "0.104.8",
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",