4runr-os 2.0.40 → 2.0.41

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 (37) hide show
  1. package/dist/ui/v5/debug/debugCommands.d.ts +20 -0
  2. package/dist/ui/v5/debug/debugCommands.d.ts.map +1 -0
  3. package/dist/ui/v5/debug/debugCommands.js +104 -0
  4. package/dist/ui/v5/debug/debugCommands.js.map +1 -0
  5. package/dist/ui/v5/guardrails/stdoutGuard.d.ts +23 -0
  6. package/dist/ui/v5/guardrails/stdoutGuard.d.ts.map +1 -0
  7. package/dist/ui/v5/guardrails/stdoutGuard.js +94 -0
  8. package/dist/ui/v5/guardrails/stdoutGuard.js.map +1 -0
  9. package/dist/ui/v5/guardrails/terminalRestore.d.ts +17 -0
  10. package/dist/ui/v5/guardrails/terminalRestore.d.ts.map +1 -0
  11. package/dist/ui/v5/guardrails/terminalRestore.js +47 -0
  12. package/dist/ui/v5/guardrails/terminalRestore.js.map +1 -0
  13. package/dist/ui/v5/index.d.ts +13 -3
  14. package/dist/ui/v5/index.d.ts.map +1 -1
  15. package/dist/ui/v5/index.js +48 -39
  16. package/dist/ui/v5/index.js.map +1 -1
  17. package/dist/ui/v5/kernel/kernel.d.ts +80 -0
  18. package/dist/ui/v5/kernel/kernel.d.ts.map +1 -0
  19. package/dist/ui/v5/kernel/kernel.js +283 -0
  20. package/dist/ui/v5/kernel/kernel.js.map +1 -0
  21. package/dist/ui/v5/layout/clampRect.d.ts +22 -0
  22. package/dist/ui/v5/layout/clampRect.d.ts.map +1 -0
  23. package/dist/ui/v5/layout/clampRect.js +40 -0
  24. package/dist/ui/v5/layout/clampRect.js.map +1 -0
  25. package/dist/ui/v5/layout/layoutEngine.d.ts +16 -0
  26. package/dist/ui/v5/layout/layoutEngine.d.ts.map +1 -0
  27. package/dist/ui/v5/layout/layoutEngine.js +99 -0
  28. package/dist/ui/v5/layout/layoutEngine.js.map +1 -0
  29. package/dist/ui/v5/resize/resizeController.d.ts +62 -0
  30. package/dist/ui/v5/resize/resizeController.d.ts.map +1 -0
  31. package/dist/ui/v5/resize/resizeController.js +133 -0
  32. package/dist/ui/v5/resize/resizeController.js.map +1 -0
  33. package/dist/ui/v5/viewport/getViewport.d.ts +19 -0
  34. package/dist/ui/v5/viewport/getViewport.d.ts.map +1 -0
  35. package/dist/ui/v5/viewport/getViewport.js +98 -0
  36. package/dist/ui/v5/viewport/getViewport.js.map +1 -0
  37. package/package.json +1 -1
