open-agents-ai 0.138.1 → 0.138.3

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 +147 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -39875,20 +39875,30 @@ if __name__ == '__main__':
39875
39875
  }
39876
39876
  if (!existsSync35(wavPath))
39877
39877
  return;
39878
- if (volume !== 1) {
39879
- try {
39880
- const wavData = readFileSync24(wavPath);
39881
- if (wavData.length > 44) {
39882
- const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
39878
+ try {
39879
+ const wavData = readFileSync24(wavPath);
39880
+ if (wavData.length > 44) {
39881
+ const sampleRate = wavData.readUInt32LE(24);
39882
+ const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
39883
+ const fadeInSamples = Math.min(Math.round(sampleRate * 0.2), samples.length);
39884
+ for (let i = 0; i < fadeInSamples; i++) {
39885
+ samples[i] = Math.round(samples[i] * (i / fadeInSamples));
39886
+ }
39887
+ const fadeOutSamples = Math.min(Math.round(sampleRate * 0.05), samples.length);
39888
+ const fadeOutStart = samples.length - fadeOutSamples;
39889
+ for (let i = 0; i < fadeOutSamples; i++) {
39890
+ samples[fadeOutStart + i] = Math.round(samples[fadeOutStart + i] * (1 - i / fadeOutSamples));
39891
+ }
39892
+ if (volume !== 1) {
39883
39893
  for (let i = 0; i < samples.length; i++) {
39884
39894
  samples[i] = Math.round(samples[i] * volume);
39885
39895
  }
39886
- const header = wavData.subarray(0, 44);
39887
- const scaled = Buffer.concat([header, Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)]);
39888
- writeFileSync14(wavPath, scaled);
39889
39896
  }
39890
- } catch {
39897
+ const header = wavData.subarray(0, 44);
39898
+ const scaled = Buffer.concat([header, Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)]);
39899
+ writeFileSync14(wavPath, scaled);
39891
39900
  }
39901
+ } catch {
39892
39902
  }
39893
39903
  if (pitchFactor !== 1) {
39894
39904
  try {
@@ -39936,6 +39946,7 @@ if __name__ == '__main__':
39936
39946
  }
39937
39947
  }
39938
39948
  await this.playWav(wavPath);
39949
+ await this.sleep(80);
39939
39950
  try {
39940
39951
  unlinkSync8(wavPath);
39941
39952
  } catch {
@@ -45151,6 +45162,8 @@ var init_stream_renderer = __esm({
45151
45162
  startTime = 0;
45152
45163
  /** Track if we're mid-tool-arg display */
45153
45164
  inToolArgs = false;
45165
+ /** Optional callback to capture rendered lines for scrollback buffer */
45166
+ onRenderedLine = null;
45154
45167
  /**
45155
45168
  * Track accumulated content size for JSON blob detection.
45156
45169
  * When a non-newline JSON blob exceeds this threshold, suppress rendering.
@@ -45338,9 +45351,18 @@ var init_stream_renderer = __esm({
45338
45351
  this.writeRaw(dimText(prefix) + rendered + (hasNewline ? "\n" : ""));
45339
45352
  this.lineStarted = !hasNewline;
45340
45353
  }
45341
- /** Write raw ANSI text to stdout */
45354
+ /** Write raw ANSI text to stdout and capture for scrollback */
45342
45355
  writeRaw(text) {
45343
45356
  process.stdout.write(text);
45357
+ if (this.onRenderedLine) {
45358
+ const parts = text.split("\n");
45359
+ for (let i = 0; i < parts.length - 1; i++) {
45360
+ this.onRenderedLine(parts[i]);
45361
+ }
45362
+ if (parts.length === 1 && parts[0].length > 0) {
45363
+ this.onRenderedLine(parts[0]);
45364
+ }
45365
+ }
45344
45366
  }
45345
45367
  /** Flush partial buffer (non-newline-terminated tokens) */
45346
45368
  flushPartial(kind) {
@@ -50755,6 +50777,12 @@ var init_status_bar = __esm({
50755
50777
  };
50756
50778
  active = false;
50757
50779
  scrollRegionTop = 1;
50780
+ // Virtual scrollback buffer — stores content lines for Page Up/Down scrolling.
50781
+ // Since we're in alternate screen buffer, there's no native scrollback.
50782
+ _contentLines = [];
50783
+ _contentScrollOffset = 0;
50784
+ // 0 = live (bottom), >0 = scrolled back
50785
+ _contentMaxLines = 1e4;
50758
50786
  stdinHooked = false;
50759
50787
  /** COHERE distributed cognitive commons active flag */
50760
50788
  _cohereActive = false;
@@ -51496,6 +51524,76 @@ var init_status_bar = __esm({
51496
51524
  this.renderFooterAndPositionInput();
51497
51525
  }
51498
51526
  }
51527
+ // -----------------------------------------------------------------------
51528
+ // Content scrollback — virtual scroll through buffered output lines
51529
+ // -----------------------------------------------------------------------
51530
+ /** Record a content line for scrollback. Called by the stream renderer intercept. */
51531
+ bufferContentLine(line) {
51532
+ this._contentLines.push(line);
51533
+ if (this._contentLines.length > this._contentMaxLines) {
51534
+ this._contentLines.splice(0, this._contentLines.length - this._contentMaxLines);
51535
+ if (this._contentScrollOffset > 0) {
51536
+ this._contentScrollOffset = Math.min(this._contentScrollOffset, Math.max(0, this._contentLines.length - this.contentHeight));
51537
+ }
51538
+ }
51539
+ }
51540
+ /** Number of visible content rows */
51541
+ get contentHeight() {
51542
+ const rows = process.stdout.rows ?? 24;
51543
+ return Math.max(1, rows - (this.scrollRegionTop - 1) - this._currentFooterHeight);
51544
+ }
51545
+ /** Whether user has scrolled back from live */
51546
+ get isScrolledBack() {
51547
+ return this._contentScrollOffset > 0;
51548
+ }
51549
+ /** Scroll up through content history */
51550
+ scrollContentUp(lines = 1) {
51551
+ if (!this.active)
51552
+ return;
51553
+ const maxOffset = Math.max(0, this._contentLines.length - this.contentHeight);
51554
+ this._contentScrollOffset = Math.min(maxOffset, this._contentScrollOffset + lines);
51555
+ this.repaintContent();
51556
+ }
51557
+ /** Scroll down through content history */
51558
+ scrollContentDown(lines = 1) {
51559
+ if (!this.active)
51560
+ return;
51561
+ this._contentScrollOffset = Math.max(0, this._contentScrollOffset - lines);
51562
+ this.repaintContent();
51563
+ }
51564
+ /** Page up — scroll by visible height */
51565
+ pageUpContent() {
51566
+ this.scrollContentUp(Math.max(1, this.contentHeight - 2));
51567
+ }
51568
+ /** Page down — scroll by visible height */
51569
+ pageDownContent() {
51570
+ this.scrollContentDown(Math.max(1, this.contentHeight - 2));
51571
+ }
51572
+ /** Jump to live (End key) */
51573
+ jumpToLive() {
51574
+ this._contentScrollOffset = 0;
51575
+ this.repaintContent();
51576
+ }
51577
+ /** Repaint content area from buffer at current scroll position.
51578
+ * Uses direct cursor positioning (btop-style) — no DECSTBM scrolling. */
51579
+ repaintContent() {
51580
+ const h = this.contentHeight;
51581
+ const totalLines = this._contentLines.length;
51582
+ const startIdx = Math.max(0, totalLines - h - this._contentScrollOffset);
51583
+ let buf = "\x1B7\x1B[?25l";
51584
+ for (let row = 0; row < h; row++) {
51585
+ const lineIdx = startIdx + row;
51586
+ const line = lineIdx < totalLines ? this._contentLines[lineIdx] : "";
51587
+ const screenRow = this.scrollRegionTop + row;
51588
+ buf += `\x1B[${screenRow};1H\x1B[2K${line}`;
51589
+ }
51590
+ if (this._contentScrollOffset > 0) {
51591
+ const linesAbove = Math.max(0, totalLines - h - this._contentScrollOffset);
51592
+ buf += `\x1B[${this.scrollRegionTop};1H\x1B[7m \u2191 ${linesAbove} lines above (PgDn/End to return) \x1B[0m`;
51593
+ }
51594
+ buf += "\x1B8\x1B[?25h";
51595
+ process.stdout.write(buf);
51596
+ }
51499
51597
  /**
51500
51598
  * Clear the input row and position cursor there at column 1.
51501
51599
  * Used by showPrompt() before readline writes the prompt.
@@ -52914,9 +53012,23 @@ ${entry.fullContent}`
52914
53012
  return;
52915
53013
  }
52916
53014
  if (statusBar?.isActive) {
53015
+ const origWrite = process.stdout.write;
53016
+ const boundWrite = origWrite.bind(process.stdout);
53017
+ process.stdout.write = ((chunk, ...args) => {
53018
+ const text = typeof chunk === "string" ? chunk : new TextDecoder().decode(chunk);
53019
+ for (const line of text.split("\n")) {
53020
+ if (line.length > 0)
53021
+ statusBar.bufferContentLine(line);
53022
+ }
53023
+ return boundWrite(chunk, ...args);
53024
+ });
52917
53025
  statusBar.beginContentWrite();
52918
- fn();
52919
- statusBar.endContentWrite();
53026
+ try {
53027
+ fn();
53028
+ } finally {
53029
+ process.stdout.write = origWrite;
53030
+ statusBar.endContentWrite();
53031
+ }
52920
53032
  } else {
52921
53033
  fn();
52922
53034
  }
@@ -53481,6 +53593,7 @@ async function startInteractive(config, repoPath) {
53481
53593
  let adminSessionKey = null;
53482
53594
  const callSubAgents = /* @__PURE__ */ new Map();
53483
53595
  const streamRenderer = new StreamRenderer();
53596
+ streamRenderer.onRenderedLine = (line) => statusBar.bufferContentLine(line);
53484
53597
  if (savedSettings.voice) {
53485
53598
  voiceEngine.toggle().catch((err) => {
53486
53599
  const msg = err instanceof Error ? err.message : String(err);
@@ -55844,6 +55957,28 @@ ${c2.dim("(Use /quit to exit)")}
55844
55957
  process.stdin.on("keypress", (_str, key) => {
55845
55958
  if (!key)
55846
55959
  return;
55960
+ if (key.name === "pageup" || key.shift && key.name === "up") {
55961
+ statusBar.pageUpContent();
55962
+ return;
55963
+ }
55964
+ if (key.name === "pagedown" || key.shift && key.name === "down") {
55965
+ statusBar.pageDownContent();
55966
+ return;
55967
+ }
55968
+ if (key.name === "end" && key.ctrl) {
55969
+ statusBar.jumpToLive();
55970
+ return;
55971
+ }
55972
+ if (key.sequence) {
55973
+ if (key.sequence.includes("[<65;") || key.sequence === "\x1B[A" && key.shift) {
55974
+ statusBar.scrollContentUp(3);
55975
+ return;
55976
+ }
55977
+ if (key.sequence.includes("[<64;") || key.sequence === "\x1B[B" && key.shift) {
55978
+ statusBar.scrollContentDown(3);
55979
+ return;
55980
+ }
55981
+ }
55847
55982
  if (key.name === "escape" && activeTask) {
55848
55983
  if (!activeTask.runner.isPaused) {
55849
55984
  activeTask.runner.pause();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.138.1",
3
+ "version": "0.138.3",
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",