usage-board 4.0.1 → 4.0.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/dist/index.mjs +1 -1
- package/dist/public/_nuxt/BILXBbDI.js +21 -0
- package/dist/public/_nuxt/{DF2WsXH3.js → BJWBp9U3.js} +1 -1
- package/dist/public/_nuxt/{DXWxIyGU.js → BOTUKIyR.js} +1 -1
- package/dist/public/_nuxt/{De8DvPWL.js → BVD8FQXV.js} +1 -1
- package/dist/public/_nuxt/BXbx6JCB.js +1 -0
- package/dist/public/_nuxt/BfVC-jX7.js +1 -0
- package/dist/public/_nuxt/BhIINiyq.js +146 -0
- package/dist/public/_nuxt/CJECfsOP.js +1 -0
- package/dist/public/_nuxt/{D7qEPtpx.js → CJv0IWZB.js} +1 -1
- package/dist/public/_nuxt/{DKaPq50Z.js → CXOkrwUP.js} +2 -2
- package/dist/public/_nuxt/DFbWcbwl.js +261 -0
- package/dist/public/_nuxt/{C0GhHHgI.js → DaoeXHW_.js} +2 -2
- package/dist/public/_nuxt/DjeKkZG3.js +25 -0
- package/dist/public/_nuxt/builds/latest.json +1 -1
- package/dist/public/_nuxt/builds/meta/80f1a776-82e2-4b5c-9c07-a61063a0dd84.json +1 -0
- package/dist/public/_nuxt/{Jp5cgQZi.js → nv0LjcWu.js} +2 -2
- package/dist/public/_nuxt/{37OOe3RF.js → tDg_nW46.js} +1 -1
- package/dist/server/chunks/build/client.precomputed.mjs +1 -1
- package/dist/server/chunks/nitro/nitro.mjs +507 -318
- package/dist/server/chunks/routes/api/analysis/agent/session.json.mjs +16 -2
- package/dist/server/chunks/routes/api/analysis/agent/token.json.mjs +2 -2
- package/dist/server/chunks/routes/api/analysis/cache.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/hot-project.json.mjs +4 -3
- package/dist/server/chunks/routes/api/analysis/model.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/overview-cards.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/session.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/token/daily.json.mjs +13 -2
- package/dist/server/chunks/routes/api/analysis/token/today-hourly.json.mjs +1 -1
- package/dist/server/chunks/routes/api/analysis/token.json.mjs +1 -1
- package/dist/server/chunks/routes/api/payload.json.mjs +1 -1
- package/dist/server/chunks/routes/api/projects/_project/modules.get.mjs +1 -1
- package/dist/server/chunks/routes/api/projects/catalog.get.mjs +1 -1
- package/dist/server/chunks/routes/renderer.mjs +1 -1
- package/dist/server/chunks/routes/ws.mjs +13 -1
- package/dist/server/index.mjs +1 -1
- package/dist/server/package.json +1 -1
- package/package.json +1 -1
- package/dist/public/_nuxt/65Ayv2XK.js +0 -146
- package/dist/public/_nuxt/BOWwkrCY.js +0 -25
- package/dist/public/_nuxt/D9-Yw1TR.js +0 -1
- package/dist/public/_nuxt/DgMMKsPE.js +0 -258
- package/dist/public/_nuxt/DxvuOJRP.js +0 -1
- package/dist/public/_nuxt/builds/meta/34b12f78-e5b7-490f-99ba-b4a8ab41b914.json +0 -1
- package/dist/public/_nuxt/qXgLTL_3.js +0 -21
- package/dist/public/_nuxt/y6mAKUDU.js +0 -1
|
@@ -4271,7 +4271,7 @@ function _expandFromEnv(value) {
|
|
|
4271
4271
|
const _inlineRuntimeConfig = {
|
|
4272
4272
|
"app": {
|
|
4273
4273
|
"baseURL": "/",
|
|
4274
|
-
"buildId": "
|
|
4274
|
+
"buildId": "80f1a776-82e2-4b5c-9c07-a61063a0dd84",
|
|
4275
4275
|
"buildAssetsDir": "/_nuxt/",
|
|
4276
4276
|
"cdnURL": ""
|
|
4277
4277
|
},
|
|
@@ -4299,7 +4299,7 @@ const _inlineRuntimeConfig = {
|
|
|
4299
4299
|
}
|
|
4300
4300
|
},
|
|
4301
4301
|
"public": {
|
|
4302
|
-
"appVersion": "4.0.
|
|
4302
|
+
"appVersion": "4.0.2",
|
|
4303
4303
|
"home": "/Users/tangchenghui"
|
|
4304
4304
|
},
|
|
4305
4305
|
"icon": {
|
|
@@ -4826,6 +4826,9 @@ function normalizeNumber(value) {
|
|
|
4826
4826
|
function roundCurrency(value) {
|
|
4827
4827
|
return Math.round(value * 1e6) / 1e6;
|
|
4828
4828
|
}
|
|
4829
|
+
function sumCurrency(total, amount) {
|
|
4830
|
+
return Math.round((total + amount) * 1e12) / 1e12;
|
|
4831
|
+
}
|
|
4829
4832
|
function uniqueItems(items) {
|
|
4830
4833
|
return Array.from(new Set(items));
|
|
4831
4834
|
}
|
|
@@ -4936,7 +4939,7 @@ function buildProjectUsage(sessionUsage) {
|
|
|
4936
4939
|
sessions: 0,
|
|
4937
4940
|
tokenTotal: 0
|
|
4938
4941
|
};
|
|
4939
|
-
project.costUSD
|
|
4942
|
+
project.costUSD = sumCurrency(project.costUSD, session.costUSD);
|
|
4940
4943
|
project.sessions += 1;
|
|
4941
4944
|
project.tokenTotal += session.tokenTotal;
|
|
4942
4945
|
projects.set(session.project, project);
|
|
@@ -4971,7 +4974,7 @@ function mergeDailyTokenUsage(items) {
|
|
|
4971
4974
|
totalTokens: 0
|
|
4972
4975
|
};
|
|
4973
4976
|
group.cachedInputTokens += item.cachedInputTokens;
|
|
4974
|
-
group.costUSD
|
|
4977
|
+
group.costUSD = sumCurrency(group.costUSD, item.costUSD);
|
|
4975
4978
|
group.inputTokens += item.inputTokens;
|
|
4976
4979
|
group.outputTokens += item.outputTokens;
|
|
4977
4980
|
group.reasoningOutputTokens += item.reasoningOutputTokens;
|
|
@@ -4979,7 +4982,7 @@ function mergeDailyTokenUsage(items) {
|
|
|
4979
4982
|
for (const [modelName, usage] of Object.entries(item.models)) {
|
|
4980
4983
|
const model = (_b = group.models.get(modelName)) != null ? _b : createEmptyModelUsage();
|
|
4981
4984
|
model.cachedInputTokens += usage.cachedInputTokens;
|
|
4982
|
-
model.costUSD
|
|
4985
|
+
model.costUSD = sumCurrency(model.costUSD, usage.costUSD);
|
|
4983
4986
|
model.inputTokens += usage.inputTokens;
|
|
4984
4987
|
model.isFallback = model.isFallback || usage.isFallback;
|
|
4985
4988
|
model.outputTokens += usage.outputTokens;
|
|
@@ -4990,7 +4993,7 @@ function mergeDailyTokenUsage(items) {
|
|
|
4990
4993
|
for (const [platform, platformUsage] of Object.entries((_c = item.platforms) != null ? _c : {})) {
|
|
4991
4994
|
const currentPlatformUsage = (_d = group.platforms.get(platform)) != null ? _d : createEmptyDailyPlatformTokenUsage();
|
|
4992
4995
|
currentPlatformUsage.cachedInputTokens += platformUsage.cachedInputTokens;
|
|
4993
|
-
currentPlatformUsage.costUSD
|
|
4996
|
+
currentPlatformUsage.costUSD = sumCurrency(currentPlatformUsage.costUSD, platformUsage.costUSD);
|
|
4994
4997
|
currentPlatformUsage.inputTokens += platformUsage.inputTokens;
|
|
4995
4998
|
currentPlatformUsage.outputTokens += platformUsage.outputTokens;
|
|
4996
4999
|
currentPlatformUsage.reasoningOutputTokens += platformUsage.reasoningOutputTokens;
|
|
@@ -4998,7 +5001,7 @@ function mergeDailyTokenUsage(items) {
|
|
|
4998
5001
|
for (const [modelName, usage] of Object.entries(platformUsage.models)) {
|
|
4999
5002
|
const model = (_e = currentPlatformUsage.models[modelName]) != null ? _e : createEmptyModelUsage();
|
|
5000
5003
|
model.cachedInputTokens += usage.cachedInputTokens;
|
|
5001
|
-
model.costUSD
|
|
5004
|
+
model.costUSD = sumCurrency(model.costUSD, usage.costUSD);
|
|
5002
5005
|
model.inputTokens += usage.inputTokens;
|
|
5003
5006
|
model.isFallback = model.isFallback || usage.isFallback;
|
|
5004
5007
|
model.outputTokens += usage.outputTokens;
|
|
@@ -5083,7 +5086,7 @@ function createEmptyDailyPlatformTokenUsage() {
|
|
|
5083
5086
|
var __defProp$1 = Object.defineProperty;
|
|
5084
5087
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5085
5088
|
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5086
|
-
const CACHE_SCHEMA_VERSION =
|
|
5089
|
+
const CACHE_SCHEMA_VERSION = 10;
|
|
5087
5090
|
const ROW_KEY_SEPARATOR = "";
|
|
5088
5091
|
const CACHE_SCHEMA_SQL = `
|
|
5089
5092
|
CREATE TABLE IF NOT EXISTS cache_schema_meta (
|
|
@@ -5382,6 +5385,8 @@ const CACHE_SCHEMA_SQL = `
|
|
|
5382
5385
|
content TEXT NOT NULL,
|
|
5383
5386
|
cost_usd REAL NOT NULL,
|
|
5384
5387
|
dedupe_key TEXT,
|
|
5388
|
+
fallback_dedupe_key TEXT,
|
|
5389
|
+
is_sidechain INTEGER,
|
|
5385
5390
|
model TEXT,
|
|
5386
5391
|
role TEXT NOT NULL,
|
|
5387
5392
|
timestamp TEXT,
|
|
@@ -5416,7 +5421,9 @@ class UsageCacheRepository {
|
|
|
5416
5421
|
if (!meta) {
|
|
5417
5422
|
return null;
|
|
5418
5423
|
}
|
|
5419
|
-
const scopes = this.loadHydratedUsageScopes("bootstrap",
|
|
5424
|
+
const scopes = this.loadHydratedUsageScopes("bootstrap", {
|
|
5425
|
+
includeInteractions: false
|
|
5426
|
+
});
|
|
5420
5427
|
const payload = Object.fromEntries(
|
|
5421
5428
|
PROJECT_USAGE_PLATFORMS.map((platform) => {
|
|
5422
5429
|
var _a2;
|
|
@@ -5517,45 +5524,39 @@ class UsageCacheRepository {
|
|
|
5517
5524
|
this.persistProjectCatalog(payload);
|
|
5518
5525
|
}
|
|
5519
5526
|
loadProjectDetails() {
|
|
5520
|
-
var _a;
|
|
5521
5527
|
const projects = this.database.prepare(`
|
|
5522
5528
|
SELECT label, create_time, session_count
|
|
5523
5529
|
FROM projects
|
|
5524
5530
|
ORDER BY label ASC
|
|
5525
5531
|
`).all();
|
|
5526
|
-
if (projects.length === 0) {
|
|
5527
|
-
return /* @__PURE__ */ new Map();
|
|
5528
|
-
}
|
|
5529
5532
|
const projectModels = groupProjectModels(this.database.prepare(`
|
|
5530
5533
|
SELECT project_label, model, model_order
|
|
5531
5534
|
FROM project_models
|
|
5532
5535
|
ORDER BY project_label ASC, model_order ASC
|
|
5533
5536
|
`).all());
|
|
5534
5537
|
const scopes = this.loadHydratedUsageScopes("project");
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
} : createEmptyProjectPlatformUsage()
|
|
5547
|
-
];
|
|
5548
|
-
})
|
|
5549
|
-
);
|
|
5550
|
-
details.set(project.label, normalizeProjectUsageDetail({
|
|
5551
|
-
analyzing,
|
|
5552
|
-
createTime: project.create_time,
|
|
5553
|
-
label: project.label,
|
|
5554
|
-
models: (_a = projectModels.get(project.label)) != null ? _a : [],
|
|
5555
|
-
sessionCound: project.session_count
|
|
5556
|
-
}));
|
|
5538
|
+
return buildProjectUsageDetails(projects, projectModels, scopes);
|
|
5539
|
+
}
|
|
5540
|
+
loadProjectDetail(label) {
|
|
5541
|
+
var _a;
|
|
5542
|
+
const project = this.database.prepare(`
|
|
5543
|
+
SELECT label, create_time, session_count
|
|
5544
|
+
FROM projects
|
|
5545
|
+
WHERE label = ?
|
|
5546
|
+
`).get(label);
|
|
5547
|
+
if (!project) {
|
|
5548
|
+
return null;
|
|
5557
5549
|
}
|
|
5558
|
-
|
|
5550
|
+
const projectModels = groupProjectModels(this.database.prepare(`
|
|
5551
|
+
SELECT project_label, model, model_order
|
|
5552
|
+
FROM project_models
|
|
5553
|
+
WHERE project_label = ?
|
|
5554
|
+
ORDER BY model_order ASC
|
|
5555
|
+
`).all(label));
|
|
5556
|
+
const scopes = this.loadHydratedUsageScopes("project", {
|
|
5557
|
+
projectLabel: label
|
|
5558
|
+
});
|
|
5559
|
+
return (_a = buildProjectUsageDetails([project], projectModels, scopes).get(label)) != null ? _a : null;
|
|
5559
5560
|
}
|
|
5560
5561
|
loadIndexedSourceFiles() {
|
|
5561
5562
|
var _a, _b, _c;
|
|
@@ -5595,6 +5596,8 @@ class UsageCacheRepository {
|
|
|
5595
5596
|
content,
|
|
5596
5597
|
cost_usd,
|
|
5597
5598
|
dedupe_key,
|
|
5599
|
+
fallback_dedupe_key,
|
|
5600
|
+
is_sidechain,
|
|
5598
5601
|
model,
|
|
5599
5602
|
role,
|
|
5600
5603
|
timestamp,
|
|
@@ -5644,7 +5647,7 @@ class UsageCacheRepository {
|
|
|
5644
5647
|
});
|
|
5645
5648
|
}
|
|
5646
5649
|
upsertIndexedSourceFiles(files) {
|
|
5647
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
5650
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
5648
5651
|
if (files.length === 0) {
|
|
5649
5652
|
return;
|
|
5650
5653
|
}
|
|
@@ -5679,6 +5682,8 @@ class UsageCacheRepository {
|
|
|
5679
5682
|
content,
|
|
5680
5683
|
cost_usd,
|
|
5681
5684
|
dedupe_key,
|
|
5685
|
+
fallback_dedupe_key,
|
|
5686
|
+
is_sidechain,
|
|
5682
5687
|
model,
|
|
5683
5688
|
role,
|
|
5684
5689
|
timestamp,
|
|
@@ -5695,7 +5700,7 @@ class UsageCacheRepository {
|
|
|
5695
5700
|
tool_tokens,
|
|
5696
5701
|
is_fallback_model
|
|
5697
5702
|
)
|
|
5698
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5703
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5699
5704
|
`);
|
|
5700
5705
|
this.database.exec("BEGIN");
|
|
5701
5706
|
try {
|
|
@@ -5726,21 +5731,23 @@ class UsageCacheRepository {
|
|
|
5726
5731
|
interaction.content,
|
|
5727
5732
|
interaction.costUSD,
|
|
5728
5733
|
(_a = interaction.dedupeKey) != null ? _a : null,
|
|
5734
|
+
(_b = interaction.fallbackDedupeKey) != null ? _b : null,
|
|
5735
|
+
interaction.isSidechain ? 1 : 0,
|
|
5729
5736
|
interaction.model,
|
|
5730
5737
|
interaction.role,
|
|
5731
5738
|
interaction.timestamp,
|
|
5732
5739
|
interaction.type,
|
|
5733
|
-
(
|
|
5734
|
-
(
|
|
5735
|
-
(
|
|
5736
|
-
(
|
|
5737
|
-
(
|
|
5738
|
-
(
|
|
5739
|
-
(
|
|
5740
|
-
(
|
|
5741
|
-
(
|
|
5742
|
-
(
|
|
5743
|
-
((
|
|
5740
|
+
(_d = (_c = interaction.usage) == null ? void 0 : _c.inputTokens) != null ? _d : null,
|
|
5741
|
+
(_f = (_e = interaction.usage) == null ? void 0 : _e.cachedInputTokens) != null ? _f : null,
|
|
5742
|
+
(_h = (_g = interaction.usage) == null ? void 0 : _g.outputTokens) != null ? _h : null,
|
|
5743
|
+
(_j = (_i = interaction.usage) == null ? void 0 : _i.reasoningOutputTokens) != null ? _j : null,
|
|
5744
|
+
(_l = (_k = interaction.usage) == null ? void 0 : _k.extraTotalTokens) != null ? _l : null,
|
|
5745
|
+
(_n = (_m = interaction.usage) == null ? void 0 : _m.totalTokens) != null ? _n : null,
|
|
5746
|
+
(_p = (_o = interaction.usage) == null ? void 0 : _o.costUSD) != null ? _p : null,
|
|
5747
|
+
(_r = (_q = interaction.usage) == null ? void 0 : _q.cacheCreationTokens) != null ? _r : null,
|
|
5748
|
+
(_t = (_s = interaction.usage) == null ? void 0 : _s.cacheReadTokens) != null ? _t : null,
|
|
5749
|
+
(_v = (_u = interaction.usage) == null ? void 0 : _u.toolTokens) != null ? _v : null,
|
|
5750
|
+
((_w = interaction.usage) == null ? void 0 : _w.isFallbackModel) ? 1 : 0
|
|
5744
5751
|
);
|
|
5745
5752
|
}
|
|
5746
5753
|
}
|
|
@@ -5842,7 +5849,7 @@ class UsageCacheRepository {
|
|
|
5842
5849
|
return currentSchemaVersion !== 0 || this.hasCachedData();
|
|
5843
5850
|
}
|
|
5844
5851
|
hasCompatibleNormalizedSchema() {
|
|
5845
|
-
return this.hasTableColumns("indexed_files", ["cache_signature"]) && this.hasTableColumns("project_catalog_entries", ["platforms_json", "total_tokens"]) && !this.hasTableColumns("project_catalog_entries", ["type"]) && this.hasTableColumns("usage_scope_daily_usage_models", ["cost_usd"]) && this.hasTableColumns("usage_scope_overview_cards", ["subvalue_json"]) && this.hasTableColumns("usage_scope_interactions", ["extra_total_tokens"]) && this.hasTableColumns("indexed_fragment_interactions", ["extra_total_tokens"]);
|
|
5852
|
+
return this.hasTableColumns("indexed_files", ["cache_signature"]) && this.hasTableColumns("project_catalog_entries", ["platforms_json", "total_tokens"]) && !this.hasTableColumns("project_catalog_entries", ["type"]) && this.hasTableColumns("usage_scope_daily_usage_models", ["cost_usd"]) && this.hasTableColumns("usage_scope_overview_cards", ["subvalue_json"]) && this.hasTableColumns("usage_scope_interactions", ["extra_total_tokens"]) && this.hasTableColumns("indexed_fragment_interactions", ["extra_total_tokens", "fallback_dedupe_key", "is_sidechain"]);
|
|
5846
5853
|
}
|
|
5847
5854
|
hasTableColumns(tableName, columnNames) {
|
|
5848
5855
|
if (!this.hasTable(tableName)) {
|
|
@@ -5984,6 +5991,12 @@ class UsageCacheRepository {
|
|
|
5984
5991
|
if (!indexedInteractionColumns.some((column) => column.name === "extra_total_tokens")) {
|
|
5985
5992
|
this.database.exec("ALTER TABLE indexed_fragment_interactions ADD COLUMN extra_total_tokens INTEGER");
|
|
5986
5993
|
}
|
|
5994
|
+
if (!indexedInteractionColumns.some((column) => column.name === "fallback_dedupe_key")) {
|
|
5995
|
+
this.database.exec("ALTER TABLE indexed_fragment_interactions ADD COLUMN fallback_dedupe_key TEXT");
|
|
5996
|
+
}
|
|
5997
|
+
if (!indexedInteractionColumns.some((column) => column.name === "is_sidechain")) {
|
|
5998
|
+
this.database.exec("ALTER TABLE indexed_fragment_interactions ADD COLUMN is_sidechain INTEGER");
|
|
5999
|
+
}
|
|
5987
6000
|
}
|
|
5988
6001
|
}
|
|
5989
6002
|
clearNormalizedTables() {
|
|
@@ -6428,8 +6441,12 @@ class UsageCacheRepository {
|
|
|
6428
6441
|
}
|
|
6429
6442
|
}
|
|
6430
6443
|
}
|
|
6431
|
-
loadHydratedUsageScopes(kind,
|
|
6432
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
6444
|
+
loadHydratedUsageScopes(kind, options = {}) {
|
|
6445
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
6446
|
+
const includeInteractions = (_a = options.includeInteractions) != null ? _a : true;
|
|
6447
|
+
const baseScopeWhere = options.projectLabel === void 0 ? "scope_kind = ?" : "scope_kind = ? AND project_label = ?";
|
|
6448
|
+
const joinedScopeWhere = options.projectLabel === void 0 ? "scope.scope_kind = ?" : "scope.scope_kind = ? AND scope.project_label = ?";
|
|
6449
|
+
const scopeParameters = options.projectLabel === void 0 ? [kind] : [kind, options.projectLabel];
|
|
6433
6450
|
const scopes = this.database.prepare(`
|
|
6434
6451
|
SELECT
|
|
6435
6452
|
scope_key,
|
|
@@ -6445,9 +6462,9 @@ class UsageCacheRepository {
|
|
|
6445
6462
|
today_top_project,
|
|
6446
6463
|
today_top_project_session_count
|
|
6447
6464
|
FROM usage_scopes
|
|
6448
|
-
WHERE
|
|
6465
|
+
WHERE ${baseScopeWhere}
|
|
6449
6466
|
ORDER BY project_label ASC, platform ASC
|
|
6450
|
-
`).all(
|
|
6467
|
+
`).all(...scopeParameters);
|
|
6451
6468
|
if (scopes.length === 0) {
|
|
6452
6469
|
return /* @__PURE__ */ new Map();
|
|
6453
6470
|
}
|
|
@@ -6456,9 +6473,9 @@ class UsageCacheRepository {
|
|
|
6456
6473
|
SELECT card.scope_key, card.position, card.icon, card.name, card.value, card.detail, card.subvalue_json, card.trend, card.trend_tone
|
|
6457
6474
|
FROM usage_scope_overview_cards AS card
|
|
6458
6475
|
JOIN usage_scopes AS scope ON scope.scope_key = card.scope_key
|
|
6459
|
-
WHERE
|
|
6476
|
+
WHERE ${joinedScopeWhere}
|
|
6460
6477
|
ORDER BY card.scope_key ASC, card.position ASC
|
|
6461
|
-
`).all(
|
|
6478
|
+
`).all(...scopeParameters));
|
|
6462
6479
|
const tokenRows = groupTokenRows(
|
|
6463
6480
|
this.database.prepare(`
|
|
6464
6481
|
SELECT
|
|
@@ -6477,23 +6494,23 @@ class UsageCacheRepository {
|
|
|
6477
6494
|
row.cost_usd
|
|
6478
6495
|
FROM usage_scope_token_rows AS row
|
|
6479
6496
|
JOIN usage_scopes AS scope ON scope.scope_key = row.scope_key
|
|
6480
|
-
WHERE
|
|
6497
|
+
WHERE ${joinedScopeWhere}
|
|
6481
6498
|
ORDER BY row.scope_key ASC, row.bucket ASC, row.row_order ASC
|
|
6482
|
-
`).all(
|
|
6499
|
+
`).all(...scopeParameters),
|
|
6483
6500
|
this.database.prepare(`
|
|
6484
6501
|
SELECT model.scope_key, model.bucket, model.row_id, model.model, model.model_order
|
|
6485
6502
|
FROM usage_scope_token_row_models AS model
|
|
6486
6503
|
JOIN usage_scopes AS scope ON scope.scope_key = model.scope_key
|
|
6487
|
-
WHERE
|
|
6504
|
+
WHERE ${joinedScopeWhere}
|
|
6488
6505
|
ORDER BY model.scope_key ASC, model.bucket ASC, model.row_id ASC, model.model_order ASC
|
|
6489
|
-
`).all(
|
|
6506
|
+
`).all(...scopeParameters),
|
|
6490
6507
|
this.database.prepare(`
|
|
6491
6508
|
SELECT project.scope_key, project.bucket, project.row_id, project.project, project.project_order
|
|
6492
6509
|
FROM usage_scope_token_row_projects AS project
|
|
6493
6510
|
JOIN usage_scopes AS scope ON scope.scope_key = project.scope_key
|
|
6494
|
-
WHERE
|
|
6511
|
+
WHERE ${joinedScopeWhere}
|
|
6495
6512
|
ORDER BY project.scope_key ASC, project.bucket ASC, project.row_id ASC, project.project_order ASC
|
|
6496
|
-
`).all(
|
|
6513
|
+
`).all(...scopeParameters)
|
|
6497
6514
|
);
|
|
6498
6515
|
const dailyUsage = groupDailyUsage(
|
|
6499
6516
|
this.database.prepare(`
|
|
@@ -6509,9 +6526,9 @@ class UsageCacheRepository {
|
|
|
6509
6526
|
daily.cost_usd
|
|
6510
6527
|
FROM usage_scope_daily_usage AS daily
|
|
6511
6528
|
JOIN usage_scopes AS scope ON scope.scope_key = daily.scope_key
|
|
6512
|
-
WHERE
|
|
6529
|
+
WHERE ${joinedScopeWhere}
|
|
6513
6530
|
ORDER BY daily.scope_key ASC, daily.row_order ASC
|
|
6514
|
-
`).all(
|
|
6531
|
+
`).all(...scopeParameters),
|
|
6515
6532
|
this.database.prepare(`
|
|
6516
6533
|
SELECT
|
|
6517
6534
|
model.scope_key,
|
|
@@ -6527,17 +6544,17 @@ class UsageCacheRepository {
|
|
|
6527
6544
|
model.is_fallback
|
|
6528
6545
|
FROM usage_scope_daily_usage_models AS model
|
|
6529
6546
|
JOIN usage_scopes AS scope ON scope.scope_key = model.scope_key
|
|
6530
|
-
WHERE
|
|
6547
|
+
WHERE ${joinedScopeWhere}
|
|
6531
6548
|
ORDER BY model.scope_key ASC, model.date ASC, model.model_order ASC
|
|
6532
|
-
`).all(
|
|
6549
|
+
`).all(...scopeParameters)
|
|
6533
6550
|
);
|
|
6534
6551
|
const monthlyUsage = groupMonthlyModelUsage(this.database.prepare(`
|
|
6535
6552
|
SELECT monthly.scope_key, monthly.row_order, monthly.month, monthly.model, monthly.token_total
|
|
6536
6553
|
FROM usage_scope_monthly_model_usage AS monthly
|
|
6537
6554
|
JOIN usage_scopes AS scope ON scope.scope_key = monthly.scope_key
|
|
6538
|
-
WHERE
|
|
6555
|
+
WHERE ${joinedScopeWhere}
|
|
6539
6556
|
ORDER BY monthly.scope_key ASC, monthly.row_order ASC
|
|
6540
|
-
`).all(
|
|
6557
|
+
`).all(...scopeParameters));
|
|
6541
6558
|
const projectUsage = groupProjectUsage(this.database.prepare(`
|
|
6542
6559
|
SELECT
|
|
6543
6560
|
usage.scope_key,
|
|
@@ -6553,9 +6570,9 @@ class UsageCacheRepository {
|
|
|
6553
6570
|
usage.cost_usd
|
|
6554
6571
|
FROM usage_scope_project_usage AS usage
|
|
6555
6572
|
JOIN usage_scopes AS scope ON scope.scope_key = usage.scope_key
|
|
6556
|
-
WHERE
|
|
6573
|
+
WHERE ${joinedScopeWhere}
|
|
6557
6574
|
ORDER BY usage.scope_key ASC, usage.row_order ASC
|
|
6558
|
-
`).all(
|
|
6575
|
+
`).all(...scopeParameters));
|
|
6559
6576
|
const sessions = groupSessions(
|
|
6560
6577
|
this.database.prepare(`
|
|
6561
6578
|
SELECT
|
|
@@ -6583,16 +6600,16 @@ class UsageCacheRepository {
|
|
|
6583
6600
|
session.top_model
|
|
6584
6601
|
FROM usage_scope_sessions AS session
|
|
6585
6602
|
JOIN usage_scopes AS scope ON scope.scope_key = session.scope_key
|
|
6586
|
-
WHERE
|
|
6603
|
+
WHERE ${joinedScopeWhere}
|
|
6587
6604
|
ORDER BY session.scope_key ASC, session.session_order ASC
|
|
6588
|
-
`).all(
|
|
6605
|
+
`).all(...scopeParameters),
|
|
6589
6606
|
this.database.prepare(`
|
|
6590
6607
|
SELECT model.scope_key, model.session_key, model.model, model.model_order
|
|
6591
6608
|
FROM usage_scope_session_models AS model
|
|
6592
6609
|
JOIN usage_scopes AS scope ON scope.scope_key = model.scope_key
|
|
6593
|
-
WHERE
|
|
6610
|
+
WHERE ${joinedScopeWhere}
|
|
6594
6611
|
ORDER BY model.scope_key ASC, model.session_key ASC, model.model_order ASC
|
|
6595
|
-
`).all(
|
|
6612
|
+
`).all(...scopeParameters),
|
|
6596
6613
|
includeInteractions ? this.database.prepare(`
|
|
6597
6614
|
SELECT
|
|
6598
6615
|
interaction.scope_key,
|
|
@@ -6618,9 +6635,9 @@ class UsageCacheRepository {
|
|
|
6618
6635
|
interaction.is_fallback_model
|
|
6619
6636
|
FROM usage_scope_interactions AS interaction
|
|
6620
6637
|
JOIN usage_scopes AS scope ON scope.scope_key = interaction.scope_key
|
|
6621
|
-
WHERE
|
|
6638
|
+
WHERE ${joinedScopeWhere}
|
|
6622
6639
|
ORDER BY interaction.scope_key ASC, interaction.session_key ASC, interaction.interaction_order ASC
|
|
6623
|
-
`).all(
|
|
6640
|
+
`).all(...scopeParameters) : []
|
|
6624
6641
|
);
|
|
6625
6642
|
const hydrated = /* @__PURE__ */ new Map();
|
|
6626
6643
|
for (const scope of scopes) {
|
|
@@ -6628,27 +6645,27 @@ class UsageCacheRepository {
|
|
|
6628
6645
|
continue;
|
|
6629
6646
|
}
|
|
6630
6647
|
const scopeTokenRows = tokenRows.get(scope.scope_key);
|
|
6631
|
-
const sessionUsage = (
|
|
6648
|
+
const sessionUsage = (_b = sessions.get(scope.scope_key)) != null ? _b : [];
|
|
6632
6649
|
hydrated.set(scope.scope_key, {
|
|
6633
|
-
dailyRows: (
|
|
6634
|
-
dailyTokenUsage: (
|
|
6635
|
-
monthlyModelUsage: (
|
|
6636
|
-
monthlyRows: (
|
|
6637
|
-
overviewCards: (
|
|
6638
|
-
projectUsage: (
|
|
6639
|
-
sessionRows: (
|
|
6650
|
+
dailyRows: (_c = scopeTokenRows == null ? void 0 : scopeTokenRows.daily) != null ? _c : [],
|
|
6651
|
+
dailyTokenUsage: (_d = dailyUsage.get(scope.scope_key)) != null ? _d : [],
|
|
6652
|
+
monthlyModelUsage: (_e = monthlyUsage.get(scope.scope_key)) != null ? _e : [],
|
|
6653
|
+
monthlyRows: (_f = scopeTokenRows == null ? void 0 : scopeTokenRows.monthly) != null ? _f : [],
|
|
6654
|
+
overviewCards: (_g = overviewCards.get(scope.scope_key)) != null ? _g : [],
|
|
6655
|
+
projectUsage: (_h = projectUsage.get(scope.scope_key)) != null ? _h : [],
|
|
6656
|
+
sessionRows: (_i = scopeTokenRows == null ? void 0 : scopeTokenRows.session) != null ? _i : [],
|
|
6640
6657
|
sessionUsage,
|
|
6641
6658
|
todayTopModel: scope.today_top_model ? {
|
|
6642
6659
|
model: scope.today_top_model,
|
|
6643
|
-
totalTokens: (
|
|
6660
|
+
totalTokens: (_j = scope.today_top_model_total_tokens) != null ? _j : 0
|
|
6644
6661
|
} : null,
|
|
6645
6662
|
todayTopProject: scope.today_top_project ? {
|
|
6646
6663
|
project: scope.today_top_project,
|
|
6647
|
-
sessionCount: (
|
|
6664
|
+
sessionCount: (_k = scope.today_top_project_session_count) != null ? _k : 0
|
|
6648
6665
|
} : null,
|
|
6649
6666
|
todayTotalCost: scope.today_total_cost,
|
|
6650
6667
|
todayTotalTokens: scope.today_total_tokens,
|
|
6651
|
-
weeklyRows: (
|
|
6668
|
+
weeklyRows: (_l = scopeTokenRows == null ? void 0 : scopeTokenRows.weekly) != null ? _l : []
|
|
6652
6669
|
});
|
|
6653
6670
|
}
|
|
6654
6671
|
return hydrated;
|
|
@@ -6783,6 +6800,33 @@ function groupProjectModels(rows) {
|
|
|
6783
6800
|
}
|
|
6784
6801
|
return grouped;
|
|
6785
6802
|
}
|
|
6803
|
+
function buildProjectUsageDetails(projects, projectModels, scopes) {
|
|
6804
|
+
var _a;
|
|
6805
|
+
const details = /* @__PURE__ */ new Map();
|
|
6806
|
+
for (const project of projects) {
|
|
6807
|
+
const analyzing = Object.fromEntries(
|
|
6808
|
+
PROJECT_USAGE_PLATFORMS.map((platform) => {
|
|
6809
|
+
const scopeKey = createUsageScopeKey("project", platform, project.label);
|
|
6810
|
+
const usage = scopes.get(scopeKey);
|
|
6811
|
+
return [
|
|
6812
|
+
platform,
|
|
6813
|
+
usage ? {
|
|
6814
|
+
...usage,
|
|
6815
|
+
sessions: usage.sessionUsage
|
|
6816
|
+
} : createEmptyProjectPlatformUsage()
|
|
6817
|
+
];
|
|
6818
|
+
})
|
|
6819
|
+
);
|
|
6820
|
+
details.set(project.label, normalizeProjectUsageDetail({
|
|
6821
|
+
analyzing,
|
|
6822
|
+
createTime: project.create_time,
|
|
6823
|
+
label: project.label,
|
|
6824
|
+
models: (_a = projectModels.get(project.label)) != null ? _a : [],
|
|
6825
|
+
sessionCound: project.session_count
|
|
6826
|
+
}));
|
|
6827
|
+
}
|
|
6828
|
+
return details;
|
|
6829
|
+
}
|
|
6786
6830
|
function groupIndexedFileProjects(rows) {
|
|
6787
6831
|
var _a;
|
|
6788
6832
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -6802,7 +6846,9 @@ function groupIndexedInteractions(rows) {
|
|
|
6802
6846
|
content: row.content,
|
|
6803
6847
|
costUSD: row.cost_usd,
|
|
6804
6848
|
dedupeKey: row.dedupe_key,
|
|
6849
|
+
fallbackDedupeKey: row.fallback_dedupe_key,
|
|
6805
6850
|
index: row.interaction_index,
|
|
6851
|
+
isSidechain: row.is_sidechain === 1,
|
|
6806
6852
|
model: row.model,
|
|
6807
6853
|
role: row.role,
|
|
6808
6854
|
timestamp: row.timestamp,
|
|
@@ -7566,7 +7612,7 @@ function buildDailyUsageGroups(events, options = {}) {
|
|
|
7566
7612
|
isFallback: false
|
|
7567
7613
|
};
|
|
7568
7614
|
addUsage(modelUsage, event);
|
|
7569
|
-
modelUsage.costUSD
|
|
7615
|
+
modelUsage.costUSD = sumCurrency(modelUsage.costUSD, getEventCostUSD(event, options));
|
|
7570
7616
|
if (event.isFallbackModel) {
|
|
7571
7617
|
modelUsage.isFallback = true;
|
|
7572
7618
|
}
|
|
@@ -7691,7 +7737,7 @@ function toUsageSessionUsageItem(session, options = {}) {
|
|
|
7691
7737
|
cachedInputTokens: getCachedInputTokens(session, options),
|
|
7692
7738
|
costUSD: session.costUSD,
|
|
7693
7739
|
date: formatDateLabelFromDateKey(getDateKey(startedAtDate)),
|
|
7694
|
-
duration: formatDuration(session.durationMinutes),
|
|
7740
|
+
duration: formatDuration$1(session.durationMinutes),
|
|
7695
7741
|
durationMinutes: session.durationMinutes,
|
|
7696
7742
|
id: (_a = session.id) != null ? _a : session.sessionId,
|
|
7697
7743
|
inputTokens: session.inputTokens,
|
|
@@ -7922,7 +7968,7 @@ function formatMonthLabel(monthKey) {
|
|
|
7922
7968
|
year: "numeric"
|
|
7923
7969
|
}).format(date);
|
|
7924
7970
|
}
|
|
7925
|
-
function formatDuration(minutes) {
|
|
7971
|
+
function formatDuration$1(minutes) {
|
|
7926
7972
|
const hours = Math.floor(minutes / 60);
|
|
7927
7973
|
const remainingMinutes = minutes % 60;
|
|
7928
7974
|
if (hours === 0) {
|
|
@@ -8130,7 +8176,7 @@ function addEventToAggregateGroup(group, event, options) {
|
|
|
8130
8176
|
group.outputTokens += event.outputTokens;
|
|
8131
8177
|
group.reasoningOutputTokens += event.reasoningOutputTokens;
|
|
8132
8178
|
group.totalTokens += event.totalTokens;
|
|
8133
|
-
group.costUSD
|
|
8179
|
+
group.costUSD = sumCurrency(group.costUSD, getEventCostUSD(event, options));
|
|
8134
8180
|
group.models = shouldIncludeModel(event, options) ? uniqueItems([...group.models, event.model]) : group.models;
|
|
8135
8181
|
group.projects = uniqueItems([...group.projects, event.project]);
|
|
8136
8182
|
}
|
|
@@ -8498,7 +8544,7 @@ const GEMINI_FALLBACK_PRICING_TABLE = {
|
|
|
8498
8544
|
}
|
|
8499
8545
|
};
|
|
8500
8546
|
|
|
8501
|
-
const CLAUDE_CODE_CACHE_SIGNATURE = "claude-code-dedupe:
|
|
8547
|
+
const CLAUDE_CODE_CACHE_SIGNATURE = "claude-code-dedupe:daily-agent-progress-v2";
|
|
8502
8548
|
const claudeCodeUsageAdapter = {
|
|
8503
8549
|
async createPricingResolver() {
|
|
8504
8550
|
return createLiteLLMPricingResolver({
|
|
@@ -8527,20 +8573,20 @@ const claudeCodeUsageAdapter = {
|
|
|
8527
8573
|
const lines = parseJsonlFile(filePath);
|
|
8528
8574
|
const fragments = /* @__PURE__ */ new Map();
|
|
8529
8575
|
for (let index = 0; index < lines.length; index += 1) {
|
|
8530
|
-
const line = lines[index];
|
|
8531
|
-
if (!
|
|
8576
|
+
const line = getClaudeUsageLine(lines[index]);
|
|
8577
|
+
if (!line) {
|
|
8532
8578
|
continue;
|
|
8533
8579
|
}
|
|
8534
|
-
const sessionId =
|
|
8535
|
-
const cwd = (_a =
|
|
8580
|
+
const sessionId = line.sessionId || fallbackSessionId;
|
|
8581
|
+
const cwd = (_a = line.cwd) != null ? _a : "";
|
|
8536
8582
|
const project = getProjectName(cwd, "") || decodeClaudeProjectPath(projectPath);
|
|
8537
|
-
const timestamp =
|
|
8538
|
-
const message =
|
|
8539
|
-
const usageRecord =
|
|
8583
|
+
const timestamp = line.timestamp;
|
|
8584
|
+
const message = line.message;
|
|
8585
|
+
const usageRecord = line.usage;
|
|
8540
8586
|
const model = getClaudeDisplayModel(line);
|
|
8541
|
-
const usage = usageRecord ? getClaudeInteractionUsage(usageRecord, model, resolvePricing, line) : null;
|
|
8587
|
+
const usage = usageRecord ? getClaudeInteractionUsage(usageRecord, model, resolvePricing, line.costUSD) : null;
|
|
8542
8588
|
const key = `${project}:${sessionId}`;
|
|
8543
|
-
const fragment = (
|
|
8589
|
+
const fragment = (_b = fragments.get(key)) != null ? _b : createSessionFragment({
|
|
8544
8590
|
project,
|
|
8545
8591
|
repository: `local/${project}`,
|
|
8546
8592
|
sessionId,
|
|
@@ -8549,13 +8595,15 @@ const claudeCodeUsageAdapter = {
|
|
|
8549
8595
|
});
|
|
8550
8596
|
addFragmentInteraction(fragment, {
|
|
8551
8597
|
content: extractClaudeMessageText(message == null ? void 0 : message.content),
|
|
8552
|
-
costUSD: (
|
|
8598
|
+
costUSD: (_c = usage == null ? void 0 : usage.costUSD) != null ? _c : 0,
|
|
8553
8599
|
dedupeKey: getClaudeUniqueHash(line),
|
|
8600
|
+
fallbackDedupeKey: normalizeStringValue(message == null ? void 0 : message.id),
|
|
8554
8601
|
index,
|
|
8602
|
+
isSidechain: line.isSidechain === true,
|
|
8555
8603
|
model: model != null ? model : null,
|
|
8556
|
-
role: getInteractionRole(line, message),
|
|
8604
|
+
role: getInteractionRole(line.type, message),
|
|
8557
8605
|
timestamp,
|
|
8558
|
-
type:
|
|
8606
|
+
type: (_d = line.type) != null ? _d : normalizeStringValue(message == null ? void 0 : message.type) || "message",
|
|
8559
8607
|
usage
|
|
8560
8608
|
});
|
|
8561
8609
|
fragments.set(key, fragment);
|
|
@@ -8566,13 +8614,12 @@ const claudeCodeUsageAdapter = {
|
|
|
8566
8614
|
return config.claudeCodePaths.map((path) => join(path, "projects", "**", "*.jsonl"));
|
|
8567
8615
|
}
|
|
8568
8616
|
};
|
|
8569
|
-
function getClaudeInteractionUsage(usage, model, resolvePricing,
|
|
8570
|
-
var _a;
|
|
8617
|
+
function getClaudeInteractionUsage(usage, model, resolvePricing, costUSD) {
|
|
8571
8618
|
const cacheCreationTokens = normalizeNumber(usage.cache_creation_input_tokens);
|
|
8572
8619
|
const cacheReadTokens = normalizeNumber(usage.cache_read_input_tokens);
|
|
8573
8620
|
const inputTokens = normalizeNumber(usage.input_tokens);
|
|
8574
8621
|
const outputTokens = normalizeNumber(usage.output_tokens);
|
|
8575
|
-
const
|
|
8622
|
+
const resolvedCostUSD = costUSD != null ? costUSD : model ? calculateUsageCostUSD({
|
|
8576
8623
|
cacheCreationTokens,
|
|
8577
8624
|
cachedInputTokens: cacheReadTokens,
|
|
8578
8625
|
inputTokens,
|
|
@@ -8584,7 +8631,7 @@ function getClaudeInteractionUsage(usage, model, resolvePricing, line) {
|
|
|
8584
8631
|
cacheCreationTokens,
|
|
8585
8632
|
cacheReadTokens,
|
|
8586
8633
|
cachedInputTokens: cacheCreationTokens + cacheReadTokens,
|
|
8587
|
-
costUSD,
|
|
8634
|
+
costUSD: resolvedCostUSD,
|
|
8588
8635
|
inputTokens,
|
|
8589
8636
|
outputTokens,
|
|
8590
8637
|
reasoningOutputTokens: 0,
|
|
@@ -8592,18 +8639,15 @@ function getClaudeInteractionUsage(usage, model, resolvePricing, line) {
|
|
|
8592
8639
|
};
|
|
8593
8640
|
}
|
|
8594
8641
|
function getClaudeDisplayModel(line) {
|
|
8595
|
-
const
|
|
8596
|
-
const model = normalizeStringValue(message == null ? void 0 : message.model);
|
|
8597
|
-
const usage = normalizeUnknownRecord(message == null ? void 0 : message.usage);
|
|
8642
|
+
const model = normalizeStringValue(line.message.model);
|
|
8598
8643
|
if (!model) {
|
|
8599
8644
|
return void 0;
|
|
8600
8645
|
}
|
|
8601
|
-
return
|
|
8646
|
+
return line.usage.speed === "fast" ? `${model}-fast` : model;
|
|
8602
8647
|
}
|
|
8603
8648
|
function getClaudeUniqueHash(line) {
|
|
8604
|
-
const
|
|
8605
|
-
const
|
|
8606
|
-
const requestId = normalizeStringValue(line.requestId);
|
|
8649
|
+
const messageId = normalizeStringValue(line.message.id);
|
|
8650
|
+
const requestId = line.requestId;
|
|
8607
8651
|
return messageId ? `${messageId}:${requestId != null ? requestId : ""}` : null;
|
|
8608
8652
|
}
|
|
8609
8653
|
function extractClaudeMessageText(content) {
|
|
@@ -8618,35 +8662,65 @@ function extractClaudeMessageText(content) {
|
|
|
8618
8662
|
return typeof item === "object" && item ? (_a = normalizeStringValue(item.text)) != null ? _a : "" : "";
|
|
8619
8663
|
}).filter(Boolean).join("\n");
|
|
8620
8664
|
}
|
|
8621
|
-
function getInteractionRole(
|
|
8622
|
-
const role = normalizeStringValue(
|
|
8665
|
+
function getInteractionRole(type, message) {
|
|
8666
|
+
const role = normalizeStringValue(message.role) || type || normalizeStringValue(message.type) || "";
|
|
8623
8667
|
return normalizeRole(role);
|
|
8624
8668
|
}
|
|
8625
|
-
function
|
|
8626
|
-
|
|
8669
|
+
function getClaudeUsageLine(line) {
|
|
8670
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8671
|
+
const progressData = normalizeUnknownRecord(line.data);
|
|
8672
|
+
const progressMessage = normalizeUnknownRecord(progressData == null ? void 0 : progressData.message);
|
|
8673
|
+
const message = (_a = normalizeUnknownRecord(progressMessage == null ? void 0 : progressMessage.message)) != null ? _a : normalizeUnknownRecord(line.message);
|
|
8627
8674
|
const usage = normalizeUnknownRecord(message == null ? void 0 : message.usage);
|
|
8628
|
-
if (hasUnsupportedClaudeNullField(line, message, usage)) {
|
|
8629
|
-
return
|
|
8675
|
+
if (!message || !usage || hasUnsupportedClaudeNullField(line, progressMessage, message, usage)) {
|
|
8676
|
+
return null;
|
|
8630
8677
|
}
|
|
8631
8678
|
const version = normalizeStringValue(line.version);
|
|
8632
8679
|
if (version && !/^\d+\.\d+\.\d+/u.test(version)) {
|
|
8633
|
-
return
|
|
8680
|
+
return null;
|
|
8681
|
+
}
|
|
8682
|
+
const sessionId = normalizeStringValue(line.sessionId);
|
|
8683
|
+
const requestId = (_b = normalizeStringValue(progressMessage == null ? void 0 : progressMessage.requestId)) != null ? _b : normalizeStringValue(line.requestId);
|
|
8684
|
+
if (hasEmptyClaudeField({
|
|
8685
|
+
message,
|
|
8686
|
+
requestId,
|
|
8687
|
+
sessionId,
|
|
8688
|
+
version
|
|
8689
|
+
})) {
|
|
8690
|
+
return null;
|
|
8634
8691
|
}
|
|
8635
|
-
return
|
|
8692
|
+
return {
|
|
8693
|
+
costUSD: (_c = normalizeFiniteNumberOrNull(progressMessage == null ? void 0 : progressMessage.costUSD)) != null ? _c : normalizeFiniteNumberOrNull(line.costUSD),
|
|
8694
|
+
cwd: normalizeStringValue(line.cwd),
|
|
8695
|
+
isSidechain: normalizeBooleanValue((_d = progressMessage == null ? void 0 : progressMessage.isSidechain) != null ? _d : line.isSidechain),
|
|
8696
|
+
message,
|
|
8697
|
+
requestId,
|
|
8698
|
+
sessionId,
|
|
8699
|
+
timestamp: (_f = toIsoString((_e = progressMessage == null ? void 0 : progressMessage.timestamp) != null ? _e : line.timestamp)) != null ? _f : null,
|
|
8700
|
+
type: (_g = normalizeStringValue(progressMessage == null ? void 0 : progressMessage.type)) != null ? _g : normalizeStringValue(line.type),
|
|
8701
|
+
usage
|
|
8702
|
+
};
|
|
8636
8703
|
}
|
|
8637
|
-
function hasUnsupportedClaudeNullField(line, message, usage) {
|
|
8638
|
-
|
|
8704
|
+
function hasUnsupportedClaudeNullField(line, progressMessage, message, usage) {
|
|
8705
|
+
var _a, _b;
|
|
8706
|
+
return line.cwd === null || ((_a = progressMessage == null ? void 0 : progressMessage.costUSD) != null ? _a : line.costUSD) === null || line.version === null || line.sessionId === null || ((_b = progressMessage == null ? void 0 : progressMessage.requestId) != null ? _b : line.requestId) === null || line.isApiErrorMessage === null || message.id === null || message.model === null || usage.speed === null || usage.cache_read_input_tokens === null || usage.cache_creation_input_tokens === null;
|
|
8639
8707
|
}
|
|
8640
|
-
function hasEmptyClaudeField(
|
|
8708
|
+
function hasEmptyClaudeField(options) {
|
|
8641
8709
|
const candidates = [
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
message
|
|
8646
|
-
message
|
|
8710
|
+
options.sessionId,
|
|
8711
|
+
options.requestId,
|
|
8712
|
+
options.version,
|
|
8713
|
+
options.message.id,
|
|
8714
|
+
options.message.model
|
|
8647
8715
|
];
|
|
8648
8716
|
return candidates.some((value) => typeof value === "string" && value.trim() === "");
|
|
8649
8717
|
}
|
|
8718
|
+
function normalizeBooleanValue(value) {
|
|
8719
|
+
if (value === true || value === false) {
|
|
8720
|
+
return value;
|
|
8721
|
+
}
|
|
8722
|
+
return void 0;
|
|
8723
|
+
}
|
|
8650
8724
|
|
|
8651
8725
|
const CODEBUFF_DEFAULT_MODEL = "codebuff-unknown";
|
|
8652
8726
|
const codebuffUsageAdapter = {
|
|
@@ -8997,7 +9071,7 @@ const codexUsageAdapter = {
|
|
|
8997
9071
|
addFragmentInteraction(fragment, {
|
|
8998
9072
|
content: extractCodexContent(line),
|
|
8999
9073
|
costUSD: (_h = usage == null ? void 0 : usage.costUSD) != null ? _h : 0,
|
|
9000
|
-
dedupeKey: usage && timestamp ? getCodexDedupeKey(timestamp, model != null ? model : CODEX_FALLBACK_MODEL, usage) : null,
|
|
9074
|
+
dedupeKey: usage && timestamp ? getCodexDedupeKey(sessionId, timestamp, model != null ? model : CODEX_FALLBACK_MODEL, usage) : null,
|
|
9001
9075
|
index,
|
|
9002
9076
|
model: model != null ? model : null,
|
|
9003
9077
|
role: getCodexRole(line, rawUsage !== null),
|
|
@@ -9021,7 +9095,8 @@ function getCodexRawUsage(line, previousTotals) {
|
|
|
9021
9095
|
const info = normalizeUnknownRecord(payload == null ? void 0 : payload.info);
|
|
9022
9096
|
const lastUsage = normalizeRawUsage(info == null ? void 0 : info.last_token_usage);
|
|
9023
9097
|
const totalUsage = normalizeRawUsage(info == null ? void 0 : info.total_token_usage);
|
|
9024
|
-
|
|
9098
|
+
const sessionUsage = lastUsage != null ? lastUsage : totalUsage ? subtractRawUsage(totalUsage, previousTotals) : null;
|
|
9099
|
+
return sessionUsage && sessionUsage.input_tokens === 0 && sessionUsage.cached_input_tokens === 0 && sessionUsage.output_tokens === 0 && sessionUsage.reasoning_output_tokens === 0 ? null : sessionUsage;
|
|
9025
9100
|
}
|
|
9026
9101
|
return getHeadlessCodexRawUsage(line);
|
|
9027
9102
|
}
|
|
@@ -9209,10 +9284,11 @@ function getCodexTimestamp(line) {
|
|
|
9209
9284
|
const payload = normalizeUnknownRecord(line.payload);
|
|
9210
9285
|
return toIsoString(line.timestamp) || toIsoString(line.created_at) || toIsoString(line.createdAt) || toIsoString(payload == null ? void 0 : payload.timestamp) || toIsoString(data == null ? void 0 : data.timestamp) || toIsoString(data == null ? void 0 : data.created_at) || toIsoString(data == null ? void 0 : data.createdAt) || toIsoString(result == null ? void 0 : result.timestamp) || toIsoString(result == null ? void 0 : result.created_at) || toIsoString(result == null ? void 0 : result.createdAt) || toIsoString(response == null ? void 0 : response.timestamp) || toIsoString(response == null ? void 0 : response.created_at) || toIsoString(response == null ? void 0 : response.createdAt);
|
|
9211
9286
|
}
|
|
9212
|
-
function getCodexDedupeKey(timestamp, model, usage) {
|
|
9287
|
+
function getCodexDedupeKey(sessionId, timestamp, model, usage) {
|
|
9213
9288
|
const rawInputTokens = usage.inputTokens + usage.cachedInputTokens;
|
|
9214
9289
|
return [
|
|
9215
9290
|
"codex",
|
|
9291
|
+
sessionId,
|
|
9216
9292
|
timestamp,
|
|
9217
9293
|
model,
|
|
9218
9294
|
String(rawInputTokens),
|
|
@@ -9693,7 +9769,7 @@ const geminiUsageAdapter = {
|
|
|
9693
9769
|
const files = Array.from(new Set(fileGroups.flat())).sort((a, b) => a.localeCompare(b));
|
|
9694
9770
|
return files.flatMap((filePath) => toDiscoveredUsageFile(filePath, "gemini"));
|
|
9695
9771
|
},
|
|
9696
|
-
parseFile(filePath
|
|
9772
|
+
parseFile(filePath) {
|
|
9697
9773
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9698
9774
|
const data = parseJsonFile(filePath);
|
|
9699
9775
|
if (!isGeminiSessionFile(data)) {
|
|
@@ -9717,7 +9793,7 @@ const geminiUsageAdapter = {
|
|
|
9717
9793
|
const message = data.messages[index];
|
|
9718
9794
|
const timestamp = toIsoString(message.timestamp);
|
|
9719
9795
|
const model = ((_f = message.model) == null ? void 0 : _f.trim()) || (message.tokens ? GEMINI_FALLBACK_MODEL : null);
|
|
9720
|
-
const usage = message.tokens && model ? getGeminiInteractionUsage(message.tokens
|
|
9796
|
+
const usage = message.tokens && model ? getGeminiInteractionUsage(message.tokens) : null;
|
|
9721
9797
|
addFragmentInteraction(fragment, {
|
|
9722
9798
|
content: extractGeminiMessageText(message.content),
|
|
9723
9799
|
costUSD: (_g = usage == null ? void 0 : usage.costUSD) != null ? _g : 0,
|
|
@@ -9738,7 +9814,7 @@ const geminiUsageAdapter = {
|
|
|
9738
9814
|
];
|
|
9739
9815
|
}
|
|
9740
9816
|
};
|
|
9741
|
-
function getGeminiInteractionUsage(tokens
|
|
9817
|
+
function getGeminiInteractionUsage(tokens) {
|
|
9742
9818
|
const baseUsage = convertGeminiTokenUsage(tokens);
|
|
9743
9819
|
const extraTotalTokens = normalizeNumber(tokens.thoughts);
|
|
9744
9820
|
const usage = {
|
|
@@ -9749,14 +9825,9 @@ function getGeminiInteractionUsage(tokens, model, resolvePricing) {
|
|
|
9749
9825
|
if (isZeroUsage(usage)) {
|
|
9750
9826
|
return null;
|
|
9751
9827
|
}
|
|
9752
|
-
const costUSD = calculateUsageCostUSD({
|
|
9753
|
-
cachedInputTokens: usage.cachedInputTokens,
|
|
9754
|
-
inputTokens: usage.inputTokens,
|
|
9755
|
-
outputTokens: usage.outputTokens
|
|
9756
|
-
}, resolvePricing(model));
|
|
9757
9828
|
return {
|
|
9758
9829
|
...usage,
|
|
9759
|
-
costUSD,
|
|
9830
|
+
costUSD: 0,
|
|
9760
9831
|
extraTotalTokens
|
|
9761
9832
|
};
|
|
9762
9833
|
}
|
|
@@ -10908,36 +10979,58 @@ function buildPlatformSessionsFromFiles(indexedFiles, platform) {
|
|
|
10908
10979
|
return Array.from(details.values()).map(finalizeSessionDetail).filter(hasBillableSessionDetail).map(toProjectSessionUsageItem).sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
|
|
10909
10980
|
}
|
|
10910
10981
|
function selectDedupedInteractions(indexedFiles, platform) {
|
|
10982
|
+
var _a;
|
|
10911
10983
|
const interactionsWithoutDedupeKey = [];
|
|
10912
10984
|
const interactionsByDedupeKey = /* @__PURE__ */ new Map();
|
|
10985
|
+
const interactionsByFallbackDedupeKey = /* @__PURE__ */ new Map();
|
|
10913
10986
|
for (const file of indexedFiles) {
|
|
10914
10987
|
if (file.platform !== platform) {
|
|
10915
10988
|
continue;
|
|
10916
10989
|
}
|
|
10917
10990
|
for (const fragment of file.payload) {
|
|
10918
10991
|
for (const interaction of fragment.interactions) {
|
|
10919
|
-
if (!interaction.dedupeKey) {
|
|
10992
|
+
if (!interaction.dedupeKey && !interaction.fallbackDedupeKey) {
|
|
10920
10993
|
interactionsWithoutDedupeKey.push({ fragment, interaction });
|
|
10921
10994
|
continue;
|
|
10922
10995
|
}
|
|
10923
|
-
const existing = interactionsByDedupeKey.get(interaction.dedupeKey);
|
|
10996
|
+
const existing = (_a = interaction.dedupeKey ? interactionsByDedupeKey.get(interaction.dedupeKey) : void 0) != null ? _a : interaction.fallbackDedupeKey ? interactionsByFallbackDedupeKey.get(interaction.fallbackDedupeKey) : void 0;
|
|
10924
10997
|
if (!existing) {
|
|
10925
|
-
|
|
10998
|
+
if (interaction.dedupeKey) {
|
|
10999
|
+
interactionsByDedupeKey.set(interaction.dedupeKey, { fragment, interaction });
|
|
11000
|
+
}
|
|
11001
|
+
if (interaction.fallbackDedupeKey) {
|
|
11002
|
+
interactionsByFallbackDedupeKey.set(interaction.fallbackDedupeKey, { fragment, interaction });
|
|
11003
|
+
}
|
|
10926
11004
|
} else if (shouldReplaceDedupedInteraction(interaction, existing.interaction)) {
|
|
10927
|
-
|
|
11005
|
+
const next = { fragment: existing.fragment, interaction };
|
|
11006
|
+
if (existing.interaction.dedupeKey) {
|
|
11007
|
+
interactionsByDedupeKey.set(existing.interaction.dedupeKey, next);
|
|
11008
|
+
}
|
|
11009
|
+
if (existing.interaction.fallbackDedupeKey) {
|
|
11010
|
+
interactionsByFallbackDedupeKey.set(existing.interaction.fallbackDedupeKey, next);
|
|
11011
|
+
}
|
|
11012
|
+
if (interaction.dedupeKey) {
|
|
11013
|
+
interactionsByDedupeKey.set(interaction.dedupeKey, next);
|
|
11014
|
+
}
|
|
11015
|
+
if (interaction.fallbackDedupeKey) {
|
|
11016
|
+
interactionsByFallbackDedupeKey.set(interaction.fallbackDedupeKey, next);
|
|
11017
|
+
}
|
|
10928
11018
|
}
|
|
10929
11019
|
}
|
|
10930
11020
|
}
|
|
10931
11021
|
}
|
|
10932
11022
|
return [
|
|
10933
11023
|
...interactionsWithoutDedupeKey,
|
|
10934
|
-
...interactionsByDedupeKey.values()
|
|
11024
|
+
...new Set(interactionsByDedupeKey.values())
|
|
10935
11025
|
];
|
|
10936
11026
|
}
|
|
10937
11027
|
function shouldReplaceDedupedInteraction(candidate, existing) {
|
|
10938
|
-
var _a, _b, _c, _d;
|
|
10939
|
-
|
|
10940
|
-
|
|
11028
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11029
|
+
if (((_a = candidate.isSidechain) != null ? _a : false) !== ((_b = existing.isSidechain) != null ? _b : false)) {
|
|
11030
|
+
return existing.isSidechain === true;
|
|
11031
|
+
}
|
|
11032
|
+
const candidateTotal = (_d = (_c = candidate.usage) == null ? void 0 : _c.totalTokens) != null ? _d : 0;
|
|
11033
|
+
const existingTotal = (_f = (_e = existing.usage) == null ? void 0 : _e.totalTokens) != null ? _f : 0;
|
|
10941
11034
|
if (candidateTotal !== existingTotal) {
|
|
10942
11035
|
return candidateTotal > existingTotal;
|
|
10943
11036
|
}
|
|
@@ -10995,7 +11088,7 @@ function addInteraction(detail, interaction) {
|
|
|
10995
11088
|
detail.outputTokens += interaction.usage.outputTokens;
|
|
10996
11089
|
detail.reasoningOutputTokens += interaction.usage.reasoningOutputTokens;
|
|
10997
11090
|
detail.tokenTotal += interaction.usage.totalTokens;
|
|
10998
|
-
detail.costUSD
|
|
11091
|
+
detail.costUSD = sumCurrency(detail.costUSD, interaction.usage.costUSD);
|
|
10999
11092
|
if (interaction.model) {
|
|
11000
11093
|
detail.models = Array.from(/* @__PURE__ */ new Set([...detail.models, interaction.model]));
|
|
11001
11094
|
detail.modelTotals.set(
|
|
@@ -11032,11 +11125,11 @@ function toProjectSessionUsageItem(detail) {
|
|
|
11032
11125
|
cachedInputTokens: detail.cachedInputTokens,
|
|
11033
11126
|
costUSD: detail.costUSD,
|
|
11034
11127
|
date: dateKey ? formatDateLabelFromDateKey(dateKey) : "",
|
|
11035
|
-
duration: formatDuration(detail.durationMinutes),
|
|
11128
|
+
duration: formatDuration$1(detail.durationMinutes),
|
|
11036
11129
|
durationMinutes: detail.durationMinutes,
|
|
11037
11130
|
id: detail.key,
|
|
11038
11131
|
inputTokens: detail.inputTokens,
|
|
11039
|
-
interactions: detail.interactions.map(({ dedupeKey: _dedupeKey, ...interaction }) => ({
|
|
11132
|
+
interactions: detail.interactions.map(({ dedupeKey: _dedupeKey, fallbackDedupeKey: _fallbackDedupeKey, isSidechain: _isSidechain, ...interaction }) => ({
|
|
11040
11133
|
...interaction,
|
|
11041
11134
|
raw: null
|
|
11042
11135
|
})),
|
|
@@ -11064,6 +11157,39 @@ const PROJECT_USAGE_DATA_MODULES = [
|
|
|
11064
11157
|
"token_usage"
|
|
11065
11158
|
];
|
|
11066
11159
|
|
|
11160
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
11161
|
+
const MAX_PAGE_SIZE = 10;
|
|
11162
|
+
|
|
11163
|
+
function normalizePagination(input = {}) {
|
|
11164
|
+
return {
|
|
11165
|
+
page: normalizePositiveInteger(input.page, 1),
|
|
11166
|
+
pageSize: Math.min(normalizePositiveInteger(input.pageSize, DEFAULT_PAGE_SIZE), MAX_PAGE_SIZE)
|
|
11167
|
+
};
|
|
11168
|
+
}
|
|
11169
|
+
function paginateItems(items, input = {}) {
|
|
11170
|
+
const { page, pageSize } = normalizePagination(input);
|
|
11171
|
+
const total = items.length;
|
|
11172
|
+
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
11173
|
+
const safePage = Math.min(page, pageCount);
|
|
11174
|
+
const start = (safePage - 1) * pageSize;
|
|
11175
|
+
return {
|
|
11176
|
+
items: items.slice(start, start + pageSize),
|
|
11177
|
+
pagination: {
|
|
11178
|
+
page: safePage,
|
|
11179
|
+
pageCount,
|
|
11180
|
+
pageSize,
|
|
11181
|
+
total
|
|
11182
|
+
}
|
|
11183
|
+
};
|
|
11184
|
+
}
|
|
11185
|
+
function normalizePositiveInteger(value, fallback) {
|
|
11186
|
+
if (!Number.isFinite(value)) {
|
|
11187
|
+
return fallback;
|
|
11188
|
+
}
|
|
11189
|
+
const normalized = Math.trunc(value);
|
|
11190
|
+
return normalized > 0 ? normalized : fallback;
|
|
11191
|
+
}
|
|
11192
|
+
|
|
11067
11193
|
const DEFAULT_PROJECT_USAGE_DATA_MODULE = "session_list";
|
|
11068
11194
|
function buildProjectUsageDataModuleFromDetail(detail, options) {
|
|
11069
11195
|
var _a, _b, _c;
|
|
@@ -11077,7 +11203,7 @@ function buildProjectUsageDataModuleFromDetail(detail, options) {
|
|
|
11077
11203
|
}
|
|
11078
11204
|
if (modules.length === 1) {
|
|
11079
11205
|
const module = modules[0];
|
|
11080
|
-
const data = buildProjectPlatformModule(normalizedDetail, module, (_c = options.platform) != null ? _c : "all");
|
|
11206
|
+
const data = buildProjectPlatformModule(normalizedDetail, module, (_c = options.platform) != null ? _c : "all", options);
|
|
11081
11207
|
return {
|
|
11082
11208
|
data,
|
|
11083
11209
|
label: normalizedDetail.label,
|
|
@@ -11090,7 +11216,7 @@ function buildProjectUsageDataModuleFromDetail(detail, options) {
|
|
|
11090
11216
|
var _a2;
|
|
11091
11217
|
return [
|
|
11092
11218
|
module,
|
|
11093
|
-
buildProjectPlatformModule(normalizedDetail, module, (_a2 = options.platform) != null ? _a2 : "all")
|
|
11219
|
+
buildProjectPlatformModule(normalizedDetail, module, (_a2 = options.platform) != null ? _a2 : "all", options)
|
|
11094
11220
|
];
|
|
11095
11221
|
}))
|
|
11096
11222
|
};
|
|
@@ -11123,34 +11249,34 @@ function buildProjectUsageCatalogItemsFromDetails(details) {
|
|
|
11123
11249
|
};
|
|
11124
11250
|
}).sort((a, b) => a.label.localeCompare(b.label));
|
|
11125
11251
|
}
|
|
11126
|
-
function buildProjectPlatformModule(detail, module, platform) {
|
|
11252
|
+
function buildProjectPlatformModule(detail, module, platform, pagination) {
|
|
11127
11253
|
var _a;
|
|
11128
11254
|
if (platform !== "all") {
|
|
11129
|
-
return buildPlatformModulePayload((_a = detail.analyzing[platform]) != null ? _a : createEmptyProjectPlatformUsage(), module);
|
|
11255
|
+
return buildPlatformModulePayload((_a = detail.analyzing[platform]) != null ? _a : createEmptyProjectPlatformUsage(), module, pagination);
|
|
11130
11256
|
}
|
|
11131
11257
|
if (module === "session_list") {
|
|
11132
11258
|
const sessions = getProjectDetailSessions(detail);
|
|
11133
11259
|
const allUsage2 = buildProjectLoadUsageResult(sessions);
|
|
11134
|
-
const platformPayloads2 = buildProjectPlatformPayloadMap(detail, module);
|
|
11260
|
+
const platformPayloads2 = buildProjectPlatformPayloadMap(detail, module, pagination);
|
|
11135
11261
|
return {
|
|
11136
|
-
all: buildSessionListModulePayload(allUsage2.sessionRows, sessions),
|
|
11262
|
+
all: buildSessionListModulePayload(allUsage2.sessionRows, sessions, pagination),
|
|
11137
11263
|
...platformPayloads2
|
|
11138
11264
|
};
|
|
11139
11265
|
}
|
|
11140
11266
|
const allUsage = buildProjectLoadUsageResult(getProjectDetailSessions(detail));
|
|
11141
|
-
const platformPayloads = buildProjectPlatformPayloadMap(detail, module);
|
|
11267
|
+
const platformPayloads = buildProjectPlatformPayloadMap(detail, module, pagination);
|
|
11142
11268
|
return {
|
|
11143
|
-
all: buildLoadUsageModulePayload(allUsage, module),
|
|
11269
|
+
all: buildLoadUsageModulePayload(allUsage, module, pagination),
|
|
11144
11270
|
...platformPayloads
|
|
11145
11271
|
};
|
|
11146
11272
|
}
|
|
11147
|
-
function buildPlatformModulePayload(usage, module) {
|
|
11273
|
+
function buildPlatformModulePayload(usage, module, pagination) {
|
|
11148
11274
|
if (module === "session_list") {
|
|
11149
|
-
return buildSessionListModulePayload(usage.sessionRows, usage.sessions);
|
|
11275
|
+
return buildSessionListModulePayload(usage.sessionRows, usage.sessions, pagination);
|
|
11150
11276
|
}
|
|
11151
|
-
return buildLoadUsageModulePayload(usage, module);
|
|
11277
|
+
return buildLoadUsageModulePayload(usage, module, pagination);
|
|
11152
11278
|
}
|
|
11153
|
-
function buildLoadUsageModulePayload(usage, module) {
|
|
11279
|
+
function buildLoadUsageModulePayload(usage, module, pagination) {
|
|
11154
11280
|
const modulePayloadBuilders = {
|
|
11155
11281
|
daily_trend: () => ({
|
|
11156
11282
|
dailyRows: usage.dailyRows,
|
|
@@ -11161,10 +11287,10 @@ function buildLoadUsageModulePayload(usage, module) {
|
|
|
11161
11287
|
monthlyModelUsage: usage.monthlyModelUsage
|
|
11162
11288
|
}),
|
|
11163
11289
|
token_usage: () => ({
|
|
11164
|
-
dailyRows: usage.dailyRows,
|
|
11165
|
-
monthlyRows: usage.monthlyRows,
|
|
11166
|
-
sessionRows: usage.sessionRows,
|
|
11167
|
-
weeklyRows: usage.weeklyRows
|
|
11290
|
+
dailyRows: paginateItems(usage.dailyRows, pagination),
|
|
11291
|
+
monthlyRows: paginateItems(usage.monthlyRows, pagination),
|
|
11292
|
+
sessionRows: paginateItems(usage.sessionRows, pagination),
|
|
11293
|
+
weeklyRows: paginateItems(usage.weeklyRows, pagination)
|
|
11168
11294
|
})
|
|
11169
11295
|
};
|
|
11170
11296
|
return modulePayloadBuilders[module]();
|
|
@@ -11198,21 +11324,21 @@ function getProjectDetailPlatforms(detail) {
|
|
|
11198
11324
|
function getProjectDetailTotalTokens(detail) {
|
|
11199
11325
|
return getProjectDetailSessions(detail).reduce((sum, session) => sum + session.tokenTotal, 0);
|
|
11200
11326
|
}
|
|
11201
|
-
function buildSessionListModulePayload(sessionRows, sessions) {
|
|
11327
|
+
function buildSessionListModulePayload(sessionRows, sessions, pagination) {
|
|
11202
11328
|
const sessionList = sessions.map(({ interactions: _interactions, ...session }) => session);
|
|
11203
11329
|
return {
|
|
11204
|
-
sessionRows,
|
|
11205
|
-
sessionUsage: sessionList,
|
|
11330
|
+
sessionRows: paginateItems(sessionRows, pagination),
|
|
11331
|
+
sessionUsage: paginateItems(sessionList, pagination),
|
|
11206
11332
|
sessions: sessionList
|
|
11207
11333
|
};
|
|
11208
11334
|
}
|
|
11209
|
-
function buildProjectPlatformPayloadMap(detail, module) {
|
|
11335
|
+
function buildProjectPlatformPayloadMap(detail, module, pagination) {
|
|
11210
11336
|
return Object.fromEntries(
|
|
11211
11337
|
PROJECT_USAGE_PLATFORMS.map((platform) => {
|
|
11212
11338
|
var _a;
|
|
11213
11339
|
return [
|
|
11214
11340
|
platform,
|
|
11215
|
-
buildPlatformModulePayload((_a = detail.analyzing[platform]) != null ? _a : createEmptyProjectPlatformUsage(), module)
|
|
11341
|
+
buildPlatformModulePayload((_a = detail.analyzing[platform]) != null ? _a : createEmptyProjectPlatformUsage(), module, pagination)
|
|
11216
11342
|
];
|
|
11217
11343
|
})
|
|
11218
11344
|
);
|
|
@@ -11258,6 +11384,7 @@ function getEarliestStartedAt(sessions) {
|
|
|
11258
11384
|
return (_a = sessions.map((session) => session.startedAt).filter((timestamp) => Number.isFinite(Date.parse(timestamp))).sort((a, b) => Date.parse(a) - Date.parse(b))[0]) != null ? _a : null;
|
|
11259
11385
|
}
|
|
11260
11386
|
|
|
11387
|
+
const TOP_PROJECT_LIMIT = 10;
|
|
11261
11388
|
function buildHomeDashboardModules(dashboardsByPlatform, todayInsights = void 0) {
|
|
11262
11389
|
const sessionUsage = buildSessionUsage(dashboardsByPlatform);
|
|
11263
11390
|
const dailyTokenUsage = mergeDailyTokenUsage(
|
|
@@ -11284,7 +11411,8 @@ function buildHomeDashboardModules(dashboardsByPlatform, todayInsights = void 0)
|
|
|
11284
11411
|
PROJECT_USAGE_PLATFORMS.flatMap((platform) => dashboardsByPlatform[platform].monthlyModelUsage)
|
|
11285
11412
|
);
|
|
11286
11413
|
const projectUsage = buildProjectUsage(sessionUsage);
|
|
11287
|
-
const
|
|
11414
|
+
const sessionAnalysisItems = buildHomeSessionAnalysisItems(sessionUsage);
|
|
11415
|
+
const totalCost = getSessionUsageCostTotal(sessionUsage);
|
|
11288
11416
|
const totalTokens = dailyTokenUsage.reduce((sum, item) => sum + item.totalTokens, 0);
|
|
11289
11417
|
const inputTokens = dailyTokenUsage.reduce((sum, item) => sum + item.inputTokens, 0);
|
|
11290
11418
|
const cachedInputTokens = dailyTokenUsage.reduce((sum, item) => sum + item.cachedInputTokens, 0);
|
|
@@ -11323,12 +11451,46 @@ function buildHomeDashboardModules(dashboardsByPlatform, todayInsights = void 0)
|
|
|
11323
11451
|
totalTokens
|
|
11324
11452
|
}),
|
|
11325
11453
|
sessionAnalysis: {
|
|
11326
|
-
items:
|
|
11454
|
+
items: sessionAnalysisItems,
|
|
11327
11455
|
totalSessions
|
|
11328
11456
|
},
|
|
11329
11457
|
todayHourlyUsage: homeTodayInsights.todayHourlyUsage
|
|
11330
11458
|
};
|
|
11331
11459
|
}
|
|
11460
|
+
function buildHomeSessionAnalysisItems(sessionUsage) {
|
|
11461
|
+
var _a;
|
|
11462
|
+
const durationMinutesByProject = /* @__PURE__ */ new Map();
|
|
11463
|
+
for (const session of sessionUsage) {
|
|
11464
|
+
durationMinutesByProject.set(
|
|
11465
|
+
session.project,
|
|
11466
|
+
((_a = durationMinutesByProject.get(session.project)) != null ? _a : 0) + session.durationMinutes
|
|
11467
|
+
);
|
|
11468
|
+
}
|
|
11469
|
+
return buildProjectUsage(sessionUsage).slice(0, TOP_PROJECT_LIMIT).map((project) => {
|
|
11470
|
+
var _a2, _b;
|
|
11471
|
+
return {
|
|
11472
|
+
costUSD: project.costUSD,
|
|
11473
|
+
duration: formatDuration((_a2 = durationMinutesByProject.get(project.label)) != null ? _a2 : 0),
|
|
11474
|
+
durationMinutes: (_b = durationMinutesByProject.get(project.label)) != null ? _b : 0,
|
|
11475
|
+
id: project.repository,
|
|
11476
|
+
model: "-",
|
|
11477
|
+
project: project.label,
|
|
11478
|
+
repository: project.repository,
|
|
11479
|
+
tokenTotal: project.tokenTotal
|
|
11480
|
+
};
|
|
11481
|
+
});
|
|
11482
|
+
}
|
|
11483
|
+
function formatDuration(minutes) {
|
|
11484
|
+
const hours = Math.floor(minutes / 60);
|
|
11485
|
+
const remainingMinutes = minutes % 60;
|
|
11486
|
+
if (hours === 0) {
|
|
11487
|
+
return `${remainingMinutes}m`;
|
|
11488
|
+
}
|
|
11489
|
+
if (remainingMinutes === 0) {
|
|
11490
|
+
return `${hours}h`;
|
|
11491
|
+
}
|
|
11492
|
+
return `${hours}h ${remainingMinutes}m`;
|
|
11493
|
+
}
|
|
11332
11494
|
function buildSessionUsage(dashboardsByPlatform) {
|
|
11333
11495
|
return PROJECT_USAGE_PLATFORMS.flatMap((platform) => dashboardsByPlatform[platform].sessionUsage.map((session) => ({
|
|
11334
11496
|
...session,
|
|
@@ -11336,6 +11498,19 @@ function buildSessionUsage(dashboardsByPlatform) {
|
|
|
11336
11498
|
sessionId: `${platform}:${session.sessionId}`
|
|
11337
11499
|
}))).sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
|
|
11338
11500
|
}
|
|
11501
|
+
function getSessionUsageCostTotal(sessions) {
|
|
11502
|
+
return roundCurrency(
|
|
11503
|
+
sessions.reduce((sessionTotal, session) => {
|
|
11504
|
+
if (!session.interactions) {
|
|
11505
|
+
return sessionTotal + session.costUSD;
|
|
11506
|
+
}
|
|
11507
|
+
return sessionTotal + session.interactions.reduce((interactionTotal, interaction) => {
|
|
11508
|
+
var _a, _b;
|
|
11509
|
+
return interactionTotal + ((_b = (_a = interaction.usage) == null ? void 0 : _a.costUSD) != null ? _b : 0);
|
|
11510
|
+
}, 0);
|
|
11511
|
+
}, 0)
|
|
11512
|
+
);
|
|
11513
|
+
}
|
|
11339
11514
|
function buildHomeOverviewCards(options) {
|
|
11340
11515
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
11341
11516
|
const tokenTrend = buildGrowthTrend(
|
|
@@ -11534,7 +11709,6 @@ function buildEfficiencyMetrics(options) {
|
|
|
11534
11709
|
var __defProp = Object.defineProperty;
|
|
11535
11710
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11536
11711
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11537
|
-
const RUNTIME_STALE_AFTER_MS = 1e3 * 60;
|
|
11538
11712
|
const WATCHER_DEBOUNCE_MS = 350;
|
|
11539
11713
|
class UsageDataRuntime {
|
|
11540
11714
|
constructor(config) {
|
|
@@ -11542,6 +11716,7 @@ class UsageDataRuntime {
|
|
|
11542
11716
|
__publicField(this, "repository");
|
|
11543
11717
|
__publicField(this, "state", {
|
|
11544
11718
|
bootstrap: null,
|
|
11719
|
+
hasIndexedCurrentProcess: false,
|
|
11545
11720
|
hydratedAt: 0,
|
|
11546
11721
|
projectCatalog: [],
|
|
11547
11722
|
projectDetails: null,
|
|
@@ -11567,8 +11742,8 @@ class UsageDataRuntime {
|
|
|
11567
11742
|
await this.initialize();
|
|
11568
11743
|
if (!this.state.bootstrap) {
|
|
11569
11744
|
await this.refreshNow();
|
|
11570
|
-
} else {
|
|
11571
|
-
this.
|
|
11745
|
+
} else if (!this.state.hasIndexedCurrentProcess) {
|
|
11746
|
+
void this.refreshInBackground();
|
|
11572
11747
|
}
|
|
11573
11748
|
return this.state.bootstrap;
|
|
11574
11749
|
}
|
|
@@ -11576,8 +11751,8 @@ class UsageDataRuntime {
|
|
|
11576
11751
|
await this.initialize();
|
|
11577
11752
|
if (this.state.projectCatalog.length === 0) {
|
|
11578
11753
|
await this.refreshNow();
|
|
11579
|
-
} else {
|
|
11580
|
-
this.
|
|
11754
|
+
} else if (!this.state.hasIndexedCurrentProcess) {
|
|
11755
|
+
void this.refreshInBackground();
|
|
11581
11756
|
}
|
|
11582
11757
|
return this.state.projectCatalog;
|
|
11583
11758
|
}
|
|
@@ -11590,27 +11765,33 @@ class UsageDataRuntime {
|
|
|
11590
11765
|
return buildHomeDashboardModules(await this.getBootstrap(), this.repository.loadHomeDashboardTodayInsights());
|
|
11591
11766
|
}
|
|
11592
11767
|
async getProjectDataModules(request) {
|
|
11768
|
+
var _a, _b, _c;
|
|
11593
11769
|
await this.initialize();
|
|
11594
11770
|
const projectLabel = (request.project || "").trim();
|
|
11595
11771
|
if (!projectLabel) {
|
|
11596
11772
|
throw new Error("Missing project name for project data request.");
|
|
11597
11773
|
}
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11774
|
+
const projectDetails = (_a = this.state.projectDetails) != null ? _a : /* @__PURE__ */ new Map();
|
|
11775
|
+
if (!projectDetails.has(projectLabel)) {
|
|
11776
|
+
const storedDetail = this.repository.loadProjectDetail(projectLabel);
|
|
11777
|
+
if (storedDetail) {
|
|
11778
|
+
projectDetails.set(projectLabel, storedDetail);
|
|
11779
|
+
this.state.projectDetails = projectDetails;
|
|
11780
|
+
} else {
|
|
11781
|
+
await this.refreshNow();
|
|
11782
|
+
}
|
|
11783
|
+
} else if (!this.state.hasIndexedCurrentProcess) {
|
|
11784
|
+
void this.refreshInBackground();
|
|
11606
11785
|
}
|
|
11607
|
-
const hydratedDetail = this.state.projectDetails.get(projectLabel);
|
|
11786
|
+
const hydratedDetail = (_c = (_b = this.state.projectDetails) == null ? void 0 : _b.get(projectLabel)) != null ? _c : null;
|
|
11608
11787
|
if (!hydratedDetail) {
|
|
11609
11788
|
return null;
|
|
11610
11789
|
}
|
|
11611
11790
|
return buildProjectUsageDataModuleFromDetail(hydratedDetail, {
|
|
11612
11791
|
module: request.module,
|
|
11613
11792
|
modules: request.modules,
|
|
11793
|
+
page: request.page,
|
|
11794
|
+
pageSize: request.pageSize,
|
|
11614
11795
|
platform: request.platform
|
|
11615
11796
|
});
|
|
11616
11797
|
}
|
|
@@ -11642,15 +11823,6 @@ class UsageDataRuntime {
|
|
|
11642
11823
|
console.error("[usage-runtime] background refresh failed", error);
|
|
11643
11824
|
});
|
|
11644
11825
|
}
|
|
11645
|
-
scheduleRefreshIfStale() {
|
|
11646
|
-
if (Date.now() - this.state.hydratedAt < RUNTIME_STALE_AFTER_MS) {
|
|
11647
|
-
return;
|
|
11648
|
-
}
|
|
11649
|
-
if (this.refreshPromise || Date.now() - this.state.refreshStartedAt < 1e3) {
|
|
11650
|
-
return;
|
|
11651
|
-
}
|
|
11652
|
-
void this.refreshInBackground();
|
|
11653
|
-
}
|
|
11654
11826
|
async refresh() {
|
|
11655
11827
|
this.state.refreshStartedAt = Date.now();
|
|
11656
11828
|
const indexed = await buildIncrementalUsageIndex(this.config, this.repository);
|
|
@@ -11671,6 +11843,7 @@ class UsageDataRuntime {
|
|
|
11671
11843
|
this.repository.replaceProjectDetails(projectDetails);
|
|
11672
11844
|
this.state.bootstrap = bootstrap;
|
|
11673
11845
|
this.state.projectCatalog = projectCatalog;
|
|
11846
|
+
this.state.hasIndexedCurrentProcess = true;
|
|
11674
11847
|
if (this.state.projectDetails) {
|
|
11675
11848
|
this.state.projectDetails = projectDetails;
|
|
11676
11849
|
}
|
|
@@ -11790,9 +11963,9 @@ const DEFAULT_CLAUDE_CODE_PATH = ".claude";
|
|
|
11790
11963
|
const DEFAULT_CLAUDE_CONFIG_PATH = join(((_a = process.env.XDG_CONFIG_HOME) == null ? void 0 : _a.trim()) || join(USER_HOME_DIR, ".config"), "claude");
|
|
11791
11964
|
const DEFAULT_DROID_SESSIONS_DIR = join(USER_HOME_DIR, ".factory", "sessions");
|
|
11792
11965
|
const DEFAULT_GOOSE_DB_CANDIDATES = [
|
|
11793
|
-
join(USER_HOME_DIR, ".local", "share", "goose", "sessions", "
|
|
11794
|
-
join(USER_HOME_DIR, "Library", "Application Support", "goose", "sessions", "
|
|
11795
|
-
join(USER_HOME_DIR, ".local", "share", "Block", "goose", "sessions", "
|
|
11966
|
+
join(USER_HOME_DIR, ".local", "share", "goose", "sessions", "sessions.db"),
|
|
11967
|
+
join(USER_HOME_DIR, "Library", "Application Support", "goose", "sessions", "sessions.db"),
|
|
11968
|
+
join(USER_HOME_DIR, ".local", "share", "Block", "goose", "sessions", "sessions.db")
|
|
11796
11969
|
];
|
|
11797
11970
|
const DEFAULT_KILO_DIR = join(USER_HOME_DIR, ".local", "share", "kilo");
|
|
11798
11971
|
const DEFAULT_KIMI_DIR = join(USER_HOME_DIR, ".kimi");
|
|
@@ -11887,7 +12060,7 @@ function getGoosePaths() {
|
|
|
11887
12060
|
var _a2;
|
|
11888
12061
|
const root = (_a2 = process.env.GOOSE_PATH_ROOT) == null ? void 0 : _a2.trim();
|
|
11889
12062
|
if (root) {
|
|
11890
|
-
const dbPath = resolve$1(root, "data", "sessions", "
|
|
12063
|
+
const dbPath = resolve$1(root, "data", "sessions", "sessions.db");
|
|
11891
12064
|
return isFileSync(dbPath) ? [dbPath] : [];
|
|
11892
12065
|
}
|
|
11893
12066
|
return DEFAULT_GOOSE_DB_CANDIDATES.map((path) => resolve$1(path)).filter(isFileSync);
|
|
@@ -11971,166 +12144,166 @@ const plugins = [
|
|
|
11971
12144
|
];
|
|
11972
12145
|
|
|
11973
12146
|
const assets = {
|
|
11974
|
-
"/
|
|
11975
|
-
"type": "image/
|
|
11976
|
-
"etag": "\"
|
|
11977
|
-
"mtime": "2026-05-
|
|
11978
|
-
"size":
|
|
11979
|
-
"path": "../public/
|
|
12147
|
+
"/logo.svg": {
|
|
12148
|
+
"type": "image/svg+xml",
|
|
12149
|
+
"etag": "\"1550-fwYFdULdJ83Qp0FjnnX31iQz9oI\"",
|
|
12150
|
+
"mtime": "2026-05-27T09:07:32.522Z",
|
|
12151
|
+
"size": 5456,
|
|
12152
|
+
"path": "../public/logo.svg"
|
|
11980
12153
|
},
|
|
11981
12154
|
"/robots.txt": {
|
|
11982
12155
|
"type": "text/plain; charset=utf-8",
|
|
11983
12156
|
"etag": "\"18-j8OIsL9qGDmNZ+lHhp2tyH4XtaE\"",
|
|
11984
|
-
"mtime": "2026-05-
|
|
12157
|
+
"mtime": "2026-05-27T09:07:32.522Z",
|
|
11985
12158
|
"size": 24,
|
|
11986
12159
|
"path": "../public/robots.txt"
|
|
11987
12160
|
},
|
|
11988
|
-
"/
|
|
11989
|
-
"type": "
|
|
11990
|
-
"etag": "\"
|
|
11991
|
-
"mtime": "2026-05-
|
|
11992
|
-
"size":
|
|
11993
|
-
"path": "../public/
|
|
11994
|
-
},
|
|
11995
|
-
"/_nuxt/BOWwkrCY.js": {
|
|
11996
|
-
"type": "text/javascript; charset=utf-8",
|
|
11997
|
-
"etag": "\"540a-Q/6WhDpXkujbyVqTxKp+MDIjyN8\"",
|
|
11998
|
-
"mtime": "2026-05-26T09:20:13.946Z",
|
|
11999
|
-
"size": 21514,
|
|
12000
|
-
"path": "../public/_nuxt/BOWwkrCY.js"
|
|
12161
|
+
"/favicon.ico": {
|
|
12162
|
+
"type": "image/vnd.microsoft.icon",
|
|
12163
|
+
"etag": "\"1083e-LfyFZ+1JmdianDqe/sQN2Ou0IzQ\"",
|
|
12164
|
+
"mtime": "2026-05-27T09:07:32.522Z",
|
|
12165
|
+
"size": 67646,
|
|
12166
|
+
"path": "../public/favicon.ico"
|
|
12001
12167
|
},
|
|
12002
|
-
"/_nuxt/
|
|
12168
|
+
"/_nuxt/BJWBp9U3.js": {
|
|
12003
12169
|
"type": "text/javascript; charset=utf-8",
|
|
12004
|
-
"etag": "\"
|
|
12005
|
-
"mtime": "2026-05-
|
|
12006
|
-
"size":
|
|
12007
|
-
"path": "../public/_nuxt/
|
|
12008
|
-
},
|
|
12009
|
-
"/logo.svg": {
|
|
12010
|
-
"type": "image/svg+xml",
|
|
12011
|
-
"etag": "\"1550-fwYFdULdJ83Qp0FjnnX31iQz9oI\"",
|
|
12012
|
-
"mtime": "2026-05-26T09:20:13.949Z",
|
|
12013
|
-
"size": 5456,
|
|
12014
|
-
"path": "../public/logo.svg"
|
|
12170
|
+
"etag": "\"101-Tesq+JGkSKIQcq2HziGnebJViCo\"",
|
|
12171
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12172
|
+
"size": 257,
|
|
12173
|
+
"path": "../public/_nuxt/BJWBp9U3.js"
|
|
12015
12174
|
},
|
|
12016
|
-
"/_nuxt/
|
|
12175
|
+
"/_nuxt/BILXBbDI.js": {
|
|
12017
12176
|
"type": "text/javascript; charset=utf-8",
|
|
12018
|
-
"etag": "\"
|
|
12019
|
-
"mtime": "2026-05-
|
|
12020
|
-
"size":
|
|
12021
|
-
"path": "../public/_nuxt/
|
|
12177
|
+
"etag": "\"95f9-A307WCqdxkMpOB/cNby3x2RHyYI\"",
|
|
12178
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12179
|
+
"size": 38393,
|
|
12180
|
+
"path": "../public/_nuxt/BILXBbDI.js"
|
|
12022
12181
|
},
|
|
12023
|
-
"/_nuxt/
|
|
12182
|
+
"/_nuxt/BOTUKIyR.js": {
|
|
12024
12183
|
"type": "text/javascript; charset=utf-8",
|
|
12025
|
-
"etag": "\"d7b-
|
|
12026
|
-
"mtime": "2026-05-
|
|
12184
|
+
"etag": "\"d7b-pIo6ACRB5DaxCZRtTo8O5AXlVps\"",
|
|
12185
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12027
12186
|
"size": 3451,
|
|
12028
|
-
"path": "../public/_nuxt/
|
|
12187
|
+
"path": "../public/_nuxt/BOTUKIyR.js"
|
|
12029
12188
|
},
|
|
12030
|
-
"/_nuxt/
|
|
12189
|
+
"/_nuxt/BVD8FQXV.js": {
|
|
12031
12190
|
"type": "text/javascript; charset=utf-8",
|
|
12032
|
-
"etag": "\"14f9
|
|
12033
|
-
"mtime": "2026-05-
|
|
12191
|
+
"etag": "\"14f9-+vYSj+n6BntsoR1zbfugGwHBnvk\"",
|
|
12192
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12034
12193
|
"size": 5369,
|
|
12035
|
-
"path": "../public/_nuxt/
|
|
12194
|
+
"path": "../public/_nuxt/BVD8FQXV.js"
|
|
12036
12195
|
},
|
|
12037
|
-
"/_nuxt/
|
|
12196
|
+
"/_nuxt/BXbx6JCB.js": {
|
|
12038
12197
|
"type": "text/javascript; charset=utf-8",
|
|
12039
|
-
"etag": "\"
|
|
12040
|
-
"mtime": "2026-05-
|
|
12041
|
-
"size":
|
|
12042
|
-
"path": "../public/_nuxt/
|
|
12198
|
+
"etag": "\"3f1a-v9YyNclwf3OlQwg5JLfj58x1tX8\"",
|
|
12199
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12200
|
+
"size": 16154,
|
|
12201
|
+
"path": "../public/_nuxt/BXbx6JCB.js"
|
|
12043
12202
|
},
|
|
12044
|
-
"/_nuxt/
|
|
12203
|
+
"/_nuxt/BfVC-jX7.js": {
|
|
12045
12204
|
"type": "text/javascript; charset=utf-8",
|
|
12046
|
-
"etag": "\"
|
|
12047
|
-
"mtime": "2026-05-
|
|
12048
|
-
"size":
|
|
12049
|
-
"path": "../public/_nuxt/
|
|
12205
|
+
"etag": "\"2f1c-GvjXf2XwhvLaVcsVeJJ2W+Agzrs\"",
|
|
12206
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12207
|
+
"size": 12060,
|
|
12208
|
+
"path": "../public/_nuxt/BfVC-jX7.js"
|
|
12050
12209
|
},
|
|
12051
|
-
"/_nuxt/
|
|
12210
|
+
"/_nuxt/BhIINiyq.js": {
|
|
12052
12211
|
"type": "text/javascript; charset=utf-8",
|
|
12053
|
-
"etag": "\"
|
|
12054
|
-
"mtime": "2026-05-
|
|
12055
|
-
"size":
|
|
12056
|
-
"path": "../public/_nuxt/
|
|
12212
|
+
"etag": "\"ba8b-RgGonB5HVwajWLPO1MR7So0GI8M\"",
|
|
12213
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12214
|
+
"size": 47755,
|
|
12215
|
+
"path": "../public/_nuxt/BhIINiyq.js"
|
|
12057
12216
|
},
|
|
12058
|
-
"/_nuxt/
|
|
12217
|
+
"/_nuxt/CJv0IWZB.js": {
|
|
12059
12218
|
"type": "text/javascript; charset=utf-8",
|
|
12060
|
-
"etag": "\"
|
|
12061
|
-
"mtime": "2026-05-
|
|
12062
|
-
"size":
|
|
12063
|
-
"path": "../public/_nuxt/
|
|
12219
|
+
"etag": "\"eb4-YLQQCkYdS3obs1V1advLn4aleSo\"",
|
|
12220
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12221
|
+
"size": 3764,
|
|
12222
|
+
"path": "../public/_nuxt/CJv0IWZB.js"
|
|
12064
12223
|
},
|
|
12065
|
-
"/_nuxt/
|
|
12066
|
-
"type": "text/
|
|
12067
|
-
"etag": "\"
|
|
12068
|
-
"mtime": "2026-05-
|
|
12069
|
-
"size":
|
|
12070
|
-
"path": "../public/_nuxt/
|
|
12224
|
+
"/_nuxt/CJECfsOP.js": {
|
|
12225
|
+
"type": "text/javascript; charset=utf-8",
|
|
12226
|
+
"etag": "\"10895-xt53mmAEjkgXulYjG9jCZNvAYT4\"",
|
|
12227
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12228
|
+
"size": 67733,
|
|
12229
|
+
"path": "../public/_nuxt/CJECfsOP.js"
|
|
12230
|
+
},
|
|
12231
|
+
"/_nuxt/CXOkrwUP.js": {
|
|
12232
|
+
"type": "text/javascript; charset=utf-8",
|
|
12233
|
+
"etag": "\"f34c-u8PO6JNUQEdj83dhxa3RQdGy7YY\"",
|
|
12234
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12235
|
+
"size": 62284,
|
|
12236
|
+
"path": "../public/_nuxt/CXOkrwUP.js"
|
|
12071
12237
|
},
|
|
12072
|
-
"/_nuxt/
|
|
12238
|
+
"/_nuxt/DjeKkZG3.js": {
|
|
12073
12239
|
"type": "text/javascript; charset=utf-8",
|
|
12074
|
-
"etag": "\"
|
|
12075
|
-
"mtime": "2026-05-
|
|
12076
|
-
"size":
|
|
12077
|
-
"path": "../public/_nuxt/
|
|
12240
|
+
"etag": "\"52b3-dLXnB5T7WTtenuKQlgkAo3hYDJM\"",
|
|
12241
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12242
|
+
"size": 21171,
|
|
12243
|
+
"path": "../public/_nuxt/DjeKkZG3.js"
|
|
12078
12244
|
},
|
|
12079
|
-
"/_nuxt/
|
|
12245
|
+
"/_nuxt/DaoeXHW_.js": {
|
|
12080
12246
|
"type": "text/javascript; charset=utf-8",
|
|
12081
|
-
"etag": "\"
|
|
12082
|
-
"mtime": "2026-05-
|
|
12083
|
-
"size":
|
|
12084
|
-
"path": "../public/_nuxt/
|
|
12247
|
+
"etag": "\"cf91-Hh4o3VXnbAZmCUpIdzWAFBvAqOw\"",
|
|
12248
|
+
"mtime": "2026-05-27T09:07:32.517Z",
|
|
12249
|
+
"size": 53137,
|
|
12250
|
+
"path": "../public/_nuxt/DaoeXHW_.js"
|
|
12251
|
+
},
|
|
12252
|
+
"/_nuxt/error-404.CFBEg71j.css": {
|
|
12253
|
+
"type": "text/css; charset=utf-8",
|
|
12254
|
+
"etag": "\"97e-GvhaEAryQvrSXyDcP4RiHXzYb5o\"",
|
|
12255
|
+
"mtime": "2026-05-27T09:07:32.518Z",
|
|
12256
|
+
"size": 2430,
|
|
12257
|
+
"path": "../public/_nuxt/error-404.CFBEg71j.css"
|
|
12085
12258
|
},
|
|
12086
12259
|
"/_nuxt/error-500.BqCnH31G.css": {
|
|
12087
12260
|
"type": "text/css; charset=utf-8",
|
|
12088
12261
|
"etag": "\"773-Tpf6lA6A2FEDtjLyWUXKolBZ3hM\"",
|
|
12089
|
-
"mtime": "2026-05-
|
|
12262
|
+
"mtime": "2026-05-27T09:07:32.518Z",
|
|
12090
12263
|
"size": 1907,
|
|
12091
12264
|
"path": "../public/_nuxt/error-500.BqCnH31G.css"
|
|
12092
12265
|
},
|
|
12266
|
+
"/_nuxt/entry.DnkKc-6G.css": {
|
|
12267
|
+
"type": "text/css; charset=utf-8",
|
|
12268
|
+
"etag": "\"1d8a6-KK9a3JMzAwbSGw5SnlSiODNKxHg\"",
|
|
12269
|
+
"mtime": "2026-05-27T09:07:32.519Z",
|
|
12270
|
+
"size": 120998,
|
|
12271
|
+
"path": "../public/_nuxt/entry.DnkKc-6G.css"
|
|
12272
|
+
},
|
|
12093
12273
|
"/_nuxt/builds/latest.json": {
|
|
12094
12274
|
"type": "application/json",
|
|
12095
|
-
"etag": "\"47-
|
|
12096
|
-
"mtime": "2026-05-
|
|
12275
|
+
"etag": "\"47-kU/OMmwcdIBz/AUhQg0OeDC5kr4\"",
|
|
12276
|
+
"mtime": "2026-05-27T09:07:32.514Z",
|
|
12097
12277
|
"size": 71,
|
|
12098
12278
|
"path": "../public/_nuxt/builds/latest.json"
|
|
12099
12279
|
},
|
|
12100
|
-
"/_nuxt/
|
|
12101
|
-
"type": "application/json",
|
|
12102
|
-
"etag": "\"58-iY4/Az2+aPYQew2Wa/IxNv6uE3Q\"",
|
|
12103
|
-
"mtime": "2026-05-26T09:20:13.942Z",
|
|
12104
|
-
"size": 88,
|
|
12105
|
-
"path": "../public/_nuxt/builds/meta/34b12f78-e5b7-490f-99ba-b4a8ab41b914.json"
|
|
12106
|
-
},
|
|
12107
|
-
"/_nuxt/error-404.CFBEg71j.css": {
|
|
12108
|
-
"type": "text/css; charset=utf-8",
|
|
12109
|
-
"etag": "\"97e-GvhaEAryQvrSXyDcP4RiHXzYb5o\"",
|
|
12110
|
-
"mtime": "2026-05-26T09:20:13.947Z",
|
|
12111
|
-
"size": 2430,
|
|
12112
|
-
"path": "../public/_nuxt/error-404.CFBEg71j.css"
|
|
12113
|
-
},
|
|
12114
|
-
"/_nuxt/37OOe3RF.js": {
|
|
12280
|
+
"/_nuxt/tDg_nW46.js": {
|
|
12115
12281
|
"type": "text/javascript; charset=utf-8",
|
|
12116
|
-
"etag": "\"433-
|
|
12117
|
-
"mtime": "2026-05-
|
|
12282
|
+
"etag": "\"433-NxH8uIPUk8I7j2aOP254GwjaJE4\"",
|
|
12283
|
+
"mtime": "2026-05-27T09:07:32.519Z",
|
|
12118
12284
|
"size": 1075,
|
|
12119
|
-
"path": "../public/_nuxt/
|
|
12285
|
+
"path": "../public/_nuxt/tDg_nW46.js"
|
|
12286
|
+
},
|
|
12287
|
+
"/_nuxt/builds/meta/80f1a776-82e2-4b5c-9c07-a61063a0dd84.json": {
|
|
12288
|
+
"type": "application/json",
|
|
12289
|
+
"etag": "\"58-VYPe+Xe4MCP0G7G1GhAtJsOcgBg\"",
|
|
12290
|
+
"mtime": "2026-05-27T09:07:32.512Z",
|
|
12291
|
+
"size": 88,
|
|
12292
|
+
"path": "../public/_nuxt/builds/meta/80f1a776-82e2-4b5c-9c07-a61063a0dd84.json"
|
|
12120
12293
|
},
|
|
12121
|
-
"/_nuxt/
|
|
12294
|
+
"/_nuxt/DFbWcbwl.js": {
|
|
12122
12295
|
"type": "text/javascript; charset=utf-8",
|
|
12123
|
-
"etag": "\"
|
|
12124
|
-
"mtime": "2026-05-
|
|
12125
|
-
"size":
|
|
12126
|
-
"path": "../public/_nuxt/
|
|
12296
|
+
"etag": "\"4237d-9L6bpd3yWeRFYelGQOUv+wIyrbk\"",
|
|
12297
|
+
"mtime": "2026-05-27T09:07:32.519Z",
|
|
12298
|
+
"size": 271229,
|
|
12299
|
+
"path": "../public/_nuxt/DFbWcbwl.js"
|
|
12127
12300
|
},
|
|
12128
|
-
"/_nuxt/
|
|
12301
|
+
"/_nuxt/nv0LjcWu.js": {
|
|
12129
12302
|
"type": "text/javascript; charset=utf-8",
|
|
12130
|
-
"etag": "\"
|
|
12131
|
-
"mtime": "2026-05-
|
|
12132
|
-
"size":
|
|
12133
|
-
"path": "../public/_nuxt/
|
|
12303
|
+
"etag": "\"3c6da-Zvl+qbXm2/IZ/Qc0CiSR/vyEqdw\"",
|
|
12304
|
+
"mtime": "2026-05-27T09:07:32.519Z",
|
|
12305
|
+
"size": 247514,
|
|
12306
|
+
"path": "../public/_nuxt/nv0LjcWu.js"
|
|
12134
12307
|
}
|
|
12135
12308
|
};
|
|
12136
12309
|
|
|
@@ -12821,7 +12994,7 @@ function getRequiredAnalysisAgentTokenType(event) {
|
|
|
12821
12994
|
}
|
|
12822
12995
|
function defineHomeAnalysisHandler(select) {
|
|
12823
12996
|
return defineEventHandler(async (event) => {
|
|
12824
|
-
return select(await getHomeAnalysisModules(event));
|
|
12997
|
+
return select(await getHomeAnalysisModules(event), event);
|
|
12825
12998
|
});
|
|
12826
12999
|
}
|
|
12827
13000
|
function defineScopedAnalysisHandler(options) {
|
|
@@ -12853,6 +13026,22 @@ function normalizeQueryString(value) {
|
|
|
12853
13026
|
return value === void 0 || value === null ? void 0 : String(value).trim();
|
|
12854
13027
|
}
|
|
12855
13028
|
|
|
13029
|
+
function getPaginationQuery(event) {
|
|
13030
|
+
const query = getQuery(event);
|
|
13031
|
+
return normalizePagination({
|
|
13032
|
+
page: normalizeQueryNumber(query.page),
|
|
13033
|
+
pageSize: normalizeQueryNumber(query.pageSize)
|
|
13034
|
+
});
|
|
13035
|
+
}
|
|
13036
|
+
function normalizeQueryNumber(value) {
|
|
13037
|
+
const rawValue = Array.isArray(value) ? value[0] : value;
|
|
13038
|
+
if (rawValue === void 0 || rawValue === null || rawValue === "") {
|
|
13039
|
+
return void 0;
|
|
13040
|
+
}
|
|
13041
|
+
const numberValue = Number(rawValue);
|
|
13042
|
+
return Number.isFinite(numberValue) ? numberValue : void 0;
|
|
13043
|
+
}
|
|
13044
|
+
|
|
12856
13045
|
const collections = {
|
|
12857
13046
|
};
|
|
12858
13047
|
|
|
@@ -13092,4 +13281,4 @@ const websocket = nitroApp.h3App.websocket ;
|
|
|
13092
13281
|
const handler = listener;
|
|
13093
13282
|
trapUnhandledNodeErrors();
|
|
13094
13283
|
|
|
13095
|
-
export { ANALYSIS_AGENT_TOKEN_ROW_KEYS as A,
|
|
13284
|
+
export { ANALYSIS_AGENT_TOKEN_ROW_KEYS as A, handler as B, listener as C, websocket as D, getRequiredAnalysisAgentTokenType as a, defineHomeAnalysisHandler as b, defineScopedAnalysisHandler as c, defineRequiredAgentAnalysisHandler as d, buildOverviewCardsWithTodayTokenBreakdown as e, defineEventHandler as f, getPaginationQuery as g, getUsageDataRuntime as h, getRouterParam as i, getQuery as j, normalizeStringList as k, defineWebSocketHandler as l, buildAssetsURL as m, normalizeStringValue as n, getResponseStatusText as o, paginateItems as p, getResponseStatus as q, resolveConfig as r, defineRenderHandler as s, publicAssetsURL as t, useRuntimeConfig as u, createError$1 as v, destr as w, getRouteRules as x, joinURL as y, useNitroApp as z };
|