oc-flight-deck 0.6.1 → 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.
package/README.md CHANGED
@@ -1,272 +1,159 @@
1
- # ✈ Flight Deck
1
+ <div align="center">
2
+
3
+ # ✈️ oc-flight-deck
2
4
 
3
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
+ ---
4
13
 
5
- Your agent is spending money right now. Most of the time you find out afterwards.
14
+ ## ⚡ Quick start
6
15
 
7
- Flight Deck puts the numbers where you're already looking — a quiet sidebar that
8
- shows which model is running, what it's costing, how full the context is, and
9
- whether your caching is actually working.
16
+ Add the plugin to your `opencode.jsonc`:
10
17
 
18
+ ```jsonc
19
+ // opencode.jsonc
20
+ { "plugins": ["oc-flight-deck"] }
11
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
12
30
  ✈ FLIGHT DECK
13
- ─────────────────
31
+ ──────────────────────────────
14
32
  status ⠹ running
15
33
  agent orchestrator
16
34
  model deepseek-v4.1-flash · high
17
35
  branch main
18
- cost $0.226
19
- total $0.247 · 2 subagents
20
- project $1.48 · 12 sessions
36
+ cost $0.245 · 2 subagents
21
37
  tokens 533k in · 91k out
22
38
  cache 98% hit · 32M read
23
39
  context ██░░░░░░░░ 18%
24
- elapsed 2h 14m
40
+ elapsed 2h14m37s
25
41
  tps 18 tok/s
26
- spark ▁▃▂▅█▄▃▂
27
42
  ```
28
43
 
29
- ## Install
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.
30
45
 
31
- ```jsonc
32
- // opencode.jsonc
33
- {
34
- "plugins": ["oc-flight-deck"]
35
- }
36
- ```
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** |
37
66
 
38
- Restart OpenCode. That's the whole setup — no config file, no options, nothing to
39
- learn. The panel appears beside an open session and starts reading.
40
-
41
- ## What you're looking at
42
-
43
- | Row | Why it's there |
44
- | --- | --- |
45
- | `caution` | **The annunciator.** Silent unless something stopped moving. |
46
- | `status` | A spinner while it works, a circle while it's waiting on you. |
47
- | `agent` | Which agent you're actually talking to. |
48
- | `model` | The model *and its variant* - `high` behaves differently. |
49
- | `branch` | Which branch you're about to commit to. |
50
- | `cost` | This conversation, plus its subagents once any have run. |
51
- | `project` | Every session in this **project** — matched by the host's project id, so worktrees count together. |
52
- | `tokens` | Input and output, cumulative. |
53
- | `cache` | Hit rate first, because that's the number that explains the bill. |
54
- | `context` | A gauge of how full the window is. |
55
- | `perms` | What is waiting for approval, not just how many. |
56
- | `elapsed` | How long you've been at it. |
57
- | `tps` | Current speed: output tokens in the last 60 seconds, 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 reads lower than a peak per-turn rate. Fixed at 60 s, not configurable. |
58
- | `spark` | Recent turn sizes as a shape. Available, off by default. |
59
- | `reasoning` | Reasoning tokens, when the model emits them. Available, off by default. |
60
- | `turns` | How many prompts you have sent this session. Available, off by default. |
61
- | `total` | The family total and subagent count on a row of its own. Adding it makes `cost` show the session figure alone. Available, off by default. |
62
- | `guard` | Harness status from oc-harness-guard. Available, off by default. |
63
-
64
- `project` matches on the host's **project id**, not on a directory, so a worktree
65
- counts as part of the same project. A host that reports no project id leaves
66
- nothing to match on, and the row then totals every session that host knows about.
67
-
68
- ### `caution` is the one row that isn't session state
69
-
70
- Everything else here reacts to events. **A hang emits none** - no completion, no
71
- error, nothing - so every observable thing about a hang is the *absence* of a
72
- signal. Catching it needs a clock instead of a listener.
73
-
74
- It stays completely silent unless something has stopped moving, so it costs
75
- nothing on a healthy session. When it does speak it reports what it saw, never
76
- what it means: `shell running 8m41s`, not "stuck". A ten-minute build is not a
77
- hang.
78
-
79
- | It fires when | Threshold |
80
- | --- | --- |
81
- | a tool has a start time and no completion | watch at 3m, caution at 7m |
82
- | a shell is still running after its tool call returned | watch at 3m, caution at 7m |
83
- | the same call repeats with identical input | caution at 3 |
84
- | the same call fails with identical input | caution at 3 |
85
- | a running session stops producing anything | watch at 10m, caution at 20m |
86
-
87
- The thresholds are calibrated, not guessed. Measured over **54,218 real settled
88
- tool calls**, **307** (0.57%) ran longer than three minutes — and **200 of those
89
- are on the exempt list**, so with it **0.20%** of calls light the row. `subagent`
90
- alone accounts for 152 of them at a p99 of 14.2 minutes: a delegated agent
91
- running a quarter of an hour is working as designed. Without the list the row
92
- lights up on every delegation, and you would learn to ignore it.
93
-
94
- The percentages move as that history grows; the exemption ratio is the point.
95
-
96
- The toast is **off by default**. The rail is the signal; a notification is an
97
- interruption.
98
-
99
- ### `cost` now carries the subagents
100
-
101
- Subagents run as **separate sessions**, and a session's own cost does not include
102
- them. On the session this was built against, the parent reported `$0.2246` while
103
- the true spend was `$0.2447` - **9% low on money, and 54% low on input tokens**.
104
-
105
- Rather than spend two rows on a number and its own superset, `cost` shows the
106
- family total and the count that explains it:
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.
107
68
 
