opencode-tokenwatch 0.5.0 → 0.6.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.
@@ -0,0 +1,14 @@
1
+ import type { HostAdapter } from "../host/types.js";
2
+ import type { PerfTracker } from "../kernel/perf.js";
3
+ import type { TokenMessage } from "../kernel/model.js";
4
+ interface TokenWatchPanelProps {
5
+ host: HostAdapter;
6
+ perfTracker: PerfTracker;
7
+ perfRevision?: () => number;
8
+ messages: () => readonly any[];
9
+ /** 绑定了当前会话的 part 查询(v2 下避免跨会话扫描) */
10
+ messageParts: (messageID: string) => readonly any[];
11
+ allTokenMessages: () => TokenMessage[];
12
+ }
13
+ export declare function TokenWatchPanel(props: TokenWatchPanelProps): import("solid-js").JSX.Element;
14
+ export {};
package/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 目录标记 + 服务端插件入口。
3
+ *
4
+ * opencode2 有两套本地插件发现:
5
+ * - 服务端(role=server)以 `index.*` 为入口,要求 default 导出为合法插件模块
6
+ * - TUI 侧以 `tui.*` 为入口(见 ./tui.ts)
7
+ *
8
+ * 本文件同时满足两者:作为 v2 目录发现的标记文件,并导出 v1/v2 通用的
9
+ * server 插件对象(v1 不使用本文件,它通过 package.json 的 exports 加载)。
10
+ */
11
+ export { default } from "./dist/server.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-tokenwatch",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Real-time token usage, cache analytics & performance dashboard plugin for OpenCode CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/server.js",
@@ -24,7 +24,9 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "files": [
27
- "dist"
27
+ "dist",
28
+ "tui.ts",
29
+ "index.ts"
28
30
  ],
29
31
  "sideEffects": false,
30
32
  "engines": {
@@ -56,11 +58,14 @@
56
58
  "url": "https://github.com/TTWK/opencode-tokenwatch/issues"
57
59
  },
58
60
  "homepage": "https://github.com/TTWK/opencode-tokenwatch#readme",
61
+ "dependencies": {
62
+ "@opentui/core": "^0.5.11",
63
+ "@opentui/solid": "^0.5.11",
64
+ "solid-js": ">=1.9.0"
65
+ },
59
66
  "devDependencies": {
60
- "@opencode-ai/plugin": "latest",
61
- "@opentui/core": "^0.2.9",
62
- "@opentui/keymap": "^0.2.9",
63
- "@opentui/solid": "^0.2.9",
67
+ "@opencode-ai/plugin": "1.18.30",
68
+ "@opentui/keymap": "^0.5.11",
64
69
  "@types/node": "^22.0.0",
65
70
  "esbuild": "^0.25.0",
66
71
  "esbuild-plugin-solid": "^0.5.0",
@@ -68,5 +73,10 @@
68
73
  },
69
74
  "publishConfig": {
70
75
  "access": "public"
76
+ },
77
+ "peerDependencies": {
78
+ "@opentui/core": ">=0.5.0",
79
+ "@opentui/solid": ">=0.5.0",
80
+ "solid-js": ">=1.9.0"
71
81
  }
72
82
  }
package/tui.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * opencode2(v2)入口。
3
+ *
4
+ * v2 以目录形式解析插件时,会把本文件作为入口模块导入并读取 default 导出,
5
+ * 再调用其 `setup(ctx)`。这里直接复用构建产物,保证 v1 / v2 走同一份实现。
6
+ *
7
+ * v1 不使用本文件——它通过 package.json 的 exports["./tui"] 加载 dist/tui.js。
8
+ */
9
+ export { default } from "./dist/tui.js"
@@ -1,2 +0,0 @@
1
- import type { TuiPluginApi } from "@opencode-ai/plugin/tui";
2
- export declare function registerCommands(api: TuiPluginApi): Promise<void>;
package/dist/sidebar.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import type { TuiPluginApi, TuiTheme } from "@opencode-ai/plugin/tui";
2
- import type { PerfTracker } from "./perf-tracker.js";
3
- import type { TokenMessage } from "./tui.js";
4
- export interface SidebarConfig {
5
- sidebar: {
6
- showPerformance: boolean;
7
- showPricing: boolean;
8
- showTokenDistribution: boolean;
9
- showTrend: boolean;
10
- };
11
- language: "zh" | "en" | "auto";
12
- }
13
- export declare function loadConfig(api: TuiPluginApi): SidebarConfig;
14
- interface TokenWatchPanelProps {
15
- api: TuiPluginApi;
16
- theme: TuiTheme;
17
- perfTracker: PerfTracker;
18
- messages: () => readonly any[];
19
- allTokenMessages: () => TokenMessage[];
20
- }
21
- export declare function TokenWatchPanel(props: TokenWatchPanelProps): any;
22
- export {};
File without changes