oc-flight-deck 0.6.2 → 0.6.6

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 CHANGED
@@ -1,187 +1,201 @@
1
- <div align="center">
2
-
3
- # ✈️ oc-flight-deck
4
-
5
- **Live session telemetry for your OpenCode terminal.**
6
- *The numbers where you're already looking — because your agent is spending money right now.*
7
-
8
- ![npm](https://img.shields.io/npm/v/oc-flight-deck) ![license](https://img.shields.io/badge/license-MIT-blue) ![opencode](https://img.shields.io/badge/opencode-V2-compatible-8A2BE2) ![node](https://img.shields.io/badge/node-%E2%89%A522-green)
9
-
10
- </div>
11
-
12
- ---
13
-
14
- ## ⚡ Quick start
15
-
16
- Add the plugin to your `opencode.jsonc`:
17
-
18
- ```jsonc
19
- // opencode.jsonc
20
- { "plugins": ["oc-flight-deck"] }
21
- ```
22
-
23
- Restart OpenCode. **That's the whole setup.** No config file, no options, nothing to learn. The panel appears beside an open session and starts reading.
24
-
25
- ---
26
-
27
- ## 📊 The panel
28
-
29
- ```text
30
- ✈ FLIGHT DECK
31
- ──────────────────────────────
32
- status ⠹ running
33
- agent orchestrator
34
- model deepseek-v4.1-flash · high
35
- branch main
36
- cost $0.245 · 2 subagents
37
- tokens 533k in · 91k out
38
- cache 98% hit · 32M read
39
- context ██░░░░░░░░ 18%
40
- elapsed 2h 14m
41
- tps 18 tok/s
42
- ```
43
-
44
- Every row is read from the open session at render time — except `caution`, which watches a clock rather than events (a hang emits none), and the opt-in `guard` row, which is polled from the local guard RPC.
45
-
46
- | Row | What it shows |
47
- |---|---|
48
- | `caution` | **The annunciator** — silent unless something stopped moving |
49
- | `status` | A spinner while anything is working, a circle while it's idle |
50
- | `agent` | Which agent you're actually talking to |
51
- | `model` | The model **and its variant** — `high` behaves differently |
52
- | `branch` | The branch you're about to commit to |
53
- | `cost` | This conversation **plus its subagents**, and the count that explains it; with `total` on the rail, the session figure alone |
54
- | `total` | The family total and subagent count on a row of its own · **off by default** |
55
- | `project` | Every session in this project, not just the one on screen |
56
- | `tokens` | Input and output, cumulative |
57
- | `cache` | Hit rate first — the number that explains the bill — then cache reads |
58
- | `context` | A gauge of how full the window is |
59
- | `perms` | What is waiting for approval, not just how many |
60
- | `elapsed` | How long you've been at it |
61
- | `tps` | Current speed: output tokens in the last 60 s, divided by that window, subagents included. Idle longer than the window and it hides — the `status` row already says `idle`. On a host that exposes no per-message timestamps it falls back to the lifetime average, which does not hide while idle and reads lower than a peak per-turn rate. Fixed at 60 s, not configurable |
62
- | `spark` | Recent turn sizes as a shape · **off by default** |
63
- | `reasoning` | Reasoning tokens, when the model emits them · **off by default** |
64
- | `turns` | How many prompts you've sent this session · **off by default** |
65
- | `guard` | Harness status from oc-harness-guard · **off by default** |
66
-
67
- `project` matches on the host's **project id**, not on a directory, so a worktree counts as part of the same project. A host that reports no project id leaves nothing to match on, and the row then totals every session that host knows about.
68
-
69
- The rows marked **off by default** are available but not in the default rail: add any of them to `sidebar.rows`.
70
-
71
- Every field named in `sidebar.rows` renders exactly one row, in order. With `sidebar.persist` (the default), a row with no data yet shows the `sidebar.placeholder` value (default `—`) in the same label column as a live row — so the rail keeps a stable shape instead of growing rows as the session produces data. Set `"persist": false` to restore omission: rows with no data are left out entirely.
72
-
73
- The `guard` row only appears when oc-harness-guard is installed and answering; without it the row stays on the placeholder. Flight Deck never installs or requires the other plugin — each side works alone.
74
-
75
- ---
76
-
77
- ## 🚨 `caution` — calibrated, not guessed
78
-
79
- A hang emits no events — its only signature is *absence*. So `caution` watches a clock, stays silent on healthy sessions, and when it speaks it reports what it saw, never what it means: `shell running 8m41s`, not "stuck".
80
-
81
- > Measured over **54,218 real settled tool calls**: 0.57% ran past three minutes — with the exempt list, **0.20%** light the row. A ten-minute build is not a hang.
82
-
83
- **Why cost carries the subagents:** subagents run as separate sessions; a session's own cost excludes them. On the session this was built against: reported `$0.2246`, true spend `$0.2447` — **9% low on money, 54% low on tokens.** One money row tells the truth.
84
-
85
- | It fires when | Threshold | Config |
86
- |---|---|---|
87
- | a tool has a start time and no completion | watch at 3m, caution at 7m | `toolWatchSeconds` / `toolCautionSeconds` |
88
- | a shell is still running after its tool call returned | watch at 3m, caution at 7m | `toolWatchSeconds` / `toolCautionSeconds` |
89
- | the same call repeats with identical input | caution at 3 | `repeatThreshold` |
90
- | the same call fails with identical input | caution at 3 | `repeatThreshold` |
91
- | a running session stops producing anything | watch at 10m, caution at 20m | `turnWatchSeconds` / `turnCautionSeconds` |
92
-
93
- The toast is **off by default**. The rail is the signal; a notification is an interruption.
94
-
95
- ---
96
-
97
- ## ⚙️ Configure
98
-
99
- **You don't need any.** Install it and the panel works. But every knob is available in a commented JSONC file.
100
-
101
- Copy [`flight-deck.example.jsonc`](./flight-deck.example.jsonc) to `~/.config/opencode/flight-deck.jsonc`, then edit. Comments and trailing commas are fine. `flight-deck.schema.json` validates it.
102
-
103
- There is **one** config file, global to your user, so the same values apply to every project. Flight Deck does not read a `flight-deck.jsonc` from a project root or from a project's `.opencode/` directory — a copy left there configures nothing. If `$XDG_CONFIG_HOME` holds an absolute path, the config path is `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead; a relative value is ignored, so the lookup cannot resolve against the host's working directory. A `.json` name works too; the `.jsonc` name is tried first.
104
-
105
- The file is optional, and a missing file is normal and silent: with no file at all you get exactly the defaults the example file writes out.
106
-
107
- > **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.
108
-
109
- `sidebar.rows` picks the rows and their order; `layout.labelWidth` fits your terminal. 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.
110
-
111
- ```jsonc
112
- // ~/.config/opencode/flight-deck.jsonc
113
- {
114
- "refresh": 100,
115
- "sidebar": {
116
- "rows": [
117
- "caution", "status", "agent", "model", "branch", "cost", "project",
118
- "tokens", "cache", "context", "perms", "elapsed", "tps"
119
- ]
120
- },
121
- "caution": { "toast": false }
122
- }
123
- ```
124
-
125
- ---
126
-
127
- ## 🔒 It reads. It writes one number — two with `guard` on.
128
-
129
- Flight Deck shows what OpenCode already knows.
130
-
131
- - **No network calls while the opt-in `guard` row stays off.** Nothing is fetched, nothing is sent. With `guard` enabled, the panel polls the local guard RPC — same machine, no telemetry — about every ten seconds, plus right away when the rendered session changes.
132
- - **No telemetry.** Nothing is collected or phoned home.
133
- - **Nothing on disk.** The one thing it normally writes is an animation counter in the host's in-memory plugin state, so the spinner and `elapsed` keep moving between turns. It is scoped to this plugin and dies with the TUI; it is never persisted, and `"refresh": 0` removes even that. With `guard` enabled there is a second in-memory write — that row's polled status — and `"refresh": 0` does not remove it; dropping `guard` from `sidebar.rows` does.
134
- - **No polling of your session while `guard` stays off.** Cost, tokens, and permissions update from the host's own events. The timer only re-reads state the host already holds in memory, so the clock-derived rows keep moving.
135
- - **Theme-native.** Every line uses your active theme's text tokens, so it blends with whatever look you already run.
136
-
137
- Delete the plugin and the stock sidebar is back, exactly as it was.
138
-
139
- ---
140
-
141
- ## 🧹 Uninstall
142
-
143
- Remove the entry from `opencode.jsonc`, restart, done. Delete your `~/.config/opencode/flight-deck.jsonc` too if you made one.
144
-
145
- ---
146
-
147
- ## 🛠 Development
148
-
149
- ```sh
150
- bun install
151
- bun run check
152
- ```
153
-
154
- `bun run check` typechecks and runs the suite, including headless OpenTUI render tests that mount the panel in a real renderer and assert the exact characters that come out. A guard test parses the shipped example config and asserts it still matches the real defaults, and a schema test validates that parsed example against the shipped schema — defaults, types, and allowed values — so the documentation can't drift from the code on either side.
155
-
156
- To load the plugin **from this checkout** while working on it, add it to the `opencode.jsonc` of the project you run OpenCode in. A `plugins` entry is a package specifier, not a file path — a bare path is ignored silently — so the checkout has to be named as a git file URL:
157
-
158
- ```jsonc
159
- {
160
- "plugins": ["git+file:///absolute/path/to/oc-flight-deck"]
161
- }
162
- ```
163
-
164
- That installs a **copy, not a symlink**, so re-run the install after editing the checkout. This file is deliberately **not** committed: if the plugin is also installed globally, declaring it in both places registers the same plugin id twice and the host's plugin list shows one of them as failed.
165
-
166
- Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/build/plugins/cli).
167
-
168
- ---
169
-
170
- ## 🧭 Compatibility
171
-
172
- | | |
173
- |---|---|
174
- | Built against | `@opencode/plugin` `2.0.12` — pin a host version you've tested |
175
- | Host | OpenCode V2 (`opencode2`) |
176
- | Building from source | Node ≥ 22 or Bun ≥ 1.4 |
177
- | Writes | In-memory counters only — the animation tick, plus the `guard` row's polled status when `guard` is on; nothing to disk |
178
-
179
- ---
180
-
181
- <div align="center">
182
-
183
- Built against `@opencode/plugin` 2.0.12 · Node ≥ 22 / Bun ≥ 1.4 · OpenCode V2
184
-
185
- **MIT © 2026 nathwn12** · For OpenCode. Free.
186
-
187
- </div>
1
+ <div align="center">
2
+
3
+ # ✈️ oc-flight-deck
4
+
5
+ **Live session telemetry for your OpenCode terminal.**
6
+ *The numbers where you're already looking — because your agent is spending money right now.*
7
+
8
+ ![npm](https://img.shields.io/npm/v/oc-flight-deck) ![license](https://img.shields.io/badge/license-MIT-blue) ![opencode](https://img.shields.io/badge/opencode-V2-compatible-8A2BE2) ![node](https://img.shields.io/badge/node-%E2%89%A522-green)
9
+
10
+ </div>
11
+
12
+ ---
13
+
14
+ ## ⚡ Quick start
15
+
16
+ Add the plugin to your `opencode.jsonc`:
17
+
18
+ ```jsonc
19
+ // opencode.jsonc
20
+ { "plugins": ["oc-flight-deck"] }
21
+ ```
22
+
23
+ Restart OpenCode. **That's the whole setup.** No config file, no options, nothing to learn. The panel appears beside an open session and starts reading.
24
+
25
+ ---
26
+
27
+ ## 📊 The panel
28
+
29
+ ```text
30
+ ✈ FLIGHT DECK
31
+ ──────────────────────────────
32
+ status ⠹ running
33
+ agent orchestrator
34
+ model deepseek-v4.1-flash · high
35
+ branch main
36
+ cost $0.245 · 2 subagents
37
+ tokens 533k in · 91k out
38
+ cache 98% hit · 32M read
39
+ context ██░░░░░░░░ 18%
40
+ elapsed 2h 14m 37s
41
+ tps 18 tok/s
42
+ ```
43
+
44
+ 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 a process-local tally of the busy windows this run observed rather than a value the session reports; and the opt-in `guard` row, which is polled from the local guard RPC.
45
+
46
+ | Row | What it shows |
47
+ |---|---|
48
+ | `caution` | **The annunciator** — silent unless something stopped moving |
49
+ | `status` | A spinner while anything is working, a circle while it's idle |
50
+ | `agent` | Which agent you're actually talking to |
51
+ | `model` | The model **and its variant** — `high` behaves differently |
52
+ | `branch` | The branch you're about to commit to |
53
+ | `cost` | This conversation **plus its subagents**, and the count that explains it; with `total` on the rail, the session figure alone |
54
+ | `total` | The family total and subagent count on a row of its own · **off by default** |
55
+ | `project` | Every session in this project, not just the one on screen |
56
+ | `tokens` | Input and output, cumulative |
57
+ | `cache` | Hit rate first — the number that explains the bill — then cache reads |
58
+ | `context` | A gauge of how full the window is |
59
+ | `perms` | What is waiting for approval, not just how many |
60
+ | `elapsed` | Active time — the clock runs only while this session, a subagent in its tree, or one of its shells is working, and freezes when everything settles. It is process-local and starts at zero when the plugin starts, so it measures activity observed this run, not wall-clock since the session began |
61
+ | `tps` | Average speed **while working**: output tokens divided by the time the assistant's turns actually ran, subagents included. Idle time between turns is never counted, so the figure freezes when everything settles instead of decaying or hiding; a turn still in flight counts up to now. On a host that exposes no per-message timestamps it falls back to the lifetime average, which includes idle and can therefore sag. Not configurable |
62
+ | `spark` | Recent turn sizes as a shape · **off by default** |
63
+ | `reasoning` | Reasoning tokens, when the model emits them · **off by default** |
64
+ | `turns` | How many prompts you've sent this session · **off by default** |
65
+ | `guard` | Harness status from oc-harness-guard · **off by default** |
66
+
67
+ `project` matches on the host's **project id**, not on a directory, so a worktree counts as part of the same project. A host that reports no project id leaves nothing to match on, and the row then totals every session that host knows about.
68
+
69
+ The rows marked **off by default** are available but not in the default rail: add any of them to `sidebar.rows`.
70
+
71
+ Every field named in `sidebar.rows` renders exactly one row, in order. With `sidebar.persist` (the default), a row with no data yet shows the `sidebar.placeholder` value (default `—`) in the same label column as a live row — so the rail keeps a stable shape instead of growing rows as the session produces data. Set `"persist": false` to restore omission: rows with no data are left out entirely.
72
+
73
+ The `guard` row only appears when oc-harness-guard is installed and answering; without it the row stays on the placeholder. Flight Deck never installs or requires the other plugin — each side works alone.
74
+
75
+ ---
76
+
77
+ ## 🚨 `caution` — calibrated, not guessed
78
+
79
+ A hang emits no events — its only signature is *absence*. So `caution` watches a clock, stays silent on healthy sessions, and when it speaks it reports what it saw, never what it means: `shell running 8m41s`, not "stuck".
80
+
81
+ > Measured over **54,218 real settled tool calls**: 0.57% ran past three minutes — with the exempt list, **0.20%** light the row. A ten-minute build is not a hang.
82
+
83
+ **Why cost carries the subagents:** subagents run as separate sessions; a session's own cost excludes them. On the session this was built against: reported `$0.2246`, true spend `$0.2447` — **9% low on money, 54% low on tokens.** One money row tells the truth.
84
+
85
+ | It fires when | Threshold | Config |
86
+ |---|---|---|
87
+ | a tool has a start time and no completion | watch at 3m, caution at 7m | `toolWatchSeconds` / `toolCautionSeconds` |
88
+ | a shell is still running after its tool call returned | watch at 3m, caution at 7m | `toolWatchSeconds` / `toolCautionSeconds` |
89
+ | the same call repeats with identical input | caution at 3 | `repeatThreshold` |
90
+ | the same call fails with identical input | caution at 3 | `repeatThreshold` |
91
+ | a running session stops producing anything | watch at 10m, caution at 20m | `turnWatchSeconds` / `turnCautionSeconds` |
92
+
93
+ The toast is **off by default**. The rail is the signal; a notification is an interruption.
94
+
95
+ ---
96
+
97
+ ## ⚙️ Configure
98
+
99
+ **You don't need any.** Install it and the panel works. But every knob is available in a commented JSONC file.
100
+
101
+ Copy [`flight-deck.example.jsonc`](./flight-deck.example.jsonc) to `~/.config/opencode/flight-deck.jsonc`, then edit. Comments and trailing commas are fine. `flight-deck.schema.json` validates it.
102
+
103
+ There is **one** config file, global to your user, so the same values apply to every project. Flight Deck does not read a `flight-deck.jsonc` from a project root or from a project's `.opencode/` directory — a copy left there configures nothing. If `$XDG_CONFIG_HOME` holds an absolute path, the config path is `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead; a relative value is ignored, so the lookup cannot resolve against the host's working directory. A `.json` name works too; the `.jsonc` name is tried first.
104
+
105
+ The file is optional, and a missing file is normal and silent: with no file at all you get exactly the defaults the example file writes out.
106
+
107
+ > **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.
108
+
109
+ `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`).
110
+
111
+ Optional styling lives under `style`: `style.lines` controls fixed branding/separator lines, `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.
112
+
113
+ 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.
114
+
115
+ ```jsonc
116
+ // ~/.config/opencode/flight-deck.jsonc
117
+ {
118
+ "refresh": 100,
119
+ "sidebar": {
120
+ "maxLines": 24,
121
+ "rows": [
122
+ "caution", "status", "agent", "model", "branch", "cost", "project",
123
+ "tokens", "cache", "context", "perms", "elapsed", "tps"
124
+ ]
125
+ },
126
+ // spaced separates the units (2h 14m 37s, the default); "compact" hugs them (2h14m37s)
127
+ "format": { "duration": "spaced" },
128
+ "caution": { "toast": false },
129
+ "style": {
130
+ "lines": { "color": "default", "attributes": [] },
131
+ "rows": {
132
+ "*": { "color": "subdued", "attributes": [] },
133
+ "cost": { "color": "success", "attributes": ["bold"] }
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ ---
140
+
141
+ ## 🔒 It reads. It writes one number — two with `guard` on.
142
+
143
+ Flight Deck shows what OpenCode already knows.
144
+
145
+ - **No network calls while the opt-in `guard` row stays off.** Nothing is fetched, nothing is sent. With `guard` enabled, the panel polls the local guard RPC — same machine, no telemetry — about every ten seconds, plus right away when the rendered session changes.
146
+ - **No telemetry.** Nothing is collected or phoned home.
147
+ - **Nothing on disk.** The one thing it normally writes is an animation counter in the host's in-memory plugin state, so the spinner and a running `elapsed` clock keep moving between host events. It is scoped to this plugin and dies with the TUI; it is never persisted, and `"refresh": 0` removes even that. With `"refresh": 0` the rail re-reads only on host events, so a busy stretch that produces few events can undercount `elapsed` — no unobserved gap bills beyond its bound, and a longer gap banks nothing. With `guard` enabled there is a second in-memory write — that row's polled status — and `"refresh": 0` does not remove it; dropping `guard` from `sidebar.rows` does.
148
+ - **No polling of your session while `guard` stays off.** Cost, tokens, and permissions update from the host's own events. The timer only re-reads state the host already holds in memory, so the clock-derived rows keep moving.
149
+ - **Theme-native.** Every line uses your active theme's text tokens, so it blends with whatever look you already run.
150
+
151
+ Delete the plugin and the stock sidebar is back, exactly as it was.
152
+
153
+ ---
154
+
155
+ ## 🧹 Uninstall
156
+
157
+ Remove the entry from `opencode.jsonc`, restart, done. Delete your `~/.config/opencode/flight-deck.jsonc` too if you made one.
158
+
159
+ ---
160
+
161
+ ## 🛠 Development
162
+
163
+ ```sh
164
+ bun install
165
+ bun run check
166
+ ```
167
+
168
+ `bun run check` typechecks and runs the suite, including headless OpenTUI render tests that mount the panel in a real renderer and assert the exact characters that come out. A guard test parses the shipped example config and asserts it still matches the real defaults, and a schema test validates that parsed example against the shipped schema — defaults, types, and allowed values — so the documentation can't drift from the code on either side.
169
+
170
+ To load the plugin **from this checkout** while working on it, add it to the `opencode.jsonc` of the project you run OpenCode in. A `plugins` entry is a package specifier, not a file path — a bare path is ignored silently — so the checkout has to be named as a git file URL:
171
+
172
+ ```jsonc
173
+ {
174
+ "plugins": ["git+file:///absolute/path/to/oc-flight-deck"]
175
+ }
176
+ ```
177
+
178
+ That installs a **copy, not a symlink**, so re-run the install after editing the checkout. This file is deliberately **not** committed: if the plugin is also installed globally, declaring it in both places registers the same plugin id twice and the host's plugin list shows one of them as failed.
179
+
180
+ Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/build/plugins/cli).
181
+
182
+ ---
183
+
184
+ ## 🧭 Compatibility
185
+
186
+ | | |
187
+ |---|---|
188
+ | Built against | `@opencode/plugin` `2.0.16` — pin a host version you've tested |
189
+ | Host | OpenCode V2 (`opencode2`) |
190
+ | Building from source | Node ≥ 22 or Bun ≥ 1.4 |
191
+ | Writes | In-memory counters only — the animation tick, plus the `guard` row's polled status when `guard` is on; nothing to disk |
192
+
193
+ ---
194
+
195
+ <div align="center">
196
+
197
+ Built against `@opencode/plugin` 2.0.16 · Node ≥ 22 / Bun ≥ 1.4 · OpenCode V2
198
+
199
+ **MIT © 2026 nathwn12** · For OpenCode. Free.
200
+
201
+ </div>