open-agents-ai 0.138.93 → 0.138.95

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 +136 -107
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38556,8 +38556,14 @@ async function startNeovimMode(opts) {
38556
38556
  } catch {
38557
38557
  }
38558
38558
  const ptyCols = opts.cols;
38559
+ const topOffset = opts.topOffset ?? 0;
38559
38560
  const ptyRows = Math.max(5, opts.contentRows);
38560
- const initVimCmd = "let g:loaded_netrwPlugin=1 | let g:loaded_netrw=1 | set mouse= autoread updatetime=300 signcolumn=no noswapfile";
38561
+ if (topOffset > 0 && isTTY5) {
38562
+ const termRows = process.stdout.rows ?? 24;
38563
+ const bottomBound = Math.min(termRows, topOffset + ptyRows);
38564
+ process.stdout.write(`\x1B[${topOffset + 1};${bottomBound}r\x1B[${topOffset + 1};1H`);
38565
+ }
38566
+ const initVimCmd = "let g:loaded_netrwPlugin=1 | let g:loaded_netrw=1 | set mouse=a autoread updatetime=300 signcolumn=no noswapfile | hi WinSeparator guifg=#1c1c1c guibg=#1c1c1c ctermfg=234 ctermbg=234 | hi VertSplit guifg=#1c1c1c guibg=#1c1c1c ctermfg=234 ctermbg=234 | hi StatusLine guifg=#bcbcbc guibg=#1c1c1c ctermfg=250 ctermbg=234 | hi StatusLineNC guifg=#585858 guibg=#1c1c1c ctermfg=240 ctermbg=234 | hi NeoTreeWinSeparator guifg=#1c1c1c guibg=#1c1c1c ctermfg=234 ctermbg=234";
38561
38567
  const luaBootstrap = "lua " + [
38562
38568
  'local lp = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"',
38563
38569
  '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',
@@ -38603,9 +38609,12 @@ async function startNeovimMode(opts) {
38603
38609
  nvimPty.onData((data) => {
38604
38610
  if (state.cleanedUp)
38605
38611
  return;
38606
- const filtered = data.replace(PTY_MODE_ENABLE_RE, "");
38612
+ let filtered = data.replace(PTY_MODE_ENABLE_RE, "");
38607
38613
  if (!filtered)
38608
38614
  return;
38615
+ if (topOffset > 0) {
38616
+ filtered = filtered.replace(/\x1B\[(\d+)(;\d+)?H/g, (_m, row, col) => `\x1B[${parseInt(row) + topOffset}${col ?? ""}H`);
38617
+ }
38609
38618
  if (!state.focused) {
38610
38619
  process.stdout.write("\x1B7" + filtered + "\x1B8");
38611
38620
  } else {
@@ -38644,8 +38653,22 @@ async function startNeovimMode(opts) {
38644
38653
  return;
38645
38654
  }
38646
38655
  if (state.focused) {
38647
- const normalized = seq.replace(/\x1BO([ABCD])/g, "\x1B[$1");
38648
- nvimPty.write(normalized);
38656
+ let normalized = seq.replace(/\x1BO([ABCD])/g, "\x1B[$1");
38657
+ if (topOffset > 0) {
38658
+ normalized = normalized.replace(/\x1B\[<(\d+);(\d+);(\d+)([Mm])/g, (_m, btn, col, row, suffix) => {
38659
+ const hostRow = parseInt(row);
38660
+ if (parseInt(btn) === 0 && suffix === "M" && hostRow > topOffset + ptyRows) {
38661
+ toggleFocus(state);
38662
+ return "";
38663
+ }
38664
+ if (hostRow <= topOffset)
38665
+ return "";
38666
+ const nvimRow = hostRow - topOffset;
38667
+ return `\x1B[<${btn};${col};${nvimRow}${suffix}`;
38668
+ });
38669
+ }
38670
+ if (normalized)
38671
+ nvimPty.write(normalized);
38649
38672
  }
38650
38673
  };
38651
38674
  stdin.on("data", state.stdinHandler);
@@ -38873,7 +38896,8 @@ function doCleanup(state) {
38873
38896
  }
38874
38897
  }
38875
38898
  _state = null;
38876
- process.stdout.write("\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?1004l\x1B[?2004l\x1B[H\x1B[J");
38899
+ const termRows = process.stdout.rows ?? 24;
38900
+ process.stdout.write(`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?1004l\x1B[?2004l\x1B[1;${termRows}r\x1B[H\x1B[J`);
38877
38901
  state.opts.onExit?.();
38878
38902
  }
38879
38903
  var isTTY5, PTY_MODE_ENABLE_RE, STDIN_MOUSE_FOCUS_RE, _state;
@@ -38882,7 +38906,7 @@ var init_neovim_mode = __esm({
38882
38906
  "use strict";
38883
38907
  init_setup();
38884
38908
  isTTY5 = process.stdout.isTTY ?? false;
38885
- PTY_MODE_ENABLE_RE = /\x1B\[\?(?:1000|1002|1003|1004|1005|1006|1015|2004)h/g;
38909
+ PTY_MODE_ENABLE_RE = /\x1B\[\?(?:1004|2004)h/g;
38886
38910
  STDIN_MOUSE_FOCUS_RE = /\x1B\[<[\d;]+[Mm]|\x1B\[M[\s\S]{3}|\x1B\[[IO]|\x1BO[ABCD]/g;
38887
38911
  _state = null;
38888
38912
  }
@@ -42203,6 +42227,8 @@ async function handleSlashCommand(input, ctx) {
42203
42227
  cwd: ctx.repoRoot,
42204
42228
  contentRows,
42205
42229
  cols,
42230
+ topOffset: 3,
42231
+ // start below 3-row banner
42206
42232
  rl: ctx.rl,
42207
42233
  initialFile: arg || void 0,
42208
42234
  onExit: () => {
@@ -54545,120 +54571,123 @@ ${CONTENT_BG_SEQ}`);
54545
54571
  let sawEscape = false;
54546
54572
  let sawEscapeTime = 0;
54547
54573
  rl._ttyWrite = function(s, key) {
54548
- if (!self.active)
54549
- return origTtyWrite(s, key);
54550
- if (key?.name === "backspace" && self.inputStateProvider) {
54551
- const { cursor = 0 } = self.inputStateProvider() ?? {};
54552
- if (cursor <= 0)
54574
+ try {
54575
+ if (!self.active)
54576
+ return origTtyWrite(s, key);
54577
+ if (key?.name === "backspace" && self.inputStateProvider) {
54578
+ const { cursor = 0 } = self.inputStateProvider() ?? {};
54579
+ if (cursor <= 0)
54580
+ return;
54581
+ }
54582
+ if (key?.ctrl && key?.name === "o" && onCtrlO) {
54583
+ onCtrlO();
54553
54584
  return;
54554
- }
54555
- if (key?.ctrl && key?.name === "o" && onCtrlO) {
54556
- onCtrlO();
54557
- return;
54558
- }
54559
- if (key?.ctrl && key?.shift && key?.name === "c") {
54560
- self.copySelection();
54561
- return;
54562
- }
54563
- if (s === "\x1B[67;6u") {
54564
- self.copySelection();
54565
- return;
54566
- }
54567
- if (key?.ctrl && key?.shift && key?.name === "b") {
54568
- self.armBlockSelection();
54569
- return;
54570
- }
54571
- if (s === "\x1B[66;6u") {
54572
- self.armBlockSelection();
54573
- return;
54574
- }
54575
- if (s && (/\x1B\[</.test(s) || /^\d+;\d+;\d*[Mm]/.test(s) || /^;\d+[Mm]/.test(s) || /\[<\d/.test(s))) {
54576
- return;
54577
- }
54578
- if (key?.name === "escape" || s === "\x1B") {
54579
- sawEscape = true;
54580
- sawEscapeTime = Date.now();
54581
- if (onEscape && s.length === 1)
54582
- onEscape();
54583
- return;
54584
- }
54585
- if (sawEscape && Date.now() - sawEscapeTime < 100) {
54586
- sawEscape = false;
54587
- if (s === "[A" || s === "[B") {
54588
- if (s === "[A")
54589
- self.scrollContentUp(1);
54590
- else
54591
- self.scrollContentDown(1);
54585
+ }
54586
+ if (key?.ctrl && key?.shift && key?.name === "c") {
54587
+ self.copySelection();
54592
54588
  return;
54593
54589
  }
54594
- if (s === "[5~" || s === "[6~") {
54595
- if (s === "[5~")
54596
- self.pageUpContent();
54597
- else
54598
- self.pageDownContent();
54590
+ if (s === "\x1B[67;6u") {
54591
+ self.copySelection();
54599
54592
  return;
54600
54593
  }
54601
- if (s.startsWith("["))
54594
+ if (key?.ctrl && key?.shift && key?.name === "b") {
54595
+ self.armBlockSelection();
54602
54596
  return;
54603
- }
54604
- sawEscape = false;
54605
- if (key?.name === "up" || key?.name === "down") {
54606
- if (self.writeDepth > 0) {
54607
- if (key.name === "up")
54608
- self.scrollContentUp(1);
54609
- else
54610
- self.scrollContentDown(1);
54597
+ }
54598
+ if (s === "\x1B[66;6u") {
54599
+ self.armBlockSelection();
54611
54600
  return;
54612
54601
  }
54613
- if (self._contentScrollOffset > 0) {
54614
- if (key.name === "up")
54615
- self.scrollContentUp(1);
54616
- else
54617
- self.scrollContentDown(1);
54602
+ if (s && (/\x1B\[</.test(s) || /^\d+;\d+;\d*[Mm]/.test(s) || /^;\d+[Mm]/.test(s) || /\[<\d/.test(s))) {
54618
54603
  return;
54619
54604
  }
54620
- return origTtyWrite(s, key);
54621
- }
54622
- if (key?.name === "pageup" || s === "\x1B[5~") {
54623
- self.pageUpContent();
54624
- return;
54625
- }
54626
- if (key?.name === "pagedown" || s === "\x1B[6~") {
54627
- self.pageDownContent();
54628
- return;
54629
- }
54630
- if (key?.shift && key?.name === "up" || s === "\x1B[1;2A") {
54631
- self.scrollContentUp(3);
54632
- return;
54633
- }
54634
- if (key?.shift && key?.name === "down" || s === "\x1B[1;2B") {
54635
- self.scrollContentDown(3);
54636
- return;
54637
- }
54638
- if (self.writeDepth > 0) {
54639
- if (s && (s.startsWith("\x1B") || s.startsWith("[")))
54605
+ if (key?.name === "escape" || s === "\x1B") {
54606
+ sawEscape = true;
54607
+ sawEscapeTime = Date.now();
54608
+ if (onEscape && s.length === 1)
54609
+ onEscape();
54640
54610
  return;
54641
- if (key?.name === "escape")
54611
+ }
54612
+ if (sawEscape && Date.now() - sawEscapeTime < 100) {
54613
+ sawEscape = false;
54614
+ if (s === "[A" || s === "[B") {
54615
+ if (s === "[A")
54616
+ self.scrollContentUp(1);
54617
+ else
54618
+ self.scrollContentDown(1);
54619
+ return;
54620
+ }
54621
+ if (s === "[5~" || s === "[6~") {
54622
+ if (s === "[5~")
54623
+ self.pageUpContent();
54624
+ else
54625
+ self.pageDownContent();
54626
+ return;
54627
+ }
54628
+ if (s.startsWith("["))
54629
+ return;
54630
+ }
54631
+ sawEscape = false;
54632
+ if (key?.name === "up" || key?.name === "down") {
54633
+ if (self.writeDepth > 0) {
54634
+ if (key.name === "up")
54635
+ self.scrollContentUp(1);
54636
+ else
54637
+ self.scrollContentDown(1);
54638
+ return;
54639
+ }
54640
+ if (self._contentScrollOffset > 0) {
54641
+ if (key.name === "up")
54642
+ self.scrollContentUp(1);
54643
+ else
54644
+ self.scrollContentDown(1);
54645
+ return;
54646
+ }
54647
+ return origTtyWrite(s, key);
54648
+ }
54649
+ if (key?.name === "pageup" || s === "\x1B[5~") {
54650
+ self.pageUpContent();
54642
54651
  return;
54643
- origTtyWrite(s, key);
54644
- return;
54652
+ }
54653
+ if (key?.name === "pagedown" || s === "\x1B[6~") {
54654
+ self.pageDownContent();
54655
+ return;
54656
+ }
54657
+ if (key?.shift && key?.name === "up" || s === "\x1B[1;2A") {
54658
+ self.scrollContentUp(3);
54659
+ return;
54660
+ }
54661
+ if (key?.shift && key?.name === "down" || s === "\x1B[1;2B") {
54662
+ self.scrollContentDown(3);
54663
+ return;
54664
+ }
54665
+ if (self.writeDepth > 0) {
54666
+ if (s && (s.startsWith("\x1B") || s.startsWith("[")))
54667
+ return;
54668
+ if (key?.name === "escape")
54669
+ return;
54670
+ origTtyWrite(s, key);
54671
+ return;
54672
+ }
54673
+ if (self.inputStateProvider && (key?.name !== "return" && key?.name !== "enter" && key?.name !== "backspace")) {
54674
+ const { line = "" } = self.inputStateProvider() ?? {};
54675
+ const w = getTermWidth();
54676
+ const avail = Math.max(1, w - self.promptWidth);
54677
+ const currentLines = Math.ceil(Math.max(1, line.length) / avail);
54678
+ const nextLines = Math.ceil((line.length + 1) / avail);
54679
+ if (nextLines > currentLines) {
54680
+ self.updateFooterHeight();
54681
+ const rows = process.stdout.rows ?? 24;
54682
+ const pos = self.rowPositions(rows);
54683
+ const writer = self._origWrite ?? process.stdout.write.bind(process.stdout);
54684
+ writer(`\x1B[${self.scrollRegionTop};${pos.scrollEnd}r`);
54685
+ self.renderFooterAndPositionInput();
54686
+ }
54687
+ }
54688
+ return origTtyWrite(s, key);
54689
+ } catch {
54645
54690
  }
54646
- if (self.inputStateProvider && (key?.name !== "return" && key?.name !== "enter" && key?.name !== "backspace")) {
54647
- const { line = "" } = self.inputStateProvider() ?? {};
54648
- const w = getTermWidth();
54649
- const avail = Math.max(1, w - self.promptWidth);
54650
- const currentLines = Math.ceil(Math.max(1, line.length) / avail);
54651
- const nextLines = Math.ceil((line.length + 1) / avail);
54652
- if (nextLines > currentLines) {
54653
- self.updateFooterHeight();
54654
- const rows = process.stdout.rows ?? 24;
54655
- const pos = self.rowPositions(rows);
54656
- const writer = self._origWrite ?? process.stdout.write.bind(process.stdout);
54657
- writer(`\x1B[${self.scrollRegionTop};${pos.scrollEnd}r`);
54658
- self.renderFooterAndPositionInput();
54659
- }
54660
- }
54661
- return origTtyWrite(s, key);
54662
54691
  };
54663
54692
  }
54664
54693
  hookStdin() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.138.93",
3
+ "version": "0.138.95",
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",