oc-flight-deck 0.4.0 → 0.6.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/README.md CHANGED
@@ -22,7 +22,7 @@ tokens 533k in · 91k out
22
22
  cache 98% hit · 32M read
23
23
  context ██░░░░░░░░ 18%
24
24
  elapsed 2h 14m
25
- tps 106 tok/s
25
+ tps 18 tok/s
26
26
  spark ▁▃▂▅█▄▃▂
27
27
  ```
28
28
 
@@ -54,7 +54,7 @@ learn. The panel appears beside an open session and starts reading.
54
54
  | `context` | A gauge of how full the window is. |
55
55
  | `perms` | What is waiting for approval, not just how many. |
56
56
  | `elapsed` | How long you've been at it. |
57
- | `tps` | Output tokens per second, measured from the last completed turn. |
57
+ | `tps` | Overall session throughput: every output token over the session's life, subagents included. A whole-conversation average, so it reads lower than a peak rate. |
58
58
  | `spark` | Recent turn sizes as a shape. Available, off by default. |
59
59
  | `reasoning` | Reasoning tokens, when the model emits them. Available, off by default. |
60
60
  | `turns` | How many prompts you have sent this session. Available, off by default. |
@@ -162,13 +162,30 @@ other plugin. Each side works alone.
162
162
  available in a commented JSONC file.
163
163
 
164
164
  Copy [`flight-deck.example.jsonc`](./flight-deck.example.jsonc) to
165
- `flight-deck.jsonc` at your project root, or to `.opencode/flight-deck.jsonc`,
166
- then edit. Comments and trailing commas are fine.
165
+ `~/.config/opencode/flight-deck.jsonc`, then edit. Comments and trailing commas
166
+ are fine.
167
+
168
+ There is **one** config file, global to your user, so the same values apply to
169
+ every project. Flight Deck does not read a `flight-deck.jsonc` from a project
170
+ root or from a project's `.opencode/` directory — a copy left there configures
171
+ nothing. If `$XDG_CONFIG_HOME` is set, the path is
172
+ `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead. A `.json` name works too;
173
+ the `.jsonc` name is tried first.
174
+
175
+ The file is optional, and a missing file is normal and silent: with no file at
176
+ all you get exactly the defaults written out below.
177
+
178
+ > **Upgrading from 0.4.0 — the config file moved.** The per-project search is
179
+ > gone. A `flight-deck.jsonc` in a project root or in `.opencode/` is no longer
180
+ > read; move it to `~/.config/opencode/flight-deck.jsonc` (or the
181
+ > `$XDG_CONFIG_HOME` path above) to keep your settings.
167
182
 
