oc-flight-deck 0.23.1 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/GUIDE.md CHANGED
@@ -89,16 +89,17 @@ One global file: `~/.config/opencode/flight-deck.jsonc`. The `.json` name is als
89
89
 
90
90
  | Key | Default | Effect |
91
91
  | --- | --- | --- |
92
+ | **`lifetimeTotalsPath`** | `~/.local/share/opencode/flight-deck/totals.json` | Optional file for the lifetime total's high-water mark. A non-empty string overrides it; malformed values fall back and are reported. |
92
93
  | **`sidebar.enabled`** | `true` | `false` leaves the plugin loaded but invisible. |
93
- | **`sidebar.rows`** | `["status","agent","model","cost","project","tokens","cache","context","perms","elapsed","tps"]` | Live rows, top to bottom, any subset in any order. Max 24 names; unknown names are ignored with a one-time warning. |
94
+ | **`sidebar.rows`** | `["status","agent","model","spend","project","tokens","cache","context","perms","elapsed","tps"]` | Live rows, top to bottom, any subset in any order. Max 24 names; unknown names are ignored with a one-time warning. `cost`, `total` and `session` stay accepted as aliases of `spend`, `lifetime` and `ses`. |
94
95
  | **`sidebar.lines`** | `[]` | Fixed lines above the rows. Max 24. These plus rows share the rail cap (`maxLines`); fixed lines render at full brightness while live rows are dimmed. |
95
96
  | **`sidebar.footer.lines`** | `[]` | Fixed lines in the host footer slot, outside the rail cap; max 24. |
96
97
  | **`sidebar.footer.go`** | `false` | `true` or an object draws the live Go usage panel. Object keys: `header` (`false`), `barWidth` (`10`, 1–40), `labelWidth` (`6`, 5–24, auto-widens), `percent` (`true`), `reset` (`true`), `align` (`"right"`, left, right, or center), `sweep` (`false`), `labels` (`{rolling,weekly,monthly}`, each 1–24 chars), `blink` (`true`), `blinkMs` (`700`, 200–5000). |
97
- | **`sidebar.persist`** | `true` | Every named row renders, drawing its zero skeleton until data arrives; `false` omits rows with no data. |
98
- | **`sidebar.placeholder`** | `"—"` | Non-empty string; only for a data-less row with no skeleton. `caution` never draws it, and `updated` draws it until the host records an action. |
98
+ | **`sidebar.persist`** | `true` | Every named row renders, drawing an honest zero until data arrives; `false` omits rows with no data. |
99
+ | **`sidebar.placeholder`** | `"0"` | Non-empty string; only for a data-less row with no zero of its own. Numeric rows never use it. `caution` stays silent, and `updated` draws it until the host records an action. |
99
100
  | **`sidebar.maxLines`** | `24` | Whole rail, fixed lines plus rows, 1–24. |
100
101
  | **`sidebar.tps.scope`** | `"family"` | `"family"` paces the open session plus subagents; `"session"` paces the open session alone. |
101
- | **`sidebar.tps.display`** | `"avg"` | `"avg"` settled-turn average, `"rt"` realtime estimate, `"both"` both figures plus ttft. |
102
+ | **`sidebar.tps.display`** | `"rt"` | `"rt"` estimated realtime throughput plus observed TTFT, `"avg"` settled-turn average, `"both"` both figures plus TTFT. |
102
103
 
103
104
  **Footer**
104
105
 
@@ -175,8 +176,10 @@ Every name `sidebar.rows` accepts, what its number means, and whether it draws b
175
176
  | `agent` | Active agent name. | yes |
176
177
  | `model` | Model id, plus ` · variant` when one is present. | yes |
177
178
  | `branch` | Current git branch. Costs a VCS call. | opt-in |
178
- | `cost` | Money for this conversation plus its subagent tree. With `total` on the rail, this row shows the session's own figure. Merged shape `$1.84 · 3 subagents`; childless shows `$1.84`. | yes |
179
- | `total` | Family total plus subagent count, `$1.84 · 0 subagents` when childless. | opt-in |
179
+ | `spend` | The current model's spend for this session only. When the rail already shows `lifetime`, this row shows the session's own figure; otherwise it merges the subagent total into itself. Merged shape `$1.84 · 3 subagents`; childless shows `$1.84`. | yes |
180
+ | `lifetime` | Family total plus subagent count, all models, `$1.84 · 0 subagents` when childless. A durable high-water mark: the highest figure seen for the family root is kept in `~/.local/share/opencode/flight-deck/totals.json`, so a restart or host pruning cannot lower the row. | opt-in |
181
+ | `cost` | Alias for `spend`; accepted in `sidebar.rows` and folded to it. Old configs keep the `cost` label. | yes |
182
+ | `total` | Alias for `lifetime`; accepted in `sidebar.rows` and folded to it. Old configs keep the `total` label. | opt-in |
180
183
  | `project` | Every session in the project: `$12.40 · 21 sessions` when more than one, else just the figure. | yes |
181
184
  | `tokens` | `1.2M in · 84k out`, same family scope as `cost`. | yes |
182
185
  | `cache` | `92% hit · 1.1M read`, family scope. The hit-rate denominator is cache read plus input; cache write is excluded because a write is not a lookup. A zero read is drawn (`0 read`, or `0% hit · 0 read` when input exists), never hidden. | yes |
@@ -184,7 +187,7 @@ Every name `sidebar.rows` accepts, what its number means, and whether it draws b
184
187
  | `perms` | Pending approvals. One names the action plus an 18-cell clipped resource (`bash · src/tui…`); several lead with the count (`3 waiting · bash`). | yes |
