4runr-os 2.0.37 → 2.0.39
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/ui/v3/tui/geometry.d.ts.map +1 -1
- package/dist/ui/v3/tui/geometry.js +6 -1
- package/dist/ui/v3/tui/geometry.js.map +1 -1
- package/dist/ui/v5/debugCommands.d.ts +20 -0
- package/dist/ui/v5/debugCommands.d.ts.map +1 -0
- package/dist/ui/v5/debugCommands.js +81 -0
- package/dist/ui/v5/debugCommands.js.map +1 -0
- package/dist/ui/v5/index.d.ts +2 -6
- package/dist/ui/v5/index.d.ts.map +1 -1
- package/dist/ui/v5/index.js +70 -32
- package/dist/ui/v5/index.js.map +1 -1
- package/dist/ui/v5/kernel.d.ts +75 -0
- package/dist/ui/v5/kernel.d.ts.map +1 -0
- package/dist/ui/v5/kernel.js +289 -0
- package/dist/ui/v5/kernel.js.map +1 -0
- package/dist/ui/v5/renderGate.d.ts +19 -0
- package/dist/ui/v5/renderGate.d.ts.map +1 -0
- package/dist/ui/v5/renderGate.js +36 -0
- package/dist/ui/v5/renderGate.js.map +1 -0
- package/dist/ui/v5/resizeController.d.ts +55 -0
- package/dist/ui/v5/resizeController.d.ts.map +1 -0
- package/dist/ui/v5/resizeController.js +124 -0
- package/dist/ui/v5/resizeController.js.map +1 -0
- package/dist/ui/v5/runtime/stdoutGuard.d.ts.map +1 -1
- package/dist/ui/v5/runtime/stdoutGuard.js +3 -1
- package/dist/ui/v5/runtime/stdoutGuard.js.map +1 -1
- package/dist/ui/v5/viewport.d.ts +41 -0
- package/dist/ui/v5/viewport.d.ts.map +1 -0
- package/dist/ui/v5/viewport.js +90 -0
- package/dist/ui/v5/viewport.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../src/ui/v3/tui/geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO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,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;CAAE,CA0E3H;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,gBAAgB,CAgC7E;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,gBAAgB,GAAG,IAAI,CAEzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CASnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CASjE;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAW,GAAG,MAAM,CAG5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAU,GAAG,MAAM,CAG9E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAE5D"}
|
|
@@ -113,11 +113,16 @@ export function getTerminalGeometry(screen) {
|
|
|
113
113
|
const { cols, rows, source } = getTerminalSize(screen);
|
|
114
114
|
// Apply mode-specific margins
|
|
115
115
|
// Browser terminals (CloudShell) need extra margin to prevent scrollbars
|
|
116
|
+
// SSH terminals should use full width (no margin)
|
|
116
117
|
const isBrowserTerminal = mode === 'browser';
|
|
117
|
-
const
|
|
118
|
+
const isSSHTerminal = mode === 'ssh';
|
|
119
|
+
// Only apply browser margin for actual browser terminals, not SSH
|
|
120
|
+
const browserTerminalMargin = (isBrowserTerminal && !isSSHTerminal) ? 12 : 0; // 12-char margin for CloudShell only
|
|
118
121
|
// Calculate safe dimensions (accounting for margins)
|
|
119
122
|
// CRITICAL: right edge must be <= cols - 1 to prevent scrollbars
|
|
120
123
|
// NO HARD CAP - allow fullscreen to expand fully
|
|
124
|
+
// For SSH/native terminals: use full width (cols - 1 for safety)
|
|
125
|
+
// For browser terminals: subtract margin to prevent scrollbars
|
|
121
126
|
const safeCols = Math.max(MIN_COLS, cols - HORIZONTAL_MARGIN - browserTerminalMargin);
|
|
122
127
|
const safeRows = Math.max(MIN_ROWS, rows - VERTICAL_MARGIN);
|
|
123
128
|
const geometry = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../src/ui/v3/tui/geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,kDAAkD;AAClD,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,+CAA+C;AAC/C,MAAM,iBAAiB,GAAG,CAAC,CAAC,CAAC,qCAAqC;AAClE,MAAM,eAAe,GAAG,CAAC,CAAC,CAAG,qCAAqC;AAiBlE,IAAI,YAAY,GAA4B,IAAI,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB;IACrD,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC;IAElC,iFAAiF;IACjF,sEAAsE;IAEtE,IAAI,IAAwB,CAAC;IAC7B,IAAI,IAAwB,CAAC;IAC7B,IAAI,MAA8C,CAAC;IAEnD,wFAAwF;IACxF,IAAI,MAAM,IAAK,MAAc,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,OAAO,GAAI,MAAc,CAAC,OAAO,CAAC;QACxC,IAAI,O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AEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,YAAoB,CAAC;IACpE,MAAM,GAAG,GAAG,YAAY,IAAI,mBAAmB,EAAE,CAAC;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAqB;IAClD,OAAO,QAAQ,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,IAAI,aAAa,GAAG,CAAC,QAAQ,aAAa,GAAG,CAAC,QAAQ,WAAW,GAAG,CAAC,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,CAAC;AACrI,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Debug Commands
|
|
3
|
+
*
|
|
4
|
+
* dbg:size - Print size info to Operations panel
|
|
5
|
+
* dbg:layout - Toggle layout debug overlay
|
|
6
|
+
*/
|
|
7
|
+
import type { Widgets } from 'neo-blessed';
|
|
8
|
+
import type { UIKernel } from './kernel.js';
|
|
9
|
+
import type { ResizeController } from './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/debugCommands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAK9D,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,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Debug Commands
|
|
3
|
+
*
|
|
4
|
+
* dbg:size - Print size info to Operations panel
|
|
5
|
+
* dbg:layout - Toggle layout debug overlay
|
|
6
|
+
*/
|
|
7
|
+
import { safeStderrWrite } from './runtime/stdoutGuard.js';
|
|
8
|
+
import { safeRender, getLayoutVersion } from './renderGate.js';
|
|
9
|
+
import { computeViewport } from './viewport.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handle debug command
|
|
12
|
+
*/
|
|
13
|
+
export function handleDebugCommand(command, context) {
|
|
14
|
+
if (command === 'dbg:size') {
|
|
15
|
+
handleDbgSize(context);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (command === 'dbg:layout') {
|
|
19
|
+
handleDbgLayout(context);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Handle dbg:size command
|
|
26
|
+
*/
|
|
27
|
+
function handleDbgSize(context) {
|
|
28
|
+
const { screen, resizeController } = context;
|
|
29
|
+
const vp = computeViewport(screen);
|
|
30
|
+
const stdoutCols = process.stdout.columns || 'N/A';
|
|
31
|
+
const stdoutRows = process.stdout.rows || 'N/A';
|
|
32
|
+
const term = process.env.TERM || 'N/A';
|
|
33
|
+
const platform = process.platform;
|
|
34
|
+
const lastCommitted = resizeController.getLastCommitted();
|
|
35
|
+
const burstCount = resizeController.getBurstCount();
|
|
36
|
+
const lastSource = resizeController.getLastSource();
|
|
37
|
+
const info = [
|
|
38
|
+
'=== V5 Size Debug ===',
|
|
39
|
+
`raw: ${vp.rawCols} x ${vp.rawRows}`,
|
|
40
|
+
`safe: ${vp.safeCols} x ${vp.safeRows}`,
|
|
41
|
+
`margins: R=${vp.marginRight}, B=${vp.marginBottom}`,
|
|
42
|
+
`environment guess: isBrowserLikely=${vp.isBrowserLikely}`,
|
|
43
|
+
`process.stdout.columns: ${stdoutCols}`,
|
|
44
|
+
`process.stdout.rows: ${stdoutRows}`,
|
|
45
|
+
`TERM: ${term}`,
|
|
46
|
+
`platform: ${platform}`,
|
|
47
|
+
`last committed: ${lastCommitted.cols}x${lastCommitted.rows}`,
|
|
48
|
+
`burstCount: ${burstCount}`,
|
|
49
|
+
`last source: ${lastSource}`,
|
|
50
|
+
].join('\n');
|
|
51
|
+
// Print to operations panel if available, otherwise to stderr
|
|
52
|
+
if (context.operationsPanel) {
|
|
53
|
+
const currentContent = context.operationsPanel.content || '';
|
|
54
|
+
context.operationsPanel.setContent((currentContent ? currentContent + '\n\n' : '') + info);
|
|
55
|
+
// Show the panel when content is added
|
|
56
|
+
context.operationsPanel.hidden = false;
|
|
57
|
+
const currentVersion = getLayoutVersion();
|
|
58
|
+
safeRender(screen, currentVersion);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
safeStderrWrite(info + '\n');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Handle dbg:layout command
|
|
66
|
+
*/
|
|
67
|
+
function handleDbgLayout(context) {
|
|
68
|
+
const { kernel, resizeController, screen } = context;
|
|
69
|
+
const vp = computeViewport(screen);
|
|
70
|
+
const version = resizeController.getLayoutVersion();
|
|
71
|
+
const burstCount = resizeController.getBurstCount();
|
|
72
|
+
const lastSource = resizeController.getLastSource();
|
|
73
|
+
kernel.toggleDebugOverlay({
|
|
74
|
+
cols: vp.rawCols,
|
|
75
|
+
rows: vp.rawRows,
|
|
76
|
+
version,
|
|
77
|
+
source: lastSource || 'manual',
|
|
78
|
+
burstCount,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=debugCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugCommands.js","sourceRoot":"","sources":["../../../src/ui/v5/debugCommands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAShD;;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;;GAEG;AACH,SAAS,aAAa,CAAC,OAA6B;IAClD,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACnC,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,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AC;QACN,eAAe,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,OAA6B;IACpD,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAErD,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,CAAC;IACpD,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IACpD,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,EAAE,CAAC;IAEpD,MAAM,CAAC,kBAAkB,CAAC;QACxB,IAAI,EAAE,EAAE,CAAC,OAAO;QAChB,IAAI,EAAE,EAAE,CAAC,OAAO;QAChB,OAAO;QACP,MAAM,EAAE,UAAU,IAAI,QAAQ;QAC9B,UAAU;KACX,CAAC,CAAC;AACL,CAAC"}
|
package/dist/ui/v5/index.d.ts
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* V5 TUI - Display Kernel Entry Point
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Phase 1: Runtime Guardrails
|
|
5
|
+
* Phase 1: Runtime Guardrails + Atomic Resize
|
|
8
6
|
* - Stdout guard (prevents glyph soup)
|
|
9
7
|
* - Keep-alive (prevents black screen)
|
|
10
8
|
* - Terminal restore (always restores terminal)
|
|
9
|
+
* - Atomic resize (no duplicate borders, no ghosts)
|
|
11
10
|
*
|
|
12
11
|
* Boot with: TUI_V5=1
|
|
13
12
|
*/
|
|
@@ -16,9 +15,6 @@ declare global {
|
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
17
|
* Start V5 TUI Display Kernel
|
|
19
|
-
*
|
|
20
|
-
* This is Phase 1 - just proves the guardrails work.
|
|
21
|
-
* We'll add the actual display kernel in Phase 2.
|
|
22
18
|
*/
|
|
23
19
|
export declare function startV5Shell(): Promise<void>;
|
|
24
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/index.ts"],"names":[],"mappings":";AACA
|
|
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"}
|
package/dist/ui/v5/index.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* V5 TUI - Display Kernel Entry Point
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Phase 1: Runtime Guardrails
|
|
5
|
+
* Phase 1: Runtime Guardrails + Atomic Resize
|
|
8
6
|
* - Stdout guard (prevents glyph soup)
|
|
9
7
|
* - Keep-alive (prevents black screen)
|
|
10
8
|
* - Terminal restore (always restores terminal)
|
|
9
|
+
* - Atomic resize (no duplicate borders, no ghosts)
|
|
11
10
|
*
|
|
12
11
|
* Boot with: TUI_V5=1
|
|
13
12
|
*/
|
|
@@ -16,13 +15,19 @@ import { initStdoutGuard, restoreStdout } from './runtime/stdoutGuard.js';
|
|
|
16
15
|
import { attachRuntime, detachRuntime } from './runtime/keepAlive.js';
|
|
17
16
|
import { restoreTerminal } from './runtime/restoreTerminal.js';
|
|
18
17
|
import { safeStderrWrite } from './runtime/stdoutGuard.js';
|
|
18
|
+
import { UIKernel } from './kernel.js';
|
|
19
|
+
import { ResizeController } from './resizeController.js';
|
|
20
|
+
import { safeRender, getLayoutVersion } from './renderGate.js';
|
|
21
|
+
import { handleDebugCommand } from './debugCommands.js';
|
|
19
22
|
/**
|
|
20
23
|
* Start V5 TUI Display Kernel
|
|
21
|
-
*
|
|
22
|
-
* This is Phase 1 - just proves the guardrails work.
|
|
23
|
-
* We'll add the actual display kernel in Phase 2.
|
|
24
24
|
*/
|
|
25
25
|
export async function startV5Shell() {
|
|
26
|
+
// Check TTY before booting
|
|
27
|
+
if (!process.stdout.isTTY) {
|
|
28
|
+
console.log('V5 TUI requires a TTY. Exiting.');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
26
31
|
// Singleton guard - prevent multiple instances
|
|
27
32
|
if (globalThis.__FOURRUNR_V5_TUI_RUNNING__) {
|
|
28
33
|
safeStderrWrite('[V5] Already running - ignoring\n');
|
|
@@ -32,11 +37,14 @@ export async function startV5Shell() {
|
|
|
32
37
|
globalThis.__FOURRUNR_V5_TUI_RUNNING__ = true;
|
|
33
38
|
// CRITICAL: Initialize stdout guard BEFORE creating screen
|
|
34
39
|
// This prevents any stdout pollution from corrupting the TUI
|
|
40
|
+
// TUI_DEBUG=1 -> redirects to /tmp/tui_v5.log
|
|
35
41
|
initStdoutGuard({
|
|
36
42
|
strict: process.env.TUI_STRICT === '1',
|
|
37
43
|
logFile: process.env.TUI_V5_LOG_FILE,
|
|
38
44
|
});
|
|
39
45
|
let screen = null;
|
|
46
|
+
let kernel = null;
|
|
47
|
+
let resizeController = null;
|
|
40
48
|
try {
|
|
41
49
|
// CRITICAL: Prepare stdin BEFORE creating screen
|
|
42
50
|
// This ensures stdin owns the event loop
|
|
@@ -44,13 +52,14 @@ export async function startV5Shell() {
|
|
|
44
52
|
if (process.stdin.isTTY && !process.stdin.isRaw) {
|
|
45
53
|
process.stdin.setRawMode(true);
|
|
46
54
|
}
|
|
47
|
-
// Create
|
|
55
|
+
// Create screen
|
|
48
56
|
screen = blessed.screen({
|
|
49
57
|
smartCSR: true,
|
|
50
58
|
fastCSR: false,
|
|
51
59
|
title: '4Runr OS - V5 Kernel (Phase 1)',
|
|
52
60
|
fullUnicode: false, // Start conservative
|
|
53
|
-
autoPadding: false,
|
|
61
|
+
autoPadding: false, // CRITICAL: No padding - use full width
|
|
62
|
+
dockBorders: false,
|
|
54
63
|
});
|
|
55
64
|
// CRITICAL: Attach runtime keep-alive AFTER screen creation
|
|
56
65
|
// This sets up signal handlers and event loop anchor
|
|
@@ -60,37 +69,58 @@ export async function startV5Shell() {
|
|
|
60
69
|
if (program && typeof program.hideCursor === 'function') {
|
|
61
70
|
program.hideCursor();
|
|
62
71
|
}
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
style: {
|
|
74
|
-
border: {
|
|
75
|
-
fg: 'green',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
screen.append(testBox);
|
|
80
|
-
screen.render();
|
|
72
|
+
// Wait a tick for screen to initialize
|
|
73
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
74
|
+
// Create kernel
|
|
75
|
+
kernel = new UIKernel(screen);
|
|
76
|
+
// Create resize controller
|
|
77
|
+
resizeController = new ResizeController(screen, kernel);
|
|
78
|
+
resizeController.start();
|
|
79
|
+
// Boot kernel (initial mount)
|
|
80
|
+
kernel.boot();
|
|
81
81
|
safeStderrWrite('[V5] Kernel started - guardrails active\n');
|
|
82
82
|
safeStderrWrite('[V5] Screen rendered - check for glyph corruption\n');
|
|
83
|
-
//
|
|
84
|
-
|
|
83
|
+
// Setup debug commands context
|
|
84
|
+
const debugContext = {
|
|
85
|
+
screen,
|
|
86
|
+
kernel,
|
|
87
|
+
resizeController,
|
|
88
|
+
operationsPanel: kernel.getOperationsPanel(),
|
|
89
|
+
};
|
|
90
|
+
// Handle input - debug commands and Ctrl+C
|
|
85
91
|
screen.key(['C-c'], () => {
|
|
86
92
|
safeStderrWrite('\n[V5] Ctrl+C pressed - exiting...\n');
|
|
87
93
|
cleanup();
|
|
88
94
|
process.exit(0);
|
|
89
95
|
});
|
|
90
|
-
// Handle
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
// Handle command input (for future use)
|
|
97
|
+
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) => {
|
|
101
|
+
if (key.name === 'enter') {
|
|
102
|
+
const value = widgets.commandInput.content || '';
|
|
103
|
+
const command = String(value).trim();
|
|
104
|
+
// Handle debug commands
|
|
105
|
+
if (handleDebugCommand(command, debugContext)) {
|
|
106
|
+
// Command handled
|
|
107
|
+
widgets.commandInput.setContent('');
|
|
108
|
+
const currentVersion = getLayoutVersion();
|
|
109
|
+
safeRender(screen, currentVersion);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// Future: handle other commands here
|
|
113
|
+
widgets.commandInput.setContent('');
|
|
114
|
+
const currentVersion = getLayoutVersion();
|
|
115
|
+
safeRender(screen, currentVersion);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
// Focus command input
|
|
119
|
+
widgets.commandInput.focus();
|
|
120
|
+
}
|
|
121
|
+
// All async renders must use safeRender
|
|
122
|
+
// Example: if you have eventBus or timers, they should call:
|
|
123
|
+
// safeRender(screen, getLayoutVersion());
|
|
94
124
|
}
|
|
95
125
|
catch (error) {
|
|
96
126
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
@@ -106,6 +136,14 @@ export async function startV5Shell() {
|
|
|
106
136
|
function cleanup() {
|
|
107
137
|
// Reset singleton guard
|
|
108
138
|
globalThis.__FOURRUNR_V5_TUI_RUNNING__ = false;
|
|
139
|
+
// Stop resize controller
|
|
140
|
+
if (resizeController) {
|
|
141
|
+
resizeController.stop();
|
|
142
|
+
}
|
|
143
|
+
// Destroy kernel
|
|
144
|
+
if (kernel) {
|
|
145
|
+
kernel.destroy();
|
|
146
|
+
}
|
|
109
147
|
// Detach runtime
|
|
110
148
|
if (screen) {
|
|
111
149
|
detachRuntime(screen);
|
package/dist/ui/v5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/v5/index.ts"],"names":[],"mappings":";AACA
|
|
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;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,+CAA+C;IAC/C,IAAK,UAAkB,CAAC,2BAA2B,EAAE,CAAC;QACpD,eAAe,CAAC,mCAAmC,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IAED,8CAA8C;IAC7C,UAAkB,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAEvD,2DAA2D;IAC3D,6DAA6D;I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ACX,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;QAED,iBAAiB;QACjB,IAAI,MAAM,EAAE,CAAC;YACX,aAAa,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;QAED,mBAAmB;QACnB,eAAe,CAAC,MAAM,CAAC,CAAC;QAExB,iBAAiB;QACjB,aAAa,EAAE,CAAC;IAClB,CAAC;IAED,iCAAiC;IACjC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 UI Kernel
|
|
3
|
+
*
|
|
4
|
+
* Owns the screen and all widgets. Provides atomic rebuild capability.
|
|
5
|
+
*
|
|
6
|
+
* 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
|
+
export interface RebuildOptions {
|
|
11
|
+
cols: number;
|
|
12
|
+
rows: number;
|
|
13
|
+
version: number;
|
|
14
|
+
source: string;
|
|
15
|
+
burstCount: number;
|
|
16
|
+
}
|
|
17
|
+
export interface UIWidgets {
|
|
18
|
+
testBox: Widgets.Box;
|
|
19
|
+
watermark: Widgets.Box;
|
|
20
|
+
commandInput?: Widgets.Box;
|
|
21
|
+
debugOverlay?: Widgets.Box;
|
|
22
|
+
operationsPanel?: Widgets.Box;
|
|
23
|
+
}
|
|
24
|
+
export declare class UIKernel {
|
|
25
|
+
private screen;
|
|
26
|
+
private widgets;
|
|
27
|
+
private layoutVersion;
|
|
28
|
+
private isRebuilding;
|
|
29
|
+
private pendingRebuild;
|
|
30
|
+
private debugOverlayVisible;
|
|
31
|
+
constructor(screen: Widgets.Screen);
|
|
32
|
+
/**
|
|
33
|
+
* Get current layout version (for render gating)
|
|
34
|
+
*/
|
|
35
|
+
getLayoutVersion(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Boot the kernel - initial mount
|
|
38
|
+
*/
|
|
39
|
+
boot(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Rebuild the UI - atomic destroy and recreate
|
|
42
|
+
*/
|
|
43
|
+
rebuild(options: RebuildOptions): void;
|
|
44
|
+
/**
|
|
45
|
+
* Destroy the kernel and all widgets
|
|
46
|
+
*/
|
|
47
|
+
destroy(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Get current widgets (for external access)
|
|
50
|
+
*/
|
|
51
|
+
getWidgets(): UIWidgets | null;
|
|
52
|
+
/**
|
|
53
|
+
* Get operations panel (for debug commands)
|
|
54
|
+
*/
|
|
55
|
+
getOperationsPanel(): Widgets.Box | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Toggle debug overlay
|
|
58
|
+
*/
|
|
59
|
+
toggleDebugOverlay(options: RebuildOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Update debug overlay with new info
|
|
62
|
+
*/
|
|
63
|
+
updateDebugOverlay(options: RebuildOptions): void;
|
|
64
|
+
/**
|
|
65
|
+
* Destroy all children widgets (hard destroy)
|
|
66
|
+
*/
|
|
67
|
+
private destroyAllChildren;
|
|
68
|
+
/**
|
|
69
|
+
* Create all widgets fresh
|
|
70
|
+
*
|
|
71
|
+
* CRITICAL: Uses safeCols/safeRows to prevent overflow
|
|
72
|
+
*/
|
|
73
|
+
private createWidgets;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=kernel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAK3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM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|
|
6
|
+
* HARD RULE: Never resize/move existing widgets.
|
|
7
|
+
* On every committed resize: destroy all widgets and recreate them.
|
|
8
|
+
*/
|
|
9
|
+
import blessed from 'neo-blessed';
|
|
10
|
+
import { safeStderrWrite } from './runtime/stdoutGuard.js';
|
|
11
|
+
import { setLayoutVersion } from './renderGate.js';
|
|
12
|
+
import { computeViewport, assertRect } from './viewport.js';
|
|
13
|
+
export class UIKernel {
|
|
14
|
+
screen;
|
|
15
|
+
widgets = null;
|
|
16
|
+
layoutVersion = 0;
|
|
17
|
+
isRebuilding = false;
|
|
18
|
+
pendingRebuild = null;
|
|
19
|
+
debugOverlayVisible = false;
|
|
20
|
+
constructor(screen) {
|
|
21
|
+
this.screen = screen;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get current layout version (for render gating)
|
|
25
|
+
*/
|
|
26
|
+
getLayoutVersion() {
|
|
27
|
+
return this.layoutVersion;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Boot the kernel - initial mount
|
|
31
|
+
*/
|
|
32
|
+
boot() {
|
|
33
|
+
if (this.widgets) {
|
|
34
|
+
throw new Error('Kernel already booted');
|
|
35
|
+
}
|
|
36
|
+
const vp = computeViewport(this.screen);
|
|
37
|
+
this.widgets = this.createWidgets(vp);
|
|
38
|
+
this.layoutVersion = 1;
|
|
39
|
+
setLayoutVersion(this.layoutVersion);
|
|
40
|
+
// Force a render after a small delay to ensure screen is ready
|
|
41
|
+
setImmediate(() => {
|
|
42
|
+
this.screen.render();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Rebuild the UI - atomic destroy and recreate
|
|
47
|
+
*/
|
|
48
|
+
rebuild(options) {
|
|
49
|
+
// A) Block re-entrant rebuild
|
|
50
|
+
if (this.isRebuilding) {
|
|
51
|
+
this.pendingRebuild = options;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.isRebuilding = true;
|
|
55
|
+
try {
|
|
56
|
+
// B) Clear the terminal buffer
|
|
57
|
+
const program = this.screen.program;
|
|
58
|
+
if (program) {
|
|
59
|
+
if (typeof program.clear === 'function') {
|
|
60
|
+
program.clear();
|
|
61
|
+
}
|
|
62
|
+
if (typeof program.flush === 'function') {
|
|
63
|
+
program.flush();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// C) Destroy everything currently mounted (hard)
|
|
67
|
+
this.destroyAllChildren();
|
|
68
|
+
// D) Compute viewport (single source of truth)
|
|
69
|
+
const vp = computeViewport(this.screen);
|
|
70
|
+
// E) Recreate widgets fresh using safe dimensions
|
|
71
|
+
this.widgets = this.createWidgets(vp);
|
|
72
|
+
this.layoutVersion = options.version;
|
|
73
|
+
setLayoutVersion(this.layoutVersion);
|
|
74
|
+
// F) Render once
|
|
75
|
+
this.screen.render();
|
|
76
|
+
// Update debug overlay if visible
|
|
77
|
+
this.updateDebugOverlay(options);
|
|
78
|
+
// G) Restore input focus
|
|
79
|
+
if (this.widgets.commandInput) {
|
|
80
|
+
this.widgets.commandInput.focus();
|
|
81
|
+
this.screen.render();
|
|
82
|
+
}
|
|
83
|
+
safeStderrWrite(`[V5] Rebuilt layout v${options.version} (raw: ${vp.rawCols}x${vp.rawRows}, safe: ${vp.safeCols}x${vp.safeRows}) from ${options.source} (burst: ${options.burstCount})\n`);
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
this.isRebuilding = false;
|
|
87
|
+
// Process pending rebuild if one was queued
|
|
88
|
+
if (this.pendingRebuild) {
|
|
89
|
+
const pending = this.pendingRebuild;
|
|
90
|
+
this.pendingRebuild = null;
|
|
91
|
+
// Use setImmediate to avoid re-entrancy issues
|
|
92
|
+
setImmediate(() => this.rebuild(pending));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Destroy the kernel and all widgets
|
|
98
|
+
*/
|
|
99
|
+
destroy() {
|
|
100
|
+
this.destroyAllChildren();
|
|
101
|
+
this.widgets = null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get current widgets (for external access)
|
|
105
|
+
*/
|
|
106
|
+
getWidgets() {
|
|
107
|
+
return this.widgets;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get operations panel (for debug commands)
|
|
111
|
+
*/
|
|
112
|
+
getOperationsPanel() {
|
|
113
|
+
return this.widgets?.operationsPanel;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Toggle debug overlay
|
|
117
|
+
*/
|
|
118
|
+
toggleDebugOverlay(options) {
|
|
119
|
+
this.debugOverlayVisible = !this.debugOverlayVisible;
|
|
120
|
+
if (this.widgets) {
|
|
121
|
+
if (this.debugOverlayVisible) {
|
|
122
|
+
// Create or update debug overlay
|
|
123
|
+
if (this.widgets.debugOverlay) {
|
|
124
|
+
if (typeof this.widgets.debugOverlay.detach === 'function') {
|
|
125
|
+
this.widgets.debugOverlay.detach();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const vp = computeViewport(this.screen);
|
|
129
|
+
const overlayWidth = vp.safeCols;
|
|
130
|
+
this.widgets.debugOverlay = blessed.box({
|
|
131
|
+
top: 0,
|
|
132
|
+
left: 0,
|
|
133
|
+
width: overlayWidth,
|
|
134
|
+
height: 1,
|
|
135
|
+
content: `raw: ${vp.rawCols}x${vp.rawRows} safe: ${vp.safeCols}x${vp.safeRows} | v${options.version} | burst: ${options.burstCount} | ${options.source}`,
|
|
136
|
+
style: {
|
|
137
|
+
fg: 'yellow',
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
assertRect('debugOverlay', { x: 0, y: 0, w: overlayWidth, h: 1 }, vp);
|
|
141
|
+
this.screen.append(this.widgets.debugOverlay);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// Remove debug overlay
|
|
145
|
+
if (this.widgets.debugOverlay) {
|
|
146
|
+
if (typeof this.widgets.debugOverlay.detach === 'function') {
|
|
147
|
+
this.widgets.debugOverlay.detach();
|
|
148
|
+
}
|
|
149
|
+
if (typeof this.widgets.debugOverlay.destroy === 'function') {
|
|
150
|
+
this.widgets.debugOverlay.destroy();
|
|
151
|
+
}
|
|
152
|
+
this.widgets.debugOverlay = undefined;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
this.screen.render();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Update debug overlay with new info
|
|
160
|
+
*/
|
|
161
|
+
updateDebugOverlay(options) {
|
|
162
|
+
if (this.debugOverlayVisible && this.widgets?.debugOverlay) {
|
|
163
|
+
const vp = computeViewport(this.screen);
|
|
164
|
+
this.widgets.debugOverlay.setContent(`raw: ${vp.rawCols}x${vp.rawRows} safe: ${vp.safeCols}x${vp.safeRows} | v${options.version} | burst: ${options.burstCount} | ${options.source}`);
|
|
165
|
+
this.screen.render();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Destroy all children widgets (hard destroy)
|
|
170
|
+
*/
|
|
171
|
+
destroyAllChildren() {
|
|
172
|
+
// Copy list first because detach mutates
|
|
173
|
+
const kids = [...this.screen.children];
|
|
174
|
+
for (const k of kids) {
|
|
175
|
+
try {
|
|
176
|
+
if (typeof k.detach === 'function') {
|
|
177
|
+
k.detach();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
// Ignore detach errors
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
if (typeof k.destroy === 'function') {
|
|
185
|
+
k.destroy();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
// Ignore destroy errors
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Remove from screen.children manually (blessed sometimes doesn't clean up)
|
|
193
|
+
const screenChildren = this.screen.children || [];
|
|
194
|
+
while (screenChildren.length > 0) {
|
|
195
|
+
screenChildren.pop();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Create all widgets fresh
|
|
200
|
+
*
|
|
201
|
+
* CRITICAL: Uses safeCols/safeRows to prevent overflow
|
|
202
|
+
*/
|
|
203
|
+
createWidgets(vp) {
|
|
204
|
+
// Use explicit pixel dimensions - use ~95% of SAFE viewport
|
|
205
|
+
const boxWidth = Math.floor(vp.safeCols * 0.95);
|
|
206
|
+
const boxHeight = Math.floor(vp.safeRows * 0.95);
|
|
207
|
+
const boxLeft = Math.floor((vp.safeCols - boxWidth) / 2);
|
|
208
|
+
const boxTop = Math.floor((vp.safeRows - boxHeight) / 2);
|
|
209
|
+
// Assert no overflow
|
|
210
|
+
assertRect('testBox', { x: boxLeft, y: boxTop, w: boxWidth, h: boxHeight }, vp);
|
|
211
|
+
const testBox = blessed.box({
|
|
212
|
+
top: boxTop,
|
|
213
|
+
left: boxLeft,
|
|
214
|
+
width: boxWidth,
|
|
215
|
+
height: boxHeight,
|
|
216
|
+
content: 'V5 Kernel - Phase 1\n\nGuardrails Active:\n✓ Stdout guard\n✓ Keep-alive\n✓ Terminal restore\n✓ Atomic resize\n✓ Safe viewport\n\nPress Ctrl+C to exit',
|
|
217
|
+
border: {
|
|
218
|
+
type: 'line',
|
|
219
|
+
},
|
|
220
|
+
style: {
|
|
221
|
+
border: {
|
|
222
|
+
fg: 'green',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
// V5 Watermark - top right corner (within safe bounds)
|
|
227
|
+
const watermarkLeft = vp.safeCols - 10;
|
|
228
|
+
const watermark = blessed.box({
|
|
229
|
+
top: 0,
|
|
230
|
+
left: watermarkLeft,
|
|
231
|
+
width: 10,
|
|
232
|
+
height: 1,
|
|
233
|
+
content: '{cyan-fg}V5{/cyan-fg}',
|
|
234
|
+
style: {
|
|
235
|
+
fg: 'cyan',
|
|
236
|
+
},
|
|
237
|
+
tags: true,
|
|
238
|
+
});
|
|
239
|
+
assertRect('watermark', { x: watermarkLeft, y: 0, w: 10, h: 1 }, vp);
|
|
240
|
+
// Operations panel (for debug output) - hidden initially, shown when dbg:size is used
|
|
241
|
+
// Position it below the testBox so it doesn't overlap
|
|
242
|
+
const opsTop = boxTop + boxHeight + 1;
|
|
243
|
+
const opsHeight = 5;
|
|
244
|
+
const operationsPanel = blessed.box({
|
|
245
|
+
top: opsTop,
|
|
246
|
+
left: boxLeft,
|
|
247
|
+
width: boxWidth,
|
|
248
|
+
height: opsHeight,
|
|
249
|
+
content: '',
|
|
250
|
+
scrollable: true,
|
|
251
|
+
alwaysScroll: true,
|
|
252
|
+
keys: true,
|
|
253
|
+
mouse: true,
|
|
254
|
+
hidden: true, // Hidden by default
|
|
255
|
+
style: {
|
|
256
|
+
fg: 'white',
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
// Only assert if panel would be visible (not hidden)
|
|
260
|
+
// assertRect('operationsPanel', { x: boxLeft, y: opsTop, w: boxWidth, h: opsHeight }, vp);
|
|
261
|
+
// Command input (for future use) - use box instead of textbox
|
|
262
|
+
const cmdTop = vp.safeRows - 3;
|
|
263
|
+
const cmdLeft = 1;
|
|
264
|
+
const cmdWidth = vp.safeCols - 2;
|
|
265
|
+
const commandInput = blessed.box({
|
|
266
|
+
top: cmdTop,
|
|
267
|
+
left: cmdLeft,
|
|
268
|
+
width: cmdWidth,
|
|
269
|
+
height: 1,
|
|
270
|
+
keys: true,
|
|
271
|
+
input: true,
|
|
272
|
+
style: {
|
|
273
|
+
fg: 'white',
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
assertRect('commandInput', { x: cmdLeft, y: cmdTop, w: cmdWidth, h: 1 }, vp);
|
|
277
|
+
this.screen.append(testBox);
|
|
278
|
+
this.screen.append(watermark);
|
|
279
|
+
this.screen.append(operationsPanel);
|
|
280
|
+
this.screen.append(commandInput);
|
|
281
|
+
return {
|
|
282
|
+
testBox,
|
|
283
|
+
watermark,
|
|
284
|
+
commandInput,
|
|
285
|
+
operationsPanel,
|
|
286
|
+
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MAAM,EAAE,CAAC;YACT,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,KAAK,EAAE;gBACL,EAAE,EAAE,OAAO;aACZ;SACK,CAAgB,CAAC;QACzB,UAAU,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAEjC,OAAO;YACL,OAAO;YACP,SAAS;YACT,YAAY;YACZ,eAAe;SAChB,CAAC;IACJ,CAAC;CAEF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Render Gating
|
|
3
|
+
*
|
|
4
|
+
* Prevents stale renders from async events.
|
|
5
|
+
* Any render that can happen asynchronously must be gated.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Set the current layout version (called by kernel)
|
|
9
|
+
*/
|
|
10
|
+
export declare function setLayoutVersion(version: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* Get the current layout version
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLayoutVersion(): number;
|
|
15
|
+
/**
|
|
16
|
+
* Safe render - only renders if version matches
|
|
17
|
+
*/
|
|
18
|
+
export declare function safeRender(screen: any, expectedVersion: number, renderFn?: () => void): boolean;
|
|
19
|
+
//# sourceMappingURL=renderGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderGate.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/renderGate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,GAAG,EACX,eAAe,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,GACpB,OAAO,CAaT"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Render Gating
|
|
3
|
+
*
|
|
4
|
+
* Prevents stale renders from async events.
|
|
5
|
+
* Any render that can happen asynchronously must be gated.
|
|
6
|
+
*/
|
|
7
|
+
let currentLayoutVersion = 0;
|
|
8
|
+
/**
|
|
9
|
+
* Set the current layout version (called by kernel)
|
|
10
|
+
*/
|
|
11
|
+
export function setLayoutVersion(version) {
|
|
12
|
+
currentLayoutVersion = version;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the current layout version
|
|
16
|
+
*/
|
|
17
|
+
export function getLayoutVersion() {
|
|
18
|
+
return currentLayoutVersion;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Safe render - only renders if version matches
|
|
22
|
+
*/
|
|
23
|
+
export function safeRender(screen, expectedVersion, renderFn) {
|
|
24
|
+
if (expectedVersion !== currentLayoutVersion) {
|
|
25
|
+
// Stale render - ignore
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (renderFn) {
|
|
29
|
+
renderFn();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
screen.render();
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=renderGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderGate.js","sourceRoot":"","sources":["../../../src/ui/v5/renderGate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,oBAAoB,GAAW,CAAC,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,oBAAoB,GAAG,OAAO,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,MAAW,EACX,eAAuB,EACvB,QAAqB;IAErB,IAAI,eAAe,KAAK,oBAAoB,EAAE,CAAC;QAC7C,wBAAwB;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;IACb,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Atomic Resize Controller
|
|
3
|
+
*
|
|
4
|
+
* Listens to BOTH resize sources and debounces commits.
|
|
5
|
+
* Tracks layoutVersion for render gating.
|
|
6
|
+
*/
|
|
7
|
+
import type { Widgets } from 'neo-blessed';
|
|
8
|
+
import type { UIKernel } from './kernel.js';
|
|
9
|
+
export declare class ResizeController {
|
|
10
|
+
private screen;
|
|
11
|
+
private kernel;
|
|
12
|
+
private timer;
|
|
13
|
+
private layoutVersion;
|
|
14
|
+
private lastCommitted;
|
|
15
|
+
private pending;
|
|
16
|
+
private burstCount;
|
|
17
|
+
private lastSource;
|
|
18
|
+
constructor(screen: Widgets.Screen, kernel: UIKernel);
|
|
19
|
+
/**
|
|
20
|
+
* Start listening to resize events
|
|
21
|
+
*/
|
|
22
|
+
start(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Stop listening to resize events
|
|
25
|
+
*/
|
|
26
|
+
stop(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get current layout version
|
|
29
|
+
*/
|
|
30
|
+
getLayoutVersion(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Get last committed size
|
|
33
|
+
*/
|
|
34
|
+
getLastCommitted(): {
|
|
35
|
+
cols: number;
|
|
36
|
+
rows: number;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Get burst count
|
|
40
|
+
*/
|
|
41
|
+
getBurstCount(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Get last resize source
|
|
44
|
+
*/
|
|
45
|
+
getLastSource(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Handle resize event (debounced)
|
|
48
|
+
*/
|
|
49
|
+
private onResizeEvent;
|
|
50
|
+
/**
|
|
51
|
+
* Commit resize (atomic)
|
|
52
|
+
*/
|
|
53
|
+
private commitResize;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=resizeController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeController.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/resizeController.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAG5D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,aAAa,CAAwD;IAC7E,OAAO,CAAC,OAAO,CAAwD;IACvE,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,UAAU,CAAc;gBAEpB,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ;IAKpD;;OAEG;IACH,KAAK,IAAI,IAAI;IAcb;;OAEG;IACH,IAAI,IAAI,IAAI;IAeZ;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,gBAAgB,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAIlD;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,YAAY;CAoCrB"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Atomic Resize Controller
|
|
3
|
+
*
|
|
4
|
+
* Listens to BOTH resize sources and debounces commits.
|
|
5
|
+
* Tracks layoutVersion for render gating.
|
|
6
|
+
*/
|
|
7
|
+
import { computeViewport } from './viewport.js';
|
|
8
|
+
export class ResizeController {
|
|
9
|
+
screen;
|
|
10
|
+
kernel;
|
|
11
|
+
timer = null;
|
|
12
|
+
layoutVersion = 0;
|
|
13
|
+
lastCommitted = { cols: 0, rows: 0 };
|
|
14
|
+
pending = { cols: 0, rows: 0 };
|
|
15
|
+
burstCount = 0;
|
|
16
|
+
lastSource = '';
|
|
17
|
+
constructor(screen, kernel) {
|
|
18
|
+
this.screen = screen;
|
|
19
|
+
this.kernel = kernel;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Start listening to resize events
|
|
23
|
+
*/
|
|
24
|
+
start() {
|
|
25
|
+
// Listen to screen resize
|
|
26
|
+
this.screen.on('resize', () => {
|
|
27
|
+
this.onResizeEvent('screen');
|
|
28
|
+
});
|
|
29
|
+
// Listen to process.stdout resize (Windows can be weird)
|
|
30
|
+
if (process.stdout.on) {
|
|
31
|
+
process.stdout.on('resize', () => {
|
|
32
|
+
this.onResizeEvent('stdout');
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Stop listening to resize events
|
|
38
|
+
*/
|
|
39
|
+
stop() {
|
|
40
|
+
if (this.timer) {
|
|
41
|
+
clearTimeout(this.timer);
|
|
42
|
+
this.timer = null;
|
|
43
|
+
}
|
|
44
|
+
// Remove listeners (blessed doesn't have removeAllListeners in types)
|
|
45
|
+
if (typeof this.screen.removeAllListeners === 'function') {
|
|
46
|
+
this.screen.removeAllListeners('resize');
|
|
47
|
+
}
|
|
48
|
+
if (process.stdout && typeof process.stdout.removeAllListeners === 'function') {
|
|
49
|
+
process.stdout.removeAllListeners('resize');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get current layout version
|
|
54
|
+
*/
|
|
55
|
+
getLayoutVersion() {
|
|
56
|
+
return this.layoutVersion;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get last committed size
|
|
60
|
+
*/
|
|
61
|
+
getLastCommitted() {
|
|
62
|
+
return { ...this.lastCommitted };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get burst count
|
|
66
|
+
*/
|
|
67
|
+
getBurstCount() {
|
|
68
|
+
return this.burstCount;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get last resize source
|
|
72
|
+
*/
|
|
73
|
+
getLastSource() {
|
|
74
|
+
return this.lastSource;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Handle resize event (debounced)
|
|
78
|
+
*/
|
|
79
|
+
onResizeEvent(source) {
|
|
80
|
+
// Use viewport to get raw dimensions (will be committed in commitResize)
|
|
81
|
+
const vp = computeViewport(this.screen);
|
|
82
|
+
this.pending = { cols: vp.rawCols, rows: vp.rawRows };
|
|
83
|
+
this.burstCount++;
|
|
84
|
+
if (this.timer) {
|
|
85
|
+
clearTimeout(this.timer);
|
|
86
|
+
}
|
|
87
|
+
this.timer = setTimeout(() => {
|
|
88
|
+
this.commitResize(source);
|
|
89
|
+
}, 120);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Commit resize (atomic)
|
|
93
|
+
*/
|
|
94
|
+
commitResize(source) {
|
|
95
|
+
this.timer = null;
|
|
96
|
+
// Use viewport to get raw dimensions (kernel will compute safe viewport)
|
|
97
|
+
const vp = computeViewport(this.screen);
|
|
98
|
+
const cols = vp.rawCols;
|
|
99
|
+
const rows = vp.rawRows;
|
|
100
|
+
// Ignore bogus zero sizes
|
|
101
|
+
if (!cols || !rows) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Ignore duplicate commits
|
|
105
|
+
if (cols === this.lastCommitted.cols && rows === this.lastCommitted.rows) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.lastCommitted = { cols, rows };
|
|
109
|
+
this.lastSource = source;
|
|
110
|
+
this.layoutVersion++;
|
|
111
|
+
const myVersion = this.layoutVersion;
|
|
112
|
+
const myBurstCount = this.burstCount;
|
|
113
|
+
// Reset burst count after commit
|
|
114
|
+
this.burstCount = 0;
|
|
115
|
+
this.kernel.rebuild({
|
|
116
|
+
cols,
|
|
117
|
+
rows,
|
|
118
|
+
version: myVersion,
|
|
119
|
+
source,
|
|
120
|
+
burstCount: myBurstCount,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=resizeController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeController.js","sourceRoot":"","sources":["../../../src/ui/v5/resizeController.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAiB;IACvB,MAAM,CAAW;IACjB,KAAK,GAA0B,IAAI,CAAC;IACpC,aAAa,GAAW,CAAC,CAAC;IAC1B,aAAa,GAAmC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACrE,OAAO,GAAmC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC/D,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,EAAE,CAAC;IAEhC,YAAY,M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M,CAAC;QACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC;QACrC,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC;QAErC,iCAAiC;QACjC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YAClB,IAAI;YACJ,IAAI;YACJ,OAAO,EAAE,SAAS;YAClB,MAAM;YACN,UAAU,EAAE,YAAY;SACzB,CAAC,CAAC;IACL,CAAC;CAEF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdoutGuard.d.ts","sourceRoot":"","sources":["../../../../src/ui/v5/runtime/stdoutGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAUH;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"stdoutGuard.d.ts","sourceRoot":"","sources":["../../../../src/ui/v5/runtime/stdoutGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAUH;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,IAAI,CA2FZ;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAkBpC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMlD"}
|
|
@@ -29,7 +29,9 @@ export function initStdoutGuard(options = {}) {
|
|
|
29
29
|
}
|
|
30
30
|
stdoutGuardActive = true;
|
|
31
31
|
const strict = options.strict || process.env.TUI_STRICT === '1';
|
|
32
|
-
|
|
32
|
+
// TUI_DEBUG=1 -> write to /tmp/tui_v5.log, otherwise use provided logFile or stderr
|
|
33
|
+
const logFilePath = options.logFile || process.env.TUI_V5_LOG_FILE ||
|
|
34
|
+
(process.env.TUI_DEBUG === '1' ? '/tmp/tui_v5.log' : undefined);
|
|
33
35
|
// Store originals
|
|
34
36
|
originalConsoleLog = console.log;
|
|
35
37
|
originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdoutGuard.js","sourceRoot":"","sources":["../../../../src/ui/v5/runtime/stdoutGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,kBAAsC,CAAC;AAC3C,IAAI,mBAAgD,CAAC;AACrD,IAAI,OAAO,GAA0B,IAAI,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,UAG5B,EAAE;IACJ,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,CAAC,iBAAiB;IAC3B,CAAC;IAED,iBAAiB,GAAG,IAAI,CAAC;IACzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"stdoutGuard.js","sourceRoot":"","sources":["../../../../src/ui/v5/runtime/stdoutGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAA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,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,iBAAiB,GAAG,KAAK,CAAC;IAE1B,oBAAoB;IACpB,OAAO,CAAC,GAAG,GAAG,kBAAkB,CAAC;IAChC,OAAO,CAAC,MAAc,CAAC,KAAK,GAAG,mBAAmB,CAAC;IAEpD,iBAAiB;IACjB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Safe Viewport Module
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for terminal dimensions.
|
|
5
|
+
* Always use safeCols/safeRows for layout to prevent overflow.
|
|
6
|
+
*
|
|
7
|
+
* Rules:
|
|
8
|
+
* - Never place any widget whose right edge touches screen.cols
|
|
9
|
+
* - Default margin: right=1, bottom=1
|
|
10
|
+
* - For AWS web terminals, default margin: right=3, bottom=2
|
|
11
|
+
* - Allow override via env vars
|
|
12
|
+
*/
|
|
13
|
+
export type Viewport = {
|
|
14
|
+
rawCols: number;
|
|
15
|
+
rawRows: number;
|
|
16
|
+
safeCols: number;
|
|
17
|
+
safeRows: number;
|
|
18
|
+
marginRight: number;
|
|
19
|
+
marginBottom: number;
|
|
20
|
+
isBrowserLikely: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Compute safe viewport from screen
|
|
24
|
+
*
|
|
25
|
+
* This is the single source of truth for terminal dimensions.
|
|
26
|
+
* Always use safeCols/safeRows for layout calculations.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeViewport(screen: any): Viewport;
|
|
29
|
+
/**
|
|
30
|
+
* Assert that a rectangle fits within safe viewport bounds
|
|
31
|
+
*
|
|
32
|
+
* Throws in debug mode if overflow detected.
|
|
33
|
+
* This prevents accidental regressions.
|
|
34
|
+
*/
|
|
35
|
+
export declare function assertRect(name: string, r: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
w: number;
|
|
39
|
+
h: number;
|
|
40
|
+
}, vp: Viewport): void;
|
|
41
|
+
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../src/ui/v5/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,QAAQ,CAsDrD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACjD,EAAE,EAAE,QAAQ,GACX,IAAI,CAUN"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V5 Safe Viewport Module
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for terminal dimensions.
|
|
5
|
+
* Always use safeCols/safeRows for layout to prevent overflow.
|
|
6
|
+
*
|
|
7
|
+
* Rules:
|
|
8
|
+
* - Never place any widget whose right edge touches screen.cols
|
|
9
|
+
* - Default margin: right=1, bottom=1
|
|
10
|
+
* - For AWS web terminals, default margin: right=3, bottom=2
|
|
11
|
+
* - Allow override via env vars
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Clamp a number to a minimum value
|
|
15
|
+
*/
|
|
16
|
+
function clamp(n, min) {
|
|
17
|
+
return n < min ? min : n;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Compute safe viewport from screen
|
|
21
|
+
*
|
|
22
|
+
* This is the single source of truth for terminal dimensions.
|
|
23
|
+
* Always use safeCols/safeRows for layout calculations.
|
|
24
|
+
*/
|
|
25
|
+
export function computeViewport(screen) {
|
|
26
|
+
// Get raw dimensions from screen (most authoritative)
|
|
27
|
+
const program = screen?.program;
|
|
28
|
+
let rawCols;
|
|
29
|
+
let rawRows;
|
|
30
|
+
if (program && typeof program.cols === 'number' && program.cols > 0) {
|
|
31
|
+
rawCols = program.cols;
|
|
32
|
+
rawRows = program.rows;
|
|
33
|
+
}
|
|
34
|
+
else if (typeof screen.width === 'number' && typeof screen.height === 'number' && screen.width > 0 && screen.height > 0) {
|
|
35
|
+
rawCols = screen.width;
|
|
36
|
+
rawRows = screen.height;
|
|
37
|
+
}
|
|
38
|
+
else if (typeof screen.cols === 'number' && typeof screen.rows === 'number') {
|
|
39
|
+
rawCols = screen.cols;
|
|
40
|
+
rawRows = screen.rows;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
rawCols = process.stdout.columns || 80;
|
|
44
|
+
rawRows = process.stdout.rows || 24;
|
|
45
|
+
}
|
|
46
|
+
// Heuristic: AWS web terminals often set these envs
|
|
47
|
+
const isBrowserLikely = !!process.env.AWS_REGION ||
|
|
48
|
+
!!process.env.CLOUDSHELL ||
|
|
49
|
+
!!process.env.AWS_EXECUTION_ENV ||
|
|
50
|
+
!!process.env.EC2_INSTANCE_ID ||
|
|
51
|
+
(process.env.TERM || '').toLowerCase().includes('xterm'); // weak but ok as fallback
|
|
52
|
+
// Defaults - AWS web terminals need more margin to prevent scrollbar
|
|
53
|
+
// Increased from 3 to 6 based on testing (horizontal scrollbar still appears with 3-5)
|
|
54
|
+
let marginRight = isBrowserLikely ? 6 : 1;
|
|
55
|
+
let marginBottom = isBrowserLikely ? 2 : 1;
|
|
56
|
+
// Override knobs (must exist)
|
|
57
|
+
if (process.env.TUI_SAFE_MARGIN_RIGHT) {
|
|
58
|
+
marginRight = Number(process.env.TUI_SAFE_MARGIN_RIGHT);
|
|
59
|
+
}
|
|
60
|
+
if (process.env.TUI_SAFE_MARGIN_BOTTOM) {
|
|
61
|
+
marginBottom = Number(process.env.TUI_SAFE_MARGIN_BOTTOM);
|
|
62
|
+
}
|
|
63
|
+
// Final safe viewport (clamp to minimums)
|
|
64
|
+
const safeCols = clamp(rawCols - marginRight, 20);
|
|
65
|
+
const safeRows = clamp(rawRows - marginBottom, 10);
|
|
66
|
+
return {
|
|
67
|
+
rawCols,
|
|
68
|
+
rawRows,
|
|
69
|
+
safeCols,
|
|
70
|
+
safeRows,
|
|
71
|
+
marginRight,
|
|
72
|
+
marginBottom,
|
|
73
|
+
isBrowserLikely,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Assert that a rectangle fits within safe viewport bounds
|
|
78
|
+
*
|
|
79
|
+
* Throws in debug mode if overflow detected.
|
|
80
|
+
* This prevents accidental regressions.
|
|
81
|
+
*/
|
|
82
|
+
export function assertRect(name, r, vp) {
|
|
83
|
+
const right = r.x + r.w;
|
|
84
|
+
const bottom = r.y + r.h;
|
|
85
|
+
if (right > vp.safeCols || bottom > vp.safeRows) {
|
|
86
|
+
throw new Error(`[V5] OVERFLOW ${name}: right=${right} (max=${vp.safeCols}) bottom=${bottom} (max=${vp.safeRows}) ` +
|
|
87
|
+
`rect: x=${r.x} y=${r.y} w=${r.w} h=${r.h} viewport: raw=${vp.rawCols}x${vp.rawRows} safe=${vp.safeCols}x${vp.safeRows}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=viewport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../../src/ui/v5/viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH;;GAEG;AACH,SAAS,KAAK,CAAC,CAAS,EAAE,GAAW;IACnC,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAW;IACzC,sDAAsD;IACtD,MAAM,OAAO,GAAI,MAAc,EAAE,OAAO,CAAC;IACzC,IAAI,OAAe,CAAC;IACpB,IAAI,OAAe,CAAC;IAEpB,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACpE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;QACvB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IACzB,CAAC;SAAM,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,MA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