oc-flight-deck 0.7.0 โ 0.8.0
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 +12 -5
- package/flight-deck.example.jsonc +13 -3
- package/flight-deck.schema.json +17 -3
- package/package.json +2 -2
- package/src/tui/config.ts +88 -19
- package/src/tui/index.tsx +50 -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
|
|
@@ -39,10 +37,15 @@ cache 98% hit ยท 32M read
|
|
|
39
37
|
context โโโโโโโโโโ 18%
|
|
40
38
|
elapsed 2h 14m 37s
|
|
41
39
|
tps 18 tok/s
|
|
40
|
+
|
|
41
|
+
โธ FLIGHT DECK
|
|
42
|
+
โโโโโโโโโโโโโโโโโ
|
|
42
43
|
```
|
|
43
44
|
|
|
44
45
|
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
46
|
|
|
47
|
+
The panel's only fixed text โ `โธ FLIGHT DECK` over a separator โ renders in the sidebar footer slot, a separate host region **below** the rows: the top of the rail starts directly with the live rows. The footer is independent of `sidebar.rows` and `sidebar.maxLines`; it ships the branding pair by default, and `sidebar.footer.lines` replaces or removes it (see โ๏ธ Configure).
|
|
48
|
+
|
|
46
49
|
| Row | What it shows |
|
|
47
50
|
|---|---|
|
|
48
51
|
| `caution` | **The annunciator** โ silent unless something stopped moving ยท **off by default** |
|
|
@@ -109,9 +112,13 @@ The file is optional, and a missing file is normal and silent: with no file at a
|
|
|
109
112
|
|
|
110
113
|
> **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
114
|
|
|
115
|
+
> **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.
|
|
116
|
+
|
|
112
117
|
`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
118
|
|
|
114
|
-
|
|
119
|
+
`sidebar.footer.lines` sets the fixed lines in the sidebar footer slot โ the branding pair by default, in a region the host draws below the rows. It is independent of `sidebar.lines`: setting your own top lines keeps the default footer, and an explicitly empty `"lines": []` inside `sidebar.footer` removes the slot entirely. The footer never counts against `sidebar.maxLines`.
|
|
120
|
+
|
|
121
|
+
Optional styling lives under `style`: `style.lines` controls the fixed branding/separator lines (the sidebar footer's default pair, 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
122
|
|
|
116
123
|
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
124
|
|
|
@@ -188,7 +195,7 @@ Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/b
|
|
|
188
195
|
|
|
189
196
|
| | |
|
|
190
197
|
|---|---|
|
|
191
|
-
| Built against | `@opencode/plugin` `2.0.
|
|
198
|
+
| Built against | `@opencode/plugin` `2.0.19` โ pin a host version you've tested |
|
|
192
199
|
| Host | OpenCode V2 (`opencode2`) |
|
|
193
200
|
| Building from source | Node โฅ 22 or Bun โฅ 1.4 |
|
|
194
201
|
| Writes | In-memory counters only โ the animation tick, plus the `guard` row's polled status when `guard` is on; nothing to disk |
|
|
@@ -197,7 +204,7 @@ Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/b
|
|
|
197
204
|
|
|
198
205
|
<div align="center">
|
|
199
206
|
|
|
200
|
-
Built against `@opencode/plugin` 2.0.
|
|
207
|
+
Built against `@opencode/plugin` 2.0.19 ยท Node โฅ 22 / Bun โฅ 1.4 ยท OpenCode V2
|
|
201
208
|
|
|
202
209
|
**MIT ยฉ 2026 nathwn12** ยท For OpenCode. Free.
|
|
203
210
|
|
|
@@ -58,11 +58,21 @@
|
|
|
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. NEW in 0.8.0 โ the branding pair ships
|
|
71
|
+
// here by default, outside the maxLines budget. An explicitly empty list
|
|
72
|
+
// removes the footer slot entirely. Fixed lines use style.lines.
|
|
73
|
+
"footer": {
|
|
74
|
+
"lines": ["โธ FLIGHT DECK", "โโโโโโโโโโโโโโโโโ"]
|
|
75
|
+
},
|
|
66
76
|
|
|
67
77
|
// The live rows, top to bottom. Every value is read from the open session,
|
|
68
78
|
// 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. The branding pair ships here by default; an explicitly empty `lines` array removes the slot entirely.",
|
|
43
|
+
"properties": {
|
|
44
|
+
"lines": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": { "type": "string" },
|
|
47
|
+
"default": ["โธ FLIGHT DECK", "โโโโโโโโโโโโโโโโโ"],
|
|
48
|
+
"maxItems": 24,
|
|
49
|
+
"description": "The footer's fixed lines, in order. Defaults to the branding pair; independent of `sidebar.lines`, so setting your own top lines keeps the default footer. An explicit empty array opts the footer slot out entirely."
|
|
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.0",
|
|
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 โ the branding pair by default.
|
|
54
|
+
*
|
|
55
|
+
* An explicitly empty list opts the footer slot out entirely. Absent, the
|
|
56
|
+
* default branding comes back regardless of what `sidebar.lines` says: the
|
|
57
|
+
* two lists are independent, and the footer draws outside the rail's
|
|
58
|
+
* `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,13 +219,24 @@ 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.
|
|
223
|
+
*
|
|
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.
|
|
228
|
+
*/
|
|
229
|
+
export const DEFAULT_SIDEBAR_LINES: readonly string[] = [];
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The sidebar footer's default fixed lines โ branding only.
|
|
206
233
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
234
|
+
* They render in the host's separate `sidebar.footer` slot, below the rows
|
|
235
|
+
* and outside the rail's `maxLines` budget. An explicitly empty
|
|
236
|
+
* `sidebar.footer.lines` from a config file removes the slot entirely.
|
|
209
237
|
*/
|
|
210
|
-
export const
|
|
211
|
-
"
|
|
238
|
+
export const DEFAULT_SIDEBAR_FOOTER_LINES: readonly string[] = [
|
|
239
|
+
"โธ FLIGHT DECK",
|
|
212
240
|
"โโโโโโโโโโโโโโโโโ",
|
|
213
241
|
];
|
|
214
242
|
|
|
@@ -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 โ the branding pair by default.
|
|
422
|
+
*
|
|
423
|
+
* Unlike the top rail, an explicitly empty list is meaningful: it removes the
|
|
424
|
+
* footer slot entirely. Only a non-empty list with no usable entries falls
|
|
425
|
+
* back to the 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,30 @@ 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
|
+
// branding pair ships here by default since 0.8.0; an explicitly
|
|
303
|
+
// empty `sidebar.footer.lines` from a config file skips this
|
|
304
|
+
// registration entirely. It draws outside the `maxLines` budget and
|
|
305
|
+
// stays when `sidebar.lines` is customized. The lines are fixed, so
|
|
306
|
+
// nothing here subscribes to the ticker or the session.
|
|
307
|
+
append: "sidebar.footer",
|
|
308
|
+
render: () => (
|
|
309
|
+
<box flexDirection="column">
|
|
310
|
+
{config.sidebar.footer.lines.map((text) => themedLine({ text }))}
|
|
311
|
+
</box>
|
|
312
|
+
),
|
|
313
|
+
}),
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
297
317
|
if (footer !== undefined) {
|
|
298
318
|
releases.push(
|
|
299
319
|
context.ui.slot({
|
|
300
320
|
append: "prompt.footer.status",
|
|
301
|
-
render: () => <text fg={context.theme
|
|
321
|
+
render: () => <text fg={themeColor("subdued", context.theme) as string | undefined}>{footer}</text>,
|
|
302
322
|
}),
|
|
303
323
|
);
|
|
304
324
|
}
|
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. */
|