dsh-cost-meter 1.9.40 → 1.9.41

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
@@ -6,7 +6,7 @@
6
6
 
7
7
  **Session cost tracking plugin for the DeepSeek Harness web GUI (bilingual UI)**
8
8
 
9
- [![version](https://img.shields.io/badge/version-1.9.40-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
9
+ [![version](https://img.shields.io/badge/version-1.9.41-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
10
10
  [![npm](https://img.shields.io/npm/v/dsh-cost-meter?label=npm)](https://www.npmjs.com/package/dsh-cost-meter)
11
11
  [![dshfind](https://dshfind.com/api/badge/Han-1413141/dsh-cost-meter?metric=downloads&lang=en)](https://dshfind.com/zh/plugins/Han-1413141/dsh-cost-meter?ref=badge)
12
12
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
@@ -16,11 +16,11 @@
16
16
 
17
17
  </div>
18
18
 
19
- **v1.9.40** moves billing accuracy guidance into settings and improves balance-query backoff to reduce redundant requests and related operational risks.
19
+ **v1.9.41** fixes Web startup and protects settings with durable ledger writes and an independent configuration backup.
20
20
 
21
21
  **Host floor: DSH 0.2.0** · Adaptation target: **0.2.1-rc.2** (npm `next`). Expand the compatibility notes below for exact declarations, host records and troubleshooting.
22
22
 
23
- Release notes: [v1.9.40](docs/update-notes-1.9.40.md#english). Fully restart DSH after updating.
23
+ Release notes: [v1.9.41](docs/update-notes-1.9.41.md#english). Fully restart DSH after updating.
24
24
 
25
25
  ![Promo art](docs/promo.en.png)
26
26
 
@@ -354,22 +354,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
354
354
  dsh plugin --profile web add dsh-cost-meter
355
355
  ```
356
356
 
357
- **PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.9.40`** — review the script before running):
357
+ **PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.9.41`** — review the script before running):
358
358
 
359
359
  ```powershell
360
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.40/install.ps1 | iex
360
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.41/install.ps1 | iex
361
361
  ```
362
362
 
363
363
  **Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
364
364
 
365
365
  ```sh
366
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.40
366
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.41
367
367
  ```
368
368
 
369
369
  Without git, use the GitHub tag archive:
370
370
 
371
371
  ```sh
372
- dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.40.tar.gz
372
+ dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.41.tar.gz
373
373
  ```
374
374
 
375
375
  After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
@@ -434,7 +434,7 @@ Workarounds:
434
434
 
435
435
  ```yaml
436
436
  minimumReleaseAgeExclude:
437
- - dsh-cost-meter@1.9.40
437
+ - dsh-cost-meter@1.9.41
438
438
  ```
439
439
 
440
440
  3. For a one-off CLI operation, forward the pnpm flag: `dsh plugin --profile desktop remove dsh-cost-meter --config.minimum-release-age=0` (or add `--trust-lockfile` when only lockfile verification fails). Both flags were verified against pnpm 11.28.5 in a temporary profile.
package/README.zh-CN.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  **DeepSeek Harness 会话费用统计插件(界面中英双语)**
8
8
 
9
- [![version](https://img.shields.io/badge/version-1.9.40-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
9
+ [![version](https://img.shields.io/badge/version-1.9.41-4176E6)](https://github.com/Han-1413141/dsh-cost-meter)
10
10
  [![npm](https://img.shields.io/npm/v/dsh-cost-meter?label=npm)](https://www.npmjs.com/package/dsh-cost-meter)
11
11
  [![dshfind](https://dshfind.com/api/badge/Han-1413141/dsh-cost-meter?metric=downloads&lang=zh)](https://dshfind.com/zh/plugins/Han-1413141/dsh-cost-meter?ref=badge)
12
12
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
@@ -16,11 +16,11 @@
16
16
 
17
17
  </div>
18
18
 
19
- **v1.9.40** 将费用误差说明移入设置页,并优化余额查询等待策略,减少无效重复请求及相关使用风险。
19
+ **v1.9.41** 修复 Web 启动报错,完善账本刷盘,并在账本损坏后从独立备份恢复配置。
20
20
 
21
21
  **宿主要求:DSH 0.2.0 起支持** · 适配目标 **0.2.1-rc.2**(npm `next`)。完整声明、历史记录与安装排障见下方展开项。
22
22
 
23
- 更新说明:[v1.9.40](docs/update-notes-1.9.40.md#中文)。更新后完全重启 DSH。
23
+ 更新说明:[v1.9.41](docs/update-notes-1.9.41.md#中文)。更新后完全重启 DSH。
24
24
 
25
25
  ![宣传图](docs/promo.png)
26
26
 
@@ -354,22 +354,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
354
354
  dsh plugin --profile web add dsh-cost-meter
355
355
  ```
356
356
 
357
- **PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.40`**,建议先下载审阅再运行):
357
+ **PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.9.41`**,建议先下载审阅再运行):
358
358
 
359
359
  ```powershell
360
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.40/install.ps1 | iex
360
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.41/install.ps1 | iex
361
361
  ```
362
362
 
363
363
  **或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
364
364
 
365
365
  ```sh
366
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.40
366
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.41
367
367
  ```
368
368
 
369
369
  没有 git 时可用 GitHub tag 打包直链:
370
370
 
371
371
  ```sh
372
- dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.40.tar.gz
372
+ dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.9.41.tar.gz
373
373
  ```
374
374
 
375
375
  安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
@@ -434,7 +434,7 @@ DSH **0.2.1-rc.1 / 0.2.1-rc.2** 宿主自带 pnpm **11.28.5**,默认启用内
434
434
 
435
435
  ```yaml
436
436
  minimumReleaseAgeExclude:
437
- - dsh-cost-meter@1.9.40
437
+ - dsh-cost-meter@1.9.41
438
438
  ```
439
439
 
440
440
  3. 仅本次操作用 CLI 透传 pnpm 参数:`dsh plugin --profile desktop remove dsh-cost-meter --config.minimum-release-age=0`;若只是 lockfile 校验阶段失败,可改用 `--trust-lockfile`。这两个参数已在本机 pnpm 11.28.5 临时 Profile 上实测可用。
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## English
4
4
 
5
+ ### Configuration recovery after an abnormal shutdown
6
+
7
+ The ledger and its independent `ledger.json.config-bak` are written to temporary files in the same directory, flushed, and then renamed over their destinations. POSIX systems also flush the directory after replacement. The backup stores only configuration and migration markers, using the ledger's existing secret filtering; credentials remain in the DSH credential store and configuration placeholders are preserved. Usage-only updates do not rewrite an unchanged backup.
8
+
9
+ A healthy existing ledger creates or updates this backup when loaded. If the ledger is corrupt, the original `.corrupt-*` file is retained and settings are recovered from the backup. A missing ledger can also use the backup. The log reports successful restoration and the number of custom balance sources; an unreadable backup is reported and defaults are used. Usage history continues through the existing backfill mechanism. An already zeroed file from before this protection, with no backup, contains no settings to recover. See [#412](https://github.com/Han-1413141/dsh-cost-meter/issues/412).
10
+
5
11
  Issue [#237](https://github.com/Han-1413141/dsh-cost-meter/issues/237) reports a startup failure with **Ledger is busy; preserving pending changes for retry**. The sidebar balance and quota widgets disappear because the cost-meter loader entry did not activate. An old lock can name a PID that now belongs to a different process; checking only whether that PID exists cannot identify the original owner.
6
12
 
7
13
  ### Update and recover
@@ -25,6 +31,12 @@ Implementation references: [Linux process start ticks](https://man7.org/linux/ma
25
31
 
26
32
  ## 简体中文
27
33
 
34
+ ### 异常退出后的配置恢复
35
+
36
+ 账本及独立的 `ledger.json.config-bak` 均先写入同目录临时文件,刷盘后再替换目标文件;POSIX 系统同时同步目录。备份只保存配置和迁移记录,沿用账本的脱敏规则,凭据仍由 DSH 凭据库保存,配置中的占位符保留。仅用量变化时不重写配置备份。
37
+
38
+ 已有的正常账本加载时即建立或更新备份。账本损坏后保留原始 `.corrupt-*` 文件,并从备份恢复设置;账本缺失时同样读取备份。日志显示恢复结果及自定义余额源数量;备份也无法读取时记录错误并使用默认配置。用量历史继续由现有补录流程处理。启用此保护之前已经全零且没有备份的文件,没有可恢复的配置内容。问题来源:[#412](https://github.com/Han-1413141/dsh-cost-meter/issues/412)。
39
+
28
40
  Issue [#237](https://github.com/Han-1413141/dsh-cost-meter/issues/237) 报告启动时出现 **Ledger is busy; preserving pending changes for retry**。费用插件未成功挂载,侧栏余额和额度卡片随之消失。旧锁中的 PID 可能已经被系统分配给另一个进程,仅检查 PID 是否存在不能确认原锁持有者。
29
41
 
30
42
  ### 升级与恢复
@@ -0,0 +1,29 @@
1
+ # v1.9.41:Web 启动修复与账本配置恢复
2
+
3
+ ## 中文
4
+
5
+ 本次更新修复 Web 端插件加载失败,并增加账本配置的独立备份与恢复。
6
+
7
+ - 为 `conversation.chat.turnTail` 补齐 chain 插槽要求的 `select`,修复启动时的 `requires options.select` 报错。
8
+ - 账本与 `ledger.json.config-bak` 均先写入同目录临时文件、刷盘,再替换目标文件。POSIX 系统同时同步目录;临时文件刷盘或替换失败时保留原文件。
9
+ - 正常账本加载时建立配置备份,之后仅在配置或迁移记录变化时更新。备份沿用现有脱敏规则,保留凭据占位符。
10
+ - 账本损坏或缺失时,从备份恢复自定义余额源等设置;保留损坏账本,并在日志中显示恢复结果。用量历史继续由现有补录流程处理。
11
+
12
+ 此前已经全零且没有备份的文件,没有可恢复的配置内容。
13
+
14
+ 感谢 [@korion3](https://github.com/korion3) 在 [#413](https://github.com/Han-1413141/dsh-cost-meter/issues/413) 报告、定位 Web 启动故障,并在 [#414](https://github.com/Han-1413141/dsh-cost-meter/pull/414) 提供修复;感谢 [@kevindawn11-hash](https://github.com/kevindawn11-hash) 在 [#412](https://github.com/Han-1413141/dsh-cost-meter/issues/412) 提供账本损坏证据与配置备份建议。
15
+
16
+ 更新后完全重启 DSH,使插件服务端加载新版本。
17
+
18
+ ## English
19
+
20
+ This update fixes Web plugin startup and adds independent configuration backup and recovery.
21
+
22
+ - Add the required `select` function to the `conversation.chat.turnTail` chain slot, fixing the startup error `requires options.select`.
23
+ - Write the ledger and `ledger.json.config-bak` to temporary files in the same directory, flush them, then replace their destinations. POSIX systems also flush the directory; file-sync or replacement failures preserve the original file.
24
+ - Create a configuration backup when a healthy ledger loads, then update it only when configuration or migration markers change. The backup uses existing secret filtering and preserves credential placeholders.
25
+ - Restore settings, including custom balance sources, when the ledger is corrupt or missing. Keep the corrupt ledger and log the restoration result. Usage history continues through the existing backfill process.
26
+
27
+ A file that was already zeroed before this protection, with no backup, contains no configuration to recover.
28
+
29
+ Thanks to [@korion3](https://github.com/korion3) for the report and diagnosis in [#413](https://github.com/Han-1413141/dsh-cost-meter/issues/413) and the fix in [#414](https://github.com/Han-1413141/dsh-cost-meter/pull/414), and to [@kevindawn11-hash](https://github.com/kevindawn11-hash) for the corruption evidence and backup suggestions in [#412](https://github.com/Han-1413141/dsh-cost-meter/issues/412). Fully restart DSH after updating.