@winston.wan/burn-your-money 2.2.0 → 2.2.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.
@@ -1,11 +1,11 @@
1
1
  Stack trace:
2
2
  Frame Function Args
3
- 0007FFFFB550 00021005FE8E (000210285F68, 00021026AB6E, 000000000000, 0007FFFFA450) msys-2.0.dll+0x1FE8E
4
- 0007FFFFB550 0002100467F9 (000000000000, 000000000000, 000000000000, 0007FFFFB828) msys-2.0.dll+0x67F9
5
- 0007FFFFB550 000210046832 (000210286019, 0007FFFFB408, 000000000000, 000000000000) msys-2.0.dll+0x6832
6
- 0007FFFFB550 000210068CF6 (000000000000, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x28CF6
7
- 0007FFFFB550 000210068E24 (0007FFFFB560, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x28E24
8
- 0007FFFFB830 00021006A225 (0007FFFFB560, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x2A225
3
+ 0007FFFFBBC0 00021005FE8E (000210285F68, 00021026AB6E, 000000000000, 0007FFFFAAC0) msys-2.0.dll+0x1FE8E
4
+ 0007FFFFBBC0 0002100467F9 (000000000000, 000000000000, 000000000000, 0007FFFFBE98) msys-2.0.dll+0x67F9
5
+ 0007FFFFBBC0 000210046832 (000210286019, 0007FFFFBA78, 000000000000, 000000000000) msys-2.0.dll+0x6832
6
+ 0007FFFFBBC0 000210068CF6 (000000000000, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x28CF6
7
+ 0007FFFFBBC0 000210068E24 (0007FFFFBBD0, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x28E24
8
+ 0007FFFFBEA0 00021006A225 (0007FFFFBBD0, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x2A225
9
9
  End of stack trace
10
10
  Loaded modules:
11
11
  000100400000 bash.exe
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@winston.wan/burn-your-money",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "💸 Burn Your Money - 实时显示 Claude Code 的 token 消耗,看着你的钱包燃烧!",
5
5
  "main": "src/statusline.js",
6
6
  "scripts": {
@@ -26,4 +26,4 @@
26
26
  "url": "https://github.com/winston-wwzhen/burn-your-money/issues"
27
27
  },
28
28
  "homepage": "https://github.com/winston-wwzhen/burn-your-money#readme"
29
- }
29
+ }
package/src/statusline.js CHANGED
@@ -166,15 +166,14 @@ function main() {
166
166
  const now = Math.floor(Date.now() / 1000);
167
167
  let historyData = readJsonFile(HISTORY_CACHE, {});
168
168
 
169
- // 检查缓存是否过期(30秒)
170
- const cacheAge = now - (historyData._cache_time || 0);
171
- if (cacheAge > 30 || !historyData.total_tokens_all) {
172
- // 缓存过期,重新生成(这里简化处理,实际应该调用 token-history)
173
- historyData = {
174
- total_tokens_all: 0,
175
- total_cost: 0,
176
- _cache_time: now
177
- };
169
+ // 如果缓存不存在或无效,使用默认值(但保留已有数据)
170
+ if (!historyData || typeof historyData !== 'object') {
171
+ historyData = {};
172
+ }
173
+
174
+ // 确保 _cache_time 存在(如果是旧缓存,添加时间戳)
175
+ if (!historyData._cache_time) {
176
+ historyData._cache_time = now;
178
177
  }
179
178
 
180
179
  // 今日数据持久化