oc-flight-deck 0.12.0 → 0.19.1

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.
@@ -73,10 +73,37 @@
73
73
  //
74
74
  // "lines": ["▸ FLIGHT DECK", "─────────────────"]
75
75
  //
76
- // An explicitly empty list removes the footer slot entirely. Fixed lines
77
- // use style.lines.
76
+ // An explicitly empty "lines" list removes the footer's fixed lines, but
77
+ // not the slot itself: "go" below can still claim it. Fixed lines use
78
+ // style.lines.
78
79
  "footer": {
79
- "lines": []
80
+ "lines": [],
81
+
82
+ // The live Go usage panel: three fixed-width lines - rolling (5h),
83
+ // weekly (1w), monthly (1m) - each with a bar, a right-aligned percent,
84
+ // and a right-aligned reset countdown. Reads the active `opencode-go`
85
+ // credential from OpenCode's own credential store (the same
86
+ // account-wide poll the "go" row uses, one poll for both surfaces). A
87
+ // window at 90% or more - or reporting a non-ok status - turns its bar
88
+ // and number red. Off by default; turning it on claims the start of
89
+ // this footer slot - directly above the host's location row - even with
90
+ // no fixed lines above, and draws three dim resting lines until the
91
+ // first poll lands.
92
+ //
93
+ // `false` is off; `true` is on with the default look (no header,
94
+ // 10-cell bar, labels at least 6 wide, both columns, breathing mark on,
95
+ // static meter). An object turns it on with a custom look - absent keys
96
+ // fall back to those defaults:
97
+ //
98
+ // "go": { "header": false, "barWidth": 10, "labelWidth": 6, "percent": true, "reset": true, "align": "right", "sweep": false, "labels": { "rolling": "rolling", "weekly": "weekly", "monthly": "monthly" }, "blink": true, "blinkMs": 700 }
99
+ //
100
+ // `header` draws the dim OPENCODE GO line above the meters; `sweep`
101
+ // lets a bright cell travel the fill (off by default: the bar moves
102
+ // only when the percentage itself moves). `labels` renames the meters;
103
+ // the column auto-widens past `labelWidth` to hold the longest rename.
104
+ // `blink` draws the slow breathing mark on the first line (on by
105
+ // default); `blinkMs` (200-5000) sets the milliseconds per breath step.
106
+ "go": false
80
107
  },
81
108
 
82
109
  // The live rows, top to bottom. Every value is read from the open session,
@@ -90,44 +117,67 @@
90
117
  // agent which agent is running (orchestrator, build, plan, ...)
91
118
  // model model id, plus the variant when there is one
92
119
  // branch current git branch. Off by default — costs a VCS call
93
- // cost this conversation, plus its subagents when any ran; with
94
- // `total` on the rail, the session figure alone
95
- // total the family total and subagent count on a row of its own
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
96
133
  // project every session in this project, not just the one on screen
97
- // tokens this session's input and output tokens
98
- // cache cache hit rate, then cache reads
134
+ // tokens input and output, in the same family scope as `cost`: this
135
+ // conversation plus its subagent sessions when any exist,
136
+ // the session alone when there are none
137
+ // cache cache hit rate, then cache reads, in the same family scope
138
+ // as `cost`
99
139
  // context a gauge of how full the context window is
100
140
  // perms what is waiting for approval, not just how many
101
- // elapsed active time: the clock runs only while this session — or a
102
- // subagent in its tree, or one of its shells — is working, and
103
- // freezes when everything settles. Seeded once from the
104
- // assistant turn spans the host already recorded, so it
105
- // survives a restart instead of resetting; work observed live
106
- // after that keeps counting in memory
107
- // tps average speed while streaming: output plus reasoning tokens
108
- // divided by the time the provider was actively streaming
109
- // (streamed minus created), subagents included. Idle between
110
- // turns and the tool settlement after one are never counted,
111
- // so the figure freezes when everything settles rather than
112
- // decaying or hiding; a turn still in flight counts up to now.
113
- // On a host with no per-message timestamps it falls back to
114
- // the lifetime average, which includes idle and can sag
141
+ // elapsed active time recomputed from the assistant-turn spans the host
142
+ // itself recorded for this session and its subagents — a turn
143
+ // still in flight ends at "now". A restart comes back with the
144
+ // same value instead of resetting, it cannot step backwards
145
+ // while the host still reports those turns, and it is NOT
146
+ // wall-clock since the session began
147
+ // tps live speed over `sidebar.tps.scope` below: generation
148
+ // tokens (output + reasoning) over generating time. Shows
149
+ // `0 tok/s` whenever the scope is not generating (idle,
150
+ // between turns, or before the first sample), and never seeds
151
+ // itself from a lifetime average
115
152
  // spark recent turn sizes as a sparkline