@@ -0,0 +1,20 @@
1
+ /**
2
+ * V5 Debug Commands
3
+ *
4
+ * dbg:size - Print size info to Operations panel (NOT stdout)
5
+ * dbg:layout - Toggle layout debug overlay
6
+ */
7
+ import type { Widgets } from 'neo-blessed';
8
+ import type { UIKernel } from '../kernel/kernel.js';
9
+ import type { ResizeController } from '../resize/resizeController.js';
10
+ export interface DebugCommandsContext {
11
+ screen: Widgets.Screen;
12
+ kernel: UIKernel;
13
+ resizeController: ResizeController;
14
+ operationsPanel?: Widgets.Box;
15
+ }
16
+ /**
17
+ * Handle debug command
18
+ */
19
+ export declare function handleDebugCommand(command: string, context: DebugCommandsContext): boolean;
20
+ //# sourceMappingURL=debugCommands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugCommands.d.ts","sourceRoot":"","sources":["../../../../src/ui/v5/debug/debugCommands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAItE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;IACvB,MAAM,EAAE,QAAQ,CAAC;IACjB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAYT"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * V5 Debug Commands
3
+ *
4
+ * dbg:size - Print size info to Operations panel (NOT stdout)
5
+ * dbg:layout - Toggle layout debug overlay
6
+ */
7
+ import { getViewport } from '../viewport/getViewport.js';
8
+ import { safeRender, getLayoutVersion } from '../renderGate.js';
9
+ /**
10
+ * Handle debug command
11
+ */
12
+ export function handleDebugCommand(command, context) {
13
+ if (command === 'dbg:size') {
14
+ handleDbgSize(context);
15
+ return true;
16
+ }
17
+ if (command === 'dbg:layout') {
18
+ handleDbgLayout(context);
19
+ return true;
20
+ }
21
+ return false;
22
+ }
23
+ /**
24
+ * Handle dbg:size command
25
+ *
26
+ * Print to Operations panel (NOT stdout):
27
+ * - screen.cols/rows
28
+ * - process.stdout.columns/rows
29
+ * - safeCols/safeRows
30
+ * - margins
31
+ * - TERM / platform
32
+ * - browserDetected true/false
33
+ */
34
+ function handleDbgSize(context) {
35
+ const { screen, resizeController } = context;
36
+ const vp = getViewport(screen);
37
+ const stdoutCols = process.stdout.columns || 'N/A';
38
+ const stdoutRows = process.stdout.rows || 'N/A';
39
+ const term = process.env.TERM || 'N/A';
40
+ const platform = process.platform;
41
+ const lastCommitted = resizeController.getLastCommitted();
42
+ const burstCount = resizeController.getBurstCount();
43
+ const lastSource = resizeController.getLastSource();
44
+ const lastResizeTs = resizeController.getLastResizeTs();
45
+ const info = [
46
+ '=== V5 Size Debug ===',
47
+ `screen.cols: ${vp.cols}`,
48
+ `screen.rows: ${vp.rows}`,
49
+ `process.stdout.columns: ${stdoutCols}`,
50
+ `process.stdout.rows: ${stdoutRows}`,
51
+ `safeCols: ${vp.safeCols}`,
52
+ `safeRows: ${vp.safeRows}`,
53
+ `margins: R=${vp.marginRight}, B=${vp.marginBottom}`,
54
+ `TERM: ${term}`,
55
+ `platform: ${platform}`,
56
+ `browserDetected: ${vp.isBrowserTerminal}`,
57
+ `last committed: ${lastCommitted.cols}x${lastCommitted.rows}`,
58
+ `burstCount: ${burstCount}`,
59
+ `lastResizeTs: ${lastResizeTs ? new Date(lastResizeTs).toISOString() : 'N/A'}`,
60
+ `last source: ${lastSource}`,
61
+ ].join('\n');
62
+ // Print to operations panel if available, otherwise to stderr
63
+ if (context.operationsPanel) {
64
+ const currentContent = context.operationsPanel.content || '';
65
+ context.operationsPanel.setContent((currentContent ? currentContent + '\n\n' : '') + info);
66
+ // Show the panel when content is added
67
+ context.operationsPanel.hidden = false;
68
+ const currentVersion = getLayoutVersion();
69
+ safeRender(screen, currentVersion);
70
+ }
71
+ else {
72
+ // Fallback to stderr (not stdout!)
73
+ process.stderr.write(info + '\n');
74
+ }
75
+ }
76
+ /**
77
+ * Handle dbg:layout command
78
+ *
79
+ * Overlay mode:
80
+ * - shows mode normal/narrow
81
+ * - prints each rect: x,y,w,h, rightEdge, bottomEdge
82
+ * - prints burstCount + lastResizeTs
83
+ */
84
+ function handleDbgLayout(context) {
85
+ const { kernel, resizeController, screen } = context;
86
+ const vp = getViewport(screen);
87
+ const layout = kernel.getLayout();
88
+ const version = resizeController.getLayoutVersion();
89
+ const burstCount = resizeController.getBurstCount();
90
+ const lastResizeTs = resizeController.getLastResizeTs();
91
+ const lastSource = resizeController.getLastSource();
92
+ // Build overlay content
93
+ const lines = [
94
+ `mode: ${layout.mode} | v${version} | burst: ${burstCount} | ts: ${lastResizeTs ? new Date(lastResizeTs).toISOString() : 'N/A'} | ${lastSource}`,
95
+ ];
96
+ // Print each rect
97
+ for (const [id, rect] of Object.entries(layout.rects)) {
98
+ const rightEdge = rect.x + rect.w;
99
+ const bottomEdge = rect.y + rect.h;
100
+ lines.push(`${id}: x=${rect.x} y=${rect.y} w=${rect.w} h=${rect.h} rightEdge=${rightEdge} bottomEdge=${bottomEdge}`);
101
+ }
102
+ kernel.toggleDebugOverlay(lines.join('\n'));
103
+ }
104
+ //# sourceMappingURL=debugCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugCommands.js","sourceRoot":"","sources":["../../../../src/ui/v5/debug/debugCommands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAShE;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,OAA6B;IAE7B,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;QAC3B,aAAa,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QAC7B,eAAe,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,aAAa,CAAC,OAA6B;IAClD,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IACnD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,aAAa,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,CAAC;IAC1D,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,YAAY,GAAG,gBAAgB,CAAC,eAA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AAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * V5 Stdout Guard - Hard Enforcement
3
+ *
4
+ * Monkeypatches process.stdout.write and console.log to prevent
5
+ * raw box-drawing characters from corrupting the TUI.
6
+ *
7
+ * During TUI runtime: block stdout writes (or redirect to stderr/file).
8
+ *
9
+ * Env escape hatch: TUI_ALLOW_STDOUT=1 disables blocking (default OFF).
10
+ */
11
+ /**
12
+ * Initialize stdout guard
13
+ */
14
+ export declare function initStdoutGuard(): void;
15
+ /**
16
+ * Restore original stdout behavior
17
+ */
18
+ export declare function restoreStdout(): void;
19
+ /**
20
+ * Check if stdout guard is active
21
+ */
22
+ export declare function isStdoutGuardActive(): boolean;
23
+ //# sourceMappingURL=stdoutGuard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdoutGuard.d.ts","sourceRoot":"","sources":["../../../../src/ui/v5/guardrails/stdoutGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAyCtC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAiBpC;AAsBD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * V5 Stdout Guard - Hard Enforcement
3
+ *
4
+ * Monkeypatches process.stdout.write and console.log to prevent
5
+ * raw box-drawing characters from corrupting the TUI.
6
+ *
7
+ * During TUI runtime: block stdout writes (or redirect to stderr/file).
8
+ *
9
+ * Env escape hatch: TUI_ALLOW_STDOUT=1 disables blocking (default OFF).
10
+ */
11
+ let stdoutGuardActive = false;
12
+ let originalStdoutWrite;
13
+ let originalConsoleLog;
14
+ let warningLogged = false;
15
+ let warningTimer = null;
16
+ /**
17
+ * Initialize stdout guard
18
+ */
19
+ export function initStdoutGuard() {
20
+ if (stdoutGuardActive) {
21
+ return; // Already active
22
+ }
23
+ // Check escape hatch
24
+ if (process.env.TUI_ALLOW_STDOUT === '1') {
25
+ return; // Guard disabled
26
+ }
27
+ stdoutGuardActive = true;
28
+ // Store originals
29
+ originalStdoutWrite = process.stdout.write.bind(process.stdout);
30
+ originalConsoleLog = console.log;
31
+ // Monkeypatch process.stdout.write
32
+ process.stdout.write = function (chunk, encoding, callback) {
33
+ // Log warning (debounced)
34
+ logWarningOnce();
35
+ // Redirect to stderr or file
36
+ const str = typeof chunk === 'string' ? chunk : chunk.toString();
37
+ process.stderr.write(`[V5 BLOCKED stdout.write] ${str}`);
38
+ // Call callback if provided
39
+ if (typeof callback === 'function') {
40
+ callback(null);
41
+ }
42
+ return true; // Pretend write succeeded
43
+ };
44
+ // Monkeypatch console.log
45
+ console.log = (...args) => {
46
+ // Log warning (debounced)
47
+ logWarningOnce();
48
+ // Redirect to stderr
49
+ const message = args.map(a => String(a)).join(' ');
50
+ process.stderr.write(`[V5 BLOCKED console.log] ${message}\n`);
51
+ };
52
+ }
53
+ /**
54
+ * Restore original stdout behavior
55
+ */
56
+ export function restoreStdout() {
57
+ if (!stdoutGuardActive) {
58
+ return;
59
+ }
60
+ stdoutGuardActive = false;
61
+ // Restore originals
62
+ process.stdout.write = originalStdoutWrite;
63
+ console.log = originalConsoleLog;
64
+ // Clear warning timer
65
+ if (warningTimer) {
66
+ clearTimeout(warningTimer);
67
+ warningTimer = null;
68
+ }
69
+ warningLogged = false;
70
+ }
71
+ /**
72
+ * Log warning once (debounced)
73
+ */
74
+ function logWarningOnce() {
75
+ if (warningLogged) {
76
+ return;
77
+ }
78
+ if (warningTimer) {
79
+ clearTimeout(warningTimer);
80
+ }
81
+ warningTimer = setTimeout(() => {
82
+ if (!warningLogged) {
83
+ process.stderr.write('[V5] Stdout guard active - stdout writes blocked. Set TUI_ALLOW_STDOUT=1 to disable.\n');
84
+ warningLogged = true;
85
+ }
86
+ }, 1000); // Debounce 1 second
87
+ }
88
+ /**
89
+ * Check if stdout guard is active
90
+ */
91
+ export function isStdoutGuardActive() {
92
+ return stdoutGuardActive;
93
+ }
94
+ //# sourceMappingURL=stdoutGuard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdoutGuard.js","sourceRoot":"","sources":["../../../../src/ui/v5/guardrails/stdoutGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,mBAAgD,CAAC;AACrD,IAAI,kBAAsC,CAAC;AAC3C,IAAI,aAAa,GAAG,KAAK,CAAC;AAC1B,IAAI,YAAY,GAA0B,IAAI,CAAC;AAE/C;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,CAAC,iBAAiB;IAC3B,CAAC;IAED,qBAAqB;IACrB,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,KAAK,GAAG,EAAE,CAAC;QACzC,OAAO,CAAC,iBAAiB;IAC3B,CAAC;IAED,iBAAiB,GAAG,IAAI,CAAC;IAEzB,kBAAkB;IAClB,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;IAEjC,mCAAmC;IAClC,OAAO,CAAC,MAAc,CAAC,KAAK,GAAG,UAAS,KAAU,EAAE,QAAc,EAAE,QAAc;QACjF,0BAA0B;QAC1B,cAAc,EAAE,CAAC;QAEjB,6BAA6B;QAC7B,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,GAAG,EAAE,CAAC,CAAC;QAEzD,4BAA4B;QAC5B,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,QAAQ,CAAC,I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IAAI,CAAC,CAAC,CAAC,oBAAoB;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * V5 Terminal Restore
3
+ *
4
+ * Ensures terminal is restored to usable state on exit.
5
+ *
6
+ * On exit (SIGINT, uncaughtException, unhandledRejection):
7
+ * - call screen.destroy()
8
+ * - show cursor
9
+ * - reset colors if needed
10
+ * - ensure input echo returns
11
+ */
12
+ import type { Widgets } from 'neo-blessed';
13
+ /**
14
+ * Restore terminal to normal state
15
+ */
16
+ export declare function restoreTerminal(screen: Widgets.Screen | null): void;
17
+ //# sourceMappingURL=terminalRestore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminalRestore.d.ts","sourceRoot":"","sources":["../../../../src/ui/v5/guardrails/terminalRestore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,CAkCnE"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * V5 Terminal Restore
3
+ *
4
+ * Ensures terminal is restored to usable state on exit.
5
+ *
6
+ * On exit (SIGINT, uncaughtException, unhandledRejection):
7
+ * - call screen.destroy()
8
+ * - show cursor
9
+ * - reset colors if needed
10
+ * - ensure input echo returns
11
+ */
12
+ /**
13
+ * Restore terminal to normal state
14
+ */
15
+ export function restoreTerminal(screen) {
16
+ if (!screen) {
17
+ return;
18
+ }
19
+ try {
20
+ const program = screen.program;
21
+ // Show cursor
22
+ if (program && typeof program.showCursor === 'function') {
23
+ program.showCursor();
24
+ }
25
+ // Reset colors
26
+ if (program && typeof program.reset === 'function') {
27
+ program.reset();
28
+ }
29
+ // Destroy screen
30
+ if (typeof screen.destroy === 'function') {
31
+ screen.destroy();
32
+ }
33
+ }
34
+ catch (e) {
35
+ // Ignore errors during cleanup
36
+ }
37
+ // Restore stdin
38
+ try {
39
+ if (process.stdin.isTTY && process.stdin.isRaw) {
40
+ process.stdin.setRawMode(false);
41
+ }
42
+ }
43
+ catch (e) {
44
+ // Ignore errors
45
+ }
46
+ }
47
+ //# sourceMappingURL=terminalRestore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminalRestore.js","sourceRoot":"","sources":["../../../../src/ui/v5/guardrails/terminalRestore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAA6B;IAC3D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAI,MAAc,CAAC,OAAO,CAAC;QAExC,cAAc;QACd,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;YACxD,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,CAAC;QAED,eAAe;QACf,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;YACnD,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QAED,iBAAiB;QACjB,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACzC,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,+BAA+B;IACjC,CAAC;IAED,gBAAgB;IAChB,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAC/C,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,gBAAgB;IAClB,CAAC;AACH,CAAC"}
@@ -2,11 +2,21 @@
2
2
  /**
3
3
  * V5 TUI - Display Kernel Entry Point
4
4
  *
5
- * Phase 1: Runtime Guardrails + Atomic Resize
5
+ * Phase A: Hard Guardrails
6
6
  * - Stdout guard (prevents glyph soup)
7
- * - Keep-alive (prevents black screen)
8
7
  * - Terminal restore (always restores terminal)
9
- * - Atomic resize (no duplicate borders, no ghosts)
8
+ *
9
+ * Phase B: Safe Viewport (scrollbar killer)
10
+ * - Proper browser terminal detection
11
+ * - Safe margins with env override
12
+ *
13
+ * Phase C: Layout Engine
14
+ * - Normal/narrow modes
15
+ * - Clamped rects (no overflow ever)
16
+ *
17
+ * Phase D: Atomic Resize
18
+ * - Debounced resize handling
19
+ * - Atomic rebuild (no ghosts/duplicates)
10
20
  *
11
21
  * Boot with: TUI_V5=1
12
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAeH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,2BAA2B,EAAE,OAAO,GAAG,SAAS,CAAC;CACtD;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAoKlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AAcH,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,2BAA2B,EAAE,OAAO,GAAG,SAAS,CAAC;CACtD;AAED;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAqKlD"}
@@ -2,52 +2,55 @@
2
2
  /**
3
3
  * V5 TUI - Display Kernel Entry Point
4
4
  *
5
- * Phase 1: Runtime Guardrails + Atomic Resize
5
+ * Phase A: Hard Guardrails
6
6
  * - Stdout guard (prevents glyph soup)
7
- * - Keep-alive (prevents black screen)
8
7
  * - Terminal restore (always restores terminal)
9
- * - Atomic resize (no duplicate borders, no ghosts)
8
+ *
9
+ * Phase B: Safe Viewport (scrollbar killer)
10
+ * - Proper browser terminal detection
11
+ * - Safe margins with env override
12
+ *
13
+ * Phase C: Layout Engine
14
+ * - Normal/narrow modes
15
+ * - Clamped rects (no overflow ever)
16
+ *
17
+ * Phase D: Atomic Resize
18
+ * - Debounced resize handling
19
+ * - Atomic rebuild (no ghosts/duplicates)
10
20
  *
11
21
  * Boot with: TUI_V5=1
12
22
  */