108
- ```
109
- cost $0.245 · 2 subagents
110
- ```
69
+ The rows marked **off by default** are available but not in the default rail: add any of them to `sidebar.rows`.
111
70
 
112
- **Add `total` to `sidebar.rows` and `cost` goes back to the session figure
113
- alone** — the merge only happens when nothing else on the rail already shows it.
114
- So "one money row or two" is decided by your rows list, not by another setting to
115
- find.
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.
116
72
 
117
- The row is deliberately short. An earlier version also printed the delta
118
- (`+ $0.020`), which pushed the row to 40 columns and made it **wrap** in a normal
119
- sidebar. It was true information that did not earn its width, and a row that
120
- wraps costs more than a row that says less.
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.
121
74
 
122
- ### `cache` is the row that surprises people
75
+ ---
123
76
 
124
- A 98% hit rate is why millions of tokens can cost cents. The moment that number
125
- drops, your bill doesn't.
77
+ ## 🚨 `caution` — calibrated, not guessed
126
78
 
127
- ### Every selected row stays on the rail
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".
128
80
 
129
- Each field named in `sidebar.rows` renders exactly one row, in order. When the
130
- host has nothing to show yet, the row shows the `sidebar.placeholder` value
131
- (default `"—"`) in the same label column as a live row — so `cache` is visible
132
- before the first cache hit, and the rail keeps a stable shape instead of
133
- growing rows as the session produces data.
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.
134
82
 
135
- ```jsonc
136
- {
137
- "sidebar": {
138
- "persist": true, // the default: stable rows with a placeholder
139
- "placeholder": "—"
140
- }
141
- }
142
- ```
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.
143
84
 
144
- Set `"persist": false` to restore omission: rows with no data are then left out
145
- entirely, which is also how a narrow rail stays shortest.
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` |
146
92
 
147
- ### guard pairs with oc-harness-guard
93
+ The toast is **off by default**. The rail is the signal; a notification is an interruption.
148
94
 
149
- The guard row is opt-in: add it to sidebar.rows and the panel polls harness
150
- status about every ten seconds, plus right away when the rendered session
151
- changes. It shows the worst signal first, then falls back to ok when every
152
- source reports available and quiet. A source that reports unavailable reads as
153
- unknown, and no data renders the placeholder like any other row.
95
+ ---
154
96
 
155
- It only appears when oc-harness-guard is installed and answering. Without it
156
- the row stays on the placeholder, and the panel never installs or requires the
157
- other plugin. Each side works alone.
97
+ ## ⚙️ Configure
158
98
 
159
- ## Configuration
99
+ **You don't need any.** Install it and the panel works. But every knob is available in a commented JSONC file.
160
100
 
161
- **You don't need any.** Install it and the panel works. But every knob is
162
- available in a commented JSONC file.
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.
163
102
 
164
- Copy [`flight-deck.example.jsonc`](./flight-deck.example.jsonc) to
165
- `~/.config/opencode/flight-deck.jsonc`, then edit. Comments and trailing commas
166
- are fine.
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.
167
104
 
168
- There is **one** config file, global to your user, so the same values apply to
169
- every project. Flight Deck does not read a `flight-deck.jsonc` from a project
170
- root or from a project's `.opencode/` directory — a copy left there configures
171
- nothing. If `$XDG_CONFIG_HOME` is set, the path is
172
- `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead. A `.json` name works too;
173
- the `.jsonc` name is tried first.
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.
174
106
 
175
- The file is optional, and a missing file is normal and silent: with no file at
176
- all you get exactly the defaults written out below.
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.
177
108
 
178
- > **Upgrading from 0.4.0 — the config file moved.** The per-project search is
179
- > gone. A `flight-deck.jsonc` in a project root or in `.opencode/` is no longer
180
- > read; move it to `~/.config/opencode/flight-deck.jsonc` (or the
181
- > `$XDG_CONFIG_HOME` path above) to keep your settings.
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.
182
110
 
