oc-flight-deck 0.10.2 → 0.10.4

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/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.10.4] - 2026-10-06
9
+
10
+ ### Fixed
11
+
12
+ - The default `caution.exemptTools` list now carries the `tools.`-prefixed aliases (`tools.delegate`, `tools.delegate_many`, `tools.subagent`, `tools.task`) alongside the bare names it already exempted. Matching is by exact name, and the host reaches these delegated-work tools under both spellings, so a fresh install lit the row on ordinary delegation the bare names were meant to cover. The schema default and `flight-deck.example.jsonc` carry the same eleven names.
13
+ - The `caution` rail row draws a single-cell severity mark (`●` caution, `▲` watch) instead of `:warning:`. The bundled `string-width` tests emoji-regex before East-Asian width and charges `⚠` two cells — and Windows Terminal draws it that way — so the annunciator ran a column wider than every other row. Severity now rides a coloured run on the mark itself (`error` for a caution, `warning` for a watch) while the words keep the row's colour, and a test measures the drawn row in cells at the rail's real width.
14
+
15
+ ## [0.10.3] - 2026-10-02
16
+
17
+ ### Changed
18
+
19
+ - The `ses` row no longer bleeds past the rail. It again draws a short-pruned preview of the session id - width-aware, with an ellipsis, so it reads as a preview of a longer value - instead of the full 30-character id wrapping out of bounds. The click still copies the **full** id; only the display is pruned.
20
+ - A successful copy is now silent. The success toast is gone, since the copied value is already on the clipboard when the gesture works. A copy that could **not** be confirmed still shows its failure toast - a silent no-op must never masquerade as a success.
21
+
8
22
  ## [0.10.2] - 2026-10-02
9
23
 
10
24
  ### Fixed
@@ -23,6 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23
37
 
24
38
  - Opt-in `ses` sidebar row: shows the full session id (the rail wraps it), and a mouse click copies that same full id and reports the outcome - a confirmation naming the id when the copy was sent, a distinct failure message when the terminal cannot take it. Off by default, and degrades gracefully when the terminal cannot copy.
25
39
 
40
+ [0.10.4]: https://github.com/nathwn12/oc-flight-deck/compare/v0.10.3...v0.10.4
41
+ [0.10.3]: https://github.com/nathwn12/oc-flight-deck/compare/v0.10.2...v0.10.3
26
42
  [0.10.2]: https://github.com/nathwn12/oc-flight-deck/compare/v0.10.1...v0.10.2
27
43
  [0.10.1]: https://github.com/nathwn12/oc-flight-deck/compare/v0.10.0...v0.10.1
28
44
  [0.10.0]: https://github.com/nathwn12/oc-flight-deck/compare/v0.9.0...v0.10.0
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  **Live session telemetry for your OpenCode terminal.**
6
6
  *The numbers where you're already looking — because your agent is spending money right now.*
7
7
 
