omegon 0.7.3 → 0.7.4

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.
@@ -470,11 +470,18 @@ function restartOmegon(): never {
470
470
  ' [ "$_w" -ge 50 ] && break',
471
471
  "done",
472
472
  // Extra grace period for fd/terminal release
473
- "sleep 0.2",
474
- // Full terminal protocol reset stty sane only resets line discipline,
475
- // not terminal protocol state (kitty keyboard, bracketed paste, cursor, SGR)
476
- "printf '\\033[<u\\033[>4;0m\\033[?2004l\\033[?25h\\033[0m\\033[r' 2>/dev/null",
473
+ "sleep 0.3",
474
+ // Hard terminal reset: RIS (Reset to Initial State) clears ALL protocol
475
+ // state kitty keyboard protocol, bracketed paste, mouse tracking,
476
+ // modifyOtherKeys, SGR, scroll regions, alternate screen, everything.
477
+ // This is what `reset` does internally and has worked since the VT100.
478
+ "printf '\\033c' 2>/dev/null",
477
479
  "stty sane 2>/dev/null",
480
+ // `reset` as belt-and-suspenders — reinitializes terminfo state.
481
+ // Some terminals (Kitty) maintain protocol state that RIS alone
482
+ // doesn't fully clear; reset queries terminfo and sends the full
483
+ // initialization sequence for the current TERM.
484
+ "reset 2>/dev/null",
478
485
  // Clean up this script
479
486
  `rm -f "${script}"`,
480
487
  // Replace this shell with new omegon
@@ -484,26 +491,17 @@ function restartOmegon(): never {
484
491
  // Reset terminal to cooked mode BEFORE exiting so the restart script
485
492
  // (and the user) aren't stuck with raw-mode terminal if something goes wrong.
486
493
  try {
487
- // Full terminal protocol teardown: pop kitty keyboard protocol,
488
- // disable modifyOtherKeys, disable bracketed paste, show cursor,
489
- // reset SGR attributes, and clear any pending scroll region.
490
- process.stdout.write(
491
- "\x1b[<u" + // Pop kitty keyboard protocol flags
492
- "\x1b[>4;0m" + // Disable modifyOtherKeys
493
- "\x1b[?2004l" + // Disable bracketed paste
494
- "\x1b[?25h" + // Show cursor
495
- "\x1b[0m" + // Reset all SGR attributes
496
- "\x1b[r" // Reset scroll region to full screen
497
- );
494
+ // RIS (Reset to Initial State) the only reliable way to ensure ALL
495
+ // terminal protocol state is cleared. Selective escape sequences are
496
+ // fragile and miss features we don't know about.
497
+ process.stdout.write("\x1bc");
498
498
  // Pause stdin to prevent buffered input from being re-interpreted
499
499
  // after raw mode is disabled (prevents Ctrl+D from closing parent shell).
500
500
  process.stdin.pause();
501
501
  if (process.stdin.isTTY && typeof process.stdin.setRawMode === "function") {
502
502
  process.stdin.setRawMode(false);
503
503
  }
504
- // Also reset via stty timeout guards against blocking on contested stdin.
505
- // Use /dev/null for stdout/stderr to prevent any stray output (including
506
- // terminal bells) from reaching the user's terminal during the transition.
504
+ // stty sane resets line discipline to known-good state.
507
505
  spawnSync("stty", ["sane"], { stdio: ["inherit", "ignore", "ignore"], timeout: 2000 });
508
506
  } catch { /* best-effort */ }
509
507
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omegon",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Omegon — an opinionated distribution of pi (by Mario Zechner) with extensions for lifecycle management, memory, orchestration, and visualization",
5
5
  "bin": {
6
6
  "omegon": "bin/omegon.mjs",