185
188
  | `elapsed` | Active generation time, recomputed from the assistant-turn spans the host recorded for this session and its subagents. Survives a restart, never steps backwards while the host reports those turns, and is not wall-clock since the session began. | yes |
186
189
  | `updated` | Absolute timestamp of the newest action the host recorded: the latest message's `completed`, else `streamed`, else `created` stamp. The host locale and time zone apply by default; `format.timestamp` sets the locale, date and time styles, the 12/24-hour clock, and an IANA zone or UTC offset. A Windows zone id is rejected and the host zone is used. | opt-in |
187
- | `tps` | Session speed. Default `avg`: generation tokens (output plus reasoning) over the union of settled turns' `streamed − created` spans; idle gaps never billed. `rt`: realtime estimate from streaming deltas, zero while nothing generates. `both`: `106 rt · 41 avg`, plus `1.2s ttft` once a step settles. Scope `family` (default; open session plus subagents, overlapping spans merged) or `session`. Below half a token per second no figure is drawn; with `persist: true` the row falls back to its `0 tok/s` skeleton, and `persist: false` omits it. | yes |
190
+ | `tps` | Session speed. Default `rt`: estimated realtime throughput from streaming delta bytes and observed mean TTFT after steps settle; TTFT rides only while a rate stands. `avg` selects the settled-turn average; `both` shows both rates. Scope `family` includes subagents; `session` covers the open session. With no rate the row draws `0 <sidebar.tps.label>` (`0 tok/s` shipped), never a placeholder or a ttft-only fallback. | yes |
188
191
  | `spark` | Recent turn sizes as a sparkline; the newest samples are kept. | opt-in |
189
192
  | `reasoning` | Reasoning tokens, family scope. | opt-in |
190
193
  | `turns` | Prompts sent this session. | opt-in |
@@ -194,7 +197,7 @@ Every name `sidebar.rows` accepts, what its number means, and whether it draws b
194
197
  | `ses` | Clipped 18-cell preview of the session id (less when the label column is narrow, floored at 8), labelled `session`. Click copies the full id. A verified copy is silent: the host write reports `written`, or an exact clipboard read-back confirms an OSC52 dispatch. An unconfirmed dispatch is an advisory warning (paste to verify). Gate the failure toast with `notifications.copy`. | opt-in |
195
198
  | `session` | Alias for `ses`; accepted in `sidebar.rows` and folded to it. | opt-in |
196
199
 
197
- With `sidebar.persist` (the default) every named row renders, drawing its zero skeleton until data arrives: `$0.000` money rows, `0 in · 0 out`, `0 read`, empty gauge plus `~0%`, `0 waiting`, `0s`, `0 tok/s` (`0 rt · 0 avg` in both), flat `▁` spark, `0` reasoning and turns, `○ 0 ○ 0 ○ 0` go, `○ idle`, `none` agent, model, and ses, `no branch`, `unknown` guard. `caution` never draws a skeleton, and `updated` has none either: it draws `sidebar.placeholder` (`—`) until the host records an action, because there is no honest zero timestamp. Set `persist: false` to omit rows with no data instead.
200
+ With `sidebar.persist` (the default) named rows render even without data. Numeric rows draw an honest zero: `$0.000` money rows, `0 in · 0 out`, `0 read`, `~0 used`, `0s`, `0` reasoning and turns, `0 tok/s` tps, plus the zero forms of the gauge and spark. `caution` stays silent; `updated` draws `sidebar.placeholder` (`0` by default) because there is no honest zero timestamp. Set `persist: false` to omit rows with no data instead.
198
201
 
199
202
  ### Recipes
200
203
 
@@ -53,6 +53,11 @@
53
53
  // host's renderer, so a smaller value spends work without adding motion.
54
54
  "refresh": 100,
55
55
 
56
+ // Optional: where the durable high-water lifetime total is kept. Omit it to
57
+ // use `~/.local/share/opencode/flight-deck/totals.json`. A non-empty string
58
+ // is used as given; malformed values are reported and the default is used.
59
+ // ,"lifetimeTotalsPath": "/tmp/flight-deck-totals.json",
60
+
56
61
  // ── Sidebar ──────────────────────────────────────────────────────────────