8
- ![npm](https://img.shields.io/npm/v/oc-flight-deck) ![license](https://img.shields.io/badge/license-MIT-blue) ![node](https://img.shields.io/badge/node-%E2%89%A522-green) ![downloads](https://img.shields.io/npm/dm/oc-flight-deck) ![check](https://img.shields.io/github/actions/workflow/status/nathwn12/oc-flight-deck/check.yml)
8
+ [![npm version](https://img.shields.io/npm/v/oc-flight-deck)](https://www.npmjs.com/package/oc-flight-deck) [![license: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE) [![node >=22](https://img.shields.io/badge/node-%E2%89%A522-green)](https://nodejs.org) [![opencode v2](https://img.shields.io/badge/opencode-v2-blueviolet)](https://opencode.ai) [![npm weekly downloads](https://img.shields.io/npm/dw/oc-flight-deck)](https://www.npmjs.com/package/oc-flight-deck) [![CI](https://github.com/nathwn12/oc-flight-deck/actions/workflows/check.yml/badge.svg)](https://github.com/nathwn12/oc-flight-deck/actions/workflows/check.yml)
9
9
 
10
10
  </div>
11
11
 
@@ -13,6 +13,13 @@
13
13
 
14
14
  ## ⚡ Quick start
15
15
 
16
+ ```text
17
+ Install the oc-flight-deck OpenCode plugin:
18
+ 1. Add "oc-flight-deck" to the "plugins" array in ~/.config/opencode/opencode.jsonc.
19
+ 2. Restart OpenCode.
20
+ 3. Verify: the panel appears beside an open session.
21
+ ```
22
+
16
23
  Add the plugin to your `opencode.jsonc`:
17
24
 
18
25
  ```jsonc
@@ -74,9 +81,7 @@ Every field named in `sidebar.rows` renders exactly one row, in order. With `sid
74
81
 
75
82
  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.
76
83
 
77
- ---
78
-
79
- ## 🚨 `caution` — calibrated, not guessed
84
+ ### 🚨 `caution` — calibrated, not guessed
80
85
 
81
86
  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".
82
87
 
@@ -155,7 +160,9 @@ Everything else lives in the example file, documented inline - a typo is never f
155
160
 
156
161
  ---
157
162
 
158
- ## 🔒 It reads. It writes almost nothing.
163
+ ## 🔒 Safety
164
+
165
+ **It reads. It writes almost nothing.**
159
166
 
160
167
  Flight Deck shows what OpenCode already knows.
161
168
 
@@ -211,6 +218,12 @@ Built on the official [OpenCode V2 CLI plugin API](https://opencode.ai/v2/docs/b
211
218
 
212
219
  ---
213
220
 
221
+ ## 📄 License
222
+
223
+ MIT © 2026 nathwn12 — see [LICENSE](./LICENSE).
224
+
225
+ ---
226
+
214
227
  <div align="center">
215
228
 
216
229
  Built against `@opencode/plugin` 2.0.19 · Node ≥ 22 / Bun ≥ 1.4 · OpenCode V2
@@ -213,7 +213,7 @@
213
213
  // times, with a p99 of 14.7 minutes. Without this list the annunciator
214
214
  // lights on every delegated task - which is how an alert gets ignored.
215
215
  // Add your own long-running or orchestration tools here.
216
- "exemptTools": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
216
+ "exemptTools": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task", "tools.delegate", "tools.delegate_many", "tools.subagent", "tools.task"],
217
217
 
218
218
  // Also raise a toast, once per distinct problem, re-arming when the session
219
219
  // goes quiet. Off by default: the rail is the signal, a notification is an
@@ -253,7 +253,7 @@
253
253
  // an unreadable one. One or two characters each.
254
254
  "glyphs": {
255
255
  "watch": "▲",
256
- "caution": "⚠",
256
+ "caution": "●",
257
257
  "clear": "○"
258
258
  },
259
259
 
@@ -73,7 +73,7 @@
73
73
  "minimum": 1,
74
74
  "maximum": 24,
75
75
  "default": 24,
76
- "description": "Maximum height of the whole rail, including fixed lines and live rows. Defaults to 24 and may be lowered from 1 to 23; lines past the limit are dropped."
76
+ "description": "Maximum height of the whole rail, including fixed lines and live rows. Defaults to 24 and may be lowered from 1 to 24; lines past the limit are dropped."
77
77
  }
78
78
  }
79
79
  },
@@ -115,7 +115,7 @@
115
115
  "type": "integer",
116
116
  "minimum": 0,
117
117
  "default": 420,
118
- "description": "A tool running longer than this becomes a real ⚠. Raised to match toolWatchSeconds if set below it, and reported."
118
+ "description": "A tool running longer than this becomes a real ●. Raised to match toolWatchSeconds if set below it, and reported."
119
119
  },
120
120
  "turnWatchSeconds": {
121
121
  "type": "integer",
@@ -127,7 +127,7 @@
127
127
  "type": "integer",
128
128
  "minimum": 0,
129
129
  "default": 1200,
130
- "description": "A quiet session becomes a real ⚠ after this long. Raised to match turnWatchSeconds if set below it, and reported."
130
+ "description": "A quiet session becomes a real ● after this long. Raised to match turnWatchSeconds if set below it, and reported."
131
131
  },
132
132
  "repeatThreshold": {
133
133
  "type": "integer",
@@ -138,7 +138,7 @@
138
138
  "exemptTools": {
139
139
  "type": "array",
140
140
  "items": { "type": "string", "minLength": 1 },
141
- "default": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
141
+ "default": ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task", "tools.delegate", "tools.delegate_many", "tools.subagent", "tools.task"],
142
142
  "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."
143
143
  },
144
144
  "toast": {
@@ -208,7 +208,7 @@
208
208
  "type": "string",
209
209
  "minLength": 1,
210
210
  "maxLength": 2,
211
- "default": "⚠",
211
+ "default": "●",
212
212
  "description": "Shown for a real caution. This is the row that has to read at a glance."
213
213
  },
214
214
  "clear": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-flight-deck",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
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",
@@ -62,6 +62,7 @@
62
62
  "@opentui/solid": "0.5.12",
63
63
  "@types/bun": "^1.4.2",
64
64
  "solid-js": "1.9.15",
65
+ "string-width": "7.2.0",
65
66
  "typescript": "^5.9.3"
66
67
  },
