acuvo-code 0.4.1 → 0.4.2

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 (3) hide show
  1. package/lib/input-box.mjs +27 -2
  2. package/lib/turn.mjs +5716 -5706
  3. package/package.json +1 -1
package/lib/input-box.mjs CHANGED
@@ -67,7 +67,20 @@ export function visibleWidth(s) {
67
67
  * @returns {{lines: string[], cursorColumn: number}} 1-based cursor column
68
68
  */
69
69
  export function renderBox({ value = '', cursor = 0, columns = 80, prompt = '› ' } = {}) {
70
- const width = Math.max(20, Math.min(100, columns - 1));
70
+ /**
71
+ * ── ⚠️ FULL WIDTH. THE 100-COLUMN CAP WAS WRONG AND IT LOOKED WRONG ────────
72
+ *
73
+ * Roman, from a screenshot: *"ours isn't the entire width."* In a ~200-column
74
+ * terminal a 100-column box reads as a half-finished element rather than as a
75
+ * deliberate measure — it is the input, and the input should be as wide as the
76
+ * place you are typing.
77
+ *
78
+ * ⚠️ `columns - 1`, NOT `columns`. A box drawn to the very last column makes
79
+ * many terminals wrap to the next row the moment the final border character is
80
+ * written, which pushes everything down by one and breaks the cursor
81
+ * arithmetic for the rest of the session.
82
+ */
83
+ const width = Math.max(20, columns - 1);
71
84
  const inner = width - 2;
72
85
  const promptWidth = visibleWidth(prompt);
73
86
 
@@ -274,7 +287,19 @@ export function readBoxedLine({ input, output, history = [], onInterrupt = null,
274
287
  input.off('data', onData);
275
288
  input.off('end', onEnd);
276
289
  try { input.setRawMode?.(false); } catch { /* not a TTY any more */ }
277
- output.write('\n');
290
+ /**
291
+ * ── ⚠️⚠️ MOVE BELOW THE BOX BEFORE ANYTHING ELSE WRITES ─────────────────
292
+ *
293
+ * Seen in a screenshot: an MCP warning printed straight ON TOP of the
294
+ * bottom border, which was left visible only where the message was
295
+ * shorter than the box.
296
+ *
297
+ * The cursor rests on the INPUT line — line 2 of 3. A bare `\n` moves it
298
+ * to line 3, which IS the bottom border, so the very next thing anyone
299
+ * writes overwrites it. Down one FIRST, then a newline, so the cursor
300
+ * lands on fresh ground below a box that stays intact.
301
+ */
302
+ output.write(`${CSI}1B\n`);
278
303
  resolve({ value, reason });
279
304
  };
280
305