oc-flight-deck 0.7.0 โ 0.8.1
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/README.md +18 -5
- package/flight-deck.example.jsonc +18 -3
- package/flight-deck.schema.json +17 -3
- package/package.json +2 -2
- package/src/tui/config.ts +90 -21
- package/src/tui/index.tsx +51 -30
- package/src/tui/style.ts +1 -1
package/README.md
CHANGED
|
@@ -27,8 +27,6 @@ Restart OpenCode. **That's the whole setup.** No config file, no options, nothin
|
|
|
27
27
|
## ๐ The panel
|
|
28
28
|
|
|
29
29
|
```text
|
|
30
|
-
โ FLIGHT DECK
|
|
31
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
32
30
|
status โ น running
|
|
33
31
|
agent orchestrator
|
|
34
32
|
model deepseek-v4.1-flash ยท high
|
|
@@ -43,6 +41,8 @@ tps 18 tok/s
|
|
|
43
41
|
|
|
44
42
|
Every row is read from the open session at render time โ except `caution`, which watches a clock rather than events (a hang emits none); `elapsed`, which is seeded once from the session's own recorded assistant turn spans and then accumulates the busy windows this run observes, rather than a value the session reports; and the opt-in `guard` row, which is polled from the local guard RPC.
|
|
45
43
|
|
|
44
|
+
The panel's only fixed text โ `โธ FLIGHT DECK` over a separator โ is **opt-in**. It renders in the sidebar footer slot, a separate host region **below** the rows: the top of the rail starts directly with the live rows. Since 0.8.1 the footer is empty by default, so a fresh install draws the live rows and nothing else; set `sidebar.footer.lines` to the pair to re-enable it (see โ๏ธ Configure). The footer is independent of `sidebar.rows` and `sidebar.maxLines`.
|
|
45
|
+
|
|
46
46
|
| Row | What it shows |
|
|
47
47
|
|---|---|
|
|
48
48
|
| `caution` | **The annunciator** โ silent unless something stopped moving ยท **off by default** |
|
|
@@ -109,9 +109,22 @@ The file is optional, and a missing file is normal and silent: with no file at a
|
|
|
109
109
|
|
|
110
110
|
> **Upgrading from 0.4.0 โ the config file moved.** The per-project search is gone. A `flight-deck.jsonc` in a project root or in `.opencode/` is no longer read; move it to `~/.config/opencode/flight-deck.jsonc` (or the `$XDG_CONFIG_HOME` path above) to keep your settings.
|
|
111
111
|
|
|
112
|
+
> **Upgrading from 0.7.0 โ the branding moved.** The `โธ FLIGHT DECK` pair now renders in the sidebar footer slot, and `sidebar.lines` defaults to empty, so the top of the rail starts with the live rows. An explicit `sidebar.lines` is kept โ it does not suppress the footer default; `sidebar.footer.lines: []` is the way to drop the footer entirely.
|
|
113
|
+
|
|
114
|
+
> **Upgrading from 0.8.0 โ the branding is opt-in since 0.8.1.** The footer slot no longer ships the `โธ FLIGHT DECK` pair by default: with `sidebar.footer.lines` empty (the new default) nothing renders below the rows and no footer slot is claimed. Set `sidebar.footer.lines` back to the pair to get the footer exactly as it was.
|
|
115
|
+
|
|
112
116
|
`sidebar.rows` picks the rows and their order; `sidebar.maxLines` caps the whole rail (fixed lines plus rows, default 24, configurable from 1 to 24); `layout.labelWidth` fits your terminal; `format.duration` switches the `elapsed` row between `spaced` (`2h 14m 37s`, the default) and `compact` (`2h14m37s`).
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
`sidebar.footer.lines` sets the fixed lines in the sidebar footer slot โ empty by default since 0.8.1, in a region the host draws below the rows. Set it to the documented pair to re-enable the branding:
|
|
119
|
+
|
|
120
|
+
```jsonc
|
|
121
|
+
// inside "sidebar":
|
|
122
|
+
"footer": { "lines": ["โธ FLIGHT DECK", "โโโโโโโโโโโโโโโโโ"] }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
It is independent of `sidebar.lines`: setting your own top lines does not turn the footer on, and an explicitly empty `"lines": []` inside `sidebar.footer` keeps the slot off entirely. The footer never counts against `sidebar.maxLines`.
|
|
126
|
+
|
|
127
|
+
Optional styling lives under `style`: `style.lines` controls the fixed branding/separator lines (the opt-in footer pair when you set `sidebar.footer.lines`, or whatever `sidebar.lines` you set), `style.rows."*"` sets every live row, and `style.rows.cost` (or another row name) overrides one field while inheriting omitted values from the wildcard. Colors are theme roles - `default`, `subdued`, `warning`, `error`, `success`, `info` - and attributes are OpenTUI descriptors: `bold`, `dim`, `italic`, `underline`, `blink`, `inverse`, `hidden`, `strikethrough`. Defaults keep the existing theme-native look; no ANSI escapes or raw colors are needed. Invalid colors, attributes, and row names are reported and safely ignored.
|
|
115
128
|
|
|
116
129
|
Everything else lives in the example file, documented inline - a typo is never fatal: the bad value is ignored, the default comes back, and you get a one-time toast naming the key to fix.
|
|
117
130
|
|
|
@@ -188,7 +201,7 @@ Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/b
|
|
|
188
201
|
|
|
189
202
|
| | |
|
|
190
203
|
|---|---|
|
|
191
|
-
| Built against | `@opencode/plugin` `2.0.
|
|
204
|
+
| Built against | `@opencode/plugin` `2.0.19` โ pin a host version you've tested |
|
|
192
205
|
| Host | OpenCode V2 (`opencode2`) |
|
|
193
206
|
| Building from source | Node โฅ 22 or Bun โฅ 1.4 |
|
|
194
207
|
| Writes | In-memory counters only โ the animation tick, plus the `guard` row's polled status when `guard` is on; nothing to disk |
|
|
@@ -197,7 +210,7 @@ Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/b
|
|
|
197
210
|
|
|
198
211
|
<div align="center">
|
|
199
212
|
|
|
200
|
-
Built against `@opencode/plugin` 2.0.
|
|
213
|
+
Built against `@opencode/plugin` 2.0.19 ยท Node โฅ 22 / Bun โฅ 1.4 ยท OpenCode V2
|
|
201
214
|
|
|
202
215
|
**MIT ยฉ 2026 nathwn12** ยท For OpenCode. Free.
|
|
203
216
|
|
|
@@ -58,11 +58,26 @@
|
|
|
58
58
|
// false hides the whole panel.
|
|
59
59
|
"enabled": true,
|
|
60
60
|
|
|
61
|
-
// Fixed lines, rendered above the live rows.
|
|
62
|
-
//
|
|
61
|
+
// Fixed lines, rendered above the live rows. EMPTY by default since
|
|
62
|
+
// 0.8.0: the branding pair has moved to `sidebar.footer.lines` below, so
|
|
63
|
+
// the top of the rail starts with the live rows. Put your own words here,
|
|
64
|
+
// or a rule โ an explicit list does NOT suppress the footer default.
|
|
63
65
|
// Fixed lines use style.lines; live rows use their style.rows entry or the
|
|
64
66
|
// wildcard. With no custom style, the shipped theme-native look is kept.
|
|
65
|
-
"lines": [
|
|
67
|
+
"lines": [],
|
|
68
|
+
|
|
69
|
+
// The sidebar footer slot: fixed lines below the rows, in the host's
|
|
70
|
+
// dedicated sidebar-footer area, outside the maxLines budget. EMPTY by
|
|
71
|
+
// default since 0.8.1 โ copying this file yields the minimal TUI. The
|
|
72
|
+
// branding pair is the documented opt-in; set it back to re-enable:
|
|
73
|
+
//
|
|
74
|
+
// "lines": ["โธ FLIGHT DECK", "โโโโโโโโโโโโโโโโโ"]
|
|
75
|
+
//
|
|
76
|
+
// An explicitly empty list removes the footer slot entirely. Fixed lines
|
|
77
|
+
// use style.lines.
|
|
78
|
+
"footer": {
|
|
79
|
+
"lines": []
|
|
80
|
+
},
|
|
66
81
|
|
|
67
82
|
// The live rows, top to bottom. Every value is read from the open session,
|
|
68
83
|
// so you never type these in. Delete any row you don't want, or reorder
|
package/flight-deck.schema.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"sidebar": {
|
|
23
23
|
"type": "object",
|
|
24
24
|
"additionalProperties": false,
|
|
25
|
-
"description": "The rail itself: the
|
|
25
|
+
"description": "The rail itself: the fixed lines, the live rows, and the sidebar footer slot's lines.",
|
|
26
26
|
"properties": {
|
|
27
27
|
"enabled": {
|
|
28
28
|
"type": "boolean",
|
|
@@ -32,9 +32,23 @@
|
|
|
32
32
|
"lines": {
|
|
33
33
|
"type": "array",
|
|
34
34
|
"items": { "type": "string" },
|
|
35
|
-
"default": [
|
|
35
|
+
"default": [],
|
|
36
36
|
"maxItems": 24,
|
|
37
|
-
"description": "Fixed lines rendered above the live rows, in order.
|
|
37
|
+
"description": "Fixed lines rendered above the live rows, in order. Empty by default since 0.8.0 โ the branding pair moved to `sidebar.footer.lines`, so the top of the rail starts with the live rows. Any lines you list here render at full brightness while the live rows below them are dimmed, and they draw from the same 24-line cap as the rows. An explicit list does not suppress the footer default."
|
|
38
|
+
},
|
|
39
|
+
"footer": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"description": "Fixed lines rendered in the sidebar footer slot, a separate host region below the rows that draws outside the 24-line rail cap. Empty by default since 0.8.1 โ set the documented `โธ FLIGHT DECK` / `โโโโโโโโโโโโโโโโโ` pair in `lines` to re-enable the branding. An explicitly empty `lines` array removes the slot entirely.",
|
|
43
|
+
"properties": {
|
|
44
|
+
"lines": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": { "type": "string" },
|
|
47
|
+
"default": [],
|
|
48
|
+
"maxItems": 24,
|
|
49
|
+
"description": "The footer's fixed lines, in order. Empty by default since 0.8.1 โ set the documented `โธ FLIGHT DECK` / `โโโโโโโโโโโโโโโโโ` pairing here to re-enable it. Independent of `sidebar.lines`, so setting your own top lines does not turn the footer on. An explicit empty array opts the footer slot out (and never registers it)."
|
|
50
|
+
}
|
|
51
|
+
}
|
|
38
52
|
},
|
|
39
53
|
"rows": {
|
|
40
54
|
"type": "array",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-flight-deck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Live OpenCode V2 session telemetry โ agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@opencode/plugin": "2.0.
|
|
56
|
+
"@opencode/plugin": "2.0.19"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@opentui/core": "0.5.12",
|
package/src/tui/config.ts
CHANGED
|
@@ -24,8 +24,13 @@ import {
|
|
|
24
24
|
interface SidebarConfig {
|
|
25
25
|
/** Show the sidebar rail. Default `true`. */
|
|
26
26
|
readonly enabled: boolean;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Fixed lines rendered above the live rows. Default `DEFAULT_SIDEBAR_LINES`
|
|
29
|
+
* (empty since 0.8.0 โ the branding pair moved to the sidebar footer).
|
|
30
|
+
*/
|
|
28
31
|
readonly lines: readonly string[];
|
|
32
|
+
/** Fixed lines rendered in the sidebar footer slot. Default `DEFAULT_SIDEBAR_FOOTER_LINES`. */
|
|
33
|
+
readonly footer: SidebarFooterConfig;
|
|
29
34
|
/** Live session fields to render, top to bottom. Default `DEFAULT_SIDEBAR_ROWS`. */
|
|
30
35
|
readonly rows: readonly string[];
|
|
31
36
|
/**
|
|
@@ -43,6 +48,18 @@ interface SidebarConfig {
|
|
|
43
48
|
readonly maxLines: number;
|
|
44
49
|
}
|
|
45
50
|
|
|
51
|
+
interface SidebarFooterConfig {
|
|
52
|
+
/**
|
|
53
|
+
* The footer's fixed lines. Empty by default since 0.8.1.
|
|
54
|
+
*
|
|
55
|
+
* An explicitly empty list opts the footer slot out entirely. Only a
|
|
56
|
+
* non-empty list registers the slot: set the documented `โธ FLIGHT DECK` /
|
|
57
|
+
* `โโโโโโโโโโโโโโโโโ` branding pair here to re-enable it. The two lists are
|
|
58
|
+
* independent, and the footer draws outside the rail's `maxLines` budget.
|
|
59
|
+
*/
|
|
60
|
+
readonly lines: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
interface FooterConfig {
|
|
47
64
|
/**
|
|
48
65
|
* Show the prompt-footer rail. Default `false`.
|
|
@@ -202,15 +219,26 @@ const DEFAULT_CAUTION: CautionConfig = {
|
|
|
202
219
|
};
|
|
203
220
|
|
|
204
221
|
/**
|
|
205
|
-
* Fixed lines shown above the live rows
|
|
222
|
+
* Fixed lines shown above the live rows.
|
|
206
223
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
224
|
+
* Empty since 0.8.0: the branding pair moved to the sidebar footer slot
|
|
225
|
+
* (`DEFAULT_SIDEBAR_FOOTER_LINES`), so the top of the rail starts with the
|
|
226
|
+
* live rows. The rail exists to show session state, so nothing here is
|
|
227
|
+
* filler: there is no placeholder text to delete before it looks finished.
|
|
209
228
|
*/
|
|
210
|
-
export const DEFAULT_SIDEBAR_LINES: readonly string[] = [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
229
|
+
export const DEFAULT_SIDEBAR_LINES: readonly string[] = [];
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The sidebar footer's default fixed lines.
|
|
233
|
+
*
|
|
234
|
+
* Empty since 0.8.1: a fresh install renders no footer text at all, so the
|
|
235
|
+
* rail is the live rows and nothing else. The `โธ FLIGHT DECK` /
|
|
236
|
+
* `โโโโโโโโโโโโโโโโโ` branding pair is a documented opt-in โ set
|
|
237
|
+
* `sidebar.footer.lines` to the pair to re-enable it (see the README's
|
|
238
|
+
* โ๏ธ Configure section). An explicitly empty `sidebar.footer.lines` from a
|
|
239
|
+
* config file removes the slot entirely.
|
|
240
|
+
*/
|
|
241
|
+
export const DEFAULT_SIDEBAR_FOOTER_LINES: readonly string[] = [];
|
|
214
242
|
|
|
215
243
|
/**
|
|
216
244
|
* Live fields shown by default, in reading order.
|
|
@@ -268,6 +296,7 @@ export const DEFAULT_CONFIG: FlightDeckConfig = {
|
|
|
268
296
|
sidebar: {
|
|
269
297
|
enabled: true,
|
|
270
298
|
lines: DEFAULT_SIDEBAR_LINES,
|
|
299
|
+
footer: { lines: DEFAULT_SIDEBAR_FOOTER_LINES },
|
|
271
300
|
rows: DEFAULT_SIDEBAR_ROWS,
|
|
272
301
|
persist: true,
|
|
273
302
|
placeholder: DEFAULT_PLACEHOLDER,
|
|
@@ -331,27 +360,42 @@ function readText(value: unknown, fallback: string, path: string, issues: string
|
|
|
331
360
|
return text;
|
|
332
361
|
}
|
|
333
362
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
363
|
+
/**
|
|
364
|
+
* One fixed-line list, shared by the top rail and the sidebar footer.
|
|
365
|
+
*
|
|
366
|
+
* An explicitly empty list is a real choice for both rails - the top rail's
|
|
367
|
+
* lines default to empty since 0.8.0, and an empty footer list removes the
|
|
368
|
+
* footer slot entirely. A list with no usable entries still falls back to
|
|
369
|
+
* `fallback`, loudly, like every other bad option.
|
|
370
|
+
*/
|
|
371
|
+
function readLineList(
|
|
372
|
+
value: unknown,
|
|
373
|
+
issues: string[],
|
|
374
|
+
maxLines: number,
|
|
375
|
+
fallback: readonly string[],
|
|
376
|
+
path: string,
|
|
377
|
+
): readonly string[] {
|
|
378
|
+
if (value === undefined) return fallback;
|
|
379
|
+
if (!Array.isArray(value)) {
|
|
380
|
+
issues.push(`${path} must be an array of strings; using the default lines`);
|
|
381
|
+
return fallback;
|
|
339
382
|
}
|
|
383
|
+
if (value.length === 0) return [];
|
|
340
384
|
|
|
341
385
|
const lines: string[] = [];
|
|
342
386
|
value.forEach((entry, index) => {
|
|
343
|
-
const
|
|
387
|
+
const entryPath = `${path}[${index}]`;
|
|
344
388
|
if (typeof entry !== "string") {
|
|
345
|
-
issues.push(`${
|
|
389
|
+
issues.push(`${entryPath} must be a string; skipping it`);
|
|
346
390
|
return;
|
|
347
391
|
}
|
|
348
|
-
const text = normalizeText(entry,
|
|
392
|
+
const text = normalizeText(entry, entryPath, issues);
|
|
349
393
|
if (text.length === 0) {
|
|
350
|
-
issues.push(`${
|
|
394
|
+
issues.push(`${entryPath} is empty; skipping it`);
|
|
351
395
|
return;
|
|
352
396
|
}
|
|
353
397
|
if (text.length > MAX_LINE_LENGTH) {
|
|
354
|
-
issues.push(`${
|
|
398
|
+
issues.push(`${entryPath} was longer than ${MAX_LINE_LENGTH} characters; it was shortened`);
|
|
355
399
|
lines.push(text.slice(0, MAX_LINE_LENGTH));
|
|
356
400
|
return;
|
|
357
401
|
}
|
|
@@ -359,16 +403,32 @@ function readLines(value: unknown, issues: string[], maxLines: number): readonly
|
|
|
359
403
|
});
|
|
360
404
|
|
|
361
405
|
if (lines.length === 0) {
|
|
362
|
-
issues.push(
|
|
363
|
-
return
|
|
406
|
+
issues.push(`${path} had no usable entries; using the default lines`);
|
|
407
|
+
return fallback;
|
|
364
408
|
}
|
|
365
409
|
if (lines.length > maxLines) {
|
|
366
|
-
issues.push(
|
|
410
|
+
issues.push(`${path} has ${lines.length} entries; keeping the first ${maxLines}`);
|
|
367
411
|
return lines.slice(0, maxLines);
|
|
368
412
|
}
|
|
369
413
|
return lines;
|
|
370
414
|
}
|
|
371
415
|
|
|
416
|
+
function readLines(value: unknown, issues: string[], maxLines: number): readonly string[] {
|
|
417
|
+
return readLineList(value, issues, maxLines, DEFAULT_SIDEBAR_LINES, "sidebar.lines");
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* The sidebar footer's fixed lines โ empty by default since 0.8.1.
|
|
422
|
+
*
|
|
423
|
+
* Unlike the top rail, an explicitly empty list is meaningful: it removes the
|
|
424
|
+
* footer slot entirely. A non-empty list with no usable entries falls back to
|
|
425
|
+
* the (empty) default, reported like every other bad value, and a runaway
|
|
426
|
+
* footer is capped at `MAX_LINES` the way the top rail is.
|
|
427
|
+
*/
|
|
428
|
+
function readSidebarFooterLines(value: unknown, issues: string[]): readonly string[] {
|
|
429
|
+
return readLineList(value, issues, MAX_LINES, DEFAULT_SIDEBAR_FOOTER_LINES, "sidebar.footer.lines");
|
|
430
|
+
}
|
|
431
|
+
|
|
372
432
|
/**
|
|
373
433
|
* Read the list of live fields to render.
|
|
374
434
|
*
|
|
@@ -809,7 +869,15 @@ export function resolveConfig(options: unknown): ConfigResolution {
|
|
|
809
869
|
const footerConfigured = Object.keys(footer).length > 0;
|
|
810
870
|
|
|
811
871
|
const maxLines = readMaxLines(sidebar.maxLines, issues);
|
|
872
|
+
// The sidebar footer is its own host slot with its own list; a malformed
|
|
873
|
+
// section is reported and the default branding comes back.
|
|
874
|
+
const rawSidebarFooter = sidebar.footer;
|
|
875
|
+
if (rawSidebarFooter !== undefined && !isRecord(rawSidebarFooter)) {
|
|
876
|
+
issues.push("sidebar.footer must be an object; using defaults");
|
|
877
|
+
}
|
|
878
|
+
const sidebarFooter = isRecord(rawSidebarFooter) ? rawSidebarFooter : {};
|
|
812
879
|
const lines = readLines(sidebar.lines, issues, maxLines);
|
|
880
|
+
const footerLines = readSidebarFooterLines(sidebarFooter.lines, issues);
|
|
813
881
|
const rows = readRows(sidebar.rows, issues, maxLines);
|
|
814
882
|
// `railLines` caps the whole rail at `sidebar.maxLines`, so the fixed lines
|
|
815
883
|
// and the live rows draw from one budget. `readLines` already reports its own
|
|
@@ -826,6 +894,7 @@ export function resolveConfig(options: unknown): ConfigResolution {
|
|
|
826
894
|
sidebar: {
|
|
827
895
|
enabled: readBoolean(sidebar.enabled, DEFAULT_CONFIG.sidebar.enabled, "sidebar.enabled", issues),
|
|
828
896
|
lines,
|
|
897
|
+
footer: { lines: footerLines },
|
|
829
898
|
rows,
|
|
830
899
|
persist: readBoolean(sidebar.persist, DEFAULT_CONFIG.sidebar.persist, "sidebar.persist", issues),
|
|
831
900
|
placeholder: readText(
|
package/src/tui/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Plugin } from "@opencode/plugin/tui";
|
|
|
3
3
|
import { cautionDetail, cautionText, detectCautions, worstCaution, type Caution } from "./caution.js";
|
|
4
4
|
import { cautionThresholds, mergeOptions, resolveConfig } from "./config.js";
|
|
5
5
|
import { loadConfigFile } from "./file-config.js";
|
|
6
|
-
import { footerLine, railLineSpans, railLines, railLineStyle } from "./presentation.js";
|
|
6
|
+
import { footerLine, railLineSpans, railLines, railLineStyle, type RailLine } from "./presentation.js";
|
|
7
7
|
import { ANIMATED_FIELDS, type StatSource } from "./stats.js";
|
|
8
8
|
import { attributeMask, themeColor } from "./style.js";
|
|
9
9
|
import { startGuardBridge } from "./guard.js";
|
|
@@ -60,6 +60,34 @@ export default Plugin.define({
|
|
|
60
60
|
const footer = footerLine(config);
|
|
61
61
|
const releases: Array<() => void> = [];
|
|
62
62
|
|
|
63
|
+
// One themed line, in the exact form the sidebar draws: the line resolves
|
|
64
|
+
// its own look from `config.style` (fixed lines use `style.lines`, every
|
|
65
|
+
// live row its own entry or the wildcard), and `themeColor`/`attributeMask`
|
|
66
|
+
// are the only things that know how a role or an attribute name becomes
|
|
67
|
+
// renderer state โ they hand back plain props here, never escapes.
|
|
68
|
+
//
|
|
69
|
+
// `?? 0` keeps a line with no attributes on the renderer's own default
|
|
70
|
+
// instead of assigning `undefined` over it, so the shipped config draws
|
|
71
|
+
// exactly what it always drew. Shared with the sidebar footer slot so both
|
|
72
|
+
// rails stay one styling path.
|
|
73
|
+
const themedLine = (line: RailLine) => {
|
|
74
|
+
const style = railLineStyle(config.style, line);
|
|
75
|
+
const lineFg = themeColor(style.color, context.theme) as string | undefined;
|
|
76
|
+
// The span mapping โ which run inherits the line's colour and which
|
|
77
|
+
// takes its own tone โ lives in a pure helper, so the "only the flagged
|
|
78
|
+
// window is red" decision is tested directly. All this renderer does is
|
|
79
|
+
// resolve each role to a theme colour and pass `fg`, never ANSI.
|
|
80
|
+
return (
|
|
81
|
+
<text fg={lineFg} attributes={attributeMask(style.attributes) ?? 0}>
|
|
82
|
+
{railLineSpans(line, style).map((span) => (
|
|
83
|
+
<span style={{ fg: themeColor(span.color, context.theme) as string | undefined }}>
|
|
84
|
+
{span.text}
|
|
85
|
+
</span>
|
|
86
|
+
))}
|
|
87
|
+
</text>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
63
91
|
// Bound a bankable window to a few ticks: `min(60s, max(5s, 4 * refreshMs))`,
|
|
64
92
|
// so a suspended process or a sparse-event gap cannot be billed as work.
|
|
65
93
|
const maxBankedMs = Math.min(60_000, Math.max(5_000, 4 * config.refresh));
|
|
@@ -258,35 +286,8 @@ export default Plugin.define({
|
|
|
258
286
|
return (
|
|
259
287
|
// No padding here: the host already lays out and pads the sidebar,
|
|
260
288
|
// so adding our own would push the rows out of alignment with it.
|
|
261
|
-
//
|
|
262
|
-
// Each line resolves its own look from `config.style`: the fixed
|
|
263
|
-
// lines use `style.lines`, and every live row its own entry or the
|
|
264
|
-
// wildcard. `themeColor`/`attributeMask` are the only things that
|
|
265
|
-
// know how a role or an attribute name becomes renderer state, and
|
|
266
|
-
// they hand back plain props here โ never escapes.
|
|
267
|
-
//
|
|
268
|
-
// `?? 0` keeps a line with no attributes on the renderer's own
|
|
269
|
-
// default instead of assigning `undefined` over it, so the shipped
|
|
270
|
-
// config draws exactly what it always drew.
|
|
271
289
|
<box flexDirection="column">
|
|
272
|
-
{lines.map(
|
|
273
|
-
const style = railLineStyle(config.style, line);
|
|
274
|
-
const lineFg = themeColor(style.color, context.theme) as string | undefined;
|
|
275
|
-
// The span mapping โ which run inherits the row's colour and
|
|
276
|
-
// which takes its own tone โ lives in a pure helper, so the
|
|
277
|
-
// "only the flagged window is red" decision is tested directly.
|
|
278
|
-
// All this renderer does is resolve each role to a theme colour
|
|
279
|
-
// and pass `fg`, never ANSI or escapes.
|
|
280
|
-
return (
|
|
281
|
-
<text fg={lineFg} attributes={attributeMask(style.attributes) ?? 0}>
|
|
282
|
-
{railLineSpans(line, style).map((span) => (
|
|
283
|
-
<span style={{ fg: themeColor(span.color, context.theme) as string | undefined }}>
|
|
284
|
-
{span.text}
|
|
285
|
-
</span>
|
|
286
|
-
))}
|
|
287
|
-
</text>
|
|
288
|
-
);
|
|
289
|
-
})}
|
|
290
|
+
{lines.map(themedLine)}
|
|
290
291
|
</box>
|
|
291
292
|
);
|
|
292
293
|
},
|
|
@@ -294,11 +295,31 @@ export default Plugin.define({
|
|
|
294
295
|
);
|
|
295
296
|
}
|
|
296
297
|
|
|
298
|
+
if (config.sidebar.enabled && config.sidebar.footer.lines.length > 0) {
|
|
299
|
+
releases.push(
|
|
300
|
+
context.ui.slot({
|
|
301
|
+
// The sidebar footer: a separate host slot below the rows. The
|
|
302
|
+
// lines are empty by default since 0.8.1, so this registration is
|
|
303
|
+
// purely opt-in โ set `sidebar.footer.lines` (the documented
|
|
304
|
+
// `โธ FLIGHT DECK` pair, or your own) to claim the slot. It draws
|
|
305
|
+
// outside the `maxLines` budget and stays when `sidebar.lines` is
|
|
306
|
+
// customized. The lines are fixed, so nothing here subscribes to
|
|
307
|
+
// the ticker or the session.
|
|
308
|
+
append: "sidebar.footer",
|
|
309
|
+
render: () => (
|
|
310
|
+
<box flexDirection="column">
|
|
311
|
+
{config.sidebar.footer.lines.map((text) => themedLine({ text }))}
|
|
312
|
+
</box>
|
|
313
|
+
),
|
|
314
|
+
}),
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
|
|
297
318
|
if (footer !== undefined) {
|
|
298
319
|
releases.push(
|
|
299
320
|
context.ui.slot({
|
|
300
321
|
append: "prompt.footer.status",
|
|
301
|
-
render: () => <text fg={context.theme
|
|
322
|
+
render: () => <text fg={themeColor("subdued", context.theme) as string | undefined}>{footer}</text>,
|
|
302
323
|
}),
|
|
303
324
|
);
|
|
304
325
|
}
|
package/src/tui/style.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface LineStyle {
|
|
|
45
45
|
|
|
46
46
|
/** The `style` config section, resolved. */
|
|
47
47
|
export interface StyleConfig {
|
|
48
|
-
/**
|
|
48
|
+
/** Fixed separator/branding lines rendered at the top of the rail. */
|
|
49
49
|
readonly lines: LineStyle;
|
|
50
50
|
readonly rows: {
|
|
51
51
|
/** Every live row inherits this unless it has its own entry. */
|