116
- // reasoning reasoning tokens, when the model emits them
153
+ // reasoning reasoning tokens, when the model emits them, in the same
154
+ // family scope as `cost`
117
155
  // turns how many prompts you have sent this session
118
156
  // guard harness status from oc-harness-guard: breaches, orphans,
119
157
  // findings, or ok. Available, off by default.
120
158
  // go Zen Go account usage for the 5h / 1w / 1m windows: a dial and
121
159
  // a percent each, turning red as a window approaches its limit.
122
- // Reads OPENCODE_GO_API_KEY. Available, off by default.
123
- // ses the full session id (the rail wraps it). A mouse click on the
124
- // row copies the full id to the terminal clipboard. Off by
125
- // default; needs the host's mouse enabled.
160
+ // Reads the active opencode-go credential from OpenCode's own
161
+ // credential store. Available, off by default.
162
+ // ses the open session id as a clipped preview, labelled `session`
163
+ // on the rail (never the full id). A mouse click on the row
164
+ // sends the full id to the terminal clipboard as a best-effort
165
+ // OSC52 request: terminal-dependent (the terminal may ignore
166
+ // it) and never reported as a confirmed copy. May be named
167
+ // `session` here — it is normalized to `ses`. The preview
168
+ // budget is 18 cells, reduced by however much the `session`
169
+ // label overflows `layout.labelWidth` below, floored at 8
170
+ // cells (at the default width 10 the budget is the full 18;
171
+ // at 6 it is 17), so the row's total width is unchanged by
172
+ // the rename at every `layout.labelWidth`. Off by default; needs the host's mouse.
126
173
  //
127
174
  // Every named row renders persistently, so the rail keeps a stable shape:
128
- // a row with no data yet shows the placeholder below, in the same label
129
- // column as a live row. The fixed lines and live rows share the maxLines
130
- // budget below, and anything past it is dropped.
175
+ // a row with no data yet draws a real-looking zero — `$0.000` for money
176
+ // rows, `0 in · 0 out` for tokens, `0 tok/s` for tps — in the same label
177
+ // column as a live row, never a placeholder symbol. (`caution` is the one
178
+ // exception: the annunciator stays silent until it has something to say.)
179
+ // The fixed lines and live rows share the maxLines budget below, and
180
+ // anything past it is dropped.
131
181
  "rows": [
132
182
  "status",
133
183
  "agent",
@@ -140,18 +190,33 @@
140
190
  "perms",
141
191
  "elapsed",
142
192
  "tps"
143
- // ,"go" — Zen Go account usage (needs OPENCODE_GO_API_KEY)
193
+ // ,"go" Zen Go account usage (needs the active opencode-go credential)
144
194
  // ,"caution" — the annunciator
145
195
  // ,"branch" — current git branch
146
- // ,"ses" - current session id (full, wrapped); click to copy the full id
196
+ // ,"ses" - session id preview (labelled `session`); click to copy the full id
147
197
  ],
148
198
 
149
- // Every named row renders persistently: with no data yet it shows the
150
- // placeholder below, in the same label column as a live row. Set to false
151
- // to omit rows with no data instead.
199
+ // Which sessions the `tps` row paces. `"family"` (the default) paces the
200
+ // open session plus its subagent sessions: generation tokens summed
201
+ // across the whole family over the union of all their streaming spans.
202
+ // Concurrent decoders share wall clock, so overlapping spans merge
203
+ // instead of adding — a root that is idle while its child decodes still
204
+ // reads live. `"session"` restores the per-session figure: the open
205
+ // session's own tokens over its own spans, reading `0 tok/s` while it is
206
+ // idle even when a child is still running. An unknown value falls back
207
+ // to `"family"` and is reported.
208
+ "tps": { "scope": "family" },
209
+
210
+ // Every named row renders persistently: with no data yet it draws its
211
+ // zero skeleton (a real-looking zero, never a placeholder symbol), in the
212
+ // same label column as a live row. Set to false to omit rows with no data
213
+ // instead.
152
214
  "persist": true,
