dsh-tokenlens 1.3.0 → 1.3.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.
- package/CHANGELOG.md +33 -79
- package/PROTOCOL.md +9 -9
- package/README.en.md +6 -6
- package/README.md +7 -7
- package/client.js +86 -47
- package/index.js +4 -4
- package/lib/provider-store.mjs +5 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,105 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
本项目遵循 [Semantic Versioning](https://semver.org/):修复 = PATCH,新功能 = MINOR,不兼容变更 = MAJOR。发布时同步更新 `package.json` 的 `version`、`index.js` 的 `PLUGIN_VERSION` 与本文件(`node scripts/bump-version.mjs <version> "<note>"
|
|
3
|
+
本项目遵循 [Semantic Versioning](https://semver.org/):修复 = PATCH,新功能 = MINOR,不兼容变更 = MAJOR。发布时同步更新 `package.json` 的 `version`、`index.js` 的 `PLUGIN_VERSION` 与本文件(`node scripts/bump-version.mjs <version> "<note>"`)。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**版本记录约定**:同一发布日只保留一个章节,标题取当日**最后一个**已发布版本号;当日多次发布的改动合并到该章节,并在标题下注明当日实际发布过的版本号(npm 上仍可安装这些独立版本)。若当日已有发布,后续小改动不再单独增加版本号,而是并入下一篇日志。这样日志按天规整、不出现同日多个小版本。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- feat(update): 供应商管理页「插件设置」新增「更新检查」块——开关、隐私提示、状态行(尚未检查 / 正在检查 / 已是最新 / 发现新版本 / 检查失败可重试)与「立即检查」;详情弹窗底部在发现新版本时显示一行「发现新版本 vX · 打开 npm」(链接到 npm 包页)
|
|
9
|
-
- feat(wire): `hello` 与 `providers` 载荷新增 `update`(`UpdateInfo`)与 `updatePackageUrl`;`settingsUpdate` 新增 `settings.updateCheck`;新增 bridge action `updateCheck`(Agent 工具同步支持)
|
|
10
|
-
- fix(update): 并发检查单飞(共享同一次在途请求);仅在开关从关→开时触发检查,已开启时保存其它显示设置不会重复请求 npm
|
|
11
|
-
- 测试:277 个自动化用例(新增 Host 版本比较/检查/设置/并发与客户端 UI 回归)
|
|
7
|
+
## 1.3.1 — 2026-11-01
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
(当日已发布版本:v1.2.2 / v1.3.0 / v1.3.1)
|
|
14
10
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
11
|
+
- feat(update): 「启动时检查更新」改为**默认开启**(可在插件设置关闭);启动时向 npm registry 查询一次 latest 版本号,不携带凭据 / 账号 / 用量,失败只记录错误、不阻塞启动
|
|
12
|
+
- feat(ui): 详情弹窗(统计首页)右下角的**插件版本处**显示更新状态——有新版本时显示「有新版本 vX」并可点击打开 npm;无新版本时显示「已是最新版本」;检查失败或关闭检查时不显示
|
|
13
|
+
- feat(update): 供应商管理页「插件设置 → 更新检查」保留开关、隐私提示、状态行(尚未检查 / 正在检查 / 已是最新 / 发现新版本 / 检查失败可重试)与「立即检查」;并发检查单飞,仅在开关关→开时补查
|
|
14
|
+
- feat(wire): `hello` / `providers` 携带 `update`(`UpdateInfo`)与 `updatePackageUrl`;`settings.updateCheck` 默认 `true`;新增 bridge action `updateCheck`(Agent 工具同步支持)
|
|
15
|
+
- fix(workspaces): 修复「工作区悬浮卡片不显示 Token 明细」——Host 裁剪本地路径时把 `path` 误删成空串,默认工作区等「界面标题 ≠ 统计标签」的场景匹配失败;现只下发文件夹名 basename,客户端标题匹配大小写不敏感并兼容旧 Host
|
|
16
|
+
- docs: README 增加「用 `link:` 安装的插件不要从插件市场重复安装/升级」的 Windows pnpm EPERM 排错说明;CHANGELOG 改为按发布日合并
|
|
17
|
+
- 测试:278 个自动化用例(版本比较/检查/并发、设置开关、状态行、图表下钻与窗口、工作区 wire 回归)
|
|
19
18
|
|
|
20
19
|
## 1.2.1 — 2026-10-31
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
- feat(wire): `providers` 载荷与 `settingsUpdate` 增加 `settings.detailsWindow`(`today|last7Days|second|total`),旧 Host 会忽略未知字段、旧 client 读取时回落 `total`,双向兼容
|
|
24
|
-
- 修复:请求进行中连续点击窗口时只保留最后一个选择(单定时器 200ms 重试);「恢复默认设置」同时把窗口重置为总计
|
|
25
|
-
- 测试:255 个自动化用例(新增 5 个持久化回归,更新 8 个既有设置/窗口用例)
|
|
21
|
+
(当日已发布版本:v1.2.0 / v1.2.1)
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- feat(chart): 图表模式点击某一天的柱子可下钻查看**当天 24 小时**的 Token 消耗棒状图(横轴 00:00–23:00,悬浮显示小时与占比,回车/空格同样可操作,返回或再次点击回到日趋势)
|
|
23
|
+
- feat(chart): 图表模式点击某一天的柱子可下钻查看**当天 24 小时**的 Token 消耗(横轴 00:00–23:00,悬浮显示小时与占比,回车/空格可操作,返回或再次点击回到日趋势)
|
|
30
24
|
- feat(chart): 小时数据覆盖全部 5 个本机 harness(DSH、ZCode、OpenCode CLI、WorkBuddy、Qoder);无小时数据的旧日期不可下钻,不伪造全零序列
|
|
31
|
-
- feat(chart):
|
|
32
|
-
- feat(
|
|
33
|
-
-
|
|
25
|
+
- feat(chart): 明细三张环形图(按 Harness / 按供应商 / Top 模型)支持 **今日 / 最近7天 / 最近X天(或最近30天)/ 总计** 窗口切换,默认总计,缺失窗口自动隐藏
|
|
26
|
+
- feat(settings): 明细窗口选择持久化到插件设置——点击 pill 立即保存,重开弹窗、切换供应商或重启 DSH 后仍保留,窗口不可用时回落到总计
|
|
27
|
+
- feat(wire): `stats.daily[]` 新增 `hours` 与 `providers[pid].hours`(24 个本地小时 Token 整数);`settings.detailsWindow`
|
|
28
|
+
- 修复:请求进行中连续点击窗口只保留最后一次选择(单定时器 200ms 重试);「恢复默认设置」同时把窗口重置为总计
|
|
29
|
+
- 测试:250 → 255(小时聚合、外部 harness 小时分组、下钻交互、窗口切换与持久化回归)
|
|
34
30
|
|
|
35
31
|
## 1.1.0 — 2026-10-30
|
|
36
32
|
|
|
37
33
|
- feat(providers): 接入 Open Design(OpenDesign)只读额度查询——Design Plan 的 5 小时 / 7 天窗口已用百分比与重置时间,以及独立的钱包 USD 余额
|
|
38
34
|
- feat(providers): Open Design 使用工作区 `workspaceId` + Control Key(`OPENDESIGN_CONTROL_KEY` / `VELA_CONTROL_KEY`)鉴权;推理 API Key 不能查询计费接口
|
|
39
|
-
- feat(ui): `windows`
|
|
35
|
+
- feat(ui): `windows` 快照可附带钱包余额——详情弹窗在额度窗口下方多一行「账户余额」,chip 悬浮提示追加金额
|
|
40
36
|
- docs: 中英 README 与 PROTOCOL 补充 Open Design;说明其余仅元数据供应商没有可用 API Key 查询的公开用量接口(千问/百炼额度仅官方 CLI 可查,腾讯混元/百度千帆只有云账户余额 API)
|
|
41
37
|
|
|
42
38
|
## 1.0.9 — 2026-10-29
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## 1.0.8 — 2026-10-29
|
|
47
|
-
|
|
48
|
-
- fix(release): npm registry 发布延迟时索引更新回退到 PUBLISH_TIMESTAMP;补录 1.0.7 到市场索引
|
|
49
|
-
|
|
50
|
-
## 1.0.7 — 2026-10-29
|
|
51
|
-
|
|
52
|
-
- ci: 发布改用 npm Trusted Publishing(OIDC),不再依赖仓库令牌;docs: 归并 1.0.0 之前版本历史并修订文档措辞
|
|
53
|
-
|
|
54
|
-
## 1.0.6 — 2026-10-29
|
|
55
|
-
|
|
56
|
-
- fix(market): 发布后等待 npm registry 同步再写索引(自动重试);索引补录 1.0.5
|
|
57
|
-
|
|
58
|
-
## 1.0.5 — 2026-10-29
|
|
59
|
-
|
|
60
|
-
- feat(market): 提供 DSH 插件市场索引(market/index.json + icon)并支持发布后自动同步;README 增加从 DSH 市场安装的说明
|
|
61
|
-
|
|
62
|
-
## 1.0.4 — 2026-10-29
|
|
63
|
-
|
|
64
|
-
- chore: 插件市场元数据(dsh-plugin 关键词、engines.dsh)与 GitHub 源安装说明
|
|
65
|
-
|
|
66
|
-
## 1.0.3 — 2026-10-29
|
|
40
|
+
(当日已发布版本:v1.0.3 / v1.0.4 / v1.0.5 / v1.0.6 / v1.0.7 / v1.0.8 / v1.0.9)
|
|
67
41
|
|
|
42
|
+
- feat(market): 提供 DSH 插件市场索引(`market/index.json` + icon)并支持发布后自动同步;README 增加从 DSH 市场安装的说明
|
|
43
|
+
- feat: 插件市场元数据(`dsh-plugin` 关键词、`engines.dsh`)与 GitHub 源安装说明
|
|
68
44
|
- fix(stats): 逐帧解压 zstd,兼容 Node >= 24.22(尾部撕裂帧不再拖垮整份日志,修复 CI 三平台失败)
|
|
45
|
+
- fix(market): 发布后等待 npm registry 同步再写索引(自动重试,`PUBLISH_TIMESTAMP` 回退);补录历史版本到索引
|
|
46
|
+
- ci: 发布改用 npm Trusted Publishing(OIDC),不再依赖仓库令牌;GitHub Actions 升级到 v7
|
|
47
|
+
- docs: 归并 1.0.0 之前版本历史并修订文档措辞
|
|
69
48
|
|
|
70
49
|
## 1.0.2 — 2026-10-28
|
|
71
50
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
## 1.0.1 — 2026-10-28
|
|
75
|
-
|
|
76
|
-
- fix(privacy): 状态文件/诊断/管理页路径脱敏(~)、状态文件 0600、网络错误 URL 去凭据/查询串;匿名化测试 fixture 与公共文档中的个人邮箱;工作区统计 tick 增加隐藏页保护;新增 redact 单测与网络错误回归测试
|
|
77
|
-
|
|
78
|
-
## 1.0.0 — 2026-10-28
|
|
79
|
-
|
|
80
|
-
首个公开版本:插件定名 **dsh-TokenLens · 词元透镜**,技术包名与内部标识统一为 `dsh-tokenlens` / `tokenlens`,以 MIT 许可开源。本版本合并了此前 0.1.0–0.36.3 的全部开发历史:
|
|
81
|
-
|
|
82
|
-
**供应商与套餐容量**
|
|
83
|
-
|
|
84
|
-
- OpenCode(Go 套餐的 5 小时 / 本周 / 本月窗口)、Command Code(美元额度与方案)、DeepSeek 余额、DeepSeek Account 钱包、OpenRouter、Moonshot / Kimi、SiliconFlow、StepFun、Novita、Hyperbolic、DeepInfra、Z.ai GLM Coding Plan、MiniMax Coding Plan;随后接入智谱 AI 国内版与火山引擎 Coding / Agent Plan
|
|
85
|
-
- 内置供应商元数据池扩充到 25 家(商汤 SenseNova、通义千问、百度千帆、腾讯混元、讯飞星火、零一万物、百川智能、Intern AI、Agnes AI、Open Design 等)
|
|
86
|
-
- 按 DSH 模型设置自动发现路由、自动匹配用量接口并继承凭据;支持短标签 / 全名、启用开关、订阅徽章与控制台链接
|
|
87
|
-
|
|
88
|
-
**本机 Token 统计**
|
|
89
|
-
|
|
90
|
-
- 接入 5 个 harness:DSH 会话日志(zstd 逐帧解码、seed 前缀与重试口径)、ZCode(只读 SQLite)、OpenCode CLI、WorkBuddy / CodeBuddy CLI、Qoder CN CLI
|
|
91
|
-
- 跨 harness 按供应商合并(alias、同 id、vendor-namespaced 模型唯一匹配),无法映射的供应商单列
|
|
92
|
-
- 窗口:今日 / 最近 7 天 / 最近 30 天 / 总计、订阅供应商的「最近 X 天」、滚动 5 小时;按 Harness / 供应商 / Top 模型 / 工作区拆分
|
|
93
|
-
- 工作区 Token 徽标与悬浮卡片
|
|
94
|
-
|
|
95
|
-
**界面**
|
|
96
|
-
|
|
97
|
-
- 输入框下方的用量 chip(跟随当前供应商)与详情弹窗:套餐容量、本机 Token 两套口径分区展示
|
|
98
|
-
- 数据 / 图表两种模式:每日趋势柱状图(坐标轴、悬浮读数)、环形占比图、明细表格
|
|
99
|
-
- 供应商管理页(已配置 / 内置 / 全部、凭据状态、短标签编辑、测试连接)与插件设置页;深色主题与窄屏适配
|
|
100
|
-
|
|
101
|
-
**工程**
|
|
51
|
+
(当日已发布版本:v1.0.0 / v1.0.1 / v1.0.2)
|
|
102
52
|
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
53
|
+
- fix(security+privacy): 安全 / 隐私审计加固——OpenCode key 作用域、工作区徽标观察器循环、缓存 canonical、统计路径与自由文本脱敏、baseURL HTTPS 校验、effective-day 全历史、原型污染防护、WorkBuddy 去重、0600 原子写、DST 窗口、控制台链接、管理页滚动;截图脱敏(账号 / 本机路径)
|
|
54
|
+
- fix(privacy): 状态文件 / 诊断 / 管理页路径脱敏(`~`)、状态文件 0600、网络错误 URL 去凭据 / 查询串;测试 fixture 与公开文档去除个人邮箱
|
|
55
|
+
- 首个公开版本(v1.0.0):插件定名 **dsh-TokenLens · 词元透镜**,包名与内部标识统一为 `dsh-tokenlens` / `tokenlens`,以 MIT 许可开源;本版本合并了此前 0.1.0–0.36.3 的全部开发历史:
|
|
56
|
+
- **供应商与套餐容量**:OpenCode(Go 套餐窗口)、Command Code、DeepSeek / DeepSeek Account、OpenRouter、Moonshot / Kimi、SiliconFlow、StepFun、Novita、Hyperbolic、DeepInfra、Z.ai GLM、MiniMax、智谱国内版、火山引擎 Coding / Agent Plan;内置 25 家供应商元数据池;按 DSH 模型设置自动发现路由并继承凭据
|
|
57
|
+
- **本机 Token 统计**:接入 5 个 harness(DSH、ZCode、OpenCode CLI、WorkBuddy / CodeBuddy CLI、Qoder CN CLI);跨 harness 按供应商合并;窗口 今日 / 最近 7 天 / 最近 30 天 / 总计 与订阅供应商「最近 X 天」、滚动 5 小时;按 Harness / 供应商 / Top 模型 / 工作区拆分
|
|
58
|
+
- **界面**:输入框下方用量 chip(跟随当前供应商)与详情弹窗(套餐容量 vs 本机 Token 分区)、数据 / 图表两种模式、供应商管理页与插件设置页
|
|
59
|
+
- **工程**:Host ↔ Client bridge 协议 v3、`planUsage` 服务、`tokenlens_usage` Agent 工具、配置覆盖、统计缓存、诊断与状态文件、231 个自动化测试、零运行时依赖、Node ≥ 24
|
package/PROTOCOL.md
CHANGED
|
@@ -335,17 +335,17 @@ The dialog 「供应商管理」 page talks to three additional actions:
|
|
|
335
335
|
saves enabled/consoleUrl/label/shortLabel. Overrides are persisted atomically to
|
|
336
336
|
`$DSH_HOME/dsh-tokenlens/providers.json` (plugin-owned, not the profile patch); the same file also
|
|
337
337
|
- `{action:"providerTest", providerId}` → the normal snapshot envelope (`{ok,snapshot}` or `{ok:false,error}`), forcing one upstream read.
|
|
338
|
-
- `{action:"settingsUpdate", settings:{labelStyle?:"short"|"full", defaultView?:"chart"|"data", defaultScope?:"provider"|"all", detailsExpanded?:"auto"|"expanded"|"collapsed", detailsWindow?:"today"|"last7Days"|"second"|"total", updateCheck?:boolean}}` → the same providers payload; every field is optional and persisted in the store (`settings.*`). `labelStyle` controls whether the composer chip shows each provider's `shortLabel` or full `label`; `defaultView` / `defaultScope` / `detailsExpanded` are the usage-dialog defaults; `detailsWindow` (v1.2.1) is the remembered 明细 donut window (falls back visually to `total` when that window is unavailable on the current provider/host); `updateCheck` (v1.3.0, default `
|
|
338
|
+
- `{action:"settingsUpdate", settings:{labelStyle?:"short"|"full", defaultView?:"chart"|"data", defaultScope?:"provider"|"all", detailsExpanded?:"auto"|"expanded"|"collapsed", detailsWindow?:"today"|"last7Days"|"second"|"total", updateCheck?:boolean}}` → the same providers payload; every field is optional and persisted in the store (`settings.*`). `labelStyle` controls whether the composer chip shows each provider's `shortLabel` or full `label`; `defaultView` / `defaultScope` / `detailsExpanded` are the usage-dialog defaults; `detailsWindow` (v1.2.1) is the remembered 明细 donut window (falls back visually to `total` when that window is unavailable on the current provider/host); `updateCheck` (v1.3.0, default `true` since v1.3.1) enables the startup update check — the off→on transition runs one check immediately. Invalid values answer `unsupported-provider`.
|
|
339
339
|
|
|
340
|
-
###
|
|
340
|
+
### Update check (v1.3.0, on by default since v1.3.1)
|
|
341
341
|
|
|
342
|
-
|
|
343
|
-
`
|
|
344
|
-
`
|
|
345
|
-
|
|
346
|
-
checks are single-flight (one registry request shared by
|
|
347
|
-
but the request itself leaves the machine — no
|
|
348
|
-
usage data.
|
|
342
|
+
On by default: at activation the Host makes one HTTPS `GET` to the fixed endpoint
|
|
343
|
+
`https://registry.npmjs.org/dsh-tokenlens/latest`; the same request also runs on
|
|
344
|
+
the off→on transition of `settings.updateCheck` and on the `updateCheck` action.
|
|
345
|
+
Users can switch it off (`settings.updateCheck: false`) to keep the plugin fully
|
|
346
|
+
local-only. Concurrent checks are single-flight (one registry request shared by
|
|
347
|
+
every caller). Nothing but the request itself leaves the machine — no
|
|
348
|
+
credentials, identifiers or usage data.
|
|
349
349
|
|
|
350
350
|
```jsonc
|
|
351
351
|
// UpdateInfo (host → client)
|
package/README.en.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
> One glance at your usage: plan capacity for the selected provider plus local token statistics across harnesses, right below the DSH composer.
|
|
11
11
|
|
|
12
|
-
**dsh-TokenLens** is a usage plugin for DSH (DeepSeek Harness), version v1.3.
|
|
12
|
+
**dsh-TokenLens** is a usage plugin for DSH (DeepSeek Harness), version v1.3.1. It keeps two kinds of numbers separate:
|
|
13
13
|
|
|
14
14
|
- **Plan capacity** — the provider's authoritative server-side values (percentage windows, used / cap, balance or remaining credit);
|
|
15
15
|
- **Local token stats** — tokens consumed on this machine across every connected harness, for the selected provider or for all providers combined.
|
|
@@ -21,7 +21,7 @@ Everything is computed locally: zero runtime dependencies, no external database,
|
|
|
21
21
|
- **Usage chip below the composer** — follows the selected model provider and shows its plan capacity; providers without an adapter or credentials stay hidden.
|
|
22
22
|
- **Details dialog** — plan capacity windows with reset times (plus an optional "consumed · estimated consumable" hint) and local token stats for today / last 7 days / last 30 days / all-time, scoped to the current provider or all harnesses.
|
|
23
23
|
- **Data and chart modes** — tables, a daily trend chart and ring charts with breakdowns by harness, provider, top model and unmapped providers. In chart mode, clicking a day's bar drills into that day's 24 hourly bars; the 明细 rings switch between today / last 7 days / last X days (or last 30 days) / all time.
|
|
24
|
-
- **Provider management page** — enabled / built-in / all filters, enable switches, credential status, console links, label editing, connection tests, subscription badges and plugin settings (label style, default view/scope, details expansion, default 明细 donut window,
|
|
24
|
+
- **Provider management page** — enabled / built-in / all filters, enable switches, credential status, console links, label editing, connection tests, subscription badges and plugin settings (label style, default view/scope, details expansion, default 明细 donut window, startup update check — on by default — with a "check now" action).
|
|
25
25
|
- **Auto-discovery and agent tool** — providers configured in DSH Settings → Model Services are detected by route id or base-URL host and reuse their DSH credentials; `tokenlens_usage` lets the model query snapshots, local stats and diagnostics.
|
|
26
26
|
- **Local-only** — 5 harnesses (DSH, ZCode, OpenCode CLI, WorkBuddy / CodeBuddy CLI, Qoder CN CLI), 25 built-in providers (16 with plan / balance adapters), read-only local data, no telemetry.
|
|
27
27
|
|
|
@@ -66,7 +66,7 @@ dsh plugin --profile <profile> add dsh-tokenlens
|
|
|
66
66
|
Then make sure `dsh.profile.bundles` in `$DSH_HOME/profiles/<profile>/package.json` contains `"dsh-tokenlens"`:
|
|
67
67
|
|
|
68
68
|
```jsonc
|
|
69
|
-
{ "dependencies": { "dsh-tokenlens": "^1.3.
|
|
69
|
+
{ "dependencies": { "dsh-tokenlens": "^1.3.1" },
|
|
70
70
|
"dsh": { "profile": { "bundles": ["…", "dsh-tokenlens"] } } }
|
|
71
71
|
```
|
|
72
72
|
|
|
@@ -123,7 +123,7 @@ Host bridge route: `/api/tokenlens`; agent tool: `tokenlens_usage`.
|
|
|
123
123
|
|
|
124
124
|
- **Read-only**: only local session logs and harness databases are read; SQLite is opened read-only and only token counters, timestamps and provider / model fields are queried — never message contents.
|
|
125
125
|
- **Keys stay local**: API keys are resolved in the Host process from DSH credentials, environment variables or the DSH credentials file, and are sent only to the matching provider's official HTTPS endpoint. They are never exposed to the browser, logged or included in diagnostics.
|
|
126
|
-
- **No telemetry**: nothing is collected, uploaded, or fetched from remote config / CDN sources (icons are inline SVG). The only
|
|
126
|
+
- **No telemetry**: nothing is collected, uploaded, or fetched from remote config / CDN sources (icons are inline SVG). The only outbound request is the startup update check (introduced in v1.3.0, on by default since v1.3.1 and switchable off): it asks the npm registry once for the published version number, without credentials, identifiers or usage data.
|
|
127
127
|
- **Owner-only data**: management overrides are written atomically to `$DSH_HOME/dsh-tokenlens/providers.json` with owner-only permissions; DSH model settings are never modified.
|
|
128
128
|
|
|
129
129
|
## Limitations
|
|
@@ -131,13 +131,13 @@ Host bridge route: `/api/tokenlens`; agent tool: `tokenlens_usage`.
|
|
|
131
131
|
- Provider usage endpoints are mostly private / undocumented and may change at any time; the plugin degrades gracefully (retryable errors, hidden chips, per-row fallbacks) but availability is not guaranteed.
|
|
132
132
|
- Plan capacity shows native server values only: no token → money conversion; Command Code monthly percentage is not guessed when no grant is reported.
|
|
133
133
|
- "Estimated consumable" is derived from local tokens and the plan percentage; it is only a hint, not a provider commitment.
|
|
134
|
-
- The startup update check compares the **latest npm release** only
|
|
134
|
+
- The startup update check is on by default (switchable off) and compares the **latest npm release** only; commits on the GitHub repository are not detected — a git-installed plugin must be uninstalled and reinstalled to update.
|
|
135
135
|
- Local stats cover connected harnesses on this machine only; uninstalled harnesses are hidden by default (`stats.showUninstalled: true` shows them). Workspace token badges are experimental.
|
|
136
136
|
- **Trademarks**: OpenCode, Command Code, DeepSeek, ZCode, WorkBuddy, CodeBuddy, Qoder and other names are trademarks of their respective owners. This is an independent third-party project, not affiliated with or endorsed by them.
|
|
137
137
|
|
|
138
138
|
## Development
|
|
139
139
|
|
|
140
|
-
Node.js ≥ 24, zero runtime dependencies: `node --test` runs the
|
|
140
|
+
Node.js ≥ 24, zero runtime dependencies: `node --test` runs the 278 tests.
|
|
141
141
|
|
|
142
142
|
Release: `node scripts/bump-version.mjs <version> "<note>"` updates `package.json`, `PLUGIN_VERSION` and `CHANGELOG.md`; see [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
|
|
143
143
|
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
> **一眼看清你的用量**:在 DSH 输入框下方显示当前供应商的套餐容量,并汇总本机跨 Harness 的 Token 消耗。
|
|
11
11
|
|
|
12
|
-
**dsh-TokenLens(词元透镜)** 是 DSH(DeepSeek Harness)的用量插件(v1.3.
|
|
12
|
+
**dsh-TokenLens(词元透镜)** 是 DSH(DeepSeek Harness)的用量插件(v1.3.1,公开版本)。它把两类数字**按不同口径**分开呈现:
|
|
13
13
|
|
|
14
14
|
- **套餐容量**(供应商服务端权威值):百分比窗口、`已用 / 上限`、账户余额或剩余额度;
|
|
15
15
|
- **本机 Token 统计**(本机记录):当前供应商在本机所有已接入 Harness 上的合计用量,也可切到「全部 Harness」看总账。
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
- **本机 Token 统计**:今日 / 最近 7 天 / 最近 30 天 / 总计(订阅类供应商显示「最近 X 天」生效窗口),可按「当前供应商 · 全部 Harness」与「全部 Harness」两个视角查看。
|
|
42
42
|
- **明细与图表**:按 Harness、按供应商、Top 模型、未映射供应商分组;支持「数据」(表格)与「图表」两种模式切换。图表模式里点击某一天的柱子可下钻查看**当天 24 小时**的 Token 消耗,底部「明细」环形图支持 **今日 / 最近 7 天 / 最近 X 天(或最近 30 天)/ 总计** 窗口切换。
|
|
43
43
|
- **工作区徽标**(实验性):左侧工作区列表的名称旁显示该工作区的本机 Token 合计,悬浮卡片显示今日 / 7 天 / 30 天 / 总计;纯展示,找不到对应 UI 时自动降级。
|
|
44
|
-
- **供应商管理页**:「已配置 / 内置 / 全部」筛选、启用开关、凭据状态、控制台链接、短标签与全名编辑、测试连接、已订阅徽章;另有「插件设置」可配置标签样式、默认展示模式、默认统计范围、明细展开状态、图表「明细」环形图的默认窗口(今日 / 最近 7 天 / 最近 X 天 /
|
|
44
|
+
- **供应商管理页**:「已配置 / 内置 / 全部」筛选、启用开关、凭据状态、控制台链接、短标签与全名编辑、测试连接、已订阅徽章;另有「插件设置」可配置标签样式、默认展示模式、默认统计范围、明细展开状态、图表「明细」环形图的默认窗口(今日 / 最近 7 天 / 最近 X 天 / 总计,记住上次选择)与「启动时检查更新」(默认开启,可关闭,也可手动立即检查)。
|
|
45
45
|
- **自动识别**:在 DSH「设置 → 模型服务」中配置过的供应商会自动出现在管理页,并按路由 id 或 baseURL 主机匹配内置用量适配器,自动继承 DSH 中的凭据,无需重复填写。
|
|
46
46
|
- **Agent 工具**:注册 `tokenlens_usage`,模型可以自行查询套餐容量与本机用量。
|
|
47
47
|
|
|
@@ -106,7 +106,7 @@ dsh plugin --profile <profile> add dsh-tokenlens
|
|
|
106
106
|
```jsonc
|
|
107
107
|
{
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"dsh-tokenlens": "^1.3.
|
|
109
|
+
"dsh-tokenlens": "^1.3.1"
|
|
110
110
|
},
|
|
111
111
|
"dsh": {
|
|
112
112
|
"profile": {
|
|
@@ -371,7 +371,7 @@ Host 半注册 `tokenlens_usage`,参数 `action`(默认 `snapshot`)与可
|
|
|
371
371
|
|
|
372
372
|
- **只读**:插件只读取本机会话日志与各 harness 的本地数据库 / JSONL;SQLite 一律以只读方式打开,只取 token 计数、时间、provider / model 等字段,不读取对话正文。
|
|
373
373
|
- **凭据不出本机**:API Key 只在 Host 进程内从 DSH 凭据服务 / 环境变量 / `.credentials.yaml` / OpenCode CLI 登录文件解析,只发往对应供应商的官方 HTTPS 接口;不下发浏览器、不写日志、不进诊断输出。
|
|
374
|
-
- **无遥测**:插件不收集、不上传任何使用数据,不请求远程配置或 CDN 资源(图标均为内联 SVG
|
|
374
|
+
- **无遥测**:插件不收集、不上传任何使用数据,不请求远程配置或 CDN 资源(图标均为内联 SVG)。唯一的外网请求是「启动时检查更新」(v1.3.0 引入,v1.3.1 起默认开启,可在插件设置关闭):仅向 npm registry 查询一次最新版本号,不携带任何账号、凭据或用量信息。
|
|
375
375
|
- **覆盖文件仅本人可读**:供应商管理页的覆盖写入 `$DSH_HOME/dsh-tokenlens/providers.json`(原子写入,权限仅当前用户),不会改动 DSH 模型设置或 profile patch。
|
|
376
376
|
- **可控降级**:上游接口不可用时只影响对应 chip / 行,不影响 DSH 本身;`enabled: false` 可整体停用插件。
|
|
377
377
|
|
|
@@ -380,7 +380,7 @@ Host 半注册 `tokenlens_usage`,参数 `action`(默认 `snapshot`)与可
|
|
|
380
380
|
- 各供应商的用量接口多为**未公开的私有接口**,可能随时变更;插件对此做了优雅降级(可重试错误、静默隐藏、行级降级),但不保证长期可用。
|
|
381
381
|
- 套餐容量只显示服务端原生数字:不做 token → 金额换算;Command Code 未报告 grant 时不计算月度百分比。
|
|
382
382
|
- 「预计可消耗」是基于本机 Token 与套餐百分比的**估算**,仅供参考,不代表供应商承诺的额度。
|
|
383
|
-
-
|
|
383
|
+
- 「启动时检查更新」默认开启(可在插件设置关闭),只对比 **npm 上的最新发布版本**;GitHub 仓库的提交更新不会被感知,需要卸载重装 git 安装的版本才会更新。
|
|
384
384
|
- 本机 Token 统计只覆盖**已接入 harness**(当前 DSH / ZCode / OpenCode CLI / WorkBuddy / Qoder CN),只统计本机的本地记录。
|
|
385
385
|
- Harness 卸载后其数据目录消失即判定为未安装,默认从弹窗隐藏(可用 `stats.showUninstalled: true` 显示「未安装」行);数据目录仍在磁盘时按历史记录继续计入。
|
|
386
386
|
- ZCode 数据库通常很大且持续写入:插件只做聚合查询并缓存结果,数据库被锁时会短暂显示不可用。
|
|
@@ -392,7 +392,7 @@ Host 半注册 `tokenlens_usage`,参数 `action`(默认 `snapshot`)与可
|
|
|
392
392
|
|
|
393
393
|
## 验证
|
|
394
394
|
|
|
395
|
-
- `node --test`:**
|
|
395
|
+
- `node --test`:**278 个自动化用例**,覆盖 Host 数据层、供应商适配器、统计折叠、各 harness 读取、插件集成与浏览器端渲染 / 交互。
|
|
396
396
|
- 在真实环境中验证过 **5 个 harness** 的数据源;本机统计与独立的 SQLite 查询、独立的日志解析逐项对账(差额为 0),跨 harness 合并与供应商映射算术自洽。
|
|
397
397
|
- 供应商接口按各官方文档与参考客户端行为验证;未配置凭据时 chip 静默隐藏,接口异常时按可重试错误降级。
|
|
398
398
|
|
|
@@ -403,7 +403,7 @@ Host 半注册 `tokenlens_usage`,参数 `action`(默认 `snapshot`)与可
|
|
|
403
403
|
```powershell
|
|
404
404
|
git clone https://github.com/daigahou/dsh-tokenlens.git
|
|
405
405
|
cd dsh-tokenlens
|
|
406
|
-
node --test #
|
|
406
|
+
node --test # 278 个用例
|
|
407
407
|
```
|
|
408
408
|
|
|
409
409
|
本地联调安装方式见[方式 C](#方式-c本地开发从源码-link)。
|
package/client.js
CHANGED
|
@@ -145,9 +145,10 @@ window.__ModuleLoader__.load({
|
|
|
145
145
|
defaultScope: 'provider',
|
|
146
146
|
detailsExpanded: 'auto',
|
|
147
147
|
detailsWindow: 'total',
|
|
148
|
-
// 「启动时检查更新」 is persisted too
|
|
149
|
-
//
|
|
150
|
-
|
|
148
|
+
// 「启动时检查更新」 is persisted too. ON by default (v1.3.1) so users learn
|
|
149
|
+
// about new releases; switching it off keeps the plugin fully local-only.
|
|
150
|
+
// Every other value (an old Host omitting the field included) means ON.
|
|
151
|
+
updateCheck: true,
|
|
151
152
|
}
|
|
152
153
|
/** The npm package page the 「打开 npm」 update links point at. */
|
|
153
154
|
const NPM_PACKAGE_URL = 'https://www.npmjs.com/package/dsh-tokenlens'
|
|
@@ -354,7 +355,7 @@ window.__ModuleLoader__.load({
|
|
|
354
355
|
settingsResetDefaults: '恢复默认设置',
|
|
355
356
|
settingsResetDefaultsHint: '恢复为插件默认的显示设置',
|
|
356
357
|
updateCheckLabel: '启动时检查更新',
|
|
357
|
-
updateCheckHint: '
|
|
358
|
+
updateCheckHint: '默认开启:开启时访问 npm registry 检查新版本;关闭后插件完全本地运行',
|
|
358
359
|
updateCheckOff: '关闭',
|
|
359
360
|
updateCheckOn: '开启',
|
|
360
361
|
updateChecking: '正在检查…',
|
|
@@ -364,6 +365,11 @@ window.__ModuleLoader__.load({
|
|
|
364
365
|
updateCheckNow: '立即检查',
|
|
365
366
|
updateCheckNever: '尚未检查',
|
|
366
367
|
updateOpenNpm: '打开 npm',
|
|
368
|
+
// The update status now lives on the plugin-version line of the dialog
|
|
369
|
+
// body (footer line removed); these two key the version-line suffix.
|
|
370
|
+
updateVersionNew: '有新版本 v{latest}',
|
|
371
|
+
updateVersionLatest: '已是最新版本',
|
|
372
|
+
// Kept for compatibility (the footer line is no longer rendered).
|
|
367
373
|
updateDialogLine: '发现新版本 v{latest} · 打开 npm',
|
|
368
374
|
providerBothLabels: '短标签:{short} · 全名:{full}',
|
|
369
375
|
providerShortLabel: '短标签',
|
|
@@ -594,7 +600,7 @@ window.__ModuleLoader__.load({
|
|
|
594
600
|
settingsResetDefaults: 'Restore defaults',
|
|
595
601
|
settingsResetDefaultsHint: 'Restore the plugin default display settings',
|
|
596
602
|
updateCheckLabel: 'Check for updates at startup',
|
|
597
|
-
updateCheckHint: '
|
|
603
|
+
updateCheckHint: 'On by default: contacts the npm registry to check for a new version; switch it off to keep the plugin fully local',
|
|
598
604
|
updateCheckOff: 'Off',
|
|
599
605
|
updateCheckOn: 'On',
|
|
600
606
|
updateChecking: 'Checking…',
|
|
@@ -604,6 +610,11 @@ window.__ModuleLoader__.load({
|
|
|
604
610
|
updateCheckNow: 'Check now',
|
|
605
611
|
updateCheckNever: 'Not checked yet',
|
|
606
612
|
updateOpenNpm: 'Open on npm',
|
|
613
|
+
// The update status now lives on the plugin-version line of the dialog
|
|
614
|
+
// body (footer line removed); these two key the version-line suffix.
|
|
615
|
+
updateVersionNew: 'New version v{latest}',
|
|
616
|
+
updateVersionLatest: 'Up to date',
|
|
617
|
+
// Kept for compatibility (the footer line is no longer rendered).
|
|
607
618
|
updateDialogLine: 'New version v{latest} · Open on npm',
|
|
608
619
|
providerBothLabels: 'Short label: {short} · Full name: {full}',
|
|
609
620
|
providerShortLabel: 'Short label',
|
|
@@ -1160,9 +1171,10 @@ window.__ModuleLoader__.load({
|
|
|
1160
1171
|
defaultScope: normalizeDisplayScope(source.defaultScope),
|
|
1161
1172
|
detailsExpanded: normalizeDetailsExpanded(source.detailsExpanded),
|
|
1162
1173
|
detailsWindow: normalizeDetailsWindow(source.detailsWindow),
|
|
1163
|
-
// The startup update check is
|
|
1164
|
-
// Host omits the field
|
|
1165
|
-
updateCheck:
|
|
1174
|
+
// The startup update check is ON by default (v1.3.1): only an explicit
|
|
1175
|
+
// boolean is honored, so an old Host that omits the field stays on.
|
|
1176
|
+
updateCheck:
|
|
1177
|
+
typeof source.updateCheck === 'boolean' ? source.updateCheck : DEFAULT_PLUGIN_SETTINGS.updateCheck,
|
|
1166
1178
|
}
|
|
1167
1179
|
}
|
|
1168
1180
|
|
|
@@ -3238,7 +3250,11 @@ window.__ModuleLoader__.load({
|
|
|
3238
3250
|
.dsh-tokenlens-chart-drill-title{color:var(--dsw-alias-label-secondary);font-size:var(--dsw-alias-font-size-sm,12px);line-height:1.4;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}
|
|
3239
3251
|
/* 明细 donut window switch (v1.2.0): one pill row under the details title. */
|
|
3240
3252
|
.dsh-tokenlens-details-window{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
|
|
3241
|
-
.dsh-tokenlens-version{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5;text-align:right;opacity:.75}
|
|
3253
|
+
.dsh-tokenlens-version{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5;text-align:right;opacity:.75;overflow-wrap:anywhere}
|
|
3254
|
+
/* Update status on the plugin-version line (dialog body): wraps on narrow screens. */
|
|
3255
|
+
.dsh-tokenlens-version-update{white-space:normal;overflow-wrap:anywhere}
|
|
3256
|
+
.dsh-tokenlens-version .dsh-tokenlens-update-link{color:inherit;font-size:inherit;vertical-align:baseline}
|
|
3257
|
+
.dsh-tokenlens-version .dsh-tokenlens-update-link .dsh-tokenlens-icon{margin-left:2px;vertical-align:-1px}
|
|
3242
3258
|
.dsh-tokenlens-cards{gap:6px;flex-wrap:wrap;display:flex}
|
|
3243
3259
|
.dsh-tokenlens-cards-caption{color:var(--dsw-alias-label-tertiary);font-size:var(--dsw-alias-font-size-sm,12px);line-height:1.4;margin-bottom:-3px}
|
|
3244
3260
|
.dsh-tokenlens-harness-breakdown{display:flex;flex-direction:column;gap:4px}
|
|
@@ -6786,43 +6802,66 @@ window.__ModuleLoader__.load({
|
|
|
6786
6802
|
}
|
|
6787
6803
|
|
|
6788
6804
|
/**
|
|
6789
|
-
* The
|
|
6790
|
-
*
|
|
6791
|
-
*
|
|
6792
|
-
*
|
|
6805
|
+
* The update status appended to the plugin-version line of the usage dialog
|
|
6806
|
+
* body, or null when it must stay silent.
|
|
6807
|
+
*
|
|
6808
|
+
* Rules (a check result only): an available release renders as
|
|
6809
|
+
* 「 · 有新版本 vX」 with the version phrase linking to the npm page; a
|
|
6810
|
+
* successful check without a newer release renders 「 · 已是最新版本」.
|
|
6811
|
+
* No result, a failed check or an explicitly disabled setting adds nothing
|
|
6812
|
+
* (never show a misleading status).
|
|
6793
6813
|
*/
|
|
6794
|
-
function
|
|
6814
|
+
function buildVersionUpdateStatus(state, t) {
|
|
6815
|
+
if (state.updateCheck !== true) return null
|
|
6795
6816
|
const update = state.update
|
|
6796
|
-
if (update === null || update.
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
'
|
|
6802
|
-
{
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
'
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6817
|
+
if (update === null || update.error !== null) return null
|
|
6818
|
+
if (update.available === true && update.latest !== null) {
|
|
6819
|
+
const packageUrl = updatePackageUrlOf(state)
|
|
6820
|
+
// The version NUMBER inside the sentence is the real npm link; the i18n
|
|
6821
|
+
// sentence itself stays a single string (`updateVersionNew`).
|
|
6822
|
+
const sentence = t('updateVersionNew', { latest: update.latest })
|
|
6823
|
+
const versionText = `v${update.latest}`
|
|
6824
|
+
const index = sentence.indexOf(versionText)
|
|
6825
|
+
const link = h(
|
|
6826
|
+
'a',
|
|
6827
|
+
{
|
|
6828
|
+
className: 'dsh-tokenlens-update-link dsh-tokenlens-version-link',
|
|
6829
|
+
'data-update-link': 'true',
|
|
6830
|
+
'data-update-version-link': 'true',
|
|
6831
|
+
href: packageUrl,
|
|
6832
|
+
target: '_blank',
|
|
6833
|
+
rel: 'noreferrer noopener',
|
|
6834
|
+
title: packageUrl,
|
|
6835
|
+
onClick: (event) => openConsole(packageUrl, event),
|
|
6836
|
+
},
|
|
6837
|
+
index >= 0 ? versionText : `v${update.latest}`,
|
|
6838
|
+
Icon('external', 12),
|
|
6839
|
+
)
|
|
6840
|
+
return h(
|
|
6841
|
+
'span',
|
|
6842
|
+
{
|
|
6843
|
+
key: 'update-status',
|
|
6844
|
+
className: 'dsh-tokenlens-version-update',
|
|
6845
|
+
'data-update-version-status': 'available',
|
|
6846
|
+
},
|
|
6847
|
+
' · ',
|
|
6848
|
+
index >= 0 ? sentence.slice(0, index) : `${sentence} `,
|
|
6849
|
+
link,
|
|
6850
|
+
)
|
|
6851
|
+
}
|
|
6852
|
+
if (update.latest !== null) {
|
|
6853
|
+
return h(
|
|
6854
|
+
'span',
|
|
6855
|
+
{
|
|
6856
|
+
key: 'update-status',
|
|
6857
|
+
className: 'dsh-tokenlens-version-update',
|
|
6858
|
+
'data-update-version-status': 'latest',
|
|
6859
|
+
},
|
|
6860
|
+
' · ',
|
|
6861
|
+
t('updateVersionLatest'),
|
|
6862
|
+
)
|
|
6863
|
+
}
|
|
6864
|
+
return null
|
|
6826
6865
|
}
|
|
6827
6866
|
|
|
6828
6867
|
/** The dialog contents (body + footer); may throw, the caller guards it. */
|
|
@@ -6856,6 +6895,9 @@ window.__ModuleLoader__.load({
|
|
|
6856
6895
|
'div',
|
|
6857
6896
|
{ key: 'version', className: 'dsh-tokenlens-version' },
|
|
6858
6897
|
t('pluginVersion', { version: state.pluginVersion }),
|
|
6898
|
+
// Update status sits right next to the plugin version: 有新版本 vX
|
|
6899
|
+
// (link to the npm page) or 已是最新版本, only for a successful check.
|
|
6900
|
+
buildVersionUpdateStatus(state, t),
|
|
6859
6901
|
),
|
|
6860
6902
|
)
|
|
6861
6903
|
}
|
|
@@ -6884,9 +6926,6 @@ window.__ModuleLoader__.load({
|
|
|
6884
6926
|
Icon('external', 12),
|
|
6885
6927
|
consoleLabel,
|
|
6886
6928
|
),
|
|
6887
|
-
// 「发现新版本」 line (only while an update is available): its 「打开 npm」
|
|
6888
|
-
// tail is the real npm-package link, next to the refresh/close buttons.
|
|
6889
|
-
buildUpdateFooterLine(state, t),
|
|
6890
6929
|
h(
|
|
6891
6930
|
Button,
|
|
6892
6931
|
{
|
package/index.js
CHANGED
|
@@ -74,7 +74,7 @@ export const inject = []
|
|
|
74
74
|
export const PLUGIN_NAME = 'dsh-tokenlens'
|
|
75
75
|
|
|
76
76
|
/** Plugin version; mirrors package.json (kept here so diagnostics need no fs read). */
|
|
77
|
-
export const PLUGIN_VERSION = '1.3.
|
|
77
|
+
export const PLUGIN_VERSION = '1.3.1'
|
|
78
78
|
|
|
79
79
|
/** Documented defaults; every field of the raw row config is optional. */
|
|
80
80
|
const DEFAULTS = {
|
|
@@ -1846,9 +1846,9 @@ export function apply(ctx, rawConfig) {
|
|
|
1846
1846
|
}
|
|
1847
1847
|
|
|
1848
1848
|
noteStatus('activate', { pollIntervalMs: config.pollIntervalMs })
|
|
1849
|
-
//
|
|
1850
|
-
//
|
|
1851
|
-
//
|
|
1849
|
+
// Startup update check: one plain npm-registry request unless the user turned
|
|
1850
|
+
// `settings.updateCheck` off (default on since v1.3.1). Failures are recorded
|
|
1851
|
+
// and never break activation.
|
|
1852
1852
|
if (sanitizeSettings(providerStore.settings).updateCheck === true) {
|
|
1853
1853
|
void runUpdateCheck()
|
|
1854
1854
|
}
|
package/lib/provider-store.mjs
CHANGED
|
@@ -40,9 +40,10 @@ export const DEFAULT_SETTINGS = {
|
|
|
40
40
|
detailsExpanded: 'auto',
|
|
41
41
|
// v1.2.1 图表明细窗口默认值: 总计 (the last choice is persisted there).
|
|
42
42
|
detailsWindow: 'total',
|
|
43
|
-
// Optional startup update check (npm registry);
|
|
44
|
-
//
|
|
45
|
-
|
|
43
|
+
// Optional startup update check (npm registry); ON by default (v1.3.1) so users
|
|
44
|
+
// learn about new releases, and can be switched off to keep the plugin fully
|
|
45
|
+
// local-only. Only the published version number is requested.
|
|
46
|
+
updateCheck: true,
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/** The default override file: `$DSH_HOME/dsh-tokenlens/providers.json`. */
|
|
@@ -129,7 +130,7 @@ export function sanitizeSettings(value) {
|
|
|
129
130
|
detailsWindow: DETAILS_WINDOWS.includes(source.detailsWindow)
|
|
130
131
|
? source.detailsWindow
|
|
131
132
|
: DEFAULT_SETTINGS.detailsWindow,
|
|
132
|
-
updateCheck: source.updateCheck ===
|
|
133
|
+
updateCheck: typeof source.updateCheck === 'boolean' ? source.updateCheck : DEFAULT_SETTINGS.updateCheck,
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tokenlens",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "dsh-TokenLens (词元透镜) — provider-aware plan capacity plus local token statistics (today/7d/30d/all-time, by harness/provider/model/workspace) for DSH.",
|
|
6
6
|
"license": "MIT",
|