open-agents-ai 0.138.93 → 0.138.94

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 +104 -101
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -54545,120 +54545,123 @@ ${CONTENT_BG_SEQ}`);
54545
54545
  let sawEscape = false;
54546
54546
  let sawEscapeTime = 0;
54547
54547
  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)
54548
+ try {
54549
+ if (!self.active)
54550
+ return origTtyWrite(s, key);
54551
+ if (key?.name === "backspace" && self.inputStateProvider) {
54552
+ const { cursor = 0 } = self.inputStateProvider() ?? {};
54553
+ if (cursor <= 0)
54554
+ return;
54555
+ }
54556
+ if (key?.ctrl && key?.name === "o" && onCtrlO) {
54557
+ onCtrlO();
54553
54558
  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);
54559
+ }
54560
+ if (key?.ctrl && key?.shift && key?.name === "c") {
54561
+ self.copySelection();
54592
54562
  return;
54593
54563
  }
54594
- if (s === "[5~" || s === "[6~") {
54595
- if (s === "[5~")
54596
- self.pageUpContent();
54597
- else
54598
- self.pageDownContent();
54564
+ if (s === "\x1B[67;6u") {
54565
+ self.copySelection();
54599
54566
  return;
54600
54567
  }
54601
- if (s.startsWith("["))
54568
+ if (key?.ctrl && key?.shift && key?.name === "b") {
54569
+ self.armBlockSelection();
54602
54570
  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);
54571
+ }
54572
+ if (s === "\x1B[66;6u") {
54573
+ self.armBlockSelection();
54611
54574
  return;
54612
54575
  }
54613
- if (self._contentScrollOffset > 0) {
54614
- if (key.name === "up")
54615
- self.scrollContentUp(1);
54616
- else
54617
- self.scrollContentDown(1);
54576
+ if (s && (/\x1B\[</.test(s) || /^\d+;\d+;\d*[Mm]/.test(s) || /^;\d+[Mm]/.test(s) || /\[<\d/.test(s))) {
54618
54577
  return;
54619
54578
  }
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("[")))
54579
+ if (key?.name === "escape" || s === "\x1B") {
54580
+ sawEscape = true;
54581
+ sawEscapeTime = Date.now();
54582
+ if (onEscape && s.length === 1)
54583
+ onEscape();
54640
54584
  return;
54641
- if (key?.name === "escape")
54585
+ }
54586
+ if (sawEscape && Date.now() - sawEscapeTime < 100) {
54587
+ sawEscape = false;
54588
+ if (s === "[A" || s === "[B") {
54589
+ if (s === "[A")
54590
+ self.scrollContentUp(1);
54591
+ else
54592
+ self.scrollContentDown(1);
54593
+ return;
54594
+ }
54595
+ if (s === "[5~" || s === "[6~") {
54596
+ if (s === "[5~")
54597
+ self.pageUpContent();
54598
+ else
54599
+ self.pageDownContent();
54600
+ return;
54601
+ }
54602
+ if (s.startsWith("["))
54603
+ return;
54604
+ }
54605
+ sawEscape = false;
54606
+ if (key?.name === "up" || key?.name === "down") {
54607
+ if (self.writeDepth > 0) {
54608
+ if (key.name === "up")
54609
+ self.scrollContentUp(1);
54610
+ else
54611
+ self.scrollContentDown(1);
54612
+ return;
54613
+ }
54614
+ if (self._contentScrollOffset > 0) {
54615
+ if (key.name === "up")
54616
+ self.scrollContentUp(1);
54617
+ else
54618
+ self.scrollContentDown(1);
54619
+ return;
54620
+ }
54621
+ return origTtyWrite(s, key);
54622
+ }
54623
+ if (key?.name === "pageup" || s === "\x1B[5~") {
54624
+ self.pageUpContent();
54642
54625
  return;
54643
- origTtyWrite(s, key);
54644
- return;
54626
+ }
54627
+ if (key?.name === "pagedown" || s === "\x1B[6~") {
54628
+ self.pageDownContent();
54629
+ return;
54630
+ }
54631
+ if (key?.shift && key?.name === "up" || s === "\x1B[1;2A") {
54632
+ self.scrollContentUp(3);
54633
+ return;
54634
+ }
54635
+ if (key?.shift && key?.name === "down" || s === "\x1B[1;2B") {
54636
+ self.scrollContentDown(3);
54637
+ return;
54638
+ }
54639
+ if (self.writeDepth > 0) {
54640
+ if (s && (s.startsWith("\x1B") || s.startsWith("[")))
54641
+ return;
54642
+ if (key?.name === "escape")
54643
+ return;
54644
+ origTtyWrite(s, key);
54645
+ return;
54646
+ }
54647
+ if (self.inputStateProvider && (key?.name !== "return" && key?.name !== "enter" && key?.name !== "backspace")) {
54648
+ const { line = "" } = self.inputStateProvider() ?? {};
54649
+ const w = getTermWidth();
54650
+ const avail = Math.max(1, w - self.promptWidth);
54651
+ const currentLines = Math.ceil(Math.max(1, line.length) / avail);
54652
+ const nextLines = Math.ceil((line.length + 1) / avail);
54653
+ if (nextLines > currentLines) {
54654
+ self.updateFooterHeight();
54655
+ const rows = process.stdout.rows ?? 24;
54656
+ const pos = self.rowPositions(rows);
54657
+ const writer = self._origWrite ?? process.stdout.write.bind(process.stdout);
54658
+ writer(`\x1B[${self.scrollRegionTop};${pos.scrollEnd}r`);
54659
+ self.renderFooterAndPositionInput();
54660
+ }
54661
+ }
54662
+ return origTtyWrite(s, key);
54663
+ } catch {
54645
54664
  }
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
54665
  };
54663
54666
  }
54664
54667
  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.94",
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",