153
215
 
154
- // Value shown for a persistent row with no data yet. Any non-empty string.
216
+ // Fallback for a persistent row with no data that has no skeleton. Any
217
+ // non-empty string. Every shipped field has a skeleton, so this dash is
218
+ // unreachable in practice — it only covers a field with nothing to draw
219
+ // a zero from.
155
220
  "placeholder": "—",
156
221
 
157
222
  // Maximum total height, including fixed lines and live rows. Defaults to 24.
@@ -222,7 +287,8 @@
222
287
  },
223
288
 
224
289
  // -- Layout ----------------------------------------------------------------
225
- // Row geometry. Change these when your terminal is unusually narrow or wide.
290
+ // Row geometry and wording. Change these when your terminal is unusually
291
+ // narrow or wide, or when you want a row called something else.
226
292
  "layout": {
227
293
  // Width of the label column every row pads to. 10 fits "caution" plus a
228
294
  // space. Narrow it to fit more value on screen.
@@ -232,7 +298,17 @@
232
298
  // Samples drawn in the `spark` row. The newest turns are kept, so
233
299
  // narrowing this keeps the recent shape rather than the oldest. The row is
234
300
  // this many cells wide, so a large value is a wide row.
235
- "sparkWidth": 12
301
+ "sparkWidth": 12,
302
+ // Rename any rail row, keyed by its row name exactly as `sidebar.rows`
303
+ // spells it (`session` is folded to `ses`). Empty by default, so every row
304
+ // keeps its built-in label; a row you leave out keeps it too. To call the
305
+ // session's own cost "session" and the family/lifetime total "lifetime":
306
+ //
307
+ // "labels": { "cost": "session", "total": "lifetime" }
308
+ //
309
+ // An unknown row name, a non-string value, or an empty label is reported
310
+ // and that row keeps its default.
311
+ "labels": {}
236
312
  },
237
313
 
238
314
  // -- Format ----------------------------------------------------------------