13
23
  import blessed from 'neo-blessed';
14
- import { initStdoutGuard, restoreStdout } from './runtime/stdoutGuard.js';
24
+ import { initStdoutGuard, restoreStdout } from './guardrails/stdoutGuard.js';
25
+ import { restoreTerminal } from './guardrails/terminalRestore.js';
15
26
  import { attachRuntime, detachRuntime } from './runtime/keepAlive.js';
16
- import { restoreTerminal } from './runtime/restoreTerminal.js';
17
- import { safeStderrWrite } from './runtime/stdoutGuard.js';
18
- import { UIKernel } from './kernel.js';
19
- import { ResizeController } from './resizeController.js';
27
+ import { UIKernel } from './kernel/kernel.js';
28
+ import { ResizeController } from './resize/resizeController.js';
20
29
  import { safeRender, getLayoutVersion } from './renderGate.js';
21
- import { handleDebugCommand } from './debugCommands.js';
30
+ import { handleDebugCommand } from './debug/debugCommands.js';
22
31
  /**
23
32
  * Start V5 TUI Display Kernel
24
33
  */
25
34
  export async function startV5Shell() {
26
35
  // Check TTY before booting
27
36
  if (!process.stdout.isTTY) {
28
- console.log('V5 TUI requires a TTY. Exiting.');
37
+ process.stderr.write('V5 TUI requires a TTY. Exiting.\n');
29
38
  process.exit(1);
30
39
  }
31
40
  // Singleton guard - prevent multiple instances
32
41
  if (globalThis.__FOURRUNR_V5_TUI_RUNNING__) {
33
- safeStderrWrite('[V5] Already running - ignoring\n');
42
+ process.stderr.write('[V5] Already running - ignoring\n');
34
43
  return;
35
44
  }
36
45
  // Mark as running BEFORE any UI code executes
37
46
  globalThis.__FOURRUNR_V5_TUI_RUNNING__ = true;
38
- // CRITICAL: Initialize stdout guard BEFORE creating screen
39
- // This prevents any stdout pollution from corrupting the TUI
40
- // TUI_DEBUG=1 -> redirects to /tmp/tui_v5.log
41
- initStdoutGuard({
42
- strict: process.env.TUI_STRICT === '1',
43
- logFile: process.env.TUI_V5_LOG_FILE,
44
- });
47
+ // Phase A1: Initialize stdout guard BEFORE creating screen
48
+ initStdoutGuard();
45
49
  let screen = null;
46
50
  let kernel = null;
47
51
  let resizeController = null;
48
52
  try {
49
53
  // CRITICAL: Prepare stdin BEFORE creating screen
50
- // This ensures stdin owns the event loop
51
54
  process.stdin.resume();
52
55
  if (process.stdin.isTTY && !process.stdin.isRaw) {
53
56
  process.stdin.setRawMode(true);
@@ -56,13 +59,12 @@ export async function startV5Shell() {
56
59
  screen = blessed.screen({
57
60
  smartCSR: true,
58
61
  fastCSR: false,
59
- title: '4Runr OS - V5 Kernel (Phase 1)',
60
- fullUnicode: false, // Start conservative
61
- autoPadding: false, // CRITICAL: No padding - use full width
62
+ title: '4Runr OS - V5 Kernel',
63
+ fullUnicode: false,
64
+ autoPadding: false,
62
65
  dockBorders: false,
63
66
  });
64
67
  // CRITICAL: Attach runtime keep-alive AFTER screen creation
65
- // This sets up signal handlers and event loop anchor
66
68
  attachRuntime(screen);
67
69
  // Hide cursor initially
68
70
  const program = screen.program;
@@ -78,8 +80,7 @@ export async function startV5Shell() {
78
80
  resizeController.start();
79
81
  // Boot kernel (initial mount)
80
82
  kernel.boot();
81
- safeStderrWrite('[V5] Kernel started - guardrails active\n');
82
- safeStderrWrite('[V5] Screen rendered - check for glyph corruption\n');
83
+ process.stderr.write('[V5] Kernel started - guardrails active\n');
83
84
  // Setup debug commands context
84
85
  const debugContext = {
85
86
  screen,
@@ -89,45 +90,42 @@ export async function startV5Shell() {
89
90
  };
90
91
  // Handle input - debug commands and Ctrl+C
91
92
  screen.key(['C-c'], () => {
92
- safeStderrWrite('\n[V5] Ctrl+C pressed - exiting...\n');
93
+ process.stderr.write('\n[V5] Ctrl+C pressed - exiting...\n');
93
94
  cleanup();
94
95
  process.exit(0);
95
96
  });
96
97
  // Handle command input (for future use)
97
98
  const widgets = kernel.getWidgets();
98
- if (widgets?.commandInput) {
99
- // For now, handle input via key events since we're using Box instead of Textbox
100
- widgets.commandInput.on('keypress', (ch, key) => {
99
+ if (widgets?.command) {
100
+ // For now, handle input via key events
101
+ widgets.command.on('keypress', (ch, key) => {
101
102
  if (key.name === 'enter') {
102
- const value = widgets.commandInput.content || '';
103
+ const value = widgets.command.content || '';
103
104
  const command = String(value).trim();
104
105
  // Handle debug commands
105
106
  if (handleDebugCommand(command, debugContext)) {
106
107
  // Command handled
107
- widgets.commandInput.setContent('');
108
+ widgets.command.setContent('');
108
109
  const currentVersion = getLayoutVersion();
109
110
  safeRender(screen, currentVersion);
110
111
  return;
111
112
  }
112
113
  // Future: handle other commands here
113
- widgets.commandInput.setContent('');
114
+ widgets.command.setContent('');
114
115
  const currentVersion = getLayoutVersion();
115
116
  safeRender(screen, currentVersion);
116
117
  }
117
118
  });
118
119
  // Focus command input
119
- widgets.commandInput.focus();
120
+ widgets.command.focus?.();
120
121
  }
121
- // All async renders must use safeRender
122
- // Example: if you have eventBus or timers, they should call:
123
- // safeRender(screen, getLayoutVersion());
124
122
  }
125
123
  catch (error) {
126
124
  const errorMsg = error instanceof Error ? error.message : String(error);
127
125
  const errorStack = error instanceof Error ? error.stack : '';
128
- safeStderrWrite(`\n[V5 INIT ERROR] ${errorMsg}\n`);
126
+ process.stderr.write(`\n[V5 INIT ERROR] ${errorMsg}\n`);
129
127
  if (errorStack) {
130
- safeStderrWrite(`[V5 INIT ERROR] Stack: ${errorStack.split('\n').slice(0, 10).join('\n')}\n`);
128
+ process.stderr.write(`[V5 INIT ERROR] Stack: ${errorStack.split('\n').slice(0, 10).join('\n')}\n`);
131
129
  }
132
130
  cleanup();
133
131
  process.exit(1);
@@ -148,7 +146,7 @@ export async function startV5Shell() {
148
146
  if (screen) {
149
147
  detachRuntime(screen);
150
148
  }
151
- // Restore terminal
149
+ // Phase A2: Restore terminal
152
150
  restoreTerminal(screen);
153
151
  // Restore stdout
154
152
  restoreStdout();
@@ -157,5 +155,16 @@ export async function startV5Shell() {
157
155
  process.on('exit', () => {
158
156
  cleanup();
159
157
  });
158
+ // Handle uncaught errors
159
+ process.on('uncaughtException', (error) => {
160
+ process.stderr.write(`[V5] Uncaught exception: ${error.message}\n`);
161
+ cleanup();
162
+ process.exit(1);
163
+ });
164
+ process.on('unhandledRejection', (reason) => {
165
+ process.stderr.write(`[V5] Unhandled rejection: ${String(reason)}\n`);
166
+ cleanup();
167
+ process.exit(1);
168
+ });
160
169
  }
161
170
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/v5/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,OAAO,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AASxD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,2BAA2B;IAC3B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;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HARD RULE: Never resize/move existing widgets.
7
+ * On every committed resize: destroy all widgets and recreate them.
8
+ */
9
+ import type { Widgets } from 'neo-blessed';
10
+ import { type Layout } from '../layout/layoutEngine.js';
11
+ export interface RebuildOptions {
12
+ cols: number;
13
+ rows: number;
14
+ version: number;
15
+ source: string;
16
+ burstCount: number;
17
+ }
18
+ export interface UIWidgets {
19
+ [key: string]: Widgets.Box;
20
+ }
21
+ export declare class UIKernel {
22
+ private screen;
23
+ private widgets;
24
+ private layout;
25
+ private layoutVersion;
26
+ private isRebuilding;
27
+ private pendingRebuild;
28
+ private debugOverlayVisible;
29
+ private debugOverlay;
30
+ constructor(screen: Widgets.Screen);
31
+ /**
32
+ * Get current layout version (for render gating)
33
+ */
34
+ getLayoutVersion(): number;
35
+ /**
36
+ * Get current layout
37
+ */
38
+ getLayout(): Layout;
39
+ /**
40
+ * Get operations panel (for debug commands)
41
+ */
42
+ getOperationsPanel(): Widgets.Box | undefined;
43
+ /**
44
+ * Get current widgets (for external access)
45
+ */
46
+ getWidgets(): UIWidgets | null;
47
+ /**
48
+ * Boot the kernel - initial mount
49
+ */
50
+ boot(): void;
51
+ /**
52
+ * Rebuild the UI - atomic destroy and recreate
53
+ */
54
+ rebuild(options: RebuildOptions): void;
55
+ /**
56
+ * Destroy the kernel and all widgets
57
+ */
58
+ destroy(): void;
59
+ /**
60
+ * Toggle debug overlay
61
+ */
62
+ toggleDebugOverlay(content?: string): void;
63
+ /**
64
+ * Update debug overlay with new info
65
+ */
66
+ private updateDebugOverlay;
67
+ /**
68
+ * Build debug overlay content
69
+ */
70
+ private buildDebugOverlayContent;
71
+ /**
72
+ * Destroy all children widgets (hard destroy)
73
+ */
74
+ private destroyAllChildren;
75
+ /**
76
+ * Create all widgets fresh from layout
77
+ */
78
+ private createWidgets;
79
+ }
80
+ //# sourceMappingURL=kernel.d.ts.map