@modelstatus/cli 0.1.49 → 0.1.51
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/package.json +1 -1
- package/src/tui/app.js +43 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modelstatus/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"description": "Track which AI models you use, where, and never get surprised by a retirement. Free offline model-health for any repo (mm status), browser sign-in for cloud inventory + alerts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llm",
|
package/src/tui/app.js
CHANGED
|
@@ -40,6 +40,45 @@ const GATE_KEYS = [{ k: "1-8", label: "switch" }, { k: "7", label: "sign in" }];
|
|
|
40
40
|
// toast, status, keybar, bottomRule) — the body fills whatever rows remain.
|
|
41
41
|
const CHROME_ROWS = 10;
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* How many rows to leave UN-rendered below the frame so the window never clips.
|
|
45
|
+
*
|
|
46
|
+
* - 1 row everywhere: a frame that fills the full height makes ink write+newline
|
|
47
|
+
* the bottom line, which scrolls the buffer up by 1 each render; reserving the
|
|
48
|
+
* last row keeps it blank so nothing ever scrolls.
|
|
49
|
+
* - 6 rows in Warp: Warp keeps ~5 rows of block chrome (sticky command header +
|
|
50
|
+
* pinned input) drawn OVER the alternate screen and over-reports stdout.rows by
|
|
51
|
+
* that much, so the TOP clips unless we also subtract them (1 guard + 5 chrome;
|
|
52
|
+
* measured against the user's Warp build — see Warp issues #6428/#2373, the
|
|
53
|
+
* chrome area can't be reclaimed via alt_screen_padding). Gated on TERM_PROGRAM
|
|
54
|
+
* so non-Warp terminals keep the plain 1-row reserve (an extra reserve elsewhere
|
|
55
|
+
* would leave a blank band).
|
|
56
|
+
*
|
|
57
|
+
* MM_TUI_RESERVE_ROWS (integer ≥ 0) overrides the whole reserve so a user on a
|
|
58
|
+
* different Warp version / input position / timing-line setting can self-tune
|
|
59
|
+
* (e.g. =5 or =7) without waiting for a release; 0 opts out entirely.
|
|
60
|
+
*/
|
|
61
|
+
export function rowsReserve(env = process.env) {
|
|
62
|
+
// Any non-blank INTEGER string overrides (so `MM_TUI_RESERVE_ROWS=` or stray
|
|
63
|
+
// whitespace falls back to the default rather than being read as 0 —
|
|
64
|
+
// `Number("")` is 0). The override may be NEGATIVE: a negative reserve GROWS the
|
|
65
|
+
// frame past the terminal height (termRows = rows - reserve), so the knob goes
|
|
66
|
+
// both ways — positive shrinks the frame, negative grows it — letting a user
|
|
67
|
+
// find the exact offset their terminal (e.g. Warp) needs in either direction.
|
|
68
|
+
const raw = env.MM_TUI_RESERVE_ROWS;
|
|
69
|
+
if (typeof raw === "string" && raw.trim() !== "") {
|
|
70
|
+
const n = Number(raw);
|
|
71
|
+
if (Number.isInteger(n)) return n;
|
|
72
|
+
}
|
|
73
|
+
return env.TERM_PROGRAM === "WarpTerminal" ? 6 : 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Frame height for a terminal of `rows` rows: reserve rows, then clamp to a
|
|
77
|
+
* sane window [8, 200]. Pure (env-injectable) so it's unit-testable. */
|
|
78
|
+
export function computeTermRows(rows, env = process.env) {
|
|
79
|
+
return Math.max(8, Math.min((rows || 24) - rowsReserve(env), 200));
|
|
80
|
+
}
|
|
81
|
+
|
|
43
82
|
/** Full terminal dims, resize-aware. Fills the screen edge-to-edge.
|
|
44
83
|
* MM_TUI_WIDTH / MM_TUI_HEIGHT force exact dims (reproducible screenshots). */
|
|
45
84
|
function useTermDims() {
|
|
@@ -69,17 +108,10 @@ function useTermDims() {
|
|
|
69
108
|
const cols = Number.isFinite(fw) && fw > 0 ? fw : dims.cols;
|
|
70
109
|
const rows = Number.isFinite(fh) && fh > 0 ? fh : dims.rows;
|
|
71
110
|
// Never exceed the real terminal width (a wider frame soft-wraps every chrome
|
|
72
|
-
// line and shatters the window).
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
// EVERY render; across the handful of renders during load/settle that scroll
|
|
77
|
-
// accumulates and creeps the window's top off-screen (the "not full-screen after
|
|
78
|
-
// the game / in Warp" clip). One row short keeps the last line blank so nothing
|
|
79
|
-
// ever scrolls. This is safe now that the TUI lives in the ALT SCREEN: ink's
|
|
80
|
-
// cursor-up diffing (which it uses when the frame is shorter than the terminal)
|
|
81
|
-
// stays inside the fixed alt buffer and can't drift the way it did inline.
|
|
82
|
-
return { outer: Math.min(cols || 80, 220), termRows: Math.max(8, Math.min((rows || 24) - 1, 200)) };
|
|
111
|
+
// line and shatters the window). Height reserves rows (see rowsReserve) so the
|
|
112
|
+
// frame never fills the screen and clips the top — 1 row everywhere (scroll
|
|
113
|
+
// guard), 6 in Warp (block chrome over-reports rows), MM_TUI_RESERVE_ROWS tunes.
|
|
114
|
+
return { outer: Math.min(cols || 80, 220), termRows: computeTermRows(rows) };
|
|
83
115
|
}
|
|
84
116
|
|
|
85
117
|
function PromptRow({ prompt }) {
|