57
62
  "sidebar": {
58
63
  // false hides the whole panel.
@@ -117,25 +122,23 @@
117
122
  // agent which agent is running (orchestrator, build, plan, ...)
118
123
  // model model id, plus the variant when there is one
119
124
  // branch current git branch. Off by default — costs a VCS call
120
- // cost this conversation, plus every subagent session in its tree
121
- // (the host links those by parentID); with `total` on the
122
- // rail, the session figure alone. It cannot see spend from an
123
- // independently spawned top-level session: the rollup follows
124
- // the host's parentID link only (family()), a session spawned
125
- // as an independent top-level session carries no parentID,
126
- // and the host returned no metadata field for the sessions
127
- // probed during this work — so there is no automatic creator
128
- // link today. The `project` row is the surface that covers
129
- // every session in the project, spawned included
130
- // total the family total and subagent count on a row of its own —
131
- // the session's own cost with `0 subagents` when it spawned
132
- // none, never a blank row
125
+ // spend the current model's spend for this session only. `cost` is
126
+ // an accepted alias and renders the same row. It cannot see
127
+ // spend from an independently spawned top-level session: the
128
+ // rollup follows the host's parentID link only (family()),
129
+ // and a session spawned as an independent top-level session
130
+ // carries no parentID. `project` covers every session in the
131
+ // project, spawned included
132
+ // lifetime the durable family total and subagent count on a row of its
133
+ // own — all models, this session plus its subagents, kept as
134
+ // a high-water mark across restarts. `total` is an accepted
135
+ // alias. `0 subagents` when it spawned none, never a blank
133
136
  // project every session in this project, not just the one on screen
134
- // tokens input and output, in the same family scope as `cost`: this
137
+ // tokens input and output, in the same family scope as `spend`: this
135
138
  // conversation plus its subagent sessions when any exist,
136
139
  // the session alone when there are none
137
140
  // cache cache hit rate, then cache reads, in the same family scope
138
- // as `cost`
141
+ // as `spend`
139
142
  // context a gauge of how full the context window is
140
143
  // perms what is waiting for approval, not just how many
141
144
  // elapsed active time recomputed from the assistant-turn spans the host
@@ -159,7 +162,7 @@
159
162
  // `both` draws both on one line
160
163
  // spark recent turn sizes as a sparkline
161
164
  // reasoning reasoning tokens, when the model emits them, in the same
162
- // family scope as `cost`
165
+ // family scope as `spend`
163
166
  // turns how many prompts you have sent this session
164
167
  // guard harness status from oc-harness-guard: breaches, orphans,
165
168
  // findings, or ok. Available, off by default.
@@ -180,19 +183,16 @@
180
183
  // the rename at every `layout.labelWidth`. Off by default; needs the host's mouse.
181
184
  //
182
185
  // Every named row renders persistently, so the rail keeps a stable shape:
183
- // a row with no data yet draws a real-looking zero — `$0.000` for money
184
- // rows, `0 in · 0 out` for tokens, `0 tok/s` for tps — in the same label
185
- // column as a live row, never a placeholder symbol. Two rows are the
186
- // exceptions: `caution` stays silent until it has something to say, and
187
- // `updated` draws `sidebar.placeholder` (`—`) until the host records an
188
- // action, because there is no honest zero timestamp.
189
- // The fixed lines and live rows share the maxLines budget below, and
190
- // anything past it is dropped.
186
+ // a numeric row with no data yet draws an honest zero — `$0.000` for
187
+ // money rows, `0 in · 0 out` for tokens, `0 tok/s` for tps. `caution`
188
+ // stays silent; `updated` draws `sidebar.placeholder` because there is no
189
+ // honest zero timestamp. The fixed lines and live rows share the maxLines
190
+ // budget below, and anything past it is dropped.
191
191
  "rows": [
192
192
  "status",
193
193
  "agent",
194
194
  "model",
195
- "cost",
195
+ "spend",
196
196
  "project",
197
197
  "tokens",
198
198
  "cache",
@@ -219,34 +219,46 @@
219
219
  // while it is idle even when a child is still running). An unknown value
220
220
  // falls back to `"family"` and is reported.
221
221
  //
222
- // `"display"` is what draws. `"avg"` (the default) is the settled-turn
222
+ // `"display"` is what draws. `"avg"` is the settled-turn
223
223
  // average: generation tokens over assistant turns that recorded
224
224
  // `streamed`, divided by the union of their `streamed - created` spans —
225
225
  // in-flight turns excluded, idle gaps never billed. `"rt"` is the
226
- // realtime estimate from the host's streaming delta events, reading
227
- // `0 tok/s` whenever the scope is not generating (idle, between turns,
228
- // or before the first delta). `"both"` draws both on one line
226
+ // realtime estimate (the default) from the host's streaming delta events.
227
+ // Without a rate, observed TTFT remains visible. `"both"` draws both on one line
229
228
  // (`106 rt · 41 avg`), plus the mean time to first token over settled
230
229
  // steps (`83 rt · 38 avg · 1.2s ttft`): per step, the earliest
231
230
  // text/reasoning delta's event time minus the step's `started` dispatch
232
231
  // stamp (request dispatch time, before waiting for provider output),
233
232
  // pushed into the scope's ring when the step ends. The mean covers the
234
233
  // most recent finalized steps observed while the plugin ran — in-memory,
235
- // so a restart forgets them. An unknown value falls back to `"avg"` and
234
+ // so a restart forgets them. `rt` also shows TTFT when available.
235
+ // An unknown value falls back to `"rt"` and
236
236
  // is reported.
237
- "tps": { "scope": "family", "display": "avg" },
237
+ //
238
+ // `"label"` is the suffix on the single-figure rows: `"rt"` draws
239
+ // `N <label>` and `"avg"` draws the same. The shipped `"tok/s"` keeps
240
+ // today's output; set it to `"rt"` to name the realtime figure after its
241
+ // half. `"both"` already names its two halves `rt` and `avg`, so it
242
+ // ignores this key. The value is trimmed; blank, non-string and overlong
243
+ // values fall back to `"tok/s"` and are reported.
244
+ //
245
+ // `"ttft"` controls the mean time to first token (`1.2s ttft`). On (the
246
+ // default) it rides along beside the figures, and is the whole fallback
247
+ // row when no rate can be drawn. Set it to false to hide that segment in
248
+ // every display mode: with no rate, the row hides instead.
249
+ "tps": { "scope": "family", "display": "rt", "label": "tok/s", "ttft": true },
238
250
 
239
251
  // Every named row renders persistently: with no data yet it draws its
240
- // zero skeleton (a real-looking zero, never a placeholder symbol), in the
252
+ // zero skeleton or placeholder, in the
241
253
  // same label column as a live row. Set to false to omit rows with no data
242
254
  // instead.
243
255
  "persist": true,
244
256
 
245
- // Fallback for a persistent row with no data that has no skeleton. Any
246
- // non-empty string. `caution` never draws it (its silence is the design),
247
- // and `updated` draws it until the host records an action: there is no
248
- // honest zero timestamp, so this dash is reachable for that one row.
249
- "placeholder": "—",
257
+ // Fallback for a persistent row with no zero of its own. Any non-empty
258
+ // string; `0` by default. Numeric rows never use it — they draw a real
259
+ // zero. `caution` stays silent (its silence is the design), and `updated`
260
+ // draws it until data is available.
261
+ "placeholder": "0",
250
262
 
251
263
  // Maximum total height, including fixed lines and live rows. Defaults to 24.
252
264
  "maxLines": 24
@@ -19,6 +19,12 @@
19
19
  "description": "Milliseconds between ticks. Cost and tokens arrive with host events; anything derived from the clock — `elapsed`, the status spinner, and the caution thresholds — needs this timer. 100 turns the spinner once a second. 0 turns the ticker off entirely, which also freezes the annunciator (it works, but only updates on host events). Practical range 16–1000; 1–15 are treated as 16, while 0 is the deliberate off switch and is never clamped."
20
20
  },
21
21
 
22
+ "lifetimeTotalsPath": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "description": "Optional path to the durable high-water ledger for the `total` row. Leave it out to use `~/.local/share/opencode/flight-deck/totals.json`. A non-empty string is used as given; a malformed value is reported and the default path is used. Entries in this file are never deleted or expired."
26
+ },
27
+
22
28
  "sidebar": {
23
29
  "type": "object",
24
30
  "additionalProperties": false,
@@ -145,16 +151,16 @@
145
151
  },
