open-agents-ai 0.187.77 → 0.187.79

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 +171 -148
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -270921,6 +270921,73 @@ var init_theme = __esm({
270921
270921
  }
270922
270922
  });
270923
270923
 
270924
+ // packages/cli/dist/tui/layout.js
270925
+ function layout() {
270926
+ const rows = _termRows;
270927
+ const cols = _termCols;
270928
+ const fh = _footerHeight;
270929
+ const hh = _headerHeight;
270930
+ const headerTop = 1;
270931
+ const headerContent = 2;
270932
+ const headerBottom = hh;
270933
+ const contentTop = headerBottom + 1;
270934
+ const footerMetrics = rows;
270935
+ const footerBoxBottom = footerMetrics - 1;
270936
+ const footerBoxTop = rows - fh + 1;
270937
+ const footerInput = footerBoxTop + 1;
270938
+ const contentBottom = footerBoxTop - 1;
270939
+ const contentHeight = Math.max(1, contentBottom - contentTop + 1);
270940
+ return {
270941
+ rows,
270942
+ cols,
270943
+ headerTop,
270944
+ headerContent,
270945
+ headerBottom,
270946
+ contentTop,
270947
+ contentBottom,
270948
+ contentHeight,
270949
+ footerBoxTop,
270950
+ footerInput,
270951
+ footerBoxBottom,
270952
+ footerMetrics,
270953
+ scrollRegionTop: contentTop,
270954
+ scrollRegionBottom: contentBottom,
270955
+ footerHeight: fh,
270956
+ headerHeight: _headerHeight
270957
+ };
270958
+ }
270959
+ function setTermSize(rows, cols) {
270960
+ _termRows = rows;
270961
+ _termCols = cols;
270962
+ }
270963
+ function setFooterHeight(height) {
270964
+ _footerHeight = Math.max(FOOTER_MIN_ROWS, height);
270965
+ }
270966
+ function setHeaderHeight(height) {
270967
+ _headerHeight = Math.max(1, height);
270968
+ }
270969
+ function headerHeight() {
270970
+ return _headerHeight;
270971
+ }
270972
+ function termRows() {
270973
+ return _termRows;
270974
+ }
270975
+ function termCols() {
270976
+ return _termCols;
270977
+ }
270978
+ var HEADER_ROWS, FOOTER_MIN_ROWS, _termRows, _termCols, _footerHeight, _headerHeight;
270979
+ var init_layout2 = __esm({
270980
+ "packages/cli/dist/tui/layout.js"() {
270981
+ "use strict";
270982
+ HEADER_ROWS = 3;
270983
+ FOOTER_MIN_ROWS = 4;
270984
+ _termRows = 24;
270985
+ _termCols = 80;
270986
+ _footerHeight = FOOTER_MIN_ROWS;
270987
+ _headerHeight = HEADER_ROWS;
270988
+ }
270989
+ });
270990
+
270924
270991
  // packages/cli/dist/tui/render.js
