oc-flight-deck 0.6.0 → 0.6.2
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 +187 -294
- package/flight-deck.example.jsonc +4 -3
- package/flight-deck.schema.json +1 -1
- package/package.json +70 -70
- package/src/tui/config.ts +3 -3
- package/src/tui/index.tsx +127 -11
- package/src/tui/stats.ts +66 -3
package/README.md
CHANGED
|
@@ -1,294 +1,187 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
|
47
|
-
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
|
|
64
|
-
`
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
tool
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
the
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
the
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
// the clock only reads in whole seconds.
|
|
189
|
-
"refresh": 100,
|
|
190
|
-
|
|
191
|
-
"sidebar": {
|
|
192
|
-
"enabled": true,
|
|
193
|
-
"lines": ["✈ FLIGHT DECK", "─────────────────"],
|
|
194
|
-
// Any rows, any order. Delete whatever you don't want.
|
|
195
|
-
"rows": [
|
|
196
|
-
"caution", "status", "agent", "model", "branch", "cost", "project",
|
|
197
|
-
"tokens", "cache", "context", "perms", "elapsed", "tps"
|
|
198
|
-
]
|
|
199
|
-
},
|
|
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
|
-
}
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
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.
|
|
226
|
-
|
|
227
|
-
## It reads. It writes one number.
|
|
228
|
-
|
|
229
|
-
Flight Deck shows what OpenCode already knows.
|
|
230
|
-
|
|
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.
|
|
232
|
-
- **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.
|
|
244
|
-
|
|
245
|
-
Delete the plugin and the stock sidebar is back, exactly as it was.
|
|
246
|
-
|
|
247
|
-
## Uninstall
|
|
248
|
-
|
|
249
|
-
Remove the entry from `opencode.jsonc`, restart, done. Delete your
|
|
250
|
-
`~/.config/opencode/flight-deck.jsonc` too if you made one.
|
|
251
|
-
|
|
252
|
-
## Development
|
|
253
|
-
|
|
254
|
-
```sh
|
|
255
|
-
bun install
|
|
256
|
-
bun run check
|
|
257
|
-
```
|
|
258
|
-
|
|
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.
|
|
265
|
-
|
|
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:
|
|
270
|
-
|
|
271
|
-
```jsonc
|
|
272
|
-
{
|
|
273
|
-
"plugins": ["git+file:///absolute/path/to/oc-flight-deck"]
|
|
274
|
-
}
|
|
275
|
-
```
|
|
276
|
-
|
|
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.
|
|
281
|
-
|
|
282
|
-
Built on the official
|
|
283
|
-
[OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/build/plugins/cli).
|
|
284
|
-
|
|
285
|
-
## Compatibility
|
|
286
|
-
|
|
287
|
-
Built against `@opencode/plugin` `2.0.10`; pin a host version you've tested.
|
|
288
|
-
|
|
289
|
-
Requires OpenCode V2 (`opencode2`). Building from source needs Bun 1.4+ or
|
|
290
|
-
Node 22+.
|
|
291
|
-
|
|
292
|
-
## License
|
|
293
|
-
|
|
294
|
-
MIT © 2026 nathwn12 — free to use, modify, and share.
|
|
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
|
+
   
|
|
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>
|
|
@@ -82,9 +82,10 @@
|
|
|
82
82
|
// context a gauge of how full the context window is
|
|
83
83
|
// perms what is waiting for approval, not just how many
|
|
84
84
|
// elapsed wall-clock time since the session started
|
|
85
|
-
// tps
|
|
86
|
-
//
|
|
87
|
-
//
|
|
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
|
|
88
89
|
// spark recent turn sizes as a sparkline
|
|
89
90
|
// reasoning reasoning tokens, when the model emits them
|
|
90
91
|
// turns how many prompts you have sent this session
|
package/flight-deck.schema.json
CHANGED
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"type": "array",
|
|
119
119
|
"items": { "type": "string", "minLength": 1 },
|
|
120
120
|
"default": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
|
|
121
|
-
"description": "Tools that are slow by nature, so slow is not an anomaly for them. Matched by exact name. Calibrated against
|
|
121
|
+
"description": "Tools that are slow by nature, so slow is not an anomaly for them. Matched by exact name. Calibrated against 54,218 real settled tool calls: at the default threshold 307 calls exceed it and 200 of those are these tools — `subagent` alone crossed 152 times with a p99 of 14.7 minutes. Without this list the annunciator lights on every delegated task, which is how an alert gets ignored. Add your own long-running or orchestration tools here."
|
|
122
122
|
},
|
|
123
123
|
"toast": {
|
|
124
124
|
"type": "boolean",
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "oc-flight-deck",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "Live OpenCode V2 session telemetry — agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"opencode",
|
|
7
|
-
"opencode-plugin",
|
|
8
|
-
"opencode-tui",
|
|
9
|
-
"tui",
|
|
10
|
-
"cli",
|
|
11
|
-
"sidebar",
|
|
12
|
-
"telemetry",
|
|
13
|
-
"cost"
|
|
14
|
-
],
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"author": "nathwn12",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/nathwn12/oc-flight-deck.git"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/nathwn12/oc-flight-deck#readme",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/nathwn12/oc-flight-deck/issues"
|
|
24
|
-
},
|
|
25
|
-
"type": "module",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./src/index.ts",
|
|
29
|
-
"import": "./src/index.ts"
|
|
30
|
-
},
|
|
31
|
-
"./tui": {
|
|
32
|
-
"types": "./src/tui/index.tsx",
|
|
33
|
-
"import": "./src/tui/index.tsx"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"files": [
|
|
37
|
-
"src",
|
|
38
|
-
"flight-deck.example.jsonc",
|
|
39
|
-
"flight-deck.schema.json",
|
|
40
|
-
"README.md",
|
|
41
|
-
"LICENSE"
|
|
42
|
-
],
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=22",
|
|
45
|
-
"bun": ">=1.4.0"
|
|
46
|
-
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"typecheck": "tsc --noEmit",
|
|
49
|
-
"test": "bun test",
|
|
50
|
-
"check": "bun run typecheck && bun test"
|
|
51
|
-
},
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@opencode/plugin": "2.0.
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"@opentui/core": "0.5.
|
|
60
|
-
"@opentui/solid": "0.5.
|
|
61
|
-
"@types/bun": "^1.4.2",
|
|
62
|
-
"solid-js": "1.9.12",
|
|
63
|
-
"typescript": "^5.9.0"
|
|
64
|
-
},
|
|
65
|
-
"peerDependencies": {
|
|
66
|
-
"@opentui/core": ">=0.5.10",
|
|
67
|
-
"@opentui/solid": ">=0.5.10",
|
|
68
|
-
"solid-js": ">=1.9.0"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "oc-flight-deck",
|
|
3
|
+
"version": "0.6.2",
|
|
4
|
+
"description": "Live OpenCode V2 session telemetry — agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"opencode",
|
|
7
|
+
"opencode-plugin",
|
|
8
|
+
"opencode-tui",
|
|
9
|
+
"tui",
|
|
10
|
+
"cli",
|
|
11
|
+
"sidebar",
|
|
12
|
+
"telemetry",
|
|
13
|
+
"cost"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "nathwn12",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/nathwn12/oc-flight-deck.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/nathwn12/oc-flight-deck#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/nathwn12/oc-flight-deck/issues"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./src/index.ts",
|
|
29
|
+
"import": "./src/index.ts"
|
|
30
|
+
},
|
|
31
|
+
"./tui": {
|
|
32
|
+
"types": "./src/tui/index.tsx",
|
|
33
|
+
"import": "./src/tui/index.tsx"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"src",
|
|
38
|
+
"flight-deck.example.jsonc",
|
|
39
|
+
"flight-deck.schema.json",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22",
|
|
45
|
+
"bun": ">=1.4.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "bun test",
|
|
50
|
+
"check": "bun run typecheck && bun test"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@opencode/plugin": "2.0.12"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@opentui/core": "0.5.11",
|
|
60
|
+
"@opentui/solid": "0.5.11",
|
|
61
|
+
"@types/bun": "^1.4.2",
|
|
62
|
+
"solid-js": "1.9.12",
|
|
63
|
+
"typescript": "^5.9.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@opentui/core": ">=0.5.10",
|
|
67
|
+
"@opentui/solid": ">=0.5.10",
|
|
68
|
+
"solid-js": ">=1.9.0"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/src/tui/config.ts
CHANGED
|
@@ -56,12 +56,12 @@ export interface CautionConfig {
|
|
|
56
56
|
/**
|
|
57
57
|
* Tools that are slow by nature, so "slow" is not an anomaly for them.
|
|
58
58
|
*
|
|
59
|
-
* Calibrated against
|
|
60
|
-
* threshold, 307 calls exceed it — and
|
|
59
|
+
* Calibrated against 54,218 real settled tool calls: at a 180-second watch
|
|
60
|
+
* threshold, 307 calls exceed it — and 200 of those are these tools.
|
|
61
61
|
* `subagent` alone accounts for 152, with a p99 of 14.7 minutes. A delegated
|
|
62
62
|
* agent running a quarter of an hour is working as designed, and an
|
|
63
63
|
* annunciator that lights on every delegation is one you learn to ignore.
|
|
64
|
-
* With these exempt, 0.
|
|
64
|
+
* With these exempt, 0.20% of real calls cross the threshold.
|
|
65
65
|
*
|
|
66
66
|
* Matching is by exact tool name. Add your own long-running tools.
|
|
67
67
|
*/
|
package/src/tui/index.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { cautionDetail, cautionText, detectCautions, worstCaution, type Caution
|
|
|
4
4
|
import { cautionThresholds, mergeOptions, resolveConfig } from "./config.js";
|
|
5
5
|
import { loadConfigFile } from "./file-config.js";
|
|
6
6
|
import { footerLine, liveRowOffset, sidebarLines } from "./presentation.js";
|
|
7
|
-
import { ANIMATED_FIELDS, sessionThroughput, type StatSource } from "./stats.js";
|
|
7
|
+
import { ANIMATED_FIELDS, sessionThroughput, TPS_WINDOW_MS, windowedThroughput, type StatSource, type ThroughputSample } from "./stats.js";
|
|
8
8
|
import { startGuardBridge } from "./guard.js";
|
|
9
9
|
import { startTicker } from "./ticker.js";
|
|
10
10
|
|
|
@@ -31,6 +31,16 @@ const RECENT_MESSAGES = 4;
|
|
|
31
31
|
|
|
32
32
|
type SessionLike = { cost?: unknown; model?: unknown; time?: unknown; tokens?: unknown };
|
|
33
33
|
|
|
34
|
+
/** What one session's message list contributes to a throughput window. */
|
|
35
|
+
interface TpsScan {
|
|
36
|
+
/** False only when the host refused to list the session's messages. */
|
|
37
|
+
readonly ok: boolean;
|
|
38
|
+
/** Assistant messages seen, whether or not they carried a timestamp. */
|
|
39
|
+
readonly assistant: number;
|
|
40
|
+
/** Samples that carried a usable timestamp. */
|
|
41
|
+
readonly samples: readonly ThroughputSample[];
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
function asCount(value: unknown): number | undefined {
|
|
35
45
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : undefined;
|
|
36
46
|
}
|
|
@@ -325,16 +335,65 @@ export default Plugin.define({
|
|
|
325
335
|
return status === undefined ? undefined : false;
|
|
326
336
|
};
|
|
327
337
|
|
|
328
|
-
// Overall session throughput
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
+
// Overall session throughput, from two sources chosen by host capability and
|
|
339
|
+
// never by the moment. A host that stamps its messages gets a trailing-window
|
|
340
|
+
// rate — output tokens over the last minute, subagents summed in — so the
|
|
341
|
+
// figure reflects current speed rather than a whole-conversation average. A
|
|
342
|
+
// host proven to expose no message timestamps uses the lifetime average.
|
|
343
|
+
//
|
|
344
|
+
// The capability is learned once and remembered for the process. `undefined`
|
|
345
|
+
// means "not yet known": a read that failed, or carried no assistant turns,
|
|
346
|
+
// tells us nothing and must not choose a metric. Once known it is sticky in
|
|
347
|
+
// BOTH directions, so a transient `message.list` failure can never flip a
|
|
348
|
+
// stamped host back to the lifetime average (nor an unstamped host off it) —
|
|
349
|
+
// a failure just hides the row. One value for the whole host, deliberately
|
|
350
|
+
// not keyed by session.
|
|
351
|
+
//
|
|
352
|
+
// The rail re-runs on the fast tick, and walking every family message for
|
|
353
|
+
// every session would repeat the same work fifty times a second, so the
|
|
354
|
+
// result is held briefly. `undefined` is cached too: an idle window must not
|
|
355
|
+
// be re-derived on each tick either.
|
|
356
|
+
const TPS_CACHE_MS = 1_000;
|
|
357
|
+
let hostStamps: boolean | undefined;
|
|
358
|
+
let tpsCache:
|
|
359
|
+
| { readonly sessionID: string; readonly at: number; readonly value: number | undefined }
|
|
360
|
+
| undefined;
|
|
361
|
+
|
|
362
|
+
const scanMessages = (id: string): TpsScan => {
|
|
363
|
+
let messages: readonly unknown[];
|
|
364
|
+
try {
|
|
365
|
+
messages = context.data.session.message.list(id) ?? [];
|
|
366
|
+
} catch {
|
|
367
|
+
// A refused read is not "this host has no messages".
|
|
368
|
+
return { ok: false, assistant: 0, samples: [] };
|
|
369
|
+
}
|
|
370
|
+
const samples: ThroughputSample[] = [];
|
|
371
|
+
let assistant = 0;
|
|
372
|
+
for (const entry of messages) {
|
|
373
|
+
const message = asRecord(entry);
|
|
374
|
+
if (message?.["type"] !== "assistant") continue;
|
|
375
|
+
assistant += 1;
|
|
376
|
+
const stamp = asRecord(message["time"]);
|
|
377
|
+
const at =
|
|
378
|
+
asCount(stamp?.["completed"]) ?? asCount(stamp?.["streamed"]) ?? asCount(stamp?.["created"]);
|
|
379
|
+
// "Stamped" depends only on the timestamp, never on the output count: a
|
|
380
|
+
// batch of zero-output assistant turns still proves the host stamps.
|
|
381
|
+
if (at === undefined) continue;
|
|
382
|
+
samples.push({ tokens: asRecord(message["tokens"])?.["output"], at });
|
|
383
|
+
}
|
|
384
|
+
return { ok: true, assistant, samples };
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// The lifetime average, the metric of last resort for a host that exposes no
|
|
388
|
+
// per-message timestamps. Measured from the session's own clock
|
|
389
|
+
// (`time.updated`, falling back to now) so a finished session settles on a
|
|
390
|
+
// stable figure instead of decaying as it sits on screen.
|
|
391
|
+
const lifetimeTps = (
|
|
392
|
+
sessionID: string,
|
|
393
|
+
session: SessionLike | undefined,
|
|
394
|
+
created: number,
|
|
395
|
+
time: Record<string, unknown> | undefined,
|
|
396
|
+
): number | undefined => {
|
|
338
397
|
const updated = asCount(time?.["updated"]);
|
|
339
398
|
const end = updated === undefined ? Date.now() : Math.min(Date.now(), updated);
|
|
340
399
|
const elapsed = end - created;
|
|
@@ -366,6 +425,63 @@ export default Plugin.define({
|
|
|
366
425
|
return sessionThroughput(output, elapsed);
|
|
367
426
|
};
|
|
368
427
|
|
|
428
|
+
const computeTps = (sessionID: string, session: SessionLike | undefined): number | undefined => {
|
|
429
|
+
const time = asRecord(session?.time);
|
|
430
|
+
const created = asCount(time?.["created"]);
|
|
431
|
+
if (created === undefined) return undefined;
|
|
432
|
+
|
|
433
|
+
// A host proven unstamped needs no message read at all: its metric is the
|
|
434
|
+
// lifetime average whether or not the read would have succeeded.
|
|
435
|
+
if (hostStamps === false) return lifetimeTps(sessionID, session, created, time);
|
|
436
|
+
|
|
437
|
+
// Timestamped assistant output this session has produced, plus — only from
|
|
438
|
+
// a family root — every subagent session's. A child asking `family()` gets
|
|
439
|
+
// its ancestors and siblings back, so it keeps its own samples.
|
|
440
|
+
const scans: TpsScan[] = [scanMessages(sessionID)];
|
|
441
|
+
if (isFamilyRoot(sessionID)) {
|
|
442
|
+
try {
|
|
443
|
+
for (const id of context.data.session.family(sessionID) ?? []) {
|
|
444
|
+
if (id !== sessionID) scans.push(scanMessages(id));
|
|
445
|
+
}
|
|
446
|
+
} catch {
|
|
447
|
+
// No family on this host: the session's own samples still stand.
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const samples: ThroughputSample[] = [];
|
|
452
|
+
let assistant = 0;
|
|
453
|
+
let readOk = false;
|
|
454
|
+
for (const scan of scans) {
|
|
455
|
+
samples.push(...scan.samples);
|
|
456
|
+
assistant += scan.assistant;
|
|
457
|
+
readOk = readOk || scan.ok;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if (hostStamps === undefined) {
|
|
461
|
+
// A stamped assistant turn proves the host stamps. Assistant turns with
|
|
462
|
+
// no timestamp prove it does not. Neither, and the capability stays
|
|
463
|
+
// unknown so the row hides rather than guessing a metric.
|
|
464
|
+
if (samples.length > 0) hostStamps = true;
|
|
465
|
+
else if (readOk && assistant > 0) hostStamps = false;
|
|
466
|
+
else return undefined;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (hostStamps === true) {
|
|
470
|
+
return windowedThroughput(samples, Date.now(), TPS_WINDOW_MS, created);
|
|
471
|
+
}
|
|
472
|
+
return lifetimeTps(sessionID, session, created, time);
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
const sessionTps = (sessionID: string, session: SessionLike | undefined): number | undefined => {
|
|
476
|
+
const cached = tpsCache;
|
|
477
|
+
if (cached !== undefined && cached.sessionID === sessionID && Date.now() - cached.at < TPS_CACHE_MS) {
|
|
478
|
+
return cached.value;
|
|
479
|
+
}
|
|
480
|
+
const value = computeTps(sessionID, session);
|
|
481
|
+
tpsCache = { sessionID, at: Date.now(), value };
|
|
482
|
+
return value;
|
|
483
|
+
};
|
|
484
|
+
|
|
369
485
|
// Recent turn sizes, oldest first. Drawn from messages the host already
|
|
370
486
|
// holds, so the sparkline needs no history of our own to accumulate.
|
|
371
487
|
const sparkValues = (sessionID: string): readonly number[] => {
|
package/src/tui/stats.ts
CHANGED
|
@@ -54,9 +54,10 @@ export interface StatSource {
|
|
|
54
54
|
readonly busy?: unknown;
|
|
55
55
|
readonly perms?: unknown;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* Current session throughput. On a host that stamps its messages this is a
|
|
58
|
+
* trailing-window rate over the last minute, subagents summed in; on a host
|
|
59
|
+
* without message timestamps it falls back to the lifetime average. Either
|
|
60
|
+
* way it is derived from state the host already holds.
|
|
60
61
|
*/
|
|
61
62
|
readonly tps?: unknown;
|
|
62
63
|
readonly elapsedMs?: unknown;
|
|
@@ -259,6 +260,68 @@ export function sessionThroughput(outputTokens: unknown, elapsedMs: unknown): nu
|
|
|
259
260
|
return output / (Math.max(elapsed, 1_000) / 1_000);
|
|
260
261
|
}
|
|
261
262
|
|
|
263
|
+
/** Length of the trailing window, in milliseconds, that `windowedThroughput` measures. */
|
|
264
|
+
export const TPS_WINDOW_MS = 60_000;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* One assistant turn's contribution to a throughput window.
|
|
268
|
+
*
|
|
269
|
+
* Both fields are untrusted: `tokens` is the turn's output count and `at` is the
|
|
270
|
+
* timestamp it finished at. Anything unusable is skipped rather than guessed at.
|
|
271
|
+
*/
|
|
272
|
+
export interface ThroughputSample {
|
|
273
|
+
readonly tokens?: unknown;
|
|
274
|
+
readonly at?: unknown;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* A trailing-window throughput rate: output tokens per second over the last
|
|
279
|
+
* `windowMs`, measured from `nowMs`.
|
|
280
|
+
*
|
|
281
|
+
* The denominator is how much of the window the session has actually lived, so
|
|
282
|
+
* a just-started session ramps up against its real age instead of being divided
|
|
283
|
+
* by a full minute it has not run — floored at one second, the same floor the
|
|
284
|
+
* lifetime average uses, so a sliver of time cannot flash an absurd rate. Once
|
|
285
|
+
* the session is older than the window, it settles into a clean rolling minute.
|
|
286
|
+
*
|
|
287
|
+
* Returns `undefined` — the caller hides the row — unless at least one sample
|
|
288
|
+
* carries a usable timestamp inside the window and a positive output count. An
|
|
289
|
+
* idle session therefore reports no rate rather than a decaying one. The window
|
|
290
|
+
* is inclusive at both ends (`start <= at <= now`) so a boundary sample counts.
|
|
291
|
+
*
|
|
292
|
+
* Pure and dependency-free: no clock, no I/O, no rendering.
|
|
293
|
+
*/
|
|
294
|
+
export function windowedThroughput(
|
|
295
|
+
samples: readonly ThroughputSample[],
|
|
296
|
+
nowMs: number,
|
|
297
|
+
windowMs: number,
|
|
298
|
+
sessionCreatedMs: number,
|
|
299
|
+
): number | undefined {
|
|
300
|
+
if (!Number.isFinite(nowMs)) return undefined;
|
|
301
|
+
if (!Number.isFinite(windowMs) || windowMs <= 0) return undefined;
|
|
302
|
+
|
|
303
|
+
// An unusable creation time cannot tell us how long the session has lived, so
|
|
304
|
+
// the whole window is assumed available rather than dropping the rate.
|
|
305
|
+
const created = Number.isFinite(sessionCreatedMs) ? sessionCreatedMs : undefined;
|
|
306
|
+
const alive = created === undefined ? windowMs : nowMs - created;
|
|
307
|
+
const denominatorMs = Math.max(1_000, Math.min(windowMs, alive));
|
|
308
|
+
|
|
309
|
+
const start = nowMs - windowMs;
|
|
310
|
+
let output = 0;
|
|
311
|
+
let sawOne = false;
|
|
312
|
+
for (const sample of samples) {
|
|
313
|
+
const at = asCount(sample.at);
|
|
314
|
+
if (at === undefined || at < start || at > nowMs) continue;
|
|
315
|
+
const tokens = asCount(sample.tokens);
|
|
316
|
+
if (tokens === undefined || tokens <= 0) continue;
|
|
317
|
+
output += tokens;
|
|
318
|
+
sawOne = true;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (!sawOne) return undefined;
|
|
322
|
+
return output / (denominatorMs / 1_000);
|
|
323
|
+
}
|
|
324
|
+
|
|
262
325
|
/** `45s`, `14m`, `2h 14m`. */
|
|
263
326
|
export function formatDuration(ms: number): string {
|
|
264
327
|
const seconds = Math.floor(ms / 1_000);
|