@@ -39,34 +39,141 @@
39
39
  "footer": {
40
40
  "type": "object",
41
41
  "additionalProperties": false,
42
- "description": "Fixed lines rendered in the sidebar footer slot, a separate host region below the rows that draws outside the 24-line rail cap. Empty by default since 0.8.1 — set the documented `▸ FLIGHT DECK` / `─────────────────` pair in `lines` to re-enable the branding. An explicitly empty `lines` array removes the slot entirely.",
42
+ "description": "The sidebar footer slot: fixed lines, plus an optional live Go usage panel, rendered in a separate host region below the rows that draws outside the 24-line rail cap. The fixed lines are empty by default since 0.8.1 - set the documented `▸ FLIGHT DECK` branding pair in `lines` to re-enable it. An explicitly empty `lines` array removes the fixed lines; `go` still claims the slot on its own.",
43
43
  "properties": {
44
44
  "lines": {
45
45
  "type": "array",
46
46
  "items": { "type": "string" },
47
47
  "default": [],
48
48
  "maxItems": 24,
49
- "description": "The footer's fixed lines, in order. Empty by default since 0.8.1 — set the documented `▸ FLIGHT DECK` / `─────────────────` pairing here to re-enable it. Independent of `sidebar.lines`, so setting your own top lines does not turn the footer on. An explicit empty array opts the footer slot out (and never registers it)."
49
+ "description": "The footer's fixed lines, in order. Empty by default since 0.8.1 - set the documented `▸ FLIGHT DECK` pairing here to re-enable it. Independent of `sidebar.lines`, so setting your own top lines does not turn the footer on. An explicit empty array removes the fixed lines (and never registers the slot on its own; `go` can still claim it)."
50
+ },
51
+ "go": {
52
+ "default": false,
53
+ "description": "Draw the live Go usage panel under the footer's fixed lines: three fixed-width lines - rolling (5h), weekly (1w), monthly (1m) - each with a bar, a right-aligned percent and a right-aligned reset countdown, read from the active opencode-go credential in OpenCode's own credential store (there is no env var). true enables with the default look (no header, 10-cell bar, labels at least 6 wide, both columns, breathing mark on, static meter); an object with header, barWidth, labelWidth, percent, reset, align, sweep, labels, blink and blinkMs enables with a custom look. A window at 90% or more, or reporting a non-ok status, turns its bar and number red. Off by default; turning it on starts the same account-wide poll the `go` row uses and claims the sidebar footer slot even when `lines` is empty. The panel renders first inside the footer slot, directly above the host's own location row.",
54
+ "anyOf": [
55
+ { "type": "boolean" },
56
+ {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "properties": {
60
+ "header": {
61
+ "type": "boolean",
62
+ "default": false,
63
+ "description": "Draw the dim OPENCODE GO header above the three meters. Off by default; the panel is three lines unless this is true."
64
+ },
65
+ "barWidth": {
66
+ "type": "integer",
67
+ "minimum": 1,
68
+ "maximum": 40,
69
+ "default": 10,
70
+ "description": "Cells in the panel meter. Honoured while the longest line stays within the sidebar width; capped rather than wrapped."
71
+ },
72
+ "labelWidth": {
73
+ "type": "integer",
74
+ "minimum": 5,
75
+ "maximum": 24,
76
+ "default": 6,
77
+ "description": "Minimum width of the panel label column. Left-aligned and shared by all three rows; auto-widens past this to hold the longest rendered rename, so a rename can never overflow or wrap."
78
+ },
79
+ "percent": {
80
+ "type": "boolean",
81
+ "default": true,
82
+ "description": "Draw the right-aligned percent column beside the meter. Turn it off to show only the bar and the countdown."
83
+ },
84
+ "reset": {
85
+ "type": "boolean",
86
+ "default": true,
87
+ "description": "Draw the right-aligned reset countdown column. Turn it off to hide the time to relief."
88
+ },
89
+ "align": {
90
+ "type": "string",
91
+ "enum": ["left", "right", "center"],
92
+ "default": "right",
93
+ "description": "Where a trailing value sits inside its own fixed-width cell. The percent (4) and reset (6) widths stay fixed; right pins the value to the cell's right edge so digits stay put as values change length, left hugs the bar, center splits the padding. Both trailing cells use the same setting."
94
+ },
95
+ "sweep": {
96
+ "type": "boolean",
97
+ "default": false,
98
+ "description": "Let a bright cell sweep the fill while the ticker runs. Off by default: the bar is static and changes only when the percentage itself changes."
99
+ },
100
+ "labels": {
101
+ "type": "object",
102
+ "additionalProperties": false,
103
+ "description": "Rename the three meter labels, each optionally and independently. Absent keys keep their lowercase defaults; the label column auto-widens to hold the longest rename.",
104
+ "properties": {
105
+ "rolling": {
106
+ "type": "string",
107
+ "minLength": 1,
108
+ "maxLength": 24,
109
+ "default": "rolling",
110
+ "description": "Label for the 5h window. Must be a non-empty string of at most 24 characters; anything else falls back to the default and is reported."
111
+ },
112
+ "weekly": {
113
+ "type": "string",
114
+ "minLength": 1,
115
+ "maxLength": 24,
116
+ "default": "weekly",
117
+ "description": "Label for the 1w window. Must be a non-empty string of at most 24 characters; anything else falls back to the default and is reported."
118
+ },
119
+ "monthly": {
120
+ "type": "string",
121
+ "minLength": 1,
122
+ "maxLength": 24,
123
+ "default": "monthly",
124
+ "description": "Label for the 1m window. Must be a non-empty string of at most 24 characters; anything else falls back to the default and is reported."
125
+ }
126
+ }
127
+ },
128
+ "blink": {
129
+ "type": "boolean",
130
+ "default": true,
131
+ "description": "Draw the slow breathing mark at the start of the first meter line. On by default: only the mark breathes, the meter stays static. Off removes the two-cell mark column entirely."
132
+ },
133
+ "blinkMs": {
134
+ "type": "integer",
135
+ "minimum": 200,
136
+ "maximum": 5000,
137
+ "default": 700,
138
+ "description": "Milliseconds per breath step of the mark. One step moves the mark rest, swell, live, swell; indexed from the wall clock so the breath is independent of the ticker period."
139
+ }
140
+ }
141
+ }
142
+ ]
50
143
  }
51
144
  }
52
145
  },