183
111
  ```jsonc
112
+ // ~/.config/opencode/flight-deck.jsonc
184
113
  {
185
- // Tick rate in ms. The spinner has ten frames, so 100 turns it once a
186
- // second. 0 turns the timer off entirely. While nothing is running the
187
- // tick backs off to about once a second — the spinner is hidden then, and
188
- // the clock only reads in whole seconds.
189
114
  "refresh": 100,
190
-
191
115
  "sidebar": {
192
- "enabled": true,
193
- "lines": ["✈ FLIGHT DECK", "─────────────────"],
194
- // Any rows, any order. Delete whatever you don't want.
195
116
  "rows": [
196
117
  "caution", "status", "agent", "model", "branch", "cost", "project",
197
118
  "tokens", "cache", "context", "perms", "elapsed", "tps"
198
119
  ]
199
120
  },
200
-
201
- "caution": {
202
- // The annunciator. Silent unless something stopped moving.
203
- "enabled": true,
204
- "toolWatchSeconds": 180,
205
- "toolCautionSeconds": 420,
206
- "turnWatchSeconds": 600,
207
- "turnCautionSeconds": 1200,
208
- "repeatThreshold": 3,
209
- // Tools that are slow by nature, so slow is not an anomaly for them.
210
- "exemptTools": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
211
- // Off by default: the rail is the signal, a toast is an interruption.
212
- "toast": false
213
- },
214
-
215
- "footer": {
216
- // Off by default — the sidebar already carries the data.
217
- "enabled": false,
218
- "text": "Flight Deck"
219
- }
121
+ "caution": { "toast": false }
220
122
  }
221
123
  ```
222
124
 
223
- The example file documents every row and every option inline. A typo is never
224
- fatal: the bad value is ignored, the default comes back, and you get a one-time
225
- toast naming the key to fix.
125
+ ---
226
126
 
227
- ## It reads. It writes one number.
127
+ ## 🔒 It reads. It writes one number — two with `guard` on.
228
128
 
229
129
  Flight Deck shows what OpenCode already knows.
230
130
 
231
- - **No network calls while the opt-in `guard` row stays off.** Nothing is fetched, nothing is sent. When the `guard` row is enabled, the panel polls the local guard RPC (same machine, no telemetry) about every ten seconds, plus right away on session change.
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.
232
132
  - **No telemetry.** Nothing is collected or phoned home.
233
- - **Nothing on disk.** The one thing it writes is an animation counter in the
234
- host's in-memory plugin state, so the spinner and `elapsed` keep moving
235
- between turns. It is scoped to this plugin and dies with the TUI; it is never
236
- persisted, and `"refresh": 0` removes even that.
237
- - **No polling of your session while the opt-in `guard` row stays off** — cost, tokens, and permissions update from the
238
- host's own events. The timer only re-reads state the host already holds in
239
- memory, and only so the clock-derived rows keep moving. When the `guard` row
240
- is enabled, the panel additionally polls the local guard RPC on its own
241
- ten-second cadence.
242
- - **Theme-native.** Every line uses your active theme's text tokens, so it blends
243
- with whatever look you already run.
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.
244
136
 
245
137
  Delete the plugin and the stock sidebar is back, exactly as it was.
246
138
 
247
- ## Uninstall
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.
248
144
 
249
- Remove the entry from `opencode.jsonc`, restart, done. Delete your
250
- `~/.config/opencode/flight-deck.jsonc` too if you made one.
145
+ ---
251
146
 
252
- ## Development
147
+ ## 🛠 Development
253
148
 
254
149
  ```sh
255
150
  bun install
256
151
  bun run check
257
152
  ```
258
153
 
259
- `bun run check` typechecks and runs the suite, including headless OpenTUI render
260
- tests that mount the panel in a real renderer and assert the exact characters
261
- that come out. A guard test parses the shipped example config and asserts it
262
- still matches the real defaults, and a schema test validates that parsed
263
- example against the shipped schema — defaults, types, and allowed values —
264
- so the documentation can't drift from the code on either side.
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.
265
155
 
266
- To load the plugin **from this checkout** while working on it, add it to the
267
- `opencode.jsonc` of the project you run OpenCode in. A `plugins` entry is a
268
- package specifier, not a file path — a bare path is ignored silently — so the
269
- checkout has to be named as a git file URL:
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:
270
157
 
271
158
  ```jsonc
272
159
  {
@@ -274,21 +161,27 @@ checkout has to be named as a git file URL:
274
161
  }
275
162
  ```
276
163
 
277
- That installs a **copy, not a symlink**, so re-run the install after editing the
278
- checkout. This file is deliberately **not** committed: if the plugin is also
279
- installed globally, declaring it in both places registers the same plugin id
280
- twice and the host's plugin list shows one of them as failed.
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
281
171
 
282
- Built on the official
283
- [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/build/plugins/cli).
172
+ | | |
173
+ |---|---|
174
+ | Built against | `@opencode/plugin` `2.0.16` — 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 |
284
178
 
285
- ## Compatibility
179
+ ---
286
180
 
287
- Built against `@opencode/plugin` `2.0.10`; pin a host version you've tested.
181
+ <div align="center">
288
182
 
289
- Requires OpenCode V2 (`opencode2`). Building from source needs Bun 1.4+ or
290
- Node 22+.
183
+ Built against `@opencode/plugin` 2.0.16 · Node ≥ 22 / Bun ≥ 1.4 · OpenCode V2
291
184
 
292
- ## License
185
+ **MIT © 2026 nathwn12** · For OpenCode. Free.
293
186
 
294
- MIT © 2026 nathwn12 — free to use, modify, and share.
187
+ </div>