146
152
  "rows": {
147
153
  "type": "array",
148
- "items": { "enum": ["caution", "status", "agent", "model", "branch", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "updated", "tps", "spark", "reasoning", "turns", "guard", "go", "dex", "ses", "session"] },
149
- "default": ["status", "agent", "model", "cost", "project", "tokens", "cache", "context", "perms", "elapsed", "tps"],
154
+ "items": { "enum": ["caution", "status", "agent", "model", "branch", "spend", "lifetime", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "updated", "tps", "spark", "reasoning", "turns", "guard", "go", "dex", "ses", "session"] },
155
+ "default": ["status", "agent", "model", "spend", "project", "tokens", "cache", "context", "perms", "elapsed", "tps"],
150
156
  "maxItems": 24,
151
- "description": "Which live fields to draw, top to bottom. Any subset, any order - this is the single most useful thing to change. With `sidebar.persist` (the default) every named row always renders, drawing its zero skeleton until the host has data (the opt-in `updated` row has no skeleton and draws `sidebar.placeholder` instead, because there is no honest zero timestamp); with `persist: false` rows with no data are omitted entirely. Counted together with `sidebar.lines` against a 24-line cap on the whole rail. The opt-in `ses` row shows a clipped preview of the session id under the `session` label - budget 18 cells, reduced by however much the label overflows `layout.labelWidth`, floored at 8 - and a mouse click on that row copies the full id to the OS clipboard: a host write reporting `written` or an exact clipboard read-back after the OSC52 dispatch verifies it, only a verified copy counts as success, a verified copy stays silent, and an unverified or failed outcome surfaces a toast gated by `notifications.copy`. `session` is accepted as an alias for `ses` and is normalized to it."
157
+ "description": "Which live fields to draw, top to bottom. Any subset, any order - this is the single most useful thing to change. With `sidebar.persist` (the default) every named row always renders, drawing its zero skeleton until the host has data (the opt-in `updated` row has no skeleton and draws `sidebar.placeholder` instead, because there is no honest zero timestamp); with `persist: false` rows with no data are omitted entirely. Counted together with `sidebar.lines` against a 24-line cap on the whole rail. The opt-in `ses` row shows a clipped preview of the session id under the `session` label - budget 18 cells, reduced by however much the label overflows `layout.labelWidth`, floored at 8 - and a mouse click on that row copies the full id to the OS clipboard: a host write reporting `written` or an exact clipboard read-back after the OSC52 dispatch verifies it, only a verified copy counts as success, a verified copy stays silent, and an unverified or failed outcome surfaces a toast gated by `notifications.copy`. `session` is accepted as an alias for `ses`, `cost` for `spend`, and `total` for `lifetime`. Aliases keep working forever; naming both an alias and its key renders the row once and reports the duplicate."
152
158
  },
