@oxecli/oxe 1.0.57 → 1.0.58

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.
package/dist/engine.js CHANGED
@@ -149,7 +149,7 @@ export class InferenceEngine {
149
149
  process.stdout.write("\x1b[1A\x1b[2K");
150
150
  }
151
151
  process.stdout.write(mutedMarkdown(text) + "\n\n");
152
- this.workRows = displayRows(text) + 1;
152
+ this.workRows = displayRows(mutedMarkdown(text)) + 1;
153
153
  }
154
154
  clearWorkLine() {
155
155
  if (!this.workActive || this.workRows < 1)
@@ -196,7 +196,7 @@ export class InferenceEngine {
196
196
  else {
197
197
  process.stdout.write(mutedMarkdown(`Worked for ${t}`) + "\n\n");
198
198
  this.workActive = true;
199
- this.workRows = displayRows(`Worked for ${t}`) + 1;
199
+ this.workRows = displayRows(mutedMarkdown(`Worked for ${t}`)) + 1;
200
200
  }
201
201
  };
202
202
  const finishThinking = (report) => {
package/dist/ui.js CHANGED
@@ -64,6 +64,38 @@ export function stripAnsi(s) {
64
64
  export function plainLen(s) {
65
65
  return stripAnsi(s).length;
66
66
  }
67
+ // Truncate styled text to a max number of visible characters while keeping
68
+ // ANSI escape sequences intact (never cut mid-sequence).
69
+ export function truncateStyled(text, maxVisible) {
70
+ if (maxVisible <= 0)
71
+ return "";
72
+ if (plainLen(text) <= maxVisible)
73
+ return text;
74
+ const re = ANSI_RE;
75
+ re.lastIndex = 0;
76
+ let out = "";
77
+ let visible = 0;
78
+ let last = 0;
79
+ let m;
80
+ while ((m = re.exec(text)) !== null) {
81
+ if (m.index > last) {
82
+ const seg = text.slice(last, m.index);
83
+ const room = maxVisible - visible;
84
+ if (room <= 0)
85
+ return out;
86
+ out += seg.slice(0, room);
87
+ visible += Math.min(seg.length, room);
88
+ if (visible >= maxVisible)
89
+ return out;
90
+ }
91
+ out += m[0];
92
+ last = m.index + m[0].length;
93
+ }
94
+ if (visible < maxVisible) {
95
+ out += text.slice(last, last + (maxVisible - visible));
96
+ }
97
+ return out;
98
+ }
67
99
  // ---------------------------------------------------------------------------
68
100
  // Markup tag -> ANSI
69
101
  // ---------------------------------------------------------------------------
@@ -377,7 +409,8 @@ function panelString(content, title = "", subtitle = "", expand = true, borderSt
377
409
  const line = styledLines[i];
378
410
  const plain = plainLines[i] ?? "";
379
411
  const pad = Math.max(innerW - plain.length, 0);
380
- out.push(`\x1b[${borderStyle}m│\x1b[0m ${line}${" ".repeat(pad)} \x1b[${borderStyle}m│\x1b[0m`);
412
+ const display = plain.length > innerW ? truncateStyled(line, innerW) : line;
413
+ out.push(`\x1b[${borderStyle}m│\x1b[0m ${display}${" ".repeat(pad)} \x1b[${borderStyle}m│\x1b[0m`);
381
414
  }
382
415
  const bottom = `╰${embed(subtitle, "center")}╯`;
383
416
  out.push(`\x1b[${borderStyle}m${bottom}\x1b[0m`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxecli/oxe",
3
- "version": "1.0.57",
3
+ "version": "1.0.58",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },