open-agents-ai 0.187.374 → 0.187.375

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 +76 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -558439,6 +558439,7 @@ var init_stream_renderer = __esm({
558439
558439
  "packages/cli/src/tui/stream-renderer.ts"() {
558440
558440
  "use strict";
558441
558441
  init_layout2();
558442
+ init_text_selection();
558442
558443
  isTTY8 = process.stdout.isTTY ?? false;
558443
558444
  PASTEL = {
558444
558445
  key: 222,
@@ -558519,6 +558520,16 @@ var init_stream_renderer = __esm({
558519
558520
  */
558520
558521
  jsonBlobSize = 0;
558521
558522
  jsonBlobSuppressed = false;
558523
+ /**
558524
+ * Track cursor's current column on the bottom-of-scroll row during partial
558525
+ * flushes so we can wrap when cumulative partials would exceed terminal
558526
+ * width. Reset to 0 on \n, 5 when a new " ⎿ " prefix line starts.
558527
+ * Essential for the typing-effect: without this, successive partial
558528
+ * writes pile up on the bottom row past the right edge and the user
558529
+ * only sees proper placement once the stream ends and a full repaint
558530
+ * runs. Tracked in VISIBLE chars (ANSI escapes stripped).
558531
+ */
558532
+ _cursorCol = 0;
558522
558533
  /** Called when a new model response starts streaming */
558523
558534
  onStreamStart() {
558524
558535
  this.lineBuffer = "";
@@ -558529,6 +558540,7 @@ var init_stream_renderer = __esm({
558529
558540
  this.inToolArgs = false;
558530
558541
  this.jsonBlobSize = 0;
558531
558542
  this.jsonBlobSuppressed = false;
558543
+ this._cursorCol = 0;
558532
558544
  this.enabled = true;
558533
558545
  this.tokenCount = 0;
558534
558546
  this.startTime = Date.now();
@@ -558687,51 +558699,70 @@ var init_stream_renderer = __esm({
558687
558699
  }
558688
558700
  }
558689
558701
  const prefix = this.lineStarted ? "" : " ⎿ ";
558702
+ const maxW = Math.max(10, termCols() - 6);
558690
558703
  let rendered;
558704
+ const emitWrapped = (text2, highlight, trailingNewline) => {
558705
+ if (!text2) return;
558706
+ if (this.lineStarted && this._cursorCol > 0) {
558707
+ const remaining = maxW - this._cursorCol;
558708
+ const firstChunkLen = Math.min(text2.length, Math.max(1, remaining));
558709
+ if (remaining < 8 && text2.length > remaining) {
558710
+ this.writeRaw("\n");
558711
+ this.lineStarted = false;
558712
+ } else if (text2.length > remaining) {
558713
+ const head = text2.slice(0, firstChunkLen).replace(/\s+$/, "");
558714
+ const tail = text2.slice(firstChunkLen).replace(/^\s+/, "");
558715
+ this.writeRaw(highlight(head) + "\n");
558716
+ this.lineStarted = false;
558717
+ text2 = tail;
558718
+ if (!text2) return;
558719
+ }
558720
+ }
558721
+ const usePrefix = this.lineStarted ? "" : prefix;
558722
+ const usableW = this.lineStarted ? maxW : Math.max(1, maxW - usePrefix.length);
558723
+ const lines = text2.length > usableW ? this.wordWrap(text2, usableW) : [text2];
558724
+ for (let i2 = 0; i2 < lines.length; i2++) {
558725
+ const isFirst = i2 === 0;
558726
+ const isLast = i2 === lines.length - 1;
558727
+ const lp = isFirst ? usePrefix : " ";
558728
+ const needsNewline = !isLast || trailingNewline;
558729
+ this.writeRaw(dimText(lp) + highlight(lines[i2]) + (needsNewline ? "\n" : ""));
558730
+ }
558731
+ this.lineStarted = !trailingNewline;
558732
+ };
558691
558733
  switch (kind) {
558692
558734
  case "thinking":
558693
- rendered = dimItalic(raw);
558694
- break;
558735
+ emitWrapped(raw, dimItalic, hasNewline);
558736
+ return;
558695
558737
  case "tool_args":
558696
558738
  rendered = this.highlightJson(raw, true);
558697
558739
  break;
558698
- case "content":
558699
- {
558700
- const maxW = termCols() - 6;
558701
- if (this.inCodeBlock) {
558702
- const cropped = raw.length > maxW ? raw.slice(0, maxW - 3) + "..." : raw;
558703
- if (this.codeLang === "diff" || this.codeLang === "patch") {
558704
- rendered = this.highlightDiff(cropped);
558705
- } else if (this.codeLang === "bash" || this.codeLang === "sh" || this.codeLang === "shell" || this.codeLang === "zsh") {
558706
- rendered = this.highlightShell(cropped);
558707
- } else {
558708
- rendered = this.highlightCode(cropped);
558709
- }
558710
- } else if (this.looksLikeJson(raw)) {
558711
- const cropped = raw.length > maxW ? raw.slice(0, maxW - 3) + "..." : raw;
558712
- rendered = this.highlightJson(cropped, false);
558740
+ case "content": {
558741
+ if (this.inCodeBlock) {
558742
+ const cropped = raw.length > maxW ? raw.slice(0, maxW - 3) + "..." : raw;
558743
+ if (this.codeLang === "diff" || this.codeLang === "patch") {
558744
+ rendered = this.highlightDiff(cropped);
558745
+ } else if (this.codeLang === "bash" || this.codeLang === "sh" || this.codeLang === "shell" || this.codeLang === "zsh") {
558746
+ rendered = this.highlightShell(cropped);
558713
558747
  } else {
558714
- if (hasNewline && raw.length > maxW) {
558715
- const wrapped = this.wordWrap(raw, maxW);
558716
- for (let i2 = 0; i2 < wrapped.length; i2++) {
558717
- const lp = i2 === 0 ? prefix : " ";
558718
- const isLast = i2 === wrapped.length - 1;
558719
- this.writeRaw(
558720
- dimText(lp) + this.highlightMarkdown(wrapped[i2]) + (isLast ? "\n" : "\n")
558721
- );
558722
- }
558723
- this.lineStarted = false;
558724
- return;
558725
- }
558726
- const cropped = raw.length > maxW ? raw.slice(0, maxW) : raw;
558727
- rendered = this.highlightMarkdown(cropped);
558748
+ rendered = this.highlightCode(cropped);
558728
558749
  }
558729
- break;
558750
+ } else if (this.looksLikeJson(raw)) {
558751
+ const cropped = raw.length > maxW ? raw.slice(0, maxW - 3) + "..." : raw;
558752
+ rendered = this.highlightJson(cropped, false);
558753
+ } else {
558754
+ if (raw.length > maxW || this.lineStarted && this._cursorCol + raw.length > maxW) {
558755
+ emitWrapped(raw, (s2) => this.highlightMarkdown(s2), hasNewline);
558756
+ return;
558757
+ }
558758
+ rendered = this.highlightMarkdown(raw);
558730
558759
  }
558731
558760
  break;
558732
- case "thinking":
558733
- rendered = dimItalic(raw);
558734
- break;
558761
+ }
558762
+ }
558763
+ if (kind === "content" && this.lineStarted && this._cursorCol + raw.length > maxW) {
558764
+ emitWrapped(raw, (s2) => this.highlightMarkdown(s2), hasNewline);
558765
+ return;
558735
558766
  }
558736
558767
  this.writeRaw(dimText(prefix) + rendered + (hasNewline ? "\n" : ""));
558737
558768
  this.lineStarted = !hasNewline;
@@ -558745,13 +558776,22 @@ var init_stream_renderer = __esm({
558745
558776
  }
558746
558777
  /** Write raw ANSI text to stdout and capture for scrollback.
558747
558778
  * Wraps each write in autowrap-disable (DECAWM off) to prevent the terminal
558748
- * from injecting line breaks when a token fragment reaches the right edge. */
558779
+ * from injecting line breaks when a token fragment reaches the right edge.
558780
+ * Also maintains _cursorCol so emitWrapped can decide when to force a
558781
+ * wrap on the NEXT partial flush (avoiding bottom-row token pile-up). */
558749
558782
  writeRaw(text) {
558750
558783
  if (isTTY8) {
558751
558784
  process.stdout.write(`\x1B[?7l${text}\x1B[?7h`);
558752
558785
  } else {
558753
558786
  process.stdout.write(text);
558754
558787
  }
558788
+ const lastNl = text.lastIndexOf("\n");
558789
+ if (lastNl >= 0) {
558790
+ const after = text.slice(lastNl + 1);
558791
+ this._cursorCol = stripAnsi(after).length;
558792
+ } else {
558793
+ this._cursorCol += stripAnsi(text).length;
558794
+ }
558755
558795
  if (this.onRenderedLine) {
558756
558796
  const parts = text.split("\n");
558757
558797
  for (let i2 = 0; i2 < parts.length - 1; i2++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.374",
3
+ "version": "0.187.375",
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",