dsh-token-gauge 0.1.1 → 0.1.2
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.en.md +15 -2
- package/README.md +22 -2
- package/package.json +3 -2
package/README.en.md
CHANGED
|
@@ -19,9 +19,12 @@ popup to switch style, palette, displayed metrics, usage scope, limits (global/d
|
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
22
|
+
> **Pin the version**: `dsh plugin add` is backed by pnpm and can be affected by mirror sync lag (e.g. npmmirror).
|
|
23
|
+
> A bare `add dsh-token-gauge` may resolve `0.1.0` under `^0.1.0` — that old build lacks `dsh.bundle`, so it installs
|
|
24
|
+
> as a plain dependency (no bundle layer, no sidebar tab). **Pin `0.1.1` to avoid this**:
|
|
22
25
|
```bash
|
|
23
|
-
# From marketplace
|
|
24
|
-
dsh plugin --profile web add dsh-token-gauge
|
|
26
|
+
# From marketplace (recommended — pin to avoid resolving to the legacy 0.1.0)
|
|
27
|
+
dsh plugin --profile web add dsh-token-gauge@0.1.1
|
|
25
28
|
dsh web
|
|
26
29
|
|
|
27
30
|
# From source
|
|
@@ -30,6 +33,16 @@ node build.mjs
|
|
|
30
33
|
dsh plugin --profile web add .
|
|
31
34
|
```
|
|
32
35
|
|
|
36
|
+
### Migrating from legacy 0.1.0
|
|
37
|
+
|
|
38
|
+
If you already installed `0.1.0` (no `token-gauge` layer in `dsh.profile.bundles`, warning `declares no dsh.bundle —
|
|
39
|
+
installed as a plain dependency`), switch with:
|
|
40
|
+
```bash
|
|
41
|
+
dsh plugin --profile web remove dsh-token-gauge
|
|
42
|
+
dsh plugin --profile web add dsh-token-gauge@0.1.1
|
|
43
|
+
```
|
|
44
|
+
After reconcile, `token-gauge` is added as a bundle layer automatically; restart `dsh web` to see the **Token Gauge** tab.
|
|
45
|
+
|
|
33
46
|
## Data & pricing
|
|
34
47
|
|
|
35
48
|
- **Source**: Host subscribes to `assistant/message.usage` in the DSH session event stream and aggregates it.
|
package/README.md
CHANGED
|
@@ -22,10 +22,22 @@ DeepSeek Harness(DSH)Web 侧边栏插件:以「机车风格仪表盘」实
|
|
|
22
22
|
> 侧边栏 Tab 通过 **`dsh-better-sidebar`** 注册,请确保你的 web profile 已安装并启用该插件(本机默认已随其它插件一并安装;若缺失,`dsh plugin --profile web add dsh-better-sidebar` 即可)。
|
|
23
23
|
|
|
24
24
|
### 方式一:从市场安装(推荐)
|
|
25
|
+
|
|
26
|
+
> **强烈建议钉版本安装**:`dsh plugin add` 底层是 pnpm,受你本地 `.npmrc` 指向的镜像(如 npmmirror)同步延迟影响,裸 `add dsh-token-gauge` 在 `^0.1.0` 范围内可能解析到尚未带 `dsh.bundle` 的旧版 `0.1.0`(装上去只会是普通依赖、不进 bundle 层、侧边栏不出现)。**显式钉 `0.1.1` 可彻底规避这一坑**:
|
|
25
27
|
```bash
|
|
26
|
-
dsh plugin --profile web add dsh-token-gauge
|
|
28
|
+
dsh plugin --profile web add dsh-token-gauge@0.1.1
|
|
27
29
|
dsh web
|
|
28
30
|
```
|
|
31
|
+
> 若想装最新版,可先 `dsh plugin --profile web update dsh-token-gauge` 升级,再确认 `node_modules/dsh-token-gauge/package.json` 的 `dsh.bundle.patch` 字段存在。
|
|
32
|
+
|
|
33
|
+
### 从旧版 0.1.0 迁移
|
|
34
|
+
|
|
35
|
+
若此前已误装 `0.1.0`(表现为 `dsh.profile.bundles` 未新增 `token-gauge` 层,并出现 `declares no dsh.bundle — installed as a plain dependency` 警告),按下面两步切换即可,无需手动改 bundles:
|
|
36
|
+
```bash
|
|
37
|
+
dsh plugin --profile web remove dsh-token-gauge
|
|
38
|
+
dsh plugin --profile web add dsh-token-gauge@0.1.1 # 钉版本,避免又解析回 0.1.0
|
|
39
|
+
```
|
|
40
|
+
装完后 `dsh.profile.bundles` 在 reconcile 时自动把 `token-gauge` 加为第 13 层,重启 `dsh web` 侧边栏即出现「Token 仪表盘」。
|
|
29
41
|
|
|
30
42
|
### 方式二:本地源码安装
|
|
31
43
|
```bash
|
|
@@ -44,6 +56,14 @@ dsh web --patch ./cordis.patch.yml
|
|
|
44
56
|
|
|
45
57
|
安装后重启/硬刷新 DSH Web,侧边栏出现「Token 仪表盘」Tab。开始对话产生 Token 后,仪表盘即实时更新。
|
|
46
58
|
|
|
59
|
+
### 排查:侧边栏 Tab 不出现
|
|
60
|
+
|
|
61
|
+
DSH 把插件拆成 host(Node 端)与 client(浏览器端)两半,走不同机制。若装好却看不到 Tab,可分别验证:
|
|
62
|
+
|
|
63
|
+
- **host 半边是否正常**:浏览器访问 `http://<dsh-host>/plugins/dsh-token-gauge/state` 应返回 200 + 状态 JSON,且 `~/.dsh-token-gauge/` 目录已生成。host 不工作通常是 bundle 层没挂上(`dsh.profile.bundles` 缺 `token-gauge`)。
|
|
64
|
+
- **client 半边是否正常**:访问 `/plugins/dsh-token-gauge/client.js` 应返回 200(打包后的客户端脚本);首页 `window.__DSH_BOOT__` 里应包含该 client。若此处 404,常见原因是 `package.json` 的 `exports` 未导出 `./package.json`——DSH 的 client 加载器用 `require.resolve('<包名>/package.json')` 定位 client 包,缺少该子路径导出会被静默判为「非 client 包」且(进程内)缓存。**本包已显式导出 `"./package.json"`,如遇此问题请确认装的是 0.1.2+**。
|
|
65
|
+
- 改动后务必**完整重启 `dsh web`**(进程内 client 缓存只在重启时清空),仅硬刷新不够。
|
|
66
|
+
|
|
47
67
|
## 数据来源与费用口径
|
|
48
68
|
|
|
49
69
|
- **数据源**:Host 半边订阅 DSH 会话事件流中的 `assistant/message.usage`(含输入/输出/缓存命中/缓存写入 token),自行累计,不依赖其他插件。
|
|
@@ -69,7 +89,7 @@ dsh web --patch ./cordis.patch.yml
|
|
|
69
89
|
|
|
70
90
|
```
|
|
71
91
|
dsh-token-gauge/
|
|
72
|
-
├── package.json # dsh 字段声明
|
|
92
|
+
├── package.json # dsh 字段声明 bundle.patch 契约 + client.inject(稳定版 0.1.1-rc.x 兼容)
|
|
73
93
|
├── tsconfig.json
|
|
74
94
|
├── build.mjs # esbuild 构建脚本
|
|
75
95
|
├── cordis.patch.yml # 本地 overlay
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-token-gauge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "DSH 机车风格 Token 用量/费用仪表盘侧边栏插件(稳定版 0.1.1-rc.x 兼容)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.mjs",
|
|
7
7
|
"module": "lib/index.mjs",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./lib/index.mjs",
|
|
10
|
-
"./client": "./lib/client.mjs"
|
|
10
|
+
"./client": "./lib/client.mjs",
|
|
11
|
+
"./package.json": "./package.json"
|
|
11
12
|
},
|
|
12
13
|
"files": [
|
|
13
14
|
"lib/index.mjs",
|