53
146
  "rows": {
54
147
  "type": "array",
55
- "items": { "enum": ["caution", "status", "agent", "model", "branch", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "tps", "spark", "reasoning", "turns", "guard", "go", "ses"] },
148
+ "items": { "enum": ["caution", "status", "agent", "model", "branch", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "tps", "spark", "reasoning", "turns", "guard", "go", "ses", "session"] },
56
149
  "default": ["status", "agent", "model", "cost", "project", "tokens", "cache", "context", "perms", "elapsed", "tps"],
57
150
  "maxItems": 24,
58
- "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, using `sidebar.placeholder` until the host has data; 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 an 18-wide clipped preview of the session id; a mouse click on that row copies the full id to the terminal clipboard."
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; 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 sends the full id to the terminal clipboard as a best-effort OSC52 request: terminal-dependent (the terminal may ignore it) and never reported as a confirmed copy. `session` is accepted as an alias for `ses` and is normalized to it."
152
+ },
153
+ "tps": {
154
+ "type": "object",
155
+ "additionalProperties": false,
156
+ "default": { "scope": "family" },
157
+ "description": "Which sessions the `tps` row paces. `family` (the default) paces the open session plus its subagent sessions: generation tokens summed across the whole family over the union of all their streaming spans, so concurrent decoders share wall clock instead of adding it. `session` paces the open session alone: its own tokens over its own spans, reading zero while it is idle even when a child is still running.",
158
+ "properties": {
159
+ "scope": {
160
+ "type": "string",
161
+ "enum": ["family", "session"],
162
+ "default": "family",
163
+ "description": "The `tps` row's scope. `family` sums generation tokens (output plus reasoning) across the open session and its subagent sessions over the union of their streaming spans, so a root that is idle while its child decodes still reads live. `session` restores the per-session figure: the open session's own tokens over its own spans. An unknown value falls back to `family` and is reported."
164
+ }
165
+ }
59
166
  },
60
167
  "persist": {
61
168
  "type": "boolean",
62
169
  "default": true,
63
- "description": "Render every field named in `sidebar.rows` as a persistent row, using `sidebar.placeholder` when the host has no data yet. 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."
170
+ "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, and so on — `caution` is the one row that never draws a skeleton and stays silent until it has something to announce). 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."
64
171
  },
65
172
  "placeholder": {
66
173
  "type": "string",
67
174
  "minLength": 1,
68
175
  "default": "—",
69
- "description": "Value shown for a persistent row with no data yet. Used only when `sidebar.persist` is true. Must be a non-empty string; anything else falls back to the default em dash."
176
+ "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. Every shipped field has a skeleton, so this dash is unreachable in practice."
70
177
  },
71
178
  "maxLines": {
72
179
  "type": "integer",
@@ -152,14 +259,19 @@
152
259
  "layout": {
153
260
  "type": "object",
154
261
  "additionalProperties": false,
155
- "description": "Row geometry. Change these when your terminal is unusually narrow or wide.",
262
+ "description": "Row geometry and wording. Change these when your terminal is unusually narrow or wide, or when you want a row called something else.",
156
263
  "properties": {
157
264
  "labelWidth": {
158
265
  "type": "integer",
159
266
  "minimum": 6,
160
267
  "maximum": 24,
161
268
  "default": 10,
162
- "description": "Width of the label column that every row pads to. 10 fits `caution` plus a space. Narrow it to fit more value on screen, widen it if you rename the labels."
269
+ "description": "Width of the label column that every row pads to. 10 fits `caution` plus a space. Narrow it to fit more value on screen, widen it if you rename the labels with `labels` below."
270
+ },
271
+ "labels": {
272
+ "type": "object",
273
+ "additionalProperties": { "type": "string", "minLength": 1 },
274
+ "description": "Rename any rail row, keyed by its row name exactly as `sidebar.rows` spells it (`session` is folded to `ses`). For example `{ \"cost\": \"session\", \"total\": \"lifetime\" }` draws the session's own cost under `session` and the family total under `lifetime`. A row left out keeps its built-in label, so omitting the key changes nothing. An unknown row name, a non-string value, or an empty label is reported as a config issue and that row keeps its default label. A label wider than `labelWidth` is still given its guaranteed space rather than being glued to its value."
163
275
  },
164
276
  "barWidth": {
165
277
  "type": "integer",
@@ -268,10 +380,10 @@
268
380
  }
269
381
  },
270
382
  "propertyNames": {
271
- "enum": ["*", "caution", "status", "agent", "model", "branch", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "tps", "spark", "reasoning", "turns", "guard", "go", "ses"]
383
+ "enum": ["*", "caution", "status", "agent", "model", "branch", "cost", "total", "project", "tokens", "cache", "context", "perms", "elapsed", "tps", "spark", "reasoning", "turns", "guard", "go", "ses", "session"]
272
384
  },
273
385
  "default": { "*": { "color": "subdued", "attributes": [] } },
274
- "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."
386
+ "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."
275
387
  }
276
388
  }
