@dougen/dsh-deepseek-usage 0.1.7 → 0.1.8

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
@@ -82,6 +82,10 @@ dsh plugin --profile web add <生成的 .tgz>
82
82
 
83
83
  ## 变更记录
84
84
 
85
+ ### v0.1.8
86
+
87
+ - **修复 0.1.7 回归:今日用量统计全为 0**。根因:`listSnapshots()` 返回的会话条目是 `{ header: SessionHeader, revision }`,id 位于 `header.id` 嵌套字段;0.1.7 误取顶层 `header.id`(undefined),导致所有会话 `readRaw` 失败被跳过(skipped>0、统计为 0)。已修正并从真实会话日志端到端验证:统计恢复、无读取失败。
88
+
85
89
  ### v0.1.7
86
90
 
87
91
  - **统计口径修正**:按 (turn, step) 去重并吸收流式 usage 样本,失败请求的用量不再漏计(P1)。
package/lib/index.js CHANGED
@@ -223,7 +223,10 @@ async function scanTodayUsage(ctx) {
223
223
  const headers = hasSnapshots ? await persistence.listSnapshots() : await persistence.list();
224
224
  const seen = new Set();
225
225
  for (const header of headers) {
226
- const id = header.id;
226
+ // listSnapshots 返回 { header: SessionHeader, revision },id header.header.id
227
+ // list 直接返回 SessionHeader[](顶层 id)。
228
+ const id = hasSnapshots ? header.header.id : header.id;
229
+ if (typeof id !== "string" || id === "") continue;
227
230
  seen.add(id);
228
231
  const revision = hasSnapshots ? header.revision : void 0;
229
232
  const cached = sessionAggCache.get(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dougen/dsh-deepseek-usage",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "DeepSeek 用量侧边栏插件:余额(官方 API)、今日花费(本地日志估算)、今日 Token 与 API 次数(本地日志)、高峰/空闲时段指示灯。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",