oc-flight-deck 0.6.2 → 0.6.3

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.
@@ -1,208 +1,208 @@
1
- {
2
- "$schema": "./flight-deck.schema.json",
3
-
4
- // ═════════════════════════════════════════════════════════════════════════
5
- // ✈ Flight Deck — configuration
6
- //
7
- // EVERYTHING HERE IS OPTIONAL. Install the plugin and the panel works with
8
- // no config file at all. The values below are the defaults, written out so
9
- // you can see exactly what there is to change. Delete any key and its
10
- // default comes straight back.
11
- //
12
- // TO USE IT: copy this file to `~/.config/opencode/flight-deck.jsonc` (or
13
- // `flight-deck.json` — the `.jsonc` name is tried first), then edit. Comments
14
- // and trailing commas are fine.
15
- //
16
- // There is ONE config file, global to your user, so the same values apply to
17
- // every project. Flight Deck does NOT look in a project root or in a
18
- // project's `.opencode/` directory: a copy left there configures nothing.
19
- //
20
- // If `$XDG_CONFIG_HOME` is set, the path is
21
- // `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead.
22
- //
23
- // The file is optional. Having none is the normal case, and it is silent —
24
- // the defaults below are what you get.
25
- //
26
- // Upgrading from 0.4.0? A `flight-deck.jsonc` in a project root or in
27
- // `.opencode/` is no longer read; move it to the global path above.
28
- //
29
- // The same values can also be passed as plugin options in opencode.jsonc /
30
- // cli.json, which take precedence on hosts that forward them.
31
- // ═════════════════════════════════════════════════════════════════════════
32
-
33
- // ── Update cadence ───────────────────────────────────────────────────────
34
- // Milliseconds between refreshes: the tick rate of everything that has to
35
- // animate. The status spinner has ten frames, so 100 turns it once a second.
36
- //
37
- // Cost, tokens, and permissions arrive from the host's own events, so they
38
- // stay current with no timer at all. Only clock-derived rows need one — and
39
- // `elapsed` plus the spinner are the reason this exists. Without a tick they
40
- // would sit frozen between turns.
41
- //
42
- // While nothing is running the tick backs off to about once a second: the
43
- // spinner is hidden then, and `elapsed` only reads in whole seconds, so the
44
- // host's renderer is woken a tenth as often for the same picture.
45
- //
46
- // 100 default — the spinner turns once a second, the clock stays live
47
- // 50 twice as lively, still negligible work per tick
48
- // 1000 a calm wall-clock tick, but the spinner visibly stutters
49
- // 0 no timer; `elapsed` and the spinner only move when the session does
50
- //
51
- // Anything faster than 16 (one frame at 60Hz) is clamped: a tick wakes the
52
- // host's renderer, so a smaller value spends work without adding motion.
53
- "refresh": 100,
54
-
55
- // ── Sidebar ──────────────────────────────────────────────────────────────
56
- "sidebar": {
57
- // false hides the whole panel.
58
- "enabled": true,
59
-
60
- // Fixed lines, rendered above the live rows. This is the only text Flight
61
- // Deck shows of its own — put your own words here, or a rule.
62
- // The first line uses your theme's primary text colour; the rest use the
63
- // subdued colour.
64
- "lines": ["✈ FLIGHT DECK", "─────────────────"],
65
-
66
- // The live rows, top to bottom. Every value is read from the open session,
67
- // so you never type these in. Delete any row you don't want, or reorder
68
- // them freely — an unknown name is ignored with a one-time warning, so a
69
- // typo can never break the panel.
70
- //
71
- // caution the annunciator: silent unless something stopped moving
72
- // status running or idle — the glyph turns while anything is working
73
- // agent which agent is running (orchestrator, build, plan, ...)
74
- // model model id, plus the variant when there is one
75
- // branch current git branch
76
- // cost this conversation, plus its subagents when any ran; with
77
- // `total` on the rail, the session figure alone
78
- // total the family total and subagent count on a row of its own
79
- // project every session in this project, not just the one on screen
80
- // tokens this session's input and output tokens
81
- // cache cache hit rate, then cache reads
82
- // context a gauge of how full the context window is
83
- // perms what is waiting for approval, not just how many
84
- // elapsed wall-clock time since the session started
85
- // tps current speed: output tokens in the last 60 seconds,
86
- // subagents included. Hides while idle longer than the
87
- // window; falls back to the session's lifetime average on
88
- // hosts with no per-message timestamps
89
- // spark recent turn sizes as a sparkline
90
- // reasoning reasoning tokens, when the model emits them
91
- // turns how many prompts you have sent this session
92
- // guard harness status from oc-harness-guard: breaches, orphans,
93
- // findings, or ok. Available, off by default.
94
- //
95
- // Every named row renders persistently, so the rail keeps a stable shape:
96
- // a row with no data yet shows the placeholder below, in the same label
97
- // column as a live row. The fixed lines and the live rows together are
98
- // capped at 24, and anything past that is dropped.
99
- "rows": [
100
- "caution",
101
- "status",
102
- "agent",
103
- "model",
104
- "branch",
105
- "cost",
106
- "project",
107
- "tokens",
108
- "cache",
109
- "context",
110
- "perms",
111
- "elapsed",
112
- "tps"
113
- ],
114
-
115
- // Every named row renders persistently: with no data yet it shows the
116
- // placeholder below, in the same label column as a live row. Set to false
117
- // to omit rows with no data instead.
118
- "persist": true,
119
-
120
- // Value shown for a persistent row with no data yet. Any non-empty string.
121
- "placeholder": "—"
122
- },
123
-
124
- // ── Footer ───────────────────────────────────────────────────────────────
125
- // Off by default: the sidebar already carries the data, and the prompt
126
- // footer is high-traffic space, so a line there should earn its place.
127
- //
128
- // Writing ANY footer setting turns it on — `"footer": { "text": "hi" }` is
129
- // enough. Set "enabled": false explicitly to keep it hidden.
130
- "footer": {
131
- "enabled": false,
132
- // Any single line. Empty text is ignored.
133
- "text": "Flight Deck"
134
- },
135
-
136
- // -- Caution ---------------------------------------------------------------
137
- // The annunciator: a warning row for the one failure nothing else can see.
138
- //
139
- // A hang emits NO events - no completion, no error, nothing - so everything
140
- // observable about it is the absence of a signal. That is why this uses a
141
- // clock and a baseline instead of a listener.
142
- //
143
- // It is silent unless something has stopped moving, so it costs nothing on a
144
- // healthy session. When it speaks it reports what it saw, never what it
145
- // means: `shell running 8m41s`, not "stuck". A ten-minute build is not a hang.
146
- //
147
- // It never aborts, kills, retries or blocks anything. Read-only.
148
- "caution": {
149
- "enabled": true,
150
-
151
- // A tool running longer than this draws a subdued triangle...
152
- "toolWatchSeconds": 180,
153
- // ... and longer than this becomes a real caution.
154
- // Raised to match the watch value if you set it lower.
155
- "toolCautionSeconds": 420,
156
-
157
- // A running session that has produced nothing for this long is noted.
158
- // Deliberately generous: a large reasoning model can think for minutes
159
- // with nothing to show, which the clock cannot distinguish from a wedge.
160
- // Suppressed entirely while a tool or shell is running.
161
- "turnWatchSeconds": 600,
162
- "turnCautionSeconds": 1200,
163
-
164
- // Identical consecutive calls before it counts as a loop. Two is a retry.
165
- // Applies to identical successes and identical failures alike.
166
- "repeatThreshold": 3,
167
-
168
- // Tools that are slow by NATURE, so slow is not an anomaly for them.
169
- // Matched by exact name.
170
- //
171
- // Calibrated against 54,218 real settled tool calls: at the default
172
- // threshold, 307 (0.57%) exceed it and 200 of those are these tools, so
173
- // with the list 0.20% of calls light the row. `subagent` alone crossed 152
174
- // times, with a p99 of 14.2 minutes. Without this list the annunciator
175
- // lights on every delegated task - which is how an alert gets ignored.
176
- // Add your own long-running or orchestration tools here.
177
- "exemptTools": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
178
-
179
- // Also raise a toast, once per distinct problem, re-arming when the session
180
- // goes quiet. Off by default: the rail is the signal, a notification is an
181
- // interruption. Turn it on if you walk away from long runs.
182
- "toast": false
183
- },
184
-
185
- // -- Layout ----------------------------------------------------------------
186
- // Row geometry. Change these when your terminal is unusually narrow or wide.
187
- "layout": {
188
- // Width of the label column every row pads to. 10 fits "caution" plus a
189
- // space. Narrow it to fit more value on screen.
190
- "labelWidth": 10,
191
- // Cells in the `context` gauge.
192
- "barWidth": 10,
193
- // Samples drawn in the `spark` row. The newest turns are kept, so
194
- // narrowing this keeps the recent shape rather than the oldest. The row is
195
- // this many cells wide, so a large value is a wide row.
196
- "sparkWidth": 12
197
- },
198
-
199
- // -- Glyphs ----------------------------------------------------------------
200
- // The annunciator's characters. Change these if your terminal renders a
201
- // default as a box or at the wrong width - an ugly but readable panel beats
202
- // an unreadable one. One or two characters each.
203
- "glyphs": {
204
- "watch": "▲",
205
- "caution": "⚠",
206
- "clear": "○"
207
- }
208
- }
1
+ {
2
+ "$schema": "./flight-deck.schema.json",
3
+
4
+ // ═════════════════════════════════════════════════════════════════════════
5
+ // ✈ Flight Deck — configuration
6
+ //
7
+ // EVERYTHING HERE IS OPTIONAL. Install the plugin and the panel works with
8
+ // no config file at all. The values below are the defaults, written out so
9
+ // you can see exactly what there is to change. Delete any key and its
10
+ // default comes straight back.
11
+ //
12
+ // TO USE IT: copy this file to `~/.config/opencode/flight-deck.jsonc` (or
13
+ // `flight-deck.json` — the `.jsonc` name is tried first), then edit. Comments
14
+ // and trailing commas are fine.
15
+ //
16
+ // There is ONE config file, global to your user, so the same values apply to
17
+ // every project. Flight Deck does NOT look in a project root or in a
18
+ // project's `.opencode/` directory: a copy left there configures nothing.
19
+ //
20
+ // If `$XDG_CONFIG_HOME` is set, the path is
21
+ // `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead.
22
+ //
23
+ // The file is optional. Having none is the normal case, and it is silent —
24
+ // the defaults below are what you get.
25
+ //
26
+ // Upgrading from 0.4.0? A `flight-deck.jsonc` in a project root or in
27
+ // `.opencode/` is no longer read; move it to the global path above.
28
+ //
29
+ // The same values can also be passed as plugin options in opencode.jsonc /
30
+ // cli.json, which take precedence on hosts that forward them.
31
+ // ═════════════════════════════════════════════════════════════════════════
32
+
33
+ // ── Update cadence ───────────────────────────────────────────────────────
34
+ // Milliseconds between refreshes: the tick rate of everything that has to
35
+ // animate. The status spinner has ten frames, so 100 turns it once a second.
36
+ //
37
+ // Cost, tokens, and permissions arrive from the host's own events, so they
38
+ // stay current with no timer at all. Only clock-derived rows need one — and
39
+ // `elapsed` plus the spinner are the reason this exists. Without a tick they
40
+ // would sit frozen between turns.
41
+ //
42
+ // While nothing is running the tick backs off to about once a second: the
43
+ // spinner is hidden then, and `elapsed` only reads in whole seconds, so the
44
+ // host's renderer is woken a tenth as often for the same picture.
45
+ //
46
+ // 100 default — the spinner turns once a second, the clock stays live
47
+ // 50 twice as lively, still negligible work per tick
48
+ // 1000 a calm wall-clock tick, but the spinner visibly stutters
49
+ // 0 no timer; `elapsed` and the spinner only move when the session does
50
+ //
51
+ // Anything faster than 16 (one frame at 60Hz) is clamped: a tick wakes the
52
+ // host's renderer, so a smaller value spends work without adding motion.
53
+ "refresh": 100,
54
+
55
+ // ── Sidebar ──────────────────────────────────────────────────────────────
56
+ "sidebar": {
57
+ // false hides the whole panel.
58
+ "enabled": true,
59
+
60
+ // Fixed lines, rendered above the live rows. This is the only text Flight
61
+ // Deck shows of its own — put your own words here, or a rule.
62
+ // The first line uses your theme's primary text colour; the rest use the
63
+ // subdued colour.
64
+ "lines": ["✈ FLIGHT DECK", "─────────────────"],
65
+
66
+ // The live rows, top to bottom. Every value is read from the open session,
67
+ // so you never type these in. Delete any row you don't want, or reorder
68
+ // them freely — an unknown name is ignored with a one-time warning, so a
69
+ // typo can never break the panel.
70
+ //
71
+ // caution the annunciator: silent unless something stopped moving
72
+ // status running or idle — the glyph turns while anything is working
73
+ // agent which agent is running (orchestrator, build, plan, ...)
74
+ // model model id, plus the variant when there is one
75
+ // branch current git branch
76
+ // cost this conversation, plus its subagents when any ran; with
77
+ // `total` on the rail, the session figure alone
78
+ // total the family total and subagent count on a row of its own
79
+ // project every session in this project, not just the one on screen
80
+ // tokens this session's input and output tokens
81
+ // cache cache hit rate, then cache reads
82
+ // context a gauge of how full the context window is
83
+ // perms what is waiting for approval, not just how many
84
+ // elapsed wall-clock time since the session started
85
+ // tps current speed: output tokens in the last 60 seconds,
86
+ // subagents included. Hides while idle longer than the
87
+ // window; falls back to the session's lifetime average on
88
+ // hosts with no per-message timestamps
89
+ // spark recent turn sizes as a sparkline
90
+ // reasoning reasoning tokens, when the model emits them
91
+ // turns how many prompts you have sent this session
92
+ // guard harness status from oc-harness-guard: breaches, orphans,
93
+ // findings, or ok. Available, off by default.
94
+ //
95
+ // Every named row renders persistently, so the rail keeps a stable shape:
96
+ // a row with no data yet shows the placeholder below, in the same label
97
+ // column as a live row. The fixed lines and the live rows together are
98
+ // capped at 24, and anything past that is dropped.
99
+ "rows": [
100
+ "caution",
101
+ "status",
102
+ "agent",
103
+ "model",
104
+ "branch",
105
+ "cost",
106
+ "project",
107
+ "tokens",
108
+ "cache",
109
+ "context",
110
+ "perms",
111
+ "elapsed",
112
+ "tps"
113
+ ],
114
+
115
+ // Every named row renders persistently: with no data yet it shows the
116
+ // placeholder below, in the same label column as a live row. Set to false
117
+ // to omit rows with no data instead.
118
+ "persist": true,
119
+
120
+ // Value shown for a persistent row with no data yet. Any non-empty string.
121
+ "placeholder": "—"
122
+ },
123
+
124
+ // ── Footer ───────────────────────────────────────────────────────────────
125
+ // Off by default: the sidebar already carries the data, and the prompt
126
+ // footer is high-traffic space, so a line there should earn its place.
127
+ //
128
+ // Writing ANY footer setting turns it on — `"footer": { "text": "hi" }` is
129
+ // enough. Set "enabled": false explicitly to keep it hidden.
130
+ "footer": {
131
+ "enabled": false,
132
+ // Any single line. Empty text is ignored.
133
+ "text": "Flight Deck"
134
+ },
135
+
136
+ // -- Caution ---------------------------------------------------------------
137
+ // The annunciator: a warning row for the one failure nothing else can see.
138
+ //
139
+ // A hang emits NO events - no completion, no error, nothing - so everything
140
+ // observable about it is the absence of a signal. That is why this uses a
141
+ // clock and a baseline instead of a listener.
142
+ //
143
+ // It is silent unless something has stopped moving, so it costs nothing on a
144
+ // healthy session. When it speaks it reports what it saw, never what it
145
+ // means: `shell running 8m41s`, not "stuck". A ten-minute build is not a hang.
146
+ //
147
+ // It never aborts, kills, retries or blocks anything. Read-only.
148
+ "caution": {
149
+ "enabled": true,
150
+
151
+ // A tool running longer than this draws a subdued triangle...
152
+ "toolWatchSeconds": 180,
153
+ // ... and longer than this becomes a real caution.
154
+ // Raised to match the watch value if you set it lower.
155
+ "toolCautionSeconds": 420,
156
+
157
+ // A running session that has produced nothing for this long is noted.
158
+ // Deliberately generous: a large reasoning model can think for minutes
159
+ // with nothing to show, which the clock cannot distinguish from a wedge.
160
+ // Suppressed entirely while a tool or shell is running.
161
+ "turnWatchSeconds": 600,
162
+ "turnCautionSeconds": 1200,
163
+
164
+ // Identical consecutive calls before it counts as a loop. Two is a retry.
165
+ // Applies to identical successes and identical failures alike.
166
+ "repeatThreshold": 3,
167
+
168
+ // Tools that are slow by NATURE, so slow is not an anomaly for them.
169
+ // Matched by exact name.
170
+ //
171
+ // Calibrated against 54,218 real settled tool calls: at the default
172
+ // threshold, 307 (0.57%) exceed it and 200 of those are these tools, so
173
+ // with the list 0.20% of calls light the row. `subagent` alone crossed 152
174
+ // times, with a p99 of 14.7 minutes. Without this list the annunciator
175
+ // lights on every delegated task - which is how an alert gets ignored.
176
+ // Add your own long-running or orchestration tools here.
177
+ "exemptTools": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
178
+
179
+ // Also raise a toast, once per distinct problem, re-arming when the session
180
+ // goes quiet. Off by default: the rail is the signal, a notification is an
181
+ // interruption. Turn it on if you walk away from long runs.
182
+ "toast": false
183
+ },
184
+
185
+ // -- Layout ----------------------------------------------------------------
186
+ // Row geometry. Change these when your terminal is unusually narrow or wide.
187
+ "layout": {
188
+ // Width of the label column every row pads to. 10 fits "caution" plus a
189
+ // space. Narrow it to fit more value on screen.
190
+ "labelWidth": 10,
191
+ // Cells in the `context` gauge.
192
+ "barWidth": 10,
193
+ // Samples drawn in the `spark` row. The newest turns are kept, so
194
+ // narrowing this keeps the recent shape rather than the oldest. The row is
195
+ // this many cells wide, so a large value is a wide row.
196
+ "sparkWidth": 12
197
+ },
198
+
199
+ // -- Glyphs ----------------------------------------------------------------
200
+ // The annunciator's characters. Change these if your terminal renders a
201
+ // default as a box or at the wrong width - an ugly but readable panel beats
202
+ // an unreadable one. One or two characters each.
203
+ "glyphs": {
204
+ "watch": "▲",
205
+ "caution": "⚠",
206
+ "clear": "○"
207
+ }
208
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-flight-deck",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
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,14 +53,14 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@opencode/plugin": "2.0.12"
56
+ "@opencode/plugin": "2.0.16"
57
57
  },
