acuvo-code 0.6.7 → 0.6.8

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/lib/input-box.mjs +38 -48
  2. package/package.json +1 -1
package/lib/input-box.mjs CHANGED
@@ -516,7 +516,7 @@ export function pinRegion(output, { rows = 2, env = process.env } = {}) {
516
516
  */
517
517
  const enabled = Boolean(output?.isTTY)
518
518
  && height > rows + 4
519
- && String(env.ACUVO_PIN ?? '') === '1'
519
+ && String(env.ACUVO_NO_PIN ?? '') !== '1'
520
520
  && String(env.CI ?? '').toLowerCase() !== 'true';
521
521
 
522
522
  if (!enabled) return { enabled: false, release() {}, rows: 0, bottom: 0 };
@@ -525,66 +525,56 @@ export function pinRegion(output, { rows = 2, env = process.env } = {}) {
525
525
  let released = false;
526
526
 
527
527
  /**
528
- * ── ⚠️⚠️ CLEAR, THEN START AT THE TOP. MY FIRST VERSION STARTED AT THE BOTTOM
528
+ * ── ⭐⭐⭐ RESERVE THE ROWS. DO NOT CLEAR THE SCREEN. ────────────────────────
529
529
  *
530
- * Roman, from a screenshot: the banner was cut in half with a huge empty gap
531
- * beneath it and the conversation crammed at the bottom of the screen.
530
+ * ⚠️⚠️ THE CLEAR WAS THE ENTIRE BUG, THROUGH FOUR ATTEMPTS. Every previous
531
+ * version began `ESC[H ESC[2J ESC[3J` home, erase screen, erase scrollback.
532
+ * That is what `clear` emits, and it is completely wrong here for two reasons
533
+ * that took far too long to separate:
532
534
  *
533
- * The cause: this parked the cursor at the BOTTOM of the region, so the first
534
- * line printed on the last usable row and everything after it scrolled. A
535
- * terminal fills downward the transcript has to START at the top and grow
536
- * toward the input, which is what every scrollback in existence does.
535
+ * 1. It runs AFTER the banner has been printed, so it erases the thing the
536
+ * user just saw. Roman: "I see the green logo and text for a fraction of
537
+ * a second then I just see the prompt box, nothing else."
538
+ * 2. `3J` deletes the SCROLLBACK the user's shell history, and then their
539
+ * own session. "Can't scroll up or it's just not there." A CLI has no
540
+ * business destroying the buffer it was launched into.
537
541
  *
538
- * ⚠️ AND THE SCREEN IS CLEARED FIRST. Whatever the shell left behind would
539
- * otherwise sit inside our region and scroll along with the session, so the
540
- * banner would never be at the top of anything.
541
- */
542
- /**
543
- * ⚠️⚠️ `3J` BEFORE `2J`, AND WITHOUT IT THE PROMPT IS OFF-SCREEN. Roman:
544
- * *"when you type acuvo you have to scroll down to see the prompt area."*
545
- *
546
- * `ESC[2J` clears the visible screen but PUSHES what was there into
547
- * SCROLLBACK — so VS Code (and most terminals) leave the viewport parked up
548
- * in the history, showing the old shell output with our banner and prompt
549
- * below the fold. The user has to scroll to find the thing they just started.
550
- *
551
- * `ESC[3J` deletes the scrollback itself, so there is nothing above to be
552
- * parked in and the viewport has nowhere to sit but the top of a clean
553
- * screen. Both are needed and the order matters: erase the history, erase the
554
- * screen, then home.
555
- */
556
- /**
557
- * ── ⚠️⚠️ THE CANONICAL CLEAR, IN THE CANONICAL ORDER — TWICE WRONG BEFORE ──
558
- *
559
- * Roman, twice: *"you have to scroll down to see the prompt area."*
560
- *
561
- * What `clear` itself emits is `ESC[H ESC[2J ESC[3J` — HOME FIRST, then erase
562
- * the screen, then erase the scrollback. I had `3J 2J` with the home last, and
563
- * the order is not cosmetic: erasing scrollback while the cursor is still
564
- * parked in it leaves the viewport anchored to a region that no longer exists,
565
- * so the terminal keeps showing the old shell output and our banner and prompt
566
- * sit below the fold.
542
+ * AND THE REFERENCE NEVER DID THIS. Claude Code does not clear your screen
543
+ * when it starts; your prompt, your previous commands and your scrollback are
544
+ * all still there afterwards. I imported a clear because I was thinking of a
545
+ * full-screen TUI, and then spent four builds fixing the ORDER of an operation
546
+ * that should not have existed.
567
547
  *
568
- * HOME FIRST puts the viewport at the top of the buffer BEFORE anything is
569
- * erased, so there is nowhere stale for it to stay.
548
+ * ⚠️ THE ROOM IS MADE BY SCROLLING, NOT BY ERASING. Printing `rows` newlines
549
+ * pushes existing content up exactly as any command would, leaving the cursor
550
+ * on the last line with `rows` blank lines below the content. Stepping back up
551
+ * to `bottom` and declaring the region there reserves those lines for the
552
+ * input — and everything above is untouched, still scrollable, still theirs.
570
553
  *
571
- * ⚠️ AND THE SCROLL REGION IS SET LAST. Setting a region while the cursor is
572
- * outside it is undefined across terminals some clamp, some ignore it. Clear
573
- * completely, then declare the region, then place the cursor inside it.
554
+ * ⚠️ THE CURSOR IS PLACED LAST, AND THAT IS NOT COSMETIC: DECSTBM homes the
555
+ * cursor to (1,1) as a side effect. Without the final move, the first line of
556
+ * output would land at the TOP of the screen and overwrite the banner which
557
+ * is a quieter version of the same defect this rewrite removes.
574
558
  */
575
- output.write(`${CSI}H${CSI}2J${CSI}3J${CSI}1;${bottom}r${CSI}1;1H`);
559
+ const makeRoom = '\n'.repeat(rows);
560
+ output.write(`${makeRoom}${CSI}${rows}A${CSI}1;${bottom}r${CSI}${bottom};1H`);
576
561
 
577
562
  const release = () => {
578
563
  if (released) return;
579
564
  released = true;
580
565
  /**
581
- * ⚠️ `ESC[r` WITH NO ARGUMENTS RESETS TO THE FULL SCREEN. Then the cursor is
582
- * moved below the reserved rows so the shell prompt does not land on top of
583
- * our box — an exit that leaves the terminal technically correct and
584
- * visually broken is still a bad exit.
566
+ * ⚠️ `ESC[r` WITH NO ARGUMENTS RESETS TO THE FULL SCREEN. Then the cursor
567
+ * moves below the reserved rows so the shell prompt does not land on top of
568
+ * our input — an exit that is technically correct and visually broken is
569
+ * still a bad exit.
570
+ *
571
+ * ⭐ AND NOTHING IS ERASED ON THE WAY OUT EITHER. The session the user just
572
+ * had stays on screen and in scrollback, which is the whole point of not
573
+ * having taken over their terminal in the first place.
585
574
  */
586
575
  try {
587
- output.write(`${CSI}r${CSI}${height};1H\n`);
576
+ output.write(`${CSI}r${CSI}${height};1H
577
+ `);
588
578
  } catch { /* the stream may already be gone on a hard exit */ }
589
579
  };
590
580
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acuvo-code",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Acuvo Code — the terminal client for the Acuvo capability registry. Zero dependencies, by design.",
5
5
  "type": "module",
6
6
  "bin": {