277
389
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-flight-deck",
3
- "version": "0.12.0",
3
+ "version": "0.19.1",
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",
@@ -26,14 +26,15 @@
26
26
  "exports": {
27
27
  ".": {
28
28
  "types": "./src/index.ts",
29
- "import": "./src/index.ts"
29
+ "import": "./dist/index.js"
30
30
  },
31
31
  "./tui": {
32
32
  "types": "./src/tui/index.tsx",
33
- "import": "./src/tui/index.tsx"
33
+ "import": "./dist/tui/index.js"
34
34
  }
35
35
  },
36
36
  "files": [
37
+ "dist",
37
38
  "src",
38
39
  "flight-deck.example.jsonc",
39
40
  "flight-deck.schema.json",
@@ -48,6 +49,7 @@
48
49
  "scripts": {
49
50
  "typecheck": "tsc --noEmit",
50
51
  "test": "bun test",
52
+ "compile": "bun scripts/build.ts",
51
53
  "check": "bun run typecheck && bun test",
52
54
  "prepublishOnly": "bun run check"
53
55
  },
@@ -55,19 +57,19 @@
55
57
  "access": "public"
56
58
  },
57
59
  "dependencies": {
58
- "@opencode/plugin": "2.0.19"
60
+ "@opencode/plugin": "2.0.30"
59
61
  },
60
62
  "devDependencies": {
61
- "@opentui/core": "0.5.12",
62
- "@opentui/solid": "0.5.12",
63
+ "@opentui/core": "0.5.17",
64
+ "@opentui/solid": "0.5.17",
63
65
  "@types/bun": "^1.4.2",
64
- "solid-js": "1.9.15",
66
+ "solid-js": "1.9.12",
65
67
  "string-width": "7.2.0",
66
68
  "typescript": "^5.9.3"
67
69
  },
68
70
  "peerDependencies": {
69
- "@opentui/core": ">=0.5.10",
70
- "@opentui/solid": ">=0.5.10",
71
+ "@opentui/core": ">=0.5.17",
72
+ "@opentui/solid": ">=0.5.17",
71
73
  "solid-js": ">=1.9.0"
72
74
  }
73
75
  }
@@ -6,22 +6,38 @@
6
6
  // through the OS clipboard, it resolves asynchronously, and it can report
7
7
  // `written` - a status that means the platform completed the copy. Only
8
8
  // this transport may ever be reported to the user as a success.
9
- // 2. OSC52 through the renderer (`createRendererClipboardAdapter`). This is a
10
- // fire-and-forget escape sequence emitted on the terminal's wire. Its
11
- // `attempted` status confirms only that a local dispatch was issued - the
12
- // terminal is free to ignore it, and on this machine's Windows Terminal it
13
- // does, so an independent read still sees the old clipboard. It is kept as
14
- // a best-effort fallback and is NEVER reported as a verified copy.
9
+ // 2. OSC52 through the host renderer. This is a fire-and-forget escape
10
+ // sequence emitted on the terminal's wire. Its dispatch confirms only that
11
+ // a local call was issued - the terminal is free to ignore it, and on this
12
+ // machine's Windows Terminal it does, so an independent read still sees the
13
+ // old clipboard. It is kept as a best-effort fallback and is NEVER reported
14
+ // as a verified copy.
15
+ //
16
+ // The renderer is read structurally, never value-imported: the plugin consumes
17
+ // the host's own renderer through the plugin context (`context.renderer`), so
18
+ // no `@opentui/*` copy may ship with or be imported by this module.
15
19
  //