153
159
  "tps": {
154
160
  "type": "object",
155
161
  "additionalProperties": false,
156
- "default": { "scope": "family", "display": "avg" },
157
- "description": "The `tps` row: which sessions it paces (`scope`) and which figure it draws (`display`). By default it shows the settled-turn average over the whole family: on hosts that record turn timestamps, generation tokens (output plus reasoning) over assistant turns that recorded `streamed`, divided by the union of their `streamed − created` spans — in-flight turns excluded, idle gaps never billed; on hosts without turn timestamps, generation tokens over the borrowed active clock instead. `display: \"rt\"` draws the realtime figure from the host's streaming events instead — an estimate from delta bytes while a turn streams, reading zero while nothing generates; `\"both\"` draws both figures on one line, plus the mean time to first token over settled steps (`1.2s ttft`) — per step, the earliest delta's event time minus the step's `started` dispatch stamp, pushed into the scope's ring when the step ends and kept in memory for the plugin's lifetime.",
162
+ "default": { "scope": "family", "display": "rt", "label": "tok/s", "ttft": true },
163
+ "description": "The `tps` row: which sessions it paces (`scope`), which figure it draws (`display`), what suffix the single-figure rows print (`label`), and whether the observed time to first token may show (`ttft`). When selected it shows the settled-turn average over the whole family: on hosts that record turn timestamps, generation tokens (output plus reasoning) over assistant turns that recorded `streamed`, divided by the union of their `streamed − created` spans — in-flight turns excluded, idle gaps never billed; on hosts without turn timestamps, generation tokens over the borrowed active clock instead. `display: \"rt\"` draws the realtime figure from the host's streaming events instead — an estimate from delta bytes while a turn streams, reading zero while nothing generates; `\"both\"` draws both figures on one line, plus the mean time to first token over settled steps (`1.2s ttft`) — per step, the earliest delta's event time minus the step's `started` dispatch stamp, pushed into the scope's ring when the step ends and kept in memory for the plugin's lifetime. `ttft: false` suppresses that segment in every display mode.",
158
164
  "properties": {
159
165
  "scope": {
160
166
  "type": "string",
@@ -165,21 +171,32 @@
165
171
  "display": {
166
172
  "type": "string",
167
173
  "enum": ["avg", "rt", "both"],
168
- "default": "avg",
169
- "description": "Which figure the `tps` row draws. `avg` (the default) is the settled-turn average: on hosts that record turn timestamps, generation tokens over assistant turns with `streamed` recorded, divided by the union of their `streamed - created` spans, in the row's scope; on hosts without them, generation tokens over the borrowed active clock. `rt` is the realtime figure from the host's streaming events — an estimate from delta bytes while a turn streams, reading zero while nothing generates. `both` draws `rt` and `avg` on one line (`106 rt · 41 avg`), plus the mean time to first token over settled steps (`83 rt · 38 avg · 1.2s ttft`): per step, the earliest text/reasoning delta's event time minus the step's `started` dispatch stamp (request dispatch time, before waiting for provider output), pushed into the scope's ring when the step ends — the mean covers the most recent finalized steps observed while the plugin ran (in-memory; a restart forgets them). An unknown value falls back to `avg` and is reported."
174
+ "default": "rt",
175
+ "description": "Which figure the `tps` row draws. `avg` is the settled-turn average: on hosts that record turn timestamps, generation tokens over assistant turns with `streamed` recorded, divided by the union of their `streamed - created` spans, in the row's scope; on hosts without them, generation tokens over the borrowed active clock. `rt` is the realtime figure from the host's streaming events — an estimate from delta bytes while a turn streams, reading zero while nothing generates. `both` draws `rt` and `avg` on one line (`106 rt · 41 avg`), plus the mean time to first token over settled steps (`83 rt · 38 avg · 1.2s ttft`): per step, the earliest text/reasoning delta's event time minus the step's `started` dispatch stamp (request dispatch time, before waiting for provider output), pushed into the scope's ring when the step ends — the mean covers the most recent finalized steps observed while the plugin ran (in-memory; a restart forgets them). An unknown value falls back to `rt` and is reported."
176
+ },
177
+ "label": {
178
+ "type": "string",
179
+ "maxLength": 16,
180
+ "default": "tok/s",
181
+ "description": "Short suffix printed after the number on the single-figure `tps` rows: `display: \"rt\"` draws `N <label>` and `display: \"avg\"` draws the same. The shipped `tok/s` keeps a new user's output unchanged; set it to `rt` to name the realtime figure after its half. `display: \"both\"` ignores this key because it already names its two halves `rt` and `avg`. The value is trimmed; a blank, non-string or overlong value falls back to `tok/s` and is reported."
182
+ },
183
+ "ttft": {
184
+ "type": "boolean",
185
+ "default": true,
186
+ "description": "Whether the `tps` row may draw the observed mean time to first token over settled steps (`1.2s ttft`). On, the default, the segment rides along beside the figures — including `display: \"rt\"`'s fallback row, shown when no rate can be drawn. Off, it is suppressed in every display mode, and with no rate there is no row at all. A non-boolean value falls back to `true` and is reported."
170
187
  }
171
188
  }
172
189
  },
173
190
  "persist": {
174
191
  "type": "boolean",
175
192
  "default": true,
176
- "description": "Render every field named in `sidebar.rows` as a persistent row, drawing its zero skeleton when the host has no data yet (`$0.000` for money rows, `0 in · 0 out` for tokens, `0 tok/s` for tps — `0 live · 0 avg` when `sidebar.tps.display` is `both` — and so on; `caution` never draws a skeleton and stays silent until it has something to announce, and `updated` draws `sidebar.placeholder` until the host records an action because there is no honest zero timestamp). True keeps the rail a stable shape that fills in as the session produces data; false restores the old behavior of omitting rows with no data."
193
+ "description": "Render named fields persistently. Numeric rows now draw a sane zero before data arrives; only `updated` (no honest zero timestamp) and a few text rows with no zero use `sidebar.placeholder`, while `caution` stays silent. False omits fields without data."
177
194
  },
178
195
  "placeholder": {
179
196
  "type": "string",
180
197
  "minLength": 1,
181
- "default": "—",
182
- "description": "Fallback value for a persistent row with no data that has no skeleton. Used only when `sidebar.persist` is true. Must be a non-empty string; anything else falls back to the default em dash. `caution` never draws it because its silence is the design, and `updated` uses it until the host records an action — there is no honest zero timestamp."
198
+ "default": "0",
199
+ "description": "Fallback value for a persistent row with no zero of its own. Used only when `sidebar.persist` is true. Must be a non-empty string; anything else falls back to the default `0`. Numeric rows never use it: they draw a real zero instead. `caution` stays silent, and `updated` uses it until the host records an action because there is no honest zero timestamp."
183
200
  },
184
201
  "maxLines": {
185
202
  "type": "integer",
@@ -450,10 +467,10 @@
450
467
  }
451
468
  },