270925
270992
  function accentFg() {
270926
270993
  const a2 = tuiAccent();
@@ -270972,7 +271039,7 @@ function getColorsEnabled() {
270972
271039
  return _colorsEnabled;
270973
271040
  }
270974
271041
  function getTermWidth() {
270975
- return process.stdout.columns ?? 80;
271042
+ return termCols();
270976
271043
  }
270977
271044
  function formatMarkdownLine(line) {
270978
271045
  const headingMatch = line.match(/^(#{1,6})\s+(.*)/);
@@ -271490,6 +271557,7 @@ var init_render = __esm({
271490
271557
  "packages/cli/dist/tui/render.js"() {
271491
271558
  "use strict";
271492
271559
  init_theme();
271560
+ init_layout2();
271493
271561
  isTTY2 = process.stdout.isTTY ?? false;
271494
271562
  c3 = {
271495
271563
  bold: (t2) => ansi2("1", t2),
@@ -278086,60 +278154,6 @@ var init_daemon_registry = __esm({
278086
278154
  }
278087
278155
  });
278088
278156
 
278089
- // packages/cli/dist/tui/layout.js
278090
- function layout() {
278091
- const rows = _termRows;
278092
- const cols = _termCols;
278093
- const fh = _footerHeight;
278094
- const headerTop = 1;
278095
- const headerContent = 2;
278096
- const headerBottom = 3;
278097
- const contentTop = headerBottom + 1;
278098
- const footerMetrics = rows;
278099
- const footerBoxBottom = footerMetrics - 1;
278100
- const footerBoxTop = rows - fh + 1;
278101
- const footerInput = footerBoxTop + 1;
278102
- const contentBottom = footerBoxTop - 1;
278103
- const contentHeight = Math.max(1, contentBottom - contentTop + 1);
278104
- return {
278105
- rows,
278106
- cols,
278107
- headerTop,
278108
- headerContent,
278109
- headerBottom,
278110
- contentTop,
278111
- contentBottom,
278112
- contentHeight,
278113
- footerBoxTop,
278114
- footerInput,
278115
- footerBoxBottom,
278116
- footerMetrics,
278117
- scrollRegionTop: contentTop,
278118
- scrollRegionBottom: contentBottom,
278119
- footerHeight: fh,
278120
- headerHeight: _headerHeight
278121
- };
278122
- }
278123
- function setTermSize(rows, cols) {
278124
- _termRows = rows;
278125
- _termCols = cols;
278126
- }
278127
- function setFooterHeight(height) {
278128
- _footerHeight = Math.max(FOOTER_MIN_ROWS, height);
278129
- }
278130
- var HEADER_ROWS, FOOTER_MIN_ROWS, _termRows, _termCols, _footerHeight, _headerHeight;
278131
- var init_layout2 = __esm({
278132
- "packages/cli/dist/tui/layout.js"() {
278133
- "use strict";
278134
- HEADER_ROWS = 3;
278135
- FOOTER_MIN_ROWS = 4;
278136
- _termRows = 24;
278137
- _termCols = 80;
278138
- _footerHeight = FOOTER_MIN_ROWS;
278139
- _headerHeight = HEADER_ROWS;
278140
- }
278141
- });
278142
-
278143
278157
  // packages/cli/dist/tui/status-bar.js
278144
278158
  var status_bar_exports = {};
278145
278159
  __export(status_bar_exports, {
@@ -278513,7 +278527,7 @@ var init_status_bar = __esm({
278513
278527
  refreshHeaderContent() {
278514
278528
  if (!this.active)
278515
278529
  return;
278516
- const w = process.stdout.columns ?? 80;
278530
+ const w = termCols();
278517
278531
  const innerW = w - 2;
278518
278532
  const panel = this._headerPanels[this._headerPanelIndex];
278519
278533
  if (!panel)
@@ -278522,14 +278536,15 @@ var init_status_bar = __esm({
278522
278536
  const hasMultiple = this._headerPanels.length > 1;
278523
278537
  const leftArrow = hasMultiple ? `\x1B]8;;oa-cmd:header-prev\x07\x1B[38;5;${TEXT_DIM}m${this._headerPanelIndex > 0 ? "\u25C0" : " "}\x1B]8;;\x07` : " ";
278524
278538
  const rightArrow = hasMultiple ? `\x1B]8;;oa-cmd:header-next\x07\x1B[38;5;${TEXT_DIM}m${this._headerPanelIndex < this._headerPanels.length - 1 ? "\u25B6" : " "}\x1B]8;;\x07` : " ";
278539
+ const hdrRow = layout().headerContent;
278525
278540
  let buf = "\x1B7";
278526
- buf += `\x1B[2;1H${PANEL_BG_SEQ}\x1B[2K`;
278541
+ buf += `\x1B[${hdrRow};1H${PANEL_BG_SEQ}\x1B[2K`;
278527
278542
  buf += `${BOX_FG}\u2502${RESET}${PANEL_BG_SEQ}`;
278528
278543
  buf += leftArrow;
278529
278544
  buf += ` `;
278530
278545
  buf += `\x1B[38;5;${TEXT_PRIMARY}m${PANEL_BG_SEQ}`;
278531
278546
  buf += content;
278532
- buf += `\x1B[2;${w - 2}H`;
278547
+ buf += `\x1B[${hdrRow};${w - 2}H`;
278533
278548
  buf += rightArrow;
278534
278549
  buf += ` ${BOX_FG}\u2502${RESET}`;
278535
278550
  buf += "\x1B8";
@@ -279101,8 +279116,9 @@ var init_status_bar = __esm({
279101
279116
  startedAt: Date.now()
279102
279117
  });
279103
279118
  }
279104
- this._prevTermRows = process.stdout.rows ?? 24;
279105
- this._prevTermCols = process.stdout.columns ?? 80;
279119
+ setTermSize(process.stdout.rows ?? 24, process.stdout.columns ?? 80);
279120
+ this._prevTermRows = termRows();
279121
+ this._prevTermCols = termCols();
279106
279122
  this.applyScrollRegion(true);
279107
279123
  this.fillContentArea();
279108
279124
  this.renderFooterAndPositionInput();
@@ -279125,8 +279141,7 @@ var init_status_bar = __esm({
279125
279141
  this._processing = false;
279126
279142
  }
279127
279143
  this.stopAllMetrics();
279128
- const rows = process.stdout.rows ?? 24;
279129
- this.termWrite(`\x1B[1;${rows}r`);
279144
+ this.termWrite(`\x1B[1;${termRows()}r`);
279130
279145
  }
279131
279146
  /** Whether the status bar is currently active */
279132
279147
  get isActive() {
@@ -279237,8 +279252,7 @@ var init_status_bar = __esm({
279237
279252
  }
279238
279253
  /** Handle mouse click on a suggestion row */
279239
279254
  suggestClickAt(row) {
279240
- const rows = process.stdout.rows ?? 24;
279241
- const pos = this.rowPositions(rows);
279255
+ const pos = this.rowPositions(termRows());
279242
279256
  if (pos.suggestStartRow <= 0 || this._suggestions.length === 0)
279243
279257
  return false;
279244
279258
  const idx = row - pos.suggestStartRow;
@@ -279394,7 +279408,7 @@ var init_status_bar = __esm({
279394
279408
  handlePointerEvent(type, col, row) {
279395
279409
  if (!this.active)
279396
279410
  return;
279397
- const w = process.stdout.columns ?? 80;
279411
+ const w = termCols();
279398
279412
  if (type === "press" && this._suggestions.length > 0) {
279399
279413
  if (this.suggestClickAt(row))
279400
279414
  return;
@@ -279429,8 +279443,7 @@ var init_status_bar = __esm({
279429
279443
  }
279430
279444
  return;
279431
279445
  }
279432
- const rows = process.stdout.rows ?? 24;
279433
- const pos = this.rowPositions(rows);
279446
+ const pos = this.rowPositions(termRows());
279434
279447
  if (type === "press" && pos.tabBarRow > 0 && row === pos.tabBarRow) {
279435
279448
  const viewId = this.hitTestTabBar(col);
279436
279449
  if (viewId)
@@ -279438,7 +279451,7 @@ var init_status_bar = __esm({
279438
279451
  return;
279439
279452
  }
279440
279453
  const fh = this._currentFooterHeight;
279441
- const footerStart = rows - fh + 1;
279454
+ const footerStart = termRows() - fh + 1;
279442
279455
  if (row >= footerStart)
279443
279456
  return;
279444
279457
  }
@@ -279449,8 +279462,7 @@ var init_status_bar = __esm({
279449
279462
  const ok = this._textSelection.copyToClipboard();
279450
279463
  this._textSelection.clear();
279451
279464
  this.repaintContent();
279452
- const rows = process.stdout.rows ?? 24;
279453
- const pos = this.rowPositions(rows);
279465
+ const pos = this.rowPositions(termRows());
279454
279466
  const writer = this._origWrite ?? process.stdout.write.bind(process.stdout);
279455
279467
  if (ok) {
279456
279468
  writer(`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;${TEXT_PRIMARY}m \u2713 Copied to clipboard\x1B[0m`);
@@ -279466,8 +279478,7 @@ var init_status_bar = __esm({
279466
279478
  /** Arm block (rectangular) selection mode — next click starts block select */
279467
279479
  armBlockSelection() {
279468
279480
  this._textSelection.armBlockMode();
279469
- const rows = process.stdout.rows ?? 24;
279470
- const pos = this.rowPositions(rows);
279481
+ const pos = this.rowPositions(termRows());
279471
279482
  const writer = this._origWrite ?? process.stdout.write.bind(process.stdout);
279472
279483
  writer(`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;${TEXT_PRIMARY}m \u25A0 Block selection mode \u2014 click and drag\x1B[0m`);
279473
279484
  setTimeout(() => {
@@ -279629,7 +279640,7 @@ var init_status_bar = __esm({
279629
279640
  * overlay UIs (tuiSelect, /expose dashboard, etc.) should use.
279630
279641
  */
279631
279642
  get availableContentRows() {
279632
- const rows = process.stdout.rows ?? 24;
279643
+ const rows = termRows();
279633
279644
  const usable = rows - (this.scrollRegionTop - 1) - this._currentFooterHeight;
279634
279645
  return Math.max(3, usable);
279635
279646
  }
@@ -279650,11 +279661,12 @@ var init_status_bar = __esm({
279650
279661
  _handleResizeImmediate() {
279651
279662
  if (!this.active)
279652
279663
  return;
279664
+ setTermSize(process.stdout.rows ?? 24, process.stdout.columns ?? 80);
279653
279665
  const prevRows = this._prevTermRows;
279654
279666
  const prevCols = this._prevTermCols;
279655
279667
  this.updateFooterHeight();
279656
- const rows = process.stdout.rows ?? 24;
279657
- const cols = process.stdout.columns ?? 80;
279668
+ const rows = termRows();
279669
+ const cols = termCols();
279658
279670
  this._prevTermRows = rows;
279659
279671
  this._prevTermCols = cols;
279660
279672
  const pos = this.rowPositions(rows);
@@ -279782,12 +279794,11 @@ ${CONTENT_BG_SEQ}`);
279782
279794
  /** Record a content line for scrollback. Called by the stream renderer intercept. */
279783
279795
  /** Paint the entire content area with CONTENT_BG — called on activation and resize */
279784
279796
  fillContentArea() {
279785
- const rows = process.stdout.rows ?? 24;
279786
279797
  const h = this.contentHeight;
279787
279798
  let buf = "\x1B7\x1B[?25l";
279788
279799
  for (let r2 = 0; r2 < h; r2++) {
279789
279800
  const screenRow = this.scrollRegionTop + r2;
279790
- if (screenRow > rows)
279801
+ if (screenRow > termRows())
279791
279802
  break;
279792
279803
  buf += `\x1B[${screenRow};1H${CONTENT_BG_SEQ}\x1B[2K`;
279793
279804
  }
@@ -279825,8 +279836,7 @@ ${CONTENT_BG_SEQ}`);
279825
279836
  }
279826
279837
  /** Number of visible content rows */
279827
279838
  get contentHeight() {
279828
- const rows = process.stdout.rows ?? 24;
279829
- return Math.max(1, rows - (this.scrollRegionTop - 1) - this._currentFooterHeight);
279839
+ return Math.max(1, termRows() - (this.scrollRegionTop - 1) - this._currentFooterHeight);
279830
279840
  }
279831
279841
  /** Whether user has scrolled back from live */
279832
279842
  get isScrolledBack() {
@@ -279881,7 +279891,7 @@ ${CONTENT_BG_SEQ}`);
279881
279891
  const h = this.contentHeight;
279882
279892
  const totalLines = this._contentLines.length;
279883
279893
  const startIdx = Math.max(0, totalLines - h - this._contentScrollOffset);
279884
- const w = process.stdout.columns ?? 80;
279894
+ const w = termCols();
279885
279895
  let buf = "\x1B[?2026h";
279886
279896
  buf += "\x1B7";
279887
279897
  buf += "\x1B[?25l";
@@ -280370,8 +280380,7 @@ ${CONTENT_BG_SEQ}`);
280370
280380
  /** Set the DECSTBM scroll region to exclude the dynamic footer rows */
280371
280381
  applyScrollRegion(clearScrollback = false) {
280372
280382
  this.updateFooterHeight();
280373
- const rows = process.stdout.rows ?? 24;
280374
- const pos = this.rowPositions(rows);
280383
+ const pos = this.rowPositions(termRows());
280375
280384
  this.termWrite(`\x1B[${this.scrollRegionTop};${pos.scrollEnd}r\x1B[${pos.scrollEnd};1H` + (clearScrollback ? "\x1B[3J" : ""));
280376
280385
  }
280377
280386
  /**
@@ -280386,7 +280395,7 @@ ${CONTENT_BG_SEQ}`);
280386
280395
  renderFooterAndPositionInput() {
280387
280396
  if (!this.active || this._resizing)
280388
280397
  return;
280389
- const rows = process.stdout.rows ?? 24;
280398
+ const rows = termRows();
280390
280399
  const w = getTermWidth();
280391
280400
  const oldFooterHeight = this._currentFooterHeight;
280392
280401
  const heightChanged = this.updateFooterHeight(w);
@@ -280475,9 +280484,8 @@ ${CONTENT_BG_SEQ}`);
280475
280484
  }
280476
280485
  return;
280477
280486
  }
280478
- const rows = process.stdout.rows ?? 24;
280479
280487
  const w = getTermWidth();
280480
- const pos = this.rowPositions(rows);
280488
+ const pos = this.rowPositions(termRows());
280481
280489
  let buf = "\x1B7\x1B[?7l";
280482
280490
  if (pos.tabBarRow > 0) {
280483
280491
  buf += `\x1B[${pos.tabBarRow};1H${PANEL_BG_SEQ}\x1B[2K${RESET}`;
@@ -280511,7 +280519,7 @@ ${CONTENT_BG_SEQ}`);
280511
280519
  renderInputRowDuringStream() {
280512
280520
  if (!this.active || this._resizing || !this.inputStateProvider)
280513
280521
  return;
280514
- const rows = process.stdout.rows ?? 24;
280522
+ const rows = termRows();
280515
280523
  const w = getTermWidth();
280516
280524
  const oldFooterHeight = this._currentFooterHeight;
280517
280525
  const heightChanged = this.updateFooterHeight(w);
@@ -280738,8 +280746,7 @@ ${CONTENT_BG_SEQ}`);
280738
280746
  const nextLines = Math.ceil((line.length + 1) / avail);
280739
280747
  if (nextLines > currentLines) {
280740
280748
  self2.updateFooterHeight();
280741
- const rows = process.stdout.rows ?? 24;
280742
- const pos = self2.rowPositions(rows);
280749
+ const pos = self2.rowPositions(termRows());
280743
280750
  const writer = self2._origWrite ?? process.stdout.write.bind(process.stdout);
280744
280751
  writer(`\x1B[${self2.scrollRegionTop};${pos.scrollEnd}r`);
280745
280752
  self2.renderFooterAndPositionInput();
@@ -280974,7 +280981,7 @@ function tuiSelect(opts) {
280974
280981
  const reservedTopBottom = 0;
280975
280982
  const hasCrumbs = opts.breadcrumbs && opts.breadcrumbs.length > 0;
280976
280983
  const selectChrome = (hasCrumbs ? 11 : 10) + 1;
280977
- const contentArea = opts.availableRows ? opts.availableRows + reservedTopBottom : process.stdout.rows ?? 24;
280984
+ const contentArea = opts.availableRows ? opts.availableRows + reservedTopBottom : termRows();
280978
280985
  let maxVisible = opts.maxVisible ?? Math.max(3, contentArea - selectChrome);
280979
280986
  let scrollOffset = 0;
280980
280987
  let lastRenderedLines = 0;
@@ -281013,7 +281020,7 @@ function tuiSelect(opts) {
281013
281020
  }
281014
281021
  const hasBreadcrumbs = opts.breadcrumbs && opts.breadcrumbs.length > 0;
281015
281022
  function render() {
281016
- const currentRows = process.stdout.rows ?? 24;
281023
+ const currentRows = termRows();
281017
281024
  if (!opts.maxVisible) {
281018
281025
  maxVisible = Math.max(3, currentRows - selectChrome);
281019
281026
  }
@@ -281483,6 +281490,7 @@ var init_tui_select = __esm({
281483
281490
  "use strict";
281484
281491
  init_overlay_lock();
281485
281492
  init_theme();
281493
+ init_layout2();
281486
281494
  isTTY3 = process.stdout.isTTY ?? false;
281487
281495
  selectColors = {
281488
281496
  orange: (t2) => fg2562(208, t2),
@@ -284470,8 +284478,8 @@ function showDropPanel(opts) {
284470
284478
  let errorMsg = "";
284471
284479
  function render() {
284472
284480
  overlayWrite("\x1B[H\x1B[2J");
284473
- const cols = process.stdout.columns ?? 80;
284474
- const rows = process.stdout.rows ?? 24;
284481
+ const cols = termCols();
284482
+ const rows = termRows();
284475
284483
  const textWidth = Math.max(10, cols - 9);
284476
284484
  const innerSpace = Math.max(10, cols - 6);
284477
284485
  const content = [];
@@ -284589,6 +284597,7 @@ var init_drop_panel = __esm({
284589
284597
  "packages/cli/dist/tui/drop-panel.js"() {
284590
284598
  "use strict";
284591
284599
  init_overlay_lock();
284600
+ init_layout2();
284592
284601
  isTTY4 = process.stdout.isTTY ?? false;
284593
284602
  dc = {
284594
284603
  bold: (t2) => ansi4("1", t2),
@@ -284662,9 +284671,9 @@ async function startNeovimMode(opts) {
284662
284671
  const topOffset = opts.topOffset ?? 0;
284663
284672
  const ptyRows = Math.max(5, opts.contentRows);
284664
284673
  if (topOffset > 0 && isTTY5) {
284665
- const termRows = process.stdout.rows ?? 24;
284666
- const bottomBound = Math.min(termRows, topOffset + ptyRows);
284667
- process.stdout.write(`\x1B[${topOffset + 1};${bottomBound}r\x1B[${topOffset + 1};1H`);
284674
+ const L = layout();
284675
+ const bottomBound = Math.min(L.rows, topOffset + ptyRows);
284676
+ process.stdout.write(`\x1B[${L.contentTop};${bottomBound}r\x1B[${L.contentTop};1H`);
284668
284677
  }
284669
284678
  const initVimCmd = "let g:loaded_netrwPlugin=1 | let g:loaded_netrw=1 | set mouse=a autoread updatetime=300 signcolumn=no noswapfile | hi WinSeparator guifg=#000000 guibg=#000000 ctermfg=0 ctermbg=0 | hi VertSplit guifg=#000000 guibg=#000000 ctermfg=0 ctermbg=0 | hi StatusLine guifg=#bcbcbc guibg=#000000 ctermfg=250 ctermbg=0 | hi StatusLineNC guifg=#585858 guibg=#000000 ctermfg=240 ctermbg=0 | hi NeoTreeWinSeparator guifg=#000000 guibg=#000000 ctermfg=0 ctermbg=0";
284670
284679
  const luaBootstrap = "lua " + [
@@ -285053,8 +285062,7 @@ function doCleanup(state) {
285053
285062
  }
285054
285063
  }
285055
285064
  _state = null;
285056
- const termRows = process.stdout.rows ?? 24;
285057
- 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`);
285065
+ 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`);
285058
285066
  state.opts.onExit?.();
285059
285067
  }
285060
285068
  var isTTY5, PTY_MODE_ENABLE_RE, STDIN_MOUSE_FOCUS_RE, _state;
@@ -285062,6 +285070,7 @@ var init_neovim_mode = __esm({
285062
285070
  "packages/cli/dist/tui/neovim-mode.js"() {
285063
285071
  "use strict";
285064
285072
  init_setup();
285073
+ init_layout2();
285065
285074
  isTTY5 = process.stdout.isTTY ?? false;
285066
285075
  PTY_MODE_ENABLE_RE = /\x1B\[\?(?:1004|2004)h/g;
285067
285076
  STDIN_MOUSE_FOCUS_RE = /\x1B\[<[\d;]+[Mm]|\x1B\[M[\s\S]{3}|\x1B\[[IO]|\x1BO[ABCD]/g;
@@ -285435,7 +285444,7 @@ function getPreset2(id) {
285435
285444
  }
285436
285445
  function presetToBannerDesign(presetId, sponsorName, message2) {
285437
285446
  const preset = getPreset2(presetId);
285438
- const width = process.stdout.columns ?? 80;
285447
+ const width = termCols();
285439
285448
  const frames = preset ? preset.generate(width) : generateWave(width);
285440
285449
  if (sponsorName) {
285441
285450
  const nameText = ` \u2726 ${sponsorName}`;
@@ -285498,7 +285507,7 @@ function renderPreviewToString(presetId, width, sponsorName, message2) {
285498
285507
  }
285499
285508
  return lines.join("\n");
285500
285509
  }
285501
- async function generateCustomAnim(prompt, ollamaUrl, model, width = process.stdout.columns ?? 80, frameCount = 8) {
285510
+ async function generateCustomAnim(prompt, ollamaUrl, model, width = termCols(), frameCount = 8) {
285502
285511
  const genWidth = 40;
285503
285512
  const systemPrompt = `Generate ${frameCount} animation frames for a terminal banner. Each frame: 3 rows, each row exactly ${genWidth} characters. Use: \u2591\u2592\u2593\u2588\u25CF\u2605\u2726\u25A0\xB7 and spaces. Respond ONLY with a JSON array.
285504
285513
 
@@ -285587,7 +285596,7 @@ RULES: Each row EXACTLY ${genWidth} chars. Pad with spaces. Each frame is ["row1
285587
285596
  return null;
285588
285597
  }
285589
285598
  }
285590
- async function generateCustomAnimWithFallback(prompt, ollamaUrl, preferredModel, width = process.stdout.columns ?? 80, frameCount = 8, onStatus) {
285599
+ async function generateCustomAnimWithFallback(prompt, ollamaUrl, preferredModel, width = termCols(), frameCount = 8, onStatus) {
285591
285600
  onStatus?.(`Generating animation with ${preferredModel}...`);
285592
285601
  const result1 = await generateCustomAnim(prompt, ollamaUrl, preferredModel, width, frameCount);
285593
285602
  if (result1)
@@ -285616,6 +285625,7 @@ var ROWS, ANIM_PRESETS;
285616
285625
  var init_sponsor_anims = __esm({
285617
285626
  "packages/cli/dist/tui/sponsor-anims.js"() {
285618
285627
  "use strict";
285628
+ init_layout2();
285619
285629
  ROWS = 3;
285620
285630
  ANIM_PRESETS = [
285621
285631
  { id: "wave", name: "Wave", desc: "Flowing wave pattern", generate: generateWave },
@@ -285992,7 +286002,7 @@ async function stepBanner(config, rl, availableRows) {
285992
286002
  },
285993
286003
  onCustomKey: (item, key, _helpers) => {
285994
286004
  if ((key === "p" || key === "P") && ANIM_PRESETS2.some((p2) => p2.id === item.key)) {
285995
- const width = process.stdout.columns ?? 80;
286005
+ const width = termCols();
285996
286006
  const preview = renderPreviewToString(item.key, width, config.header?.message || "Sponsor Preview", config.header?.linkText || void 0);
285997
286007
  process.stdout.write("\n" + preview + "\n\n");
285998
286008
  return true;
@@ -286002,7 +286012,7 @@ async function stepBanner(config, rl, availableRows) {
286002
286012
  });
286003
286013
  if (!result.confirmed)
286004
286014
  return false;
286005
- const previewWidth = process.stdout.columns ?? 80;
286015
+ const previewWidth = termCols();
286006
286016
  const previewStr = renderPreviewToString(config.banner.preset, previewWidth, config.header?.message || "Sponsor Preview", config.header?.linkText || void 0);
286007
286017
  process.stdout.write("\n" + previewStr + "\n\n");
286008
286018
  if (result.key === "next")
@@ -286519,6 +286529,7 @@ var init_sponsor_wizard = __esm({
286519
286529
  init_tui_select();
286520
286530
  init_render();
286521
286531
  init_sponsor_anims();
286532
+ init_layout2();
286522
286533
  COLOR_PRESETS = [
286523
286534
  { name: "Amber", code: 214 },
286524
286535
  { name: "Cyan", code: 51 },
@@ -291094,14 +291105,15 @@ Clone a new voice: /voice clone <wav-file> [name]`);
291094
291105
  renderInfo("Neovim mode stopped. Main waterfall restored.");
291095
291106
  } else {
291096
291107
  ctx3.retireCarousel?.();
291097
- const contentRows = ctx3.availableContentRows?.() ?? Math.max(5, (process.stdout.rows ?? 24) - 6);
291098
- const cols = process.stdout.columns ?? 80;
291108
+ const L = layout();
291109
+ const contentRows = ctx3.availableContentRows?.() ?? Math.max(5, L.contentHeight);
291110
+ const cols = termCols();
291099
291111
  const err = await startNeovimMode({
291100
291112
  cwd: ctx3.repoRoot,
291101
291113
  contentRows,
291102
291114
  cols,
291103
- topOffset: 3,
291104
- // start below 3-row banner
291115
+ topOffset: headerHeight(),
291116
+ // start below header (banner/carousel)
291105
291117
  rl: ctx3.rl,
291106
291118
  initialFile: arg || void 0,
291107
291119
  onExit: () => {
@@ -294183,7 +294195,7 @@ async function handleUpdate(subcommand, ctx3) {
294183
294195
  const centerCol = Math.floor(cols / 2);
294184
294196
  const boxW = Math.min(50, cols - 4);
294185
294197
  const boxH = 5;
294186
- const boxTop = centerRow - Math.floor(boxH / 2);
294198
+ const boxTop = Math.max(contentTop, Math.min(centerRow - Math.floor(boxH / 2), contentBottom - boxH + 1));
294187
294199
  const boxLeft = centerCol - Math.floor(boxW / 2);
294188
294200
  const innerW = boxW - 2;
294189
294201
  buf += `\x1B[${boxTop};${boxLeft}H${boxFg}\u256D${"\u2500".repeat(innerW)}\u256E`;
@@ -294894,8 +294906,8 @@ async function showExposeDashboard(gateway, rl, ctx3) {
294894
294906
  }
294895
294907
  return;
294896
294908
  }
294897
- const cols = () => process.stdout.columns ?? 80;
294898
- const rows = () => process.stdout.rows ?? 24;
294909
+ const cols = () => termCols();
294910
+ const rows = () => termRows();
294899
294911
  const peerLedColor = (peerIdx) => {
294900
294912
  const stops = [51, 81, 111, 141, 171, 201];
294901
294913
  const code8 = stops[Math.min(peerIdx, stops.length - 1)] ?? 51;
@@ -296202,6 +296214,7 @@ var isTTY6, PHRASES, Carousel;
296202
296214
  var init_carousel = __esm({
296203
296215
  "packages/cli/dist/tui/carousel.js"() {
296204
296216
  "use strict";
296217
+ init_layout2();
296205
296218
  isTTY6 = process.stdout.isTTY ?? false;
296206
296219
  PHRASES = [
296207
296220
  // English
@@ -296285,7 +296298,7 @@ var init_carousel = __esm({
296285
296298
  started = false;
296286
296299
  resizeHandler = null;
296287
296300
  constructor(customPhrases) {
296288
- this.width = process.stdout.columns ?? 80;
296301
+ this.width = termCols();
296289
296302
  const bank = customPhrases && customPhrases.length > 0 ? customPhrases : PHRASES;
296290
296303
  const indices0 = Array.from({ length: bank.length }, (_, i2) => i2).sort(() => Math.random() - 0.5);
296291
296304
  const indices1 = Array.from({ length: bank.length }, (_, i2) => i2).sort(() => Math.random() - 0.5);
@@ -296314,15 +296327,16 @@ var init_carousel = __esm({
296314
296327
  if (!isTTY6)
296315
296328
  return 0;
296316
296329
  this.started = true;
296317
- const termRows = process.stdout.rows ?? 24;
296318
- process.stdout.write("\x1B[1;1H");
296330
+ setHeaderHeight(this.reservedRows);
296331
+ const L = layout();
296332
+ process.stdout.write(`\x1B[${L.headerTop};1H`);
296319
296333
  for (let i2 = 0; i2 < this.reservedRows; i2++) {
296320
296334
  process.stdout.write("\x1B[2K\n");
296321
296335
  }
296322
- process.stdout.write(`\x1B[${this.reservedRows + 1};${termRows}r`);
296323
- process.stdout.write(`\x1B[${this.reservedRows + 1};1H`);
296336
+ process.stdout.write(`\x1B[${L.contentTop};${L.rows}r`);
296337
+ process.stdout.write(`\x1B[${L.contentTop};1H`);
296324
296338
  this.resizeHandler = () => {
296325
- this.width = process.stdout.columns ?? 80;
296339
+ this.width = termCols();
296326
296340
  this.rebuildRibbons();
296327
296341
  };
296328
296342
  process.stdout.on("resize", this.resizeHandler);
@@ -296345,13 +296359,14 @@ var init_carousel = __esm({
296345
296359
  renderFrame() {
296346
296360
  if (!isTTY6)
296347
296361
  return;
296362
+ const L = layout();
296348
296363
  let buf = "\x1B7";
296349
296364
  buf += "\x1B[?7l";
296350
296365
  for (let i2 = 0; i2 < this.rows.length; i2++) {
296351
296366
  const line = this.extractWindow(this.rows[i2]);
296352
- buf += `\x1B[${i2 + 1};1H\x1B[2K${line}`;
296367
+ buf += `\x1B[${L.headerTop + i2};1H\x1B[2K${line}`;
296353
296368
  }
296354
- buf += `\x1B[4;1H\x1B[2K`;
296369
+ buf += `\x1B[${L.headerBottom};1H\x1B[2K`;
296355
296370
  buf += "\x1B[?7h";
296356
296371
  buf += "\x1B8";
296357
296372
  process.stdout.write(buf);
@@ -296425,10 +296440,12 @@ var init_carousel = __esm({
296425
296440
  }
296426
296441
  if (!isTTY6 || !this.started)
296427
296442
  return;
296443
+ const L = layout();
296428
296444
  let buf = "\x1B7";
296429
296445
  for (let i2 = 0; i2 < this.reservedRows; i2++) {
296430
- buf += `\x1B[${i2 + 1};1H\x1B[2K`;
296446
+ buf += `\x1B[${L.headerTop + i2};1H\x1B[2K`;
296431
296447
  }
296448
+ setHeaderHeight(HEADER_ROWS);
296432
296449
  buf += "\x1B[r";
296433
296450
  buf += "\x1B8";
296434
296451
  process.stdout.write(buf);
@@ -296481,8 +296498,8 @@ function getNodeMnemonic() {
296481
296498
  }
296482
296499
  }
296483
296500
  function createDefaultBanner(version4 = "0.120.0") {
296484
- const width = process.stdout.columns ?? 80;
296485
- const rows = 3;
296501
+ const width = termCols();
296502
+ const rows = headerHeight();
296486
296503
  const yellow = tuiAccent() < 0 ? -1 : tuiAccent();
296487
296504
  const bgBlack = tuiBg() < 0 ? -1 : tuiBg();
296488
296505
  const grid = [];
@@ -296522,8 +296539,8 @@ function createDefaultBanner(version4 = "0.120.0") {
296522
296539
  };
296523
296540
  }
296524
296541
  function createCohereBanner() {
296525
- const width = process.stdout.columns ?? 80;
296526
- const rows = 3;
296542
+ const width = termCols();
296543
+ const rows = headerHeight();
296527
296544
  const grid = [];
296528
296545
  const bgColor = 0;
296529
296546
  const fgColor = 226;
@@ -296556,8 +296573,8 @@ function createCohereBanner() {
296556
296573
  };
296557
296574
  }
296558
296575
  function createSponsorBanner(sponsorName, tagline, primaryColor = 214, bgColor = 0) {
296559
- const width = process.stdout.columns ?? 80;
296560
- const rows = 3;
296576
+ const width = termCols();
296577
+ const rows = headerHeight();
296561
296578
  const grid = [];
296562
296579
  for (let r2 = 0; r2 < rows; r2++) {
296563
296580
  const row = [];
@@ -296642,7 +296659,7 @@ function fillGridRegion(grid, startRow, startCol, endRow, endCol, cell) {
296642
296659
  }
296643
296660
  }
296644
296661
  function createAnimatedBanner(id, name10, frameBuilders, frameDurationMs, author = "user") {
296645
- const width = process.stdout.columns ?? 80;
296662
+ const width = termCols();
296646
296663
  return {
296647
296664
  id,
296648
296665
  name: name10,
@@ -296662,6 +296679,7 @@ var init_banner = __esm({
296662
296679
  "packages/cli/dist/tui/banner.js"() {
296663
296680
  "use strict";
296664
296681
  init_theme();
296682
+ init_layout2();
296665
296683
  isTTY7 = process.stdout.isTTY ?? false;
296666
296684
  MNEMONIC_ADJECTIVES = [
296667
296685
  "swift",
@@ -296753,7 +296771,9 @@ var init_banner = __esm({
296753
296771
  timer = null;
296754
296772
  frameTick = 0;
296755
296773
  width;
296756
- rows = 3;
296774
+ get rows() {
296775
+ return headerHeight();
296776
+ }
296757
296777
  /** Callback fired after every frame render — used for header button overlay */
296758
296778
  onAfterRender = null;
296759
296779
  /** When set, the version text on row 1 becomes a pulsing UPDATE button */
@@ -296763,7 +296783,7 @@ var init_banner = __esm({
296763
296783
  /** Whether header zone is focused (Ctrl+Tab highlight) */
296764
296784
  _focused = false;
296765
296785
  constructor() {
296766
- this.width = process.stdout.columns ?? 80;
296786
+ this.width = termCols();
296767
296787
  }
296768
296788
  /** Signal that an update is available — enables pulsing UPDATE badge on row 1 */
296769
296789
  setUpdateAvailable(latestVersion) {
@@ -296787,7 +296807,7 @@ var init_banner = __esm({
296787
296807
  this.currentDesign = design;
296788
296808
  this.currentFrame = 0;
296789
296809
  this.frameTick = 0;
296790
- this.width = process.stdout.columns ?? 80;
296810
+ this.width = termCols();
296791
296811
  }
296792
296812
  /** Get current design */
296793
296813
  getDesign() {
@@ -296804,7 +296824,7 @@ var init_banner = __esm({
296804
296824
  } else if (this.currentDesign.type === "cohere") {
296805
296825
  this.currentDesign = createCohereBanner();
296806
296826
  }
296807
- this.width = process.stdout.columns ?? 80;
296827
+ this.width = termCols();
296808
296828
  this.renderCurrentFrame();
296809
296829
  }
296810
296830
  /**
@@ -296818,7 +296838,7 @@ var init_banner = __esm({
296818
296838
  return 0;
296819
296839
  this.renderCurrentFrame();
296820
296840
  this._resizeHandler = () => {
296821
- this.width = process.stdout.columns ?? 80;
296841
+ this.width = termCols();
296822
296842
  if (this.currentDesign) {
296823
296843
  if (this.currentDesign.type === "default") {
296824
296844
  const version4 = this.currentDesign.version ?? "0.0.0";
@@ -296826,8 +296846,8 @@ var init_banner = __esm({
296826
296846
  } else if (this.currentDesign.type === "cohere") {
296827
296847
  this.currentDesign = createCohereBanner();
296828
296848
  }
296829
- const newRows = process.stdout.rows ?? 24;
296830
- process.stdout.write(`\x1B[${this.rows + 2};${newRows}r`);
296849
+ const L = layout();
296850
+ process.stdout.write(`\x1B[${L.contentTop};${L.rows}r`);
296831
296851
  this.renderCurrentFrame();
296832
296852
  }
296833
296853
  };
@@ -296860,10 +296880,11 @@ var init_banner = __esm({
296860
296880
  const frame = this.currentDesign.frames[this.currentFrame];
296861
296881
  if (!frame)
296862
296882
  return;
296863
- this.width = process.stdout.columns ?? 80;
296883
+ this.width = termCols();
296864
296884
  let buf = "\x1B[?2026h";
296885
+ const L = layout();
296865
296886
  for (let r2 = 0; r2 < this.rows; r2++) {
296866
- buf += `\x1B[${r2 + 1};1H${tuiBg() >= 0 ? `\x1B[48;5;${tuiBg()}m` : "\x1B[49m"}\x1B[2K`;
296887
+ buf += `\x1B[${L.headerTop + r2};1H${tuiBg() >= 0 ? `\x1B[48;5;${tuiBg()}m` : "\x1B[49m"}\x1B[2K`;
296867
296888
  const row = frame.grid[r2];
296868
296889
  if (!row)
296869
296890
  continue;
@@ -296898,16 +296919,15 @@ var init_banner = __esm({
296898
296919
  }
296899
296920
  if (this.onAfterRender)
296900
296921
  this.onAfterRender();
296901
- const termRows = process.stdout.rows ?? 24;
296902
- const inputRow = termRows - 2;
296922
+ const Lp = layout();
296903
296923
  try {
296904
- process.stdout.write(`\x1B[${inputRow};1H\x1B[?2026l`);
296924
+ process.stdout.write(`\x1B[${Lp.footerInput};1H\x1B[?2026l`);
296905
296925
  } catch {
296906
296926
  }
296907
296927
  }
296908
296928
  /** Handle terminal resize */
296909
296929
  handleResize() {
296910
- this.width = process.stdout.columns ?? 80;
296930
+ this.width = termCols();
296911
296931
  if (this.currentDesign) {
296912
296932
  if (this.currentDesign.type === "cohere") {
296913
296933
  this.currentDesign = createCohereBanner();
@@ -297292,6 +297312,7 @@ var isTTY8, PASTEL, StreamRenderer;
297292
297312
  var init_stream_renderer = __esm({
297293
297313
  "packages/cli/dist/tui/stream-renderer.js"() {
297294
297314
  "use strict";
297315
+ init_layout2();
297295
297316
  isTTY8 = process.stdout.isTTY ?? false;
297296
297317
  PASTEL = {
297297
297318
  key: 222,
@@ -297540,7 +297561,7 @@ var init_stream_renderer = __esm({
297540
297561
  rendered = this.highlightJson(raw, true);
297541
297562
  break;
297542
297563
  case "content": {
297543
- const maxW = (process.stdout.columns ?? 80) - 6;
297564
+ const maxW = termCols() - 6;
297544
297565
  if (this.inCodeBlock) {
297545
297566
  const cropped = raw.length > maxW ? raw.slice(0, maxW - 3) + "..." : raw;
297546
297567
  if (this.codeLang === "diff" || this.codeLang === "patch") {
@@ -297746,7 +297767,7 @@ var init_stream_renderer = __esm({
297746
297767
  return boldText(fg2563(colors2[level - 1] ?? 147, text));
297747
297768
  }
297748
297769
  if (/^[-*_]{3,}\s*$/.test(line)) {
297749
- const w = (process.stdout.columns ?? 80) - 10;
297770
+ const w = termCols() - 10;
297750
297771
  return fg2563(PASTEL.hr, "\u2500".repeat(Math.min(w, 60)));
297751
297772
  }
297752
297773
  if (/^>\s?/.test(line)) {
@@ -308768,10 +308789,11 @@ async function startInteractive(config, repoPath) {
308768
308789
  }
308769
308790
  let restoredSessionContext = null;
308770
308791
  if (process.stdout.isTTY) {
308792
+ setTermSize(process.stdout.rows ?? 24, process.stdout.columns ?? 80);
308771
308793
  process.stdout.write("\x1B[2J\x1B[3J\x1B]50;ClearScrollback\x07\x1B[H");
308772
308794
  process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?1049h" + // enter alternate screen buffer
308773
308795
  tuiBgSeq() + // theme bg for content area
308774
- `\x1B[2J\x1B[3J\x1B[H\x1B[1;${process.stdout.rows ?? 24}r\x1B[?25l`);
308796
+ `\x1B[2J\x1B[3J\x1B[H\x1B[1;${termRows()}r\x1B[?25l`);
308775
308797
  const restoreScreen = () => {
308776
308798
  process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?25h\x1B[?1049l");
308777
308799
  };
@@ -309470,9 +309492,8 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
309470
309492
  const { MouseFilterStream: MouseFilterStream2 } = await Promise.resolve().then(() => (init_mouse_filter(), mouse_filter_exports));
309471
309493
  let origTtyWriteRef = null;
309472
309494
  const mouseFilter = new MouseFilterStream2((direction, lines, row) => {
309473
- const rows = process.stdout.rows ?? 24;
309474
309495
  const fh = statusBar._currentFooterHeight ?? 3;
309475
- const footerStart = rows - fh + 1;
309496
+ const footerStart = termRows() - fh + 1;
309476
309497
  if (row >= footerStart) {
309477
309498
  const arrowKey = direction === "up" ? { name: "up" } : { name: "down" };
309478
309499
  const arrowSeq = direction === "up" ? "\x1B[A" : "\x1B[B";
@@ -309590,14 +309611,15 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
309590
309611
  }
309591
309612
  process.stdout.on("resize", () => {
309592
309613
  statusBar.handleResize();
309614
+ setTermSize(process.stdout.rows ?? 24, process.stdout.columns ?? 80);
309593
309615
  if (isNeovimActive()) {
309594
- const contentRows = statusBar.isActive ? statusBar.availableContentRows : Math.max(5, (process.stdout.rows ?? 24) - 6);
309595
- resizeNeovim(process.stdout.columns ?? 80, contentRows);
309616
+ const contentRows = statusBar.isActive ? statusBar.availableContentRows : Math.max(5, termRows() - 6);
309617
+ resizeNeovim(termCols(), contentRows);
309596
309618
  }
309597
309619
  if (!carouselRetired && !isNeovimActive()) {
309598
- const termRows = process.stdout.rows ?? 24;
309620
+ const tr = termRows();
309599
309621
  const scrollStart = carousel.reservedRows + 1;
309600
- const scrollEnd = Math.max(termRows - statusBar.reservedRows, scrollStart + 1);
309622
+ const scrollEnd = Math.max(tr - statusBar.reservedRows, scrollStart + 1);
309601
309623
  let clearBuf = "";
309602
309624
  for (let r2 = scrollStart; r2 <= scrollEnd; r2++) {
309603
309625
  clearBuf += `\x1B[${r2};1H\x1B[2K`;
@@ -311206,7 +311228,7 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
311206
311228
  return true;
311207
311229
  },
311208
311230
  availableContentRows() {
311209
- return statusBar.isActive ? statusBar.availableContentRows : Math.max(3, (process.stdout.rows ?? 24) - 6);
311231
+ return statusBar.isActive ? statusBar.availableContentRows : Math.max(3, termRows() - 6);
311210
311232
  },
311211
311233
  showPrompt() {
311212
311234
  showPrompt();
@@ -312546,6 +312568,7 @@ var init_interactive = __esm({
312546
312568
  init_config();
312547
312569
  init_updater();
312548
312570
  init_commands();
312571
+ init_layout2();
312549
312572
  init_setup();
312550
312573
  init_model_picker();
312551
312574
  init_project_context();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.77",
3
+ "version": "0.187.79",
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",