168
183
  ```jsonc
169
184
  {
170
185
  // Tick rate in ms. The spinner has ten frames, so 100 turns it once a
171
- // second. 0 turns the timer off entirely.
186
+ // second. 0 turns the timer off entirely. While nothing is running the
187
+ // tick backs off to about once a second — the spinner is hidden then, and
188
+ // the clock only reads in whole seconds.
172
189
  "refresh": 100,
173
190
 
174
191
  "sidebar": {
@@ -230,7 +247,7 @@ Delete the plugin and the stock sidebar is back, exactly as it was.
230
247
  ## Uninstall
231
248
 
232
249
  Remove the entry from `opencode.jsonc`, restart, done. Delete your
233
- `flight-deck.jsonc` too if you made one.
250
+ `~/.config/opencode/flight-deck.jsonc` too if you made one.
234
251
 
235
252
  ## Development
236
253
 
@@ -267,7 +284,7 @@ Built on the official
267
284
 
268
285
  ## Compatibility
269
286
 
270
- Built against `@opencode/plugin` `2.0.2`; pin a host version you've tested.
287
+ Built against `@opencode/plugin` `2.0.10`; pin a host version you've tested.
271
288
 
272
289
  Requires OpenCode V2 (`opencode2`). Building from source needs Bun 1.4+ or
273
290
  Node 22+.
@@ -9,12 +9,22 @@
9
9
  // you can see exactly what there is to change. Delete any key and its
10
10
  // default comes straight back.
11
11
  //
12
- // TO USE IT: copy this file to `flight-deck.jsonc` at your project root, or
13
- // to `.opencode/flight-deck.jsonc`. Comments and trailing commas are fine.
12
+ // TO USE IT: copy this file to `~/.config/opencode/flight-deck.jsonc` (or
13
+ // `flight-deck.json` — the `.jsonc` name is tried first), then edit. Comments
14
+ // and trailing commas are fine.
14
15
  //
15
- // Flight Deck looks in this order and uses the first file it finds:
16
- // .opencode/flight-deck.jsonc .opencode/flight-deck.json
17
- // flight-deck.jsonc flight-deck.json
16
+ // There is ONE config file, global to your user, so the same values apply to
17
+ // every project. Flight Deck does NOT look in a project root or in a
18
+ // project's `.opencode/` directory: a copy left there configures nothing.
19
+ //
20
+ // If `$XDG_CONFIG_HOME` is set, the path is
21
+ // `$XDG_CONFIG_HOME/opencode/flight-deck.jsonc` instead.
22
+ //
23
+ // The file is optional. Having none is the normal case, and it is silent —
24
+ // the defaults below are what you get.
25
+ //
26
+ // Upgrading from 0.4.0? A `flight-deck.jsonc` in a project root or in
27
+ // `.opencode/` is no longer read; move it to the global path above.
18
28
  //
19
29
  // The same values can also be passed as plugin options in opencode.jsonc /
20
30
  // cli.json, which take precedence on hosts that forward them.
@@ -29,6 +39,10 @@
29
39
  // `elapsed` plus the spinner are the reason this exists. Without a tick they
30
40
  // would sit frozen between turns.
31
41
  //
42
+ // While nothing is running the tick backs off to about once a second: the
43
+ // spinner is hidden then, and `elapsed` only reads in whole seconds, so the
44
+ // host's renderer is woken a tenth as often for the same picture.
45
+ //
32
46
  // 100 default — the spinner turns once a second, the clock stays live
33
47
  // 50 twice as lively, still negligible work per tick
34
48
  // 1000 a calm wall-clock tick, but the spinner visibly stutters
@@ -68,7 +82,9 @@
68
82
  // context a gauge of how full the context window is
69
83
  // perms what is waiting for approval, not just how many
70
84
  // elapsed wall-clock time since the session started
71
- // tps output tokens per second on the last completed turn
85
+ // tps overall session throughput: output tokens over the
86
+ // session's life, subagents included (an average, so it
87
+ // reads lower than a peak rate)
72
88
  // spark recent turn sizes as a sparkline
73
89
  // reasoning reasoning tokens, when the model emits them
74
90
  // turns how many prompts you have sent this session
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://github.com/nathwn12/oc-flight-deck/flight-deck.schema.json",
4
4
  "title": "Flight Deck configuration",
5
- "description": "Configuration for the oc-flight-deck TUI plugin. Every key is optional: install the plugin and it works with no config file at all. Copy flight-deck.example.jsonc to flight-deck.jsonc (or .opencode/flight-deck.jsonc) and edit. Comments and trailing commas are allowed. An invalid value is ignored, its default is restored, and a one-time toast names the key to fix — a typo can never break the TUI.",
5
+ "description": "Configuration for the oc-flight-deck TUI plugin. Every key is optional: install the plugin and it works with no config file at all — a missing file is normal and silent. Copy flight-deck.example.jsonc to the one global path, ~/.config/opencode/flight-deck.jsonc ($XDG_CONFIG_HOME/opencode/flight-deck.jsonc when XDG_CONFIG_HOME is set), and edit; that single file applies to every project. There is no per-project lookup: a flight-deck.jsonc in a project root or in .opencode/ is not read. Comments and trailing commas are allowed. An invalid value is ignored, its default is restored, and a one-time toast names the key to fix — a typo can never break the TUI.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "properties": {
package/package.json CHANGED
@@ -1,70 +1,70 @@
1
- {
2
- "name": "oc-flight-deck",
3
- "version": "0.4.0",
4
- "description": "Live OpenCode V2 session telemetry — agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
5
- "keywords": [
6
- "opencode",
7
- "opencode-plugin",
8
- "opencode-tui",
9
- "tui",
10
- "cli",
11
- "sidebar",
12
- "telemetry",
13
- "cost"
14
- ],
15
- "license": "MIT",
16
- "author": "nathwn12",
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/nathwn12/oc-flight-deck.git"
20
- },
21
- "homepage": "https://github.com/nathwn12/oc-flight-deck#readme",
22
- "bugs": {
23
- "url": "https://github.com/nathwn12/oc-flight-deck/issues"
24
- },
25
- "type": "module",
26
- "exports": {
27
- ".": {
28
- "types": "./src/index.ts",
29
- "import": "./src/index.ts"
30
- },
31
- "./tui": {
32
- "types": "./src/tui/index.tsx",
33
- "import": "./src/tui/index.tsx"
34
- }
35
- },
36
- "files": [
37
- "src",
38
- "flight-deck.example.jsonc",
39
- "flight-deck.schema.json",
40
- "README.md",
41
- "LICENSE"
42
- ],
43
- "engines": {
44
- "node": ">=22",
45
- "bun": ">=1.4.0"
46
- },
47
- "scripts": {
48
- "typecheck": "tsc --noEmit",
49
- "test": "bun test",
50
- "check": "bun run typecheck && bun test"
51
- },
52
- "publishConfig": {
53
- "access": "public"
54
- },
55
- "dependencies": {
56
- "@opencode/plugin": "2.0.2"
57
- },
58
- "devDependencies": {
59
- "@opentui/core": "0.5.10",
60
- "@opentui/solid": "0.5.10",
61
- "@types/bun": "^1.4.2",
62
- "solid-js": "1.9.12",
63
- "typescript": "^5.9.0"
64
- },
65
- "peerDependencies": {
66
- "@opentui/core": ">=0.5.10",
67
- "@opentui/solid": ">=0.5.10",
68
- "solid-js": ">=1.9.0"
69
- }
70
- }
1
+ {
2
+ "name": "oc-flight-deck",
3
+ "version": "0.6.0",
4
+ "description": "Live OpenCode V2 session telemetry — agent, model, branch, cost, tokens, cache hit rate and context usage in your sidebar.",
5
+ "keywords": [
6
+ "opencode",
7
+ "opencode-plugin",
8
+ "opencode-tui",
9
+ "tui",
10
+ "cli",
11
+ "sidebar",
12
+ "telemetry",
13
+ "cost"
14
+ ],
15
+ "license": "MIT",
16
+ "author": "nathwn12",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/nathwn12/oc-flight-deck.git"
20
+ },
21
+ "homepage": "https://github.com/nathwn12/oc-flight-deck#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/nathwn12/oc-flight-deck/issues"
24
+ },
25
+ "type": "module",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./src/index.ts",
29
+ "import": "./src/index.ts"
30
+ },
31
+ "./tui": {
32
+ "types": "./src/tui/index.tsx",
33
+ "import": "./src/tui/index.tsx"
34
+ }
35
+ },
36
+ "files": [
37
+ "src",
38
+ "flight-deck.example.jsonc",
39
+ "flight-deck.schema.json",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "engines": {
44
+ "node": ">=22",
45
+ "bun": ">=1.4.0"
46
+ },
47
+ "scripts": {
48
+ "typecheck": "tsc --noEmit",
49
+ "test": "bun test",
50
+ "check": "bun run typecheck && bun test"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "dependencies": {
56
+ "@opencode/plugin": "2.0.10"
57
+ },
58
+ "devDependencies": {
59
+ "@opentui/core": "0.5.10",
60
+ "@opentui/solid": "0.5.10",
61
+ "@types/bun": "^1.4.2",
62
+ "solid-js": "1.9.12",
63
+ "typescript": "^5.9.0"
64
+ },
65
+ "peerDependencies": {
66
+ "@opentui/core": ">=0.5.10",
67
+ "@opentui/solid": ">=0.5.10",
68
+ "solid-js": ">=1.9.0"
69
+ }
70
+ }
@@ -2,19 +2,35 @@
2
2
  //
3
3
  // The host's `context.options` is the official configuration channel, but not
4
4
  // every host build forwards it (and `cli.json` may not allow comments). So the
5
- // plugin also reads a small JSONC file from the project, which guarantees
6
- // inline comments work everywhere. `context.options` still wins when present.
5
+ // plugin also reads a small global JSONC file, which guarantees inline comments
6
+ // work everywhere. `context.options` still wins when present.
7
+ //
8
+ // There is exactly one config file, in the user's config directory. There is no
9
+ // per-project channel: what the rail shows cannot change with the directory the
10
+ // host happens to open.
7
11
 
8
12
  import { existsSync, readFileSync, statSync } from "node:fs";
9
- import { join } from "node:path";
13
+ import { homedir } from "node:os";
14
+ import { isAbsolute, join } from "node:path";
10
15
 
11
- /** Searched in order, relative to the project directory; first hit wins. */
12
- export const CONFIG_FILE_CANDIDATES: readonly string[] = [
13
- join(".opencode", "flight-deck.jsonc"),
14
- join(".opencode", "flight-deck.json"),
15
- "flight-deck.jsonc",
16
- "flight-deck.json",
17
- ];
16
+ /**
17
+ * Searched in order inside `globalConfigDirectory()`; first hit wins. Both
18
+ * candidates live in the same directory — one file configures every session.
19
+ */
20
+ export const CONFIG_FILE_CANDIDATES: readonly string[] = ["flight-deck.jsonc", "flight-deck.json"];
21
+
22
+ /**
23
+ * The one directory Flight Deck reads its config from: `$XDG_CONFIG_HOME/opencode`
24
+ * when that variable holds an absolute path, else `~/.config/opencode`. A
25
+ * relative value is ignored, as the XDG base directory spec requires — otherwise
26
+ * the lookup would resolve against the host's working directory.
27
+ */
28
+ export function globalConfigDirectory(): string {
29
+ const xdg = process.env["XDG_CONFIG_HOME"]?.trim();
30
+ return xdg !== undefined && xdg.length > 0 && isAbsolute(xdg)
31
+ ? join(xdg, "opencode")
32
+ : join(homedir(), ".config", "opencode");
33
+ }
18
34
 
19
35
  /** Refuse to pull an unreasonable file into the TUI at startup. */
20
36
  const MAX_CONFIG_BYTES = 64 * 1024;
@@ -28,7 +44,11 @@ export interface FileConfig {
28
44
  readonly issue?: string;
29
45
  }
30
46
 
31
- export function findConfigFile(directory: string): string | undefined {
47
+ /**
48
+ * Find the first config file that exists in `directory`, which defaults to the
49
+ * global config directory. A missing directory simply has no candidates.
50
+ */
51
+ export function findConfigFile(directory: string = globalConfigDirectory()): string | undefined {
32
52
  for (const candidate of CONFIG_FILE_CANDIDATES) {
33
53
  const path = join(directory, candidate);
34
54
  if (existsSync(path)) return path;
@@ -45,13 +65,15 @@ export function parseJsonc(text: string): unknown {
45
65
  }
46
66
 
47
67
  /**
48
- * Load the first config file that exists under `directory`.
68
+ * Load the first config file that exists in `directory`, which defaults to the
69
+ * global config directory (`$XDG_CONFIG_HOME/opencode`, else `~/.config/opencode`).
70
+ * There is no per-project lookup.
49
71
  *
50
72
  * A missing file is normal and silent. A present-but-broken file is reported in
51
73
  * `issue` so the caller can warn once, and then behaves as if it were absent.
52
74
  * Only regular files under the size cap are read.
53
75
  */
54
- export function loadConfigFile(directory: string): FileConfig {
76
+ export function loadConfigFile(directory: string = globalConfigDirectory()): FileConfig {
55
77
  const source = findConfigFile(directory);
56
78
  if (source === undefined) return { options: undefined };
57
79