Repository navigation
claude-usage v0.1.2
修复会话信息缺失时的漏计,以及后补迭代分类未被保存的问题。
- 有效 Claude 请求不再因为缺少
sessionId被静默跳过。缺少会话归属时保留 Token 并显示诊断;子代理目录仍可提供明确的任务关系。 - 后补会话信息会更新已有请求,同一请求及其 Windows / WSL 副本只计一次。
- 后补的
compaction/ Advisor 分类可以补全默认message分类。旧副本不会将已明确的分类降级;互相矛盾的明确分类会给出诊断。 - 后补分类或缓存期限时,保留请求原有的结束状态,避免随后出现的冲突用量覆盖已确认的计数。
新增回归用例覆盖漏计复现、来源并集、子代理、后补会话、分类补全、旧副本、分类冲突和已结束请求的保护。使用隔离状态目录对 Windows / WSL 真实日志进行了逐请求核对,比较独立计量、数据库、API 与 JSON / CSV 导出;未改写原始日志。
更新保留端口、配置和历史数据库,不自动重建历史。若旧版本曾跳过缺少会话信息的记录,已经保存的扫描游标不会自动回退;需要在备份后明确执行历史重建。当前日志未触发该情况时,无需重建。
English
This release fixes usage records silently skipped when sessionId is absent, and late iteration classifications incorrectly left as message.
- Retain identifiable Claude usage without a session ID, report missing attribution, and retain explicit subagent directory relationships.
- Enrich missing session metadata without counting the request or its mirrored copies twice.
- Accept late compaction / Advisor classifications, preserve them against stale generic copies, and diagnose contradictory specific classifications.
- Preserve finalization when enriching classification or cache-lifetime metadata, so conflicting partial snapshots cannot overwrite confirmed usage.
Regression tests cover these cases. An isolated Windows / WSL audit compared independent request accounting with SQLite, APIs and JSON / CSV exports. Source transcripts were unchanged.
Updates preserve configuration and history. Previously skipped historical records require an explicitly approved rebuild after backup; existing scan cursors are not reset automatically. No rebuild is needed for unaffected logs.