58
58
  "devDependencies": {
59
- "@opentui/core": "0.5.11",
60
- "@opentui/solid": "0.5.11",
59
+ "@opentui/core": "0.5.12",
60
+ "@opentui/solid": "0.5.12",
61
61
  "@types/bun": "^1.4.2",
62
- "solid-js": "1.9.12",
63
- "typescript": "^5.9.0"
62
+ "solid-js": "1.9.15",
63
+ "typescript": "^5.9.3"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@opentui/core": ">=0.5.10",
@@ -30,9 +30,9 @@
30
30
  // caution light that cries wolf is worse than no caution light.
31
31
 
32
32
  /** Flight Deck's rail has one line for this, so only the worst is ever drawn. */
33
- export type CautionSeverity = "watch" | "caution";
33
+ type CautionSeverity = "watch" | "caution";
34
34
 
35
- export type CautionKind = "hung-tool" | "hung-shell" | "repeat-loop" | "failure-loop" | "silent-turn";
35
+ type CautionKind = "hung-tool" | "hung-shell" | "repeat-loop" | "failure-loop" | "silent-turn";
36
36
 
37
37
  export interface CautionThresholds {
38
38
  readonly toolWatchMs: number;
@@ -56,7 +56,7 @@ export interface Caution {
56
56
  readonly key: string;
57
57
  }
58
58
 
59
- export interface CautionInput {
59
+ interface CautionInput {
60
60
  /** The snapshot's tool parts, oldest first. */
61
61
  readonly parts: readonly unknown[];
62
62
  /** Running shells from `context.data.shell`, when the host exposes them. */
@@ -90,7 +90,7 @@ function asText(value: unknown): string | undefined {
90
90
  /** Statuses that mean a tool has stopped. Anything else counts as live. */
91
91
  const SETTLED_TOOL = new Set(["completed", "error", "aborted", "cancelled"]);
92
92
 
93
- export interface ToolCall {
93
+ interface ToolCall {
94
94
  readonly name: string;
95
95
  readonly status: string;
96
96
  /** Canonical form of the input, for comparing one call with the next. */
@@ -340,14 +340,14 @@ export function worstCaution(cautions: readonly Caution[]): Caution | undefined
340
340
 
341
341
  export const WATCH_GLYPH = "▲";
342
342
  export const CAUTION_GLYPH = "⚠";
343
- export const CLEAR_GLYPH = "○";
343
+ const CLEAR_GLYPH = "○";
344
344
 
345
345
  /**
346
346
  * Glyph overrides, for terminals that render the defaults badly.
347
347
  *
348
348
  * Structural, like `LayoutHint`, so this module stays free of imports.
349
349
  */
350
- export interface GlyphHint {
350
+ interface GlyphHint {
351
351
  readonly watch?: string;
352
352
  readonly caution?: string;
353
353
  readonly clear?: string;
@@ -406,13 +406,13 @@ export function cautionDetail(caution: Caution): string {
406
406
  }
407
407
  }
408
408
 
409
- /** `45s`, `14m`, `2h 14m`. */
409
+ /** `45s`, `14m07s`, `2h14m37s`. Seconds always show, so the text ticks every second. */
410
410
  export function formatElapsed(ms: number): string {
411
- const seconds = Math.max(0, Math.floor(ms / 1_000));
412
- if (seconds < 60) return `${seconds}s`;
413
- const minutes = Math.floor(seconds / 60);
414
- if (minutes < 60) return `${minutes}m`;
415
- const hours = Math.floor(minutes / 60);
416
- const rest = minutes % 60;
417
- return rest === 0 ? `${hours}h` : `${hours}h ${rest}m`;
411
+ const total = Math.max(0, Math.floor(ms / 1_000));
412
+ const seconds = total % 60;
413
+ const minutes = Math.floor(total / 60) % 60;
414
+ const hours = Math.floor(total / 3_600);
415
+ const ss = String(seconds).padStart(2, "0");
416
+ if (hours > 0) return `${hours}h${String(minutes).padStart(2, "0")}m${ss}s`;
417
+ return minutes > 0 ? `${minutes}m${ss}s` : `${seconds}s`;
418
418
  }
@@ -0,0 +1,25 @@
1
+ // Coercion guards for untrusted host values.
2
+ //
3
+ // Everything the host hands the rail — session records, message lists, model
4
+ // catalog entries — is `unknown` and read defensively. These four guards are
5
+ // the only place the plugin turns a raw value into something the rail can use;
6
+ // every other module coerces through them rather than re-checking shapes.
7
+ // `SessionLike` is the minimal session shape the reads understand.
8
+
9
+ export type SessionLike = { cost?: unknown; model?: unknown; time?: unknown; tokens?: unknown };
10
+
11
+ export function asCount(value: unknown): number | undefined {
12
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : undefined;
13
+ }
14
+
15
+ export function asText(value: unknown): string | undefined {
16
+ if (typeof value !== "string") return undefined;
17
+ const text = value.trim();
18
+ return text.length === 0 ? undefined : text;
19
+ }
20
+
21
+ export function asRecord(value: unknown): Record<string, unknown> | undefined {
22
+ return typeof value === "object" && value !== null && !Array.isArray(value)
23
+ ? (value as Record<string, unknown>)
24
+ : undefined;
25
+ }
package/src/tui/config.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  import { DEFAULT_PLACEHOLDER, isStatField, STAT_FIELDS } from "./stats.js";
12
12
  import type { CautionThresholds } from "./caution.js";
13
13
 
14
- export interface SidebarConfig {
14
+ interface SidebarConfig {
15
15
  /** Show the sidebar rail. Default `true`. */
16
16
  readonly enabled: boolean;
17
17
  /** Fixed lines rendered above the live rows. Default `DEFAULT_SIDEBAR_LINES`. */
@@ -27,7 +27,7 @@ export interface SidebarConfig {
27
27
  readonly placeholder: string;
28
28
  }
29
29
 
30
- export interface FooterConfig {
30
+ interface FooterConfig {
31
31
  /**
32
32
  * Show the prompt-footer rail. Default `false`.
33
33
  *
@@ -40,7 +40,7 @@ export interface FooterConfig {
40
40
  readonly text: string;
41
41
  }
42
42
 
43
- export interface CautionConfig {
43
+ interface CautionConfig {
44
44
  /** Show the caution annunciator. Default `true`. */
45
45
  readonly enabled: boolean;
46
46
  /** A tool running longer than this is worth noting. Default `180`. */
@@ -108,7 +108,7 @@ export function cautionThresholds(config: CautionConfig): CautionThresholds {
108
108
  }
109
109
 
110
110
  /** Pure cosmetics: the geometry of a row. */
111
- export interface LayoutConfig {
111
+ interface LayoutConfig {
112
112
  /** Width of the row label column. Default `10`. */
113
113
  readonly labelWidth: number;
114
114
  /** Cells in the context gauge. Default `10`. */
@@ -124,25 +124,25 @@ export interface LayoutConfig {
124
124
  * some terminals render `⚠` as a box or the wrong width. Swapping it for `!` is
125
125
  * a worse-looking but working panel, which beats an unreadable one.
126
126
  */
127
- export interface GlyphConfig {
127
+ interface GlyphConfig {
128
128
  readonly watch: string;
129
129
  readonly caution: string;
130
130
  readonly clear: string;
131
131
  }
132
132
 
133
- export const DEFAULT_LAYOUT: LayoutConfig = {
133
+ const DEFAULT_LAYOUT: LayoutConfig = {
134
134
  labelWidth: 10,
135
135
  barWidth: 10,
136
136
  sparkWidth: 12,
137
137
  };
138
138
 
139
- export const DEFAULT_GLYPHS: GlyphConfig = {
139
+ const DEFAULT_GLYPHS: GlyphConfig = {
140
140
  watch: "▲",
141
141
  caution: "⚠",
142
142
  clear: "○",
143
143
  };
144
144
 
145
- export const DEFAULT_CAUTION: CautionConfig = {
145
+ const DEFAULT_CAUTION: CautionConfig = {
146
146
  enabled: true,
147
147
  toolWatchSeconds: 180,
148
148
  toolCautionSeconds: 420,
@@ -244,7 +244,7 @@ function normalizeText(value: string, path: string, issues: string[]): string {
244
244
  return value.replace(CONTROL_CHARS, " ").replace(/ {2,}/g, " ").trim();
245
245
  }
246
246
 
247
- export interface ConfigResolution {
247
+ interface ConfigResolution {
248
248
  readonly config: FlightDeckConfig;
249
249
  /** Human-readable problems found in the supplied options; empty when clean. */
250
250
  readonly issues: readonly string[];
@@ -48,7 +48,7 @@ export interface FileConfig {
48
48
  * Find the first config file that exists in `directory`, which defaults to the
49
49
  * global config directory. A missing directory simply has no candidates.
50
50
  */
51
- export function findConfigFile(directory: string = globalConfigDirectory()): string | undefined {
51
+ function findConfigFile(directory: string = globalConfigDirectory()): string | undefined {
52
52
  for (const candidate of CONFIG_FILE_CANDIDATES) {
53
53
  const path = join(directory, candidate);
54
54
  if (existsSync(path)) return path;