452
469
  "propertyNames": {
453
- "enum": ["*", "caution", "status", "agent", "model", "branch", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "updated", "tps", "spark", "reasoning", "turns", "guard", "go", "dex", "ses", "session"]
470
+ "enum": ["*", "caution", "status", "agent", "model", "branch", "spend", "lifetime", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "updated", "tps", "spark", "reasoning", "turns", "guard", "go", "dex", "ses", "session"]
454
471
  },
455
472
  "default": { "*": { "color": "subdued", "attributes": [] } },
456
- "description": "Style all live rows under `*`, then optionally override any known row name such as `cost`. A row can change one field and inherit the other from `*`; unknown row names are reported and ignored. `session` is accepted as an alias for `ses` and is normalized to it."
473
+ "description": "Style all live rows under `*`, then optionally override any known row name such as `cost`. A row can change one field and inherit the other from `*`; unknown row names are reported and ignored. `session` is accepted as an alias for `ses`, `cost` for `spend`, and `total` for `lifetime`. Aliases keep working forever; naming both an alias and its key renders the row once and reports the duplicate."
457
474
  }
458
475
  }
459
476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-flight-deck",
3
- "version": "0.23.1",
3
+ "version": "0.25.0",
4
4
  "description": "Live OpenCode V2 session telemetry — agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
5
5
  "keywords": [
6
6
  "opencode",
@@ -60,16 +60,16 @@
60
60
  "access": "public"
61
61
  },
