@deathbeam/pi-usage 0.0.11 → 0.0.12
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 +1 -1
- package/src/usage.ts +5 -4
package/package.json
CHANGED
package/src/usage.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type DailyCost = { label: string; cost: number };
|
|
|
58
58
|
|
|
59
59
|
type Tally = { stats: Stats; requests: number; models?: Map<string, Tally>; providers?: Set<string> };
|
|
60
60
|
|
|
61
|
-
const CACHE_VERSION =
|
|
61
|
+
const CACHE_VERSION = 4;
|
|
62
62
|
|
|
63
63
|
function emptyStats(): Stats {
|
|
64
64
|
return { cost: 0, input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
@@ -198,9 +198,10 @@ async function parseFile(file: string): Promise<UsageRecord[]> {
|
|
|
198
198
|
provider = String(entry.provider);
|
|
199
199
|
model = String(entry.model);
|
|
200
200
|
} else {
|
|
201
|
-
// Compaction and branch-summary calls carry no model, so their cost gets its own row.
|
|
202
|
-
provider
|
|
203
|
-
|
|
201
|
+
// Compaction and branch-summary calls carry no model, so their cost gets its own row. Subagent
|
|
202
|
+
// artifact transcripts carry no type at all and keep provider/model on the nested message.
|
|
203
|
+
provider = String(message?.provider || entry.provider || "(summaries)");
|
|
204
|
+
model = String(message?.model || entry.model || entry.type || "unknown");
|
|
204
205
|
}
|
|
205
206
|
const cost = typeof usage.cost === "number" ? usage.cost : num(usage.cost?.total);
|
|
206
207
|
const input = num(usage.input);
|