67
68
  "peerDependencies": {
@@ -339,7 +339,7 @@ export function worstCaution(cautions: readonly Caution[]): Caution | undefined
339
339
  // ---------------------------------------------------------------------------
340
340
 
341
341
  export const WATCH_GLYPH = "▲";
342
- export const CAUTION_GLYPH = "⚠";
342
+ export const CAUTION_GLYPH = "●";
343
343
  const CLEAR_GLYPH = "○";
344
344
 
345
345
  /**
@@ -358,9 +358,8 @@ export function glyphFor(caution: Caution | undefined, glyphs: GlyphHint = {}):
358
358
  return caution.severity === "caution" ? (glyphs.caution ?? CAUTION_GLYPH) : (glyphs.watch ?? WATCH_GLYPH);
359
359
  }
360
360
 
361
- /** The short value beside the label. Says what was seen, not what it means. */
362
- export function cautionText(caution: Caution, glyphs: GlyphHint = {}): string {
363
- const glyph = glyphFor(caution, glyphs);
361
+ /** Everything after the mark: what was seen, with no severity and no colour. */
362
+ function cautionBody(caution: Caution): string {
364
363
  const elapsed = caution.elapsedMs === undefined ? "" : ` ${formatElapsed(caution.elapsedMs)}`;
365
364
  switch (caution.kind) {
366
365
  case "hung-tool": {
@@ -368,21 +367,49 @@ export function cautionText(caution: Caution, glyphs: GlyphHint = {}): string {
368
367
  // is a different situation from a tool that is executing and has not
369
368
  // returned. Calling both "running" would be a small lie.
370
369
  const phase = caution.status === "streaming" ? "streaming" : "running";
371
- return `${glyph} ${caution.tool ?? "tool"} ${phase}${elapsed}`;
370
+ return `${caution.tool ?? "tool"} ${phase}${elapsed}`;
372
371
  }
373
372
  case "hung-shell":
374
- return `${glyph} ${caution.tool ?? "shell"} running${elapsed}`;
373
+ return `${caution.tool ?? "shell"} running${elapsed}`;
375
374
  case "repeat-loop":
376
- return `${glyph} ${caution.tool ?? "tool"} ×${caution.repeats ?? 0} identical`;
375
+ return `${caution.tool ?? "tool"} ×${caution.repeats ?? 0} identical`;
377
376
  case "failure-loop":
378
- return `${glyph} ${caution.tool ?? "tool"} failing ×${caution.repeats ?? 0}`;
377
+ return `${caution.tool ?? "tool"} failing ×${caution.repeats ?? 0}`;
379
378
  case "silent-turn":
380
- return `${glyph} no progress${elapsed}`;
379
+ return `no progress${elapsed}`;
381
380
  default:
382
- return `${glyph} unknown`;
381
+ return "unknown";
383
382
  }
384
383
  }
385
384
 
385
+ /**
386
+ * The annunciator's mark: its one-cell glyph, the theme role its severity draws
387
+ * in, and the exact row text (`cautionText`'s value).
388
+ *
389
+ * The tone is structural on purpose, like `GlyphHint`: this module stays free
390
+ * of imports, and the caller maps the role onto a theme colour.
391
+ */
392
+ export interface CautionMark {
393
+ readonly glyph: string;
394
+ /** `error` for a caution, `warning` for a watch — the rail's own roles. */
395
+ readonly tone: "warning" | "error";
396
+ readonly text: string;
397
+ }
398
+
399
+ export function cautionMark(caution: Caution, glyphs: GlyphHint = {}): CautionMark {
400
+ const glyph = glyphFor(caution, glyphs);
401
+ return {
402
+ glyph,
403
+ tone: caution.severity === "caution" ? "error" : "warning",
404
+ text: `${glyph} ${cautionBody(caution)}`,
405
+ };
406
+ }
407
+
408
+ /** The short value beside the label. Says what was seen, not what it means. */
409
+ export function cautionText(caution: Caution, glyphs: GlyphHint = {}): string {
410
+ return cautionMark(caution, glyphs).text;
411
+ }
412
+
386
413
  /** The longer sentence, used for the toast. States the observation, then the readings. */
387
414
  export function cautionDetail(caution: Caution): string {
388
415
  const elapsed = caution.elapsedMs === undefined ? "a while" : formatElapsed(caution.elapsedMs);
package/src/tui/config.ts CHANGED
@@ -159,11 +159,13 @@ interface LayoutConfig {
159
159
  }
160
160
 
161
161
  /**
162
- * The annunciator's glyphs.
162
+ * The annunciator's glyphs: one mark per severity.
163
163
  *
164
- * Configurable because this is the one row that has to read at a glance, and
165
- * some terminals render `⚠` as a box or the wrong width. Swapping it for `!` is
166
- * a worse-looking but working panel, which beats an unreadable one.
164
+ * All three are single-cell marks — `▲` watch, `●` caution, `○` clear — so the
165
+ * annunciator row lines up with every other row on the rail regardless of how
166
+ * the terminal classifies their East Asian width. Configurable because this is
167
+ * the one row that has to read at a glance, and a terminal that draws one of
168
+ * these badly can be given a substitute without a rebuild.
167
169
  */
168
170
  interface GlyphConfig {
169
171
  readonly watch: string;
@@ -196,7 +198,7 @@ const DEFAULT_FORMAT: FormatConfig = { duration: "spaced" };
196
198
 
197
199
  const DEFAULT_GLYPHS: GlyphConfig = {
198
200
  watch: "▲",
199
- caution: "⚠",
201
+ caution: "●",
200
202
  clear: "○",
201
203
  };
202
204
 
@@ -207,7 +209,7 @@ const DEFAULT_CAUTION: CautionConfig = {
207
209
  turnWatchSeconds: 600,
208
210
  turnCautionSeconds: 1200,
209
211
  repeatThreshold: 3,
210
- exemptTools: ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task"],
212
+ exemptTools: ["question", "task", "subagent", "agent", "delegate", "delegate_many", "delegate_task", "tools.delegate", "tools.delegate_many", "tools.subagent", "tools.task"],
211
213
  /**
212
214
  * Off by default. The rail is the signal; a toast is an interruption.
213
215
  *
package/src/tui/index.tsx CHANGED
@@ -1,6 +1,13 @@
1
1
  /** @jsxImportSource @opentui/solid */
2
2
  import { Plugin } from "@opencode/plugin/tui";
3
- import { cautionDetail, cautionText, detectCautions, worstCaution, type Caution } from "./caution.js";
3
+ import {
4
+ cautionDetail,
5
+ cautionMark,
6
+ detectCautions,
7
+ worstCaution,
8
+ type Caution,
9
+ type CautionMark,
10
+ } from "./caution.js";
4
11
  import { copyFeedback, copyToClipboard } from "./clipboard.js";
5
12
  import { cautionThresholds, mergeOptions, resolveConfig } from "./config.js";
6
13
  import { loadConfigFile } from "./file-config.js";
@@ -101,10 +108,11 @@ export default Plugin.define({
101
108
  // the full session id. The handler wraps the line in a box so it fires
102
109
  // wherever the row is clicked (mouse events bubble up, never down), and
103
110
  // it closes over the id from THIS render - see `snapshot` for why the id
104
- // is never cached. The confirmation is a host toast, not an on-row glyph:
105
- // a signal from this plugin's own Solid is invisible to the host's
106
- // renderer (`./ticker.ts`), so the one host-reactive surface is used
107
- // instead. The toast is wrapped so a failure in it can never throw out of
111
+ // is never cached. A verified copy is silent: the owner objects to the
112
+ // noise of a toast confirming a gesture that plainly worked, so the only
113
+ // host-reactive surface (`./ticker.ts`) is reserved for a genuine failure,
114
+ // where the honesty rail requires that a no-op can never pass as a
115
+ // success. The call is wrapped so a failure in it can never throw out of
108
116
  // the mouse handler.
109
117
  if (copyId === undefined) return text;
110
118
  return (
@@ -117,6 +125,7 @@ export default Plugin.define({
117
125
  try {
118
126
  const result = await copyToClipboard(context.renderer, copyId);
119
127
  const fb = copyFeedback(result, copyId);
128
+ if (fb.ok) return;
120
129
  context.ui.toast.show({
121
130
  title: "Flight Deck",
122
131
  message: fb.message,
@@ -214,14 +223,13 @@ export default Plugin.define({
214
223
  // Only the worst is ever drawn: the rail has one line for this, and two
215
224
  // simultaneous observations is one problem with two symptoms.
216
225
  //
217
- // Returns a plain string, themed exactly like every other live row. The
218
- // annunciator carries its meaning in its glyph, not in a colour of its own:
219
- // a row that suddenly brightens reads as a different kind of thing rather
220
- // than as the same panel telling you something.
221
- const announce = (sessionID: string): string | undefined => {
226
+ // Returns the mark itself, not just its text: severity survives to the
227
+ // renderer as the mark's own tone, so the glyph takes the rail's error or
228
+ // warning colour while the rest of the row keeps its own.
229
+ const announce = (sessionID: string): CautionMark | undefined => {
222
230
  if (!config.caution.enabled) return undefined;
223
231
  const top = worstCaution(cautionsOf(sessionID, Date.now()));
224
- return top === undefined ? undefined : cautionText(top, config.glyphs);
232
+ return top === undefined ? undefined : cautionMark(top, config.glyphs);
225
233
  };
226
234
 
227
235
  // A VCS call on a directory with no repository must not throw and take the
@@ -23,8 +23,9 @@ export interface RailLine {
23
23
  readonly field?: string;
24
24
  /**
25
25
  * The same line split into coloured runs, when a row's severity lives on part
26
- * of it (only `go` today). `text` is always the exact join of these segments,
27
- * so a caller that ignores them draws the row unchanged.
26
+ * of it (the `go` dials and the `caution` mark). `text` is always the exact
27
+ * join of these segments, so a caller that ignores them draws the row
28
+ * unchanged.
28
29
  */
29
30
  readonly segments?: readonly StatSegment[];
30
31
  }
package/src/tui/rows.ts CHANGED
@@ -23,6 +23,17 @@ import {
23
23
  /** Braille frames, advanced by the ticker, shown only while the session runs. */
24
24
  const SPINNER = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] as const;
25
25
 
26
+ /**
27
+ * Value-column budget for the `ses` row's preview, in cells.
28
+ *
29
+ * Same width the `perms` row clips its resource to, because that is the column
30
+ * this roughly thirty-odd-column rail was designed to fit: the label column
31
+ * plus a value of this length stays inside the panel. A full 30-character
32
+ * session id is always shortened at this budget and gets the ellipsis appended
33
+ * - the row reads as a preview of a longer value, never as the value.
34
+ */
35
+ const SES_PREVIEW_WIDTH = 18;
36
+
26
37
  /**
27
38
  * Flatten control characters in anything about to be drawn.
28
39
  *
@@ -186,6 +197,49 @@ function goValueSegments(source: StatSource, layout: LayoutHint): StatSegment[]
186
197
  return segments;
187
198
  }
188
199
 
200
+ /**
201
+ * The annunciator mark the caller built, validated at the untrusted boundary.
202
+ *
203
+ * `source.caution` is `unknown`, so the shape is re-checked here: a mark is kept
204
+ * only when its glyph and text are non-empty strings and its tone is one of the
205
+ * two severity roles. Anything else falls through to the plain-string path.
206
+ */
207
+ function asCautionMark(value: unknown): { glyph: string; tone: StyleColor; text: string } | undefined {
208
+ const record = asRecord(value);
209
+ if (record === undefined) return undefined;
210
+ const glyph = asText(record["glyph"]);
211
+ const text = asText(record["text"]);
212
+ const tone = record["tone"];
213
+ if (glyph === undefined || text === undefined) return undefined;
214
+ if (tone !== "warning" && tone !== "error") return undefined;
215
+ return { glyph, tone, text };
216
+ }
217
+
218
+ /**
219
+ * The `caution` row's value as coloured segments, or `undefined` when there is
220
+ * nothing to draw.
221
+ *
222
+ * The annunciator carries its severity in the mark itself: the glyph runs in the
223
+ * severity's own tone (`error` for a caution, `warning` for a watch) while the
224
+ * words after it keep the row's colour, so the row does not read as a different
225
+ * kind of line. A legacy plain-string value is accepted unchanged, in the row's
226
+ * own colour, which keeps every existing caller working.
227
+ */
228
+ function cautionValueSegments(source: StatSource): StatSegment[] | undefined {
229
+ const mark = asCautionMark(source.caution);
230
+ if (mark !== undefined) {
231
+ // `plain` first, then split: flattening replaces each control character with
232
+ // one space, so the glyph's length still indexes the run boundary.
233
+ const text = plain(mark.text);
234
+ return [
235
+ { text: text.slice(0, mark.glyph.length), tone: mark.tone },
236
+ { text: text.slice(mark.glyph.length) },
237
+ ];
238
+ }
239
+ const text = asText(source.caution);
240
+ return text === undefined ? undefined : [{ text: plain(text) }];
241
+ }
242
+
189
243
  /**
190
244
  * Render one named field, or `undefined` when the host has not supplied it yet.
191
245
  *
@@ -215,10 +269,13 @@ export function statLine(
215
269
  case "caution": {
216
270
  // Rendered only when the caller found something to say, which is what
217
271
  // keeps a healthy session visually identical to one without the
218
- // annunciator at all. The string already carries its glyph; nothing here
219
- // knows or cares about severity.
220
- const text = asText(source.caution);
221
- return text === undefined ? undefined : row("caution", text);
272
+ // annunciator at all. The plain string is the exact join of the coloured
273
+ // segments, so the string view and the coloured view agree; a legacy plain
274
+ // string value is accepted too, with no tone.
275
+ const value = cautionValueSegments(source);
276
+ return value === undefined
277
+ ? undefined
278
+ : row("caution", value.map((segment) => segment.text).join(""));
222
279
  }
223
280
  case "status": {
224
281
  const status = asText(source.status);
@@ -385,9 +442,17 @@ export function statLine(
385
442
  }
386
443
  case "ses": {
387
444
  const id = asText(source.sessionId);
388
- // The full id is drawn: it is the only usable form of the value, and the
389
- // rail wraps it on character boundaries rather than clipping it.
390
- return id === undefined ? undefined : row("ses", id);
445
+ // A short preview, never the full id: the rail is roughly thirty-odd
446
+ // columns wide and the label already costs its column, so the 30-character
447
+ // id runs past the panel. `clip` shortens width-aware and appends the
448
+ // ellipsis that tells the reader this is a preview, not the value. The
449
+ // full id still lives on `source.sessionId`, which is what the row's click
450
+ // gesture copies - the display and the copy are separate values.
451
+ //
452
+ // Budget `SES_PREVIEW_WIDTH` (18), matching the `perms` row's clip width:
453
+ // that is the column this rail was designed to fit, so a preview of that
454
+ // length sits inside it beside the label.
455
+ return id === undefined ? undefined : row("ses", clip(id, SES_PREVIEW_WIDTH));
391
456
  }
392
457
  case "go": {
393
458
  // The plain string is the exact join of the coloured segments, so the
@@ -405,16 +470,21 @@ export function statLine(
405
470
  * One field's rail row as coloured segments, or `undefined` when the field is
406
471
  * not segment-aware or has nothing to draw.
407
472
  *
408
- * Only `go` is segment-aware today — the one row whose severity lives on part
409
- * of the line rather than the whole. Every other field returns `undefined` and
410
- * the caller falls through to {@link statLine}, so there is still exactly one
411
- * place that knows a row's text.
473
+ * The `go` dials and the `caution` mark are the segment-aware rows — the two
474
+ * whose severity lives on part of the line rather than the whole. Every other
475
+ * field returns `undefined` and the caller falls through to {@link statLine},
476
+ * so there is still exactly one place that knows a row's text.
412
477
  */
413
478
  export function statSegments(
414
479
  field: string,
415
480
  source: StatSource,
416
481
  layout: LayoutHint = {},
417
482
  ): readonly StatSegment[] | undefined {
483
+ if (field === "caution") {
484
+ const value = cautionValueSegments(source);
485
+ if (value === undefined) return undefined;
486
+ return [{ text: labelPrefix("caution", layout.labelWidth ?? DEFAULT_LABEL_WIDTH) }, ...value];
487
+ }
418
488
  if (field !== "go") return undefined;
419
489
  const value = goValueSegments(source, layout);
420
490
  if (value === undefined) return undefined;
@@ -12,9 +12,11 @@ export interface StatSource {
12
12
  /**
13
13
  * The annunciator line, precomputed by the caller.
14
14
  *
15
- * A plain string on purpose: the rules that decide whether something is wrong
16
- * live in ./caution.ts and need the clock and the session snapshot, not a
17
- * formatting function. Severity is already encoded in the glyph.
15
+ * Either a plain string (legacy, drawn in the row's own colour) or the mark
16
+ * returned by `caution.ts`'s `cautionMark`: its `glyph` and `tone` ride to
17
+ * the renderer so severity is carried by a coloured run. The rules that
18
+ * decide whether something is wrong live in ./caution.ts and need the clock
19
+ * and the session snapshot, not a formatting function.
18
20
  */
19
21
  readonly caution?: unknown;
20
22
  readonly agent?: unknown;