llm-usage-metrics 0.3.7 → 0.4.0
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/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1014,6 +1014,13 @@ function hasUsageSignal(usage) {
|
|
|
1014
1014
|
function deriveDeltaUsage(info, previousTotalUsage) {
|
|
1015
1015
|
const totalUsage = toUsage(info.total_token_usage);
|
|
1016
1016
|
const lastUsage = toUsage(info.last_token_usage);
|
|
1017
|
+
if (totalUsage && previousTotalUsage) {
|
|
1018
|
+
const deltaFromTotals = subtractUsage(totalUsage, previousTotalUsage);
|
|
1019
|
+
if (hasUsageSignal(deltaFromTotals)) {
|
|
1020
|
+
return { deltaUsage: deltaFromTotals, latestTotalUsage: totalUsage };
|
|
1021
|
+
}
|
|
1022
|
+
return { latestTotalUsage: totalUsage };
|
|
1023
|
+
}
|
|
1017
1024
|
if (lastUsage) {
|
|
1018
1025
|
return { deltaUsage: lastUsage, latestTotalUsage: totalUsage };
|
|
1019
1026
|
}
|
|
@@ -3576,7 +3583,7 @@ function normalizeSkippedRowReasons(value) {
|
|
|
3576
3583
|
// src/cli/parse-file-cache.ts
|
|
3577
3584
|
import { mkdir as mkdir2, readFile as readFile4, rename, rm, stat as stat3, writeFile as writeFile2 } from "fs/promises";
|
|
3578
3585
|
import path11 from "path";
|
|
3579
|
-
var PARSE_FILE_CACHE_VERSION =
|
|
3586
|
+
var PARSE_FILE_CACHE_VERSION = 4;
|
|
3580
3587
|
var CACHE_KEY_SEPARATOR = "\0";
|
|
3581
3588
|
function createCacheKey(source, filePath) {
|
|
3582
3589
|
return `${source}${CACHE_KEY_SEPARATOR}${filePath}`;
|