16
20
  // The gesture is still the one and only trigger: there is no render-time,
17
21
  // background, or automatic write, ever. And nothing here may throw out of the
18
22
  // caller's mouse handler: every backend call is wrapped, and a backend that is
19
23
  // missing, refuses, or throws degrades to a definite non-success result.
20
24
 
21
- import { createRendererClipboardAdapter } from "@opentui/core";
22
25
  import { createHostClipboard } from "./host-clipboard.js";
23
26
 
24
- type RendererBoundary = Parameters<typeof createRendererClipboardAdapter>[0];
27
+ /**
28
+ * The OSC52 boundary the host renderer provides. Structural on purpose: the
29
+ * plugin must consume the host's renderer, never a vendored copy's adapter, so
30
+ * this mirrors the `{ capabilities, copyToClipboardOSC52 }` surface the host's
31
+ * `CliRenderer` implements (a direct call returning a boolean) without
32
+ * importing it.
33
+ */
34
+ interface RendererOsc52Boundary {
35
+ readonly capabilities?: {
36
+ readonly remote?: boolean;
37
+ readonly osc52_support?: "supported" | "unsupported" | "unknown";
38
+ } | null;
39
+ copyToClipboardOSC52(text: string, ...args: never[]): boolean;
40
+ }
25
41
 
26
42
  /**
27
43
  * The outcome of a copy gesture.
@@ -50,18 +66,24 @@ interface HostClipboardLike {
50
66
  }
51
67
 
52
68
  /** A factory for the host clipboard; injectable so tests can stand in a fake. */
53
- type HostClipboardFactory = () => HostClipboardLike;
69
+ type HostClipboardFactory = () => HostClipboardLike | undefined;
54
70
 
55
71
  /**
56
72
  * Determine the OSC52 dispatch outcome for `text`, or `false` when the
57
73
  * renderer cannot take it. Kept separate so the renderer type can stay
58
74
  * `unknown` at the public boundary.
75
+ *
76
+ * This mirrors the gating the vendored adapter applies: a terminal that
77
+ * reports `osc52_support: "unsupported"` is never written to, and anything
78
+ * missing, refusing, or throwing degrades to `false`.
59
79
  */
60
80
  function dispatchOsc52(renderer: unknown, text: string): boolean {
61
81
  if (renderer === undefined || renderer === null) return false;
62
82
  try {
63
- const terminal = createRendererClipboardAdapter(renderer as RendererBoundary);
64
- return terminal.writeText(text, "clipboard").status === "attempted";
83
+ const boundary = renderer as Partial<RendererOsc52Boundary>;
84
+ if (boundary.capabilities?.osc52_support === "unsupported") return false;
85
+ if (typeof boundary.copyToClipboardOSC52 !== "function") return false;
86
+ return boundary.copyToClipboardOSC52.call(renderer, text) === true;
65
87
  } catch {
66
88
  return false;
67
89
  }
@@ -91,10 +113,20 @@ export async function copyToClipboard(
91
113
  createHost: HostClipboardFactory = createHostClipboard,
92
114
  ): Promise<CopyResult> {
93
115
  // 1. The verified path: a real host write that can report back `written`.
116
+ // The production backend is explicitly absent (`undefined`), so this step
117
+ // is skipped outside tests that inject a fake.
94
118
  let hostReached = true;
95
119
  let hostStatus: string = "failed";
120
+ let host: HostClipboardLike | undefined;
96
121
  try {
97
- const host = createHost();
122
+ host = createHost();
123
+ } catch {
124
+ // The factory itself threw: there is no host service at all.
125
+ host = undefined;
126
+ }
127
+ if (host === undefined) {
128
+ hostReached = false;
129
+ } else {
98
130
  try {
99
131
  const result = await host.writeText(text);
100
132
  hostStatus = result.status;
@@ -103,9 +135,6 @@ export async function copyToClipboard(
103
135
  // host failure, never an exception out of this call.
104
136
  hostStatus = "failed";
105
137
  }
106
- } catch {
107
- // The factory itself threw: there is no host service at all.
108
- hostReached = false;
109
138
  }
110
139
  if (hostStatus === "written") return { verified: true, outcome: "written" };
111
140