62
62
  "dependencies": {
63
- "@opencode/plugin": "^2.2.5"
63
+ "@opencode/plugin": "^2.3.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@opencode/plugin": "2.2.6",
67
- "@opentui/core": "^0.8.3",
68
- "@opentui/solid": "^0.8.3",
66
+ "@opencode/plugin": "2.3.0",
67
+ "@opentui/core": "^0.9.0",
68
+ "@opentui/solid": "^0.9.0",
69
69
  "@types/bun": "^1.4.4",
70
- "solid-js": "1.9.18",
70
+ "solid-js": "1.9.19",
71
71
  "string-width": "7.2.0",
72
- "typescript": "^5.9.3"
72
+ "typescript": "^7.0.2"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@opentui/core": ">=0.8.0",
package/src/tui/config.ts CHANGED
@@ -9,6 +9,7 @@
9
9
  // defaults below, so the rail always renders and a typo can never break the TUI.
10
10
 
11
11
  import { DEFAULT_PLACEHOLDER, canonicalField, isStatField, STAT_FIELDS } from "./stats.js";
12
+ import { defaultLifetimeTotalsPath } from "./lifetime-totals.js";
12
13
  import type { CautionThresholds } from "./caution.js";
13
14
  import type { DurationStyle, TimestampDateStyle, TimestampTimeStyle } from "./format.js";
14
15
  import {
@@ -33,7 +34,7 @@ interface SidebarConfig {
33
34
  readonly footer: SidebarFooterConfig;
34
35
  /** Live session fields to render, top to bottom. Default `DEFAULT_SIDEBAR_ROWS`. */
35
36
  readonly rows: readonly string[];
36
- /** Which sessions the `tps` row paces, and which figure it draws. Default `{ scope: DEFAULT_TPS_SCOPE, display: DEFAULT_TPS_DISPLAY }`. */
37
+ /** Which sessions the `tps` row paces, which figure it draws, its single-figure suffix, and whether TTFT may show. Default `{ scope: DEFAULT_TPS_SCOPE, display: DEFAULT_TPS_DISPLAY, label: DEFAULT_TPS_LABEL, ttft: DEFAULT_TPS_TTFT }`. */
37
38
  readonly tps: TpsConfig;
38
39
  /**
39
40
  * Render every named row even when the host has no data for it, using
@@ -153,22 +154,32 @@ export type TpsDisplay = "avg" | "rt" | "both";
153
154
  export const DEFAULT_TPS_SCOPE: TpsScope = "family";
154
155
 
155
156
  /**
156
- * The shipped `tps` figure: `"avg"`.
157
- *
158
- * The one default for this knob, so flipping the shipped behaviour is one
159
- * line here. The average ships because it answers the question the row is
160
- * really asked — how fast is this session producing — instead of what the
161
- * decoder is doing in this exact poll: an idle gap between turns reads as a
162
- * steady figure rather than as zero, while `rt` stays one edit away for
163
- * the moment-to-moment view.
157
+ * The shipped `tps` figure: `"rt"`, an estimate of current throughput.
158
+ */
159
+ export const DEFAULT_TPS_DISPLAY: TpsDisplay = "rt";
160
+
161
+ /**
162
+ * The shipped `tps` TTFT switch: `true`, so the observed time to first token
163
+ * keeps its place beside the figures until the owner turns it off.
164
164
  */
165
- export const DEFAULT_TPS_DISPLAY: TpsDisplay = "avg";
165
+ export const DEFAULT_TPS_TTFT = true;
166
+
167
+ /**
168
+ * The shipped `tps` single-figure suffix: `"tok/s"`, so a new user sees the
169
+ * same line as before. `display: "both"` names its halves itself and ignores
170
+ * this key.
171
+ */
172
+ export const DEFAULT_TPS_LABEL = "tok/s";
166
173
 
167
174
  interface TpsConfig {
168
175
  /** Which sessions the `tps` row paces. Default `DEFAULT_TPS_SCOPE`. */
169
176
  readonly scope: TpsScope;
170
177
  /** Which figure the `tps` row draws. Default `DEFAULT_TPS_DISPLAY`. */
171
178
  readonly display: TpsDisplay;
179
+ /** Suffix on the single-figure rows (`rt`, `avg`). Default `DEFAULT_TPS_LABEL`. */
180
+ readonly label: string;
181
+ /** Whether the observed time to first token may render. Default `DEFAULT_TPS_TTFT`. */
182
+ readonly ttft: boolean;
172
183
  }
173
184
 
174
185
  interface SidebarFooterConfig {
@@ -279,6 +290,12 @@ export interface FlightDeckConfig {
279
290
  * it needs a tick. `0` turns the ticker off, leaving every row event-driven.
280
291
  */
281
292
  readonly refresh: number;
293
+ /**
294
+ * Path to the durable lifetime-totals ledger. Ships as
295
+ * `~/.local/share/opencode/flight-deck/totals.json`; a host config can point
296
+ * it at another file, which is also the test seam.
297
+ */
298
+ readonly lifetimeTotalsPath: string;
282
299
  }
283
300
 
284
301
  /** The millisecond view the rules in ./caution.ts operate on. */
@@ -471,7 +488,7 @@ export const DEFAULT_SIDEBAR_ROWS: readonly string[] = [
471
488
  "status",
472
489
  "agent",
473
490
  "model",
474
- "cost",
491
+ "spend",
475
492
  "project",
476
493
  "tokens",
477
494
  "cache",
@@ -517,7 +534,12 @@ export const DEFAULT_CONFIG: FlightDeckConfig = {
517
534
  lines: DEFAULT_SIDEBAR_LINES,
518
535
  footer: { lines: DEFAULT_SIDEBAR_FOOTER_LINES, go: false },
519
536
  rows: DEFAULT_SIDEBAR_ROWS,
520
- tps: { scope: DEFAULT_TPS_SCOPE, display: DEFAULT_TPS_DISPLAY },
537
+ tps: {
538
+ scope: DEFAULT_TPS_SCOPE,
539
+ display: DEFAULT_TPS_DISPLAY,
540
+ label: DEFAULT_TPS_LABEL,
541
+ ttft: DEFAULT_TPS_TTFT,
542
+ },
521
543
  persist: true,
522
544
  placeholder: DEFAULT_PLACEHOLDER,
523
545
  maxLines: MAX_LINES,
@@ -530,6 +552,7 @@ export const DEFAULT_CONFIG: FlightDeckConfig = {
530
552
  glyphs: DEFAULT_GLYPHS,
531
553
  style: DEFAULT_STYLE,
532
554
  refresh: DEFAULT_REFRESH_MS,
555
+ lifetimeTotalsPath: defaultLifetimeTotalsPath(),
533
556
  };
534
557
 
535
558
  /** Layout guards: keep a hand-edited config from producing an unusable rail. */
@@ -787,7 +810,20 @@ function readRows(value: unknown, issues: string[], maxLines: number): readonly
787
810
  issues.push(`${path} is not a known field (${STAT_FIELDS.join(", ")}); skipping it`);
788
811
  return;
789
812
  }
790
- rows.push(canonicalField(name));
813
+ // An alias and its key name one row. Keep the first spelling (so an old
814
+ // config keeps its old label) and report the second rather than drawing
815
+ // the same figure twice.
816
+ const canonical = canonicalField(name);
817
+ const duplicateOf = rows.find((entry) => canonicalField(entry) === canonical);
818
+ if (duplicateOf !== undefined) {
819
+ issues.push(`${path} duplicates ${duplicateOf}; rendering the row once`);
820
+ return;
821
+ }
822
+ // `session` keeps folding to `ses`; `cost` and `total` keep their spelling
823
+ // so old configs render byte-for-byte as they did before the rename.
824
+ // The guard above narrows to the canonical union, but the original string
825
+ // may still be an accepted alias; read it as a plain string here.
826
+ rows.push((name as string) === "session" ? "ses" : name);
791
827
  });
792
828
 
793
829
  if (rows.length === 0) {
@@ -821,10 +857,49 @@ function readTpsScope(value: unknown, issues: string[]): TpsScope {
821
857
  function readTpsDisplay(value: unknown, issues: string[]): TpsDisplay {
822
858
  if (value === undefined) return DEFAULT_TPS_DISPLAY;
823
859
  if (value === "avg" || value === "rt" || value === "both") return value;
824
- issues.push(`sidebar.tps.display must be "avg", "rt" or "both"; using "avg"`);
860
+ issues.push(`sidebar.tps.display must be "avg", "rt" or "both"; using "${DEFAULT_TPS_DISPLAY}"`);
825
861
  return DEFAULT_TPS_DISPLAY;
826
862
  }
827
863
 
864
+ /**
865
+ * Whether the `tps` row may draw the observed time to first token.
866
+ *
867
+ * A boolean knob: `false` suppresses the TTFT segment in every display mode,
868
+ * including the realtime fallback row that otherwise appears when no rate can
869
+ * be drawn. A non-boolean falls back to the shipped default and is reported.
870
+ */
871
+ function readTpsTtft(value: unknown, issues: string[]): boolean {
872
+ return readBoolean(value, DEFAULT_TPS_TTFT, "sidebar.tps.ttft", issues);
873
+ }
874
+
875
+ /** Longest suffix the single-figure `tps` rows accept before the rail gets silly. */
876
+ const TPS_LABEL_MAX_LENGTH = 16;
877
+
878
+ /**
879
+ * The suffix the single-figure `tps` rows print after the number.
880
+ *
881
+ * A short string, trimmed like the other text values. Blank means no label to
882
+ * draw, so the default comes back and the key is named; a non-string and an
883
+ * overlong value fall back the same way. `display: "both"` ignores it.
884
+ */
885
+ function readTpsLabel(value: unknown, issues: string[]): string {
886
+ if (value === undefined) return DEFAULT_TPS_LABEL;
887
+ if (typeof value !== "string") {
888
+ issues.push("sidebar.tps.label must be a string; using the default");
889
+ return DEFAULT_TPS_LABEL;
890
+ }
891
+ const text = normalizeText(value, "sidebar.tps.label", issues);
892
+ if (text.length === 0) {
893
+ issues.push("sidebar.tps.label must not be empty; using the default");
894
+ return DEFAULT_TPS_LABEL;
895
+ }
896
+ if (text.length > TPS_LABEL_MAX_LENGTH) {
897
+ issues.push(`sidebar.tps.label was longer than ${TPS_LABEL_MAX_LENGTH} characters; using the default`);
898
+ return DEFAULT_TPS_LABEL;
899
+ }
900
+ return text;
901
+ }
902
+
828
903
  /**
829
904
  * Which sessions the `tps` row paces.
830
905
  *
@@ -836,10 +911,20 @@ function readTps(section: Record<string, unknown>, issues: string[]): TpsConfig
836
911
  const raw = section["tps"];
837
912
  if (raw !== undefined && !isRecord(raw)) {
838
913
  issues.push("sidebar.tps must be an object; using defaults");
839
- return { scope: DEFAULT_TPS_SCOPE, display: DEFAULT_TPS_DISPLAY };
914
+ return {
915
+ scope: DEFAULT_TPS_SCOPE,
916
+ display: DEFAULT_TPS_DISPLAY,
917
+ label: DEFAULT_TPS_LABEL,
918
+ ttft: DEFAULT_TPS_TTFT,
919
+ };
840
920
  }
841
921
  const tps = isRecord(raw) ? raw : {};
842
- return { scope: readTpsScope(tps["scope"], issues), display: readTpsDisplay(tps["display"], issues) };
922
+ return {
923
+ scope: readTpsScope(tps["scope"], issues),
924
+ display: readTpsDisplay(tps["display"], issues),
925
+ label: readTpsLabel(tps["label"], issues),
926
+ ttft: readTpsTtft(tps["ttft"], issues),
927
+ };
843
928
  }
844
929
 
845
930
  /**
@@ -860,6 +945,22 @@ function sectionOf(options: Record<string, unknown>, key: SectionKey): Record<st
860
945
  return isRecord(value) ? value : {};
861
946
  }
862
947
 
948
+ /**
949
+ * Optional override for the durable lifetime-totals file.
950
+ *
951
+ * A non-empty string is used as given; an absent key leaves the module's
952
+ * shipped path alone. A malformed key is reported and ignored, like every
953
+ * other option.
954
+ */
955
+ function readLifetimeTotalsPath(value: unknown, issues: string[]): string {
956
+ if (value === undefined) return DEFAULT_CONFIG.lifetimeTotalsPath;
957
+ if (typeof value !== "string" || value.trim().length === 0) {
958
+ issues.push("lifetimeTotalsPath must be a non-empty string; using the default path");
959
+ return DEFAULT_CONFIG.lifetimeTotalsPath;
960
+ }
961
+ return value.trim();
962
+ }
963
+
863
964
  /**
864
965
  * Read the ticker cadence.
865
966
  *
@@ -1530,6 +1631,7 @@ export function resolveConfig(options: unknown): ConfigResolution {
1530
1631
  glyphs: readGlyphs(glyphs, issues),
1531
1632
  style: readStyle(style, issues),
1532
1633
  refresh: readRefresh(options.refresh, issues),
1634
+ lifetimeTotalsPath: readLifetimeTotalsPath(options.lifetimeTotalsPath, issues),
1533
1635
  },
1534
1636
  issues,
1535
1637
  };
@@ -30,7 +30,9 @@ import { formatRemaining as formatCompactRemaining, goTone, type GoUsage, type G
30
30
  export { formatRemaining as formatCompactRemaining } from "./go-usage.js";
31
31
  import type { RailLine } from "./presentation.js";
32
32
  import type { StatSegment } from "./rows.js";
33
- import { DEFAULT_PLACEHOLDER } from "./stat-fields.js";
33
+ // The panel's "no reading" mark is its own, not the sidebar row placeholder:
34
+ // changing `sidebar.placeholder` must never rewrite the Go dials.
35
+ const NO_READING = "\u2014";
34
36
  import type { StyleColor } from "./style.js";
35
37
 
36
38
  /** The panel's three windows, in canonical 5h -> 1w -> 1m order. Labels live in the look. */
@@ -482,7 +484,7 @@ function restingLine(
482
484
  }
483
485
  const tail =
484
486
  CELL.repeat(trackCells) +
485
- (look.showPercent ? ` ${alignCell(DEFAULT_PLACEHOLDER, PANEL_PERCENT_WIDTH, look.align)}` : "");
487
+ (look.showPercent ? ` ${alignCell(NO_READING, PANEL_PERCENT_WIDTH, look.align)}` : "");
486
488
  segments.push({ text: tail, tone: "subdued" });
487
489
  return { field: "go", text: segments.map((segment) => segment.text).join(""), segments };
488
490
  }
@@ -535,7 +537,7 @@ function valueLine(
535
537
  appendRun(runs, CELL, "subdued");
536
538
  }
537
539
  if (look.showPercent) {
538
- const percent = ratio === undefined ? DEFAULT_PLACEHOLDER : `${Math.round(ratio * 100)}%`;
540
+ const percent = ratio === undefined ? NO_READING : `${Math.round(ratio * 100)}%`;
539
541
  // The percent joins the meter's trailing run so a uniform meter stays one
540
542
  // span; the countdown is its own dim run (relief, not severity).
541
543
  appendRun(runs, ` ${alignCell(percent, PANEL_PERCENT_WIDTH, look.align)}`, tone);