clawculator 2.2.1 → 2.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawculator",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "AI cost forensics for OpenClaw and multi-model setups. Your friendly penny pincher. 100% offline. Zero AI. Pure deterministic logic.",
5
5
  "main": "src/analyzer.js",
6
6
  "bin": {
@@ -528,13 +528,16 @@ function parseTranscript(jsonlPath) {
528
528
 
529
529
  // Only assistant messages with usage blocks have cost data
530
530
  if (entry.type !== 'message') continue;
531
- if (!entry.usage) continue;
531
+
532
+ // Usage can be at entry.usage (some formats) or entry.message.usage (standard format)
533
+ const u = entry.usage || entry.message?.usage;
534
+ if (!u) continue;
532
535
 
533
536
  messageCount++;
534
- const u = entry.usage;
535
537
 
536
- // Use model from transcript (most accurate)
537
- if (entry.model && !model) model = entry.model;
538
+ // Model can be at entry.model or entry.message.model
539
+ const entryModel = entry.model || entry.message?.model;
540
+ if (entryModel && !model) model = entryModel;
538
541
 
539
542
  input += u.input || 0;
540
543
  output += u.output || 0;
package/src/analyzer.js CHANGED
@@ -528,13 +528,16 @@ function parseTranscript(jsonlPath) {
528
528
 
529
529
  // Only assistant messages with usage blocks have cost data
530
530
  if (entry.type !== 'message') continue;
531
- if (!entry.usage) continue;
531
+
532
+ // Usage can be at entry.usage (some formats) or entry.message.usage (standard format)
533
+ const u = entry.usage || entry.message?.usage;
534
+ if (!u) continue;
532
535
 
533
536
  messageCount++;
534
- const u = entry.usage;
535
537
 
536
- // Use model from transcript (most accurate)
537
- if (entry.model && !model) model = entry.model;
538
+ // Model can be at entry.model or entry.message.model
539
+ const entryModel = entry.model || entry.message?.model;
540
+ if (entryModel && !model) model = entryModel;
538
541
 
539
542
  input += u.input || 0;
540
543
  output += u.output || 0;