oc-metricboard 0.1.12 → 0.1.13

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.
Files changed (2) hide show
  1. package/package.json +26 -6
  2. package/src/tui-v2.tsx +18 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-metricboard",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "OpenCode TUI sidebar plugin showing real-time LLM metrics (TPS, TTFT, tokens) with sub-agent × model breakdown",
5
5
  "keywords": [
6
6
  "opencode",
@@ -76,18 +76,38 @@
76
76
  "devDependencies": {
77
77
  "@opencode-ai/plugin": "1.18.4",
78
78
  "@opencode-ai/sdk": "1.18.4",
79
+ "@opentui/core": "^0.4.5",
80
+ "@opentui/solid": "^0.4.5",
81
+ "solid-js": "^1.9.12",
79
82
  "@types/bun": "latest",
80
83
  "tsup": "^8.0.0",
81
84
  "typescript": "^5.0.0"
82
85
  },
83
86
  "dependencies": {
84
- "@opentui/core": "0.4.5",
85
- "@opentui/solid": "0.4.5",
86
- "comment-json": "^5.0.0",
87
- "solid-js": "^1.9.12"
87
+ "comment-json": "^5.0.0"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@opencode-ai/plugin": "*",
91
- "@opencode-ai/sdk": "*"
91
+ "@opencode-ai/sdk": "*",
92
+ "@opentui/core": "*",
93
+ "@opentui/solid": "*",
94
+ "solid-js": ">=1.9.0"
95
+ },
96
+ "peerDependenciesMeta": {
97
+ "@opencode-ai/plugin": {
98
+ "optional": true
99
+ },
100
+ "@opencode-ai/sdk": {
101
+ "optional": true
102
+ },
103
+ "@opentui/core": {
104
+ "optional": true
105
+ },
106
+ "@opentui/solid": {
107
+ "optional": true
108
+ },
109
+ "solid-js": {
110
+ "optional": true
111
+ }
92
112
  }
93
113
  }
package/src/tui-v2.tsx CHANGED
@@ -40,8 +40,8 @@
40
40
  */
41
41
  /** @jsxImportSource @opentui/solid */
42
42
  /** @jsxRuntime automatic */
43
- import type { TuiThemeCurrent } from "@opencode-ai/plugin/tui"
44
43
  import { createCollector, type MetricsCollector } from "./collector"
44
+ import type { MetricsEventApi } from "./event-bus"
45
45
  import { getConfig } from "./config"
46
46
  import { log } from "./logger"
47
47
  import { SidebarMetrics } from "./components/SidebarMetrics"
@@ -199,8 +199,22 @@ function createV1EventShim(ctx: V2Context, holder: CollectorHolder): MetricsEven
199
199
 
200
200
  // ---------------------------------------------------------------------------
201
201
  // Theme adapter: components read V1 flat tokens.
202
+ // NOTE: the theme shape is declared locally on purpose — tui-v2 must not
203
+ // import anything from the `@opencode-ai/*` (V1) scope, not even types: the
204
+ // V2 host installs every `@opencode-ai/*` specifier it sees into the
205
+ // plugin sandbox, pulling a second plugin runtime into the process.
202
206
  // ---------------------------------------------------------------------------
203
207
 
208
+ /** Flat theme tokens the shared components read (V1 shape, structural). */
209
+ interface V1FlatTheme {
210
+ readonly text?: unknown
211
+ readonly textMuted?: unknown
212
+ readonly accent?: unknown
213
+ readonly warning?: unknown
214
+ readonly success?: unknown
215
+ readonly [key: string]: unknown
216
+ }
217
+
204
218
  function pickThemeToken(theme: V2Theme | undefined, paths: ReadonlyArray<ReadonlyArray<string>>): unknown {
205
219
  for (const path of paths) {
206
220
  let value: unknown = theme
@@ -216,14 +230,14 @@ function pickThemeToken(theme: V2Theme | undefined, paths: ReadonlyArray<Readonl
216
230
  return undefined
217
231
  }
218
232
 
219
- function v1ThemeFromV2(theme: V2Theme | undefined): TuiThemeCurrent {
233
+ function v1ThemeFromV2(theme: V2Theme | undefined): V1FlatTheme {
220
234
  return {
221
235
  text: pickThemeToken(theme, [["text", "default"]]),
222
236
  textMuted: pickThemeToken(theme, [["text", "subdued"]]),
223
237
  accent: pickThemeToken(theme, [["text", "feedback", "info", "default"], ["text", "default"]]),
224
238
  warning: pickThemeToken(theme, [["text", "feedback", "warning", "default"]]),
225
239
  success: pickThemeToken(theme, [["text", "feedback", "success", "default"]]),
226
- } as TuiThemeCurrent
240
+ }
227
241
  }
228
242
 
229
243
  // ---------------------------------------------------------------------------
@@ -264,7 +278,7 @@ export function setupTuiV2(ctx: V2Context): V2Cleanup {
264
278
  collector={collector}
265
279
  refreshIntervalMs={config.refreshIntervalMs}
266
280
  barConfig={config}
267
- theme={theme}
281
+ theme={theme as never}
268
282
  controller={controller}
269
283
  requestRender={requestRender}
270
284
  />