usage-board 3.0.0 → 3.1.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.
Files changed (47) hide show
  1. package/dist/index.mjs +1 -1
  2. package/dist/public/_nuxt/BJUAqwzD.js +1 -0
  3. package/dist/public/_nuxt/{y3weNNd-.js → BuL2_OVR.js} +2 -2
  4. package/dist/public/_nuxt/Bz0aA7IQ.js +1 -0
  5. package/dist/public/_nuxt/CEZpUSPI.js +1 -0
  6. package/dist/public/_nuxt/CF27djws.js +1 -0
  7. package/dist/public/_nuxt/CbwePq4F.js +119 -0
  8. package/dist/public/_nuxt/Cd5S9Sm2.js +1 -0
  9. package/dist/public/_nuxt/{Be3rizqy.js → CoVMsEv_.js} +1 -1
  10. package/dist/public/_nuxt/D7Qebc1i.js +4 -0
  11. package/dist/public/_nuxt/DS17D0R7.js +25 -0
  12. package/dist/public/_nuxt/{7Dy4NLP8.js → Dr4nyTE3.js} +24 -24
  13. package/dist/public/_nuxt/Dzuxw4nD.js +21 -0
  14. package/dist/public/_nuxt/LYzk-FvL.js +1 -0
  15. package/dist/public/_nuxt/WjVGlVHF.js +6 -0
  16. package/dist/public/_nuxt/builds/latest.json +1 -1
  17. package/dist/public/_nuxt/builds/meta/5b933d30-47b4-45ca-8d5a-cba3255174fa.json +1 -0
  18. package/dist/public/_nuxt/entry.vHfFzkyD.css +1 -0
  19. package/dist/server/chunks/_/shared.cjs.prod.mjs +1 -1
  20. package/dist/server/chunks/build/client.precomputed.mjs +1 -1
  21. package/dist/server/chunks/nitro/nitro.mjs +540 -88
  22. package/dist/server/chunks/routes/api/analysis/agent/session.json.mjs +22 -0
  23. package/dist/server/chunks/routes/api/analysis/agent/token.json.mjs +25 -0
  24. package/dist/server/chunks/routes/api/analysis/cache.json.mjs +25 -0
  25. package/dist/server/chunks/routes/api/analysis/hot-project.json.mjs +25 -0
  26. package/dist/server/chunks/routes/api/analysis/model.json.mjs +25 -0
  27. package/dist/server/chunks/routes/api/analysis/overview-cards.json.mjs +25 -0
  28. package/dist/server/chunks/routes/api/analysis/session.json.mjs +22 -0
  29. package/dist/server/chunks/routes/api/analysis/token/daily.json.mjs +22 -0
  30. package/dist/server/chunks/routes/api/analysis/token.json.mjs +25 -0
  31. package/dist/server/chunks/routes/api/payload.json.mjs +1 -1
  32. package/dist/server/chunks/routes/api/projects/_project/modules.get.mjs +1 -1
  33. package/dist/server/chunks/routes/api/projects/catalog.get.mjs +1 -1
  34. package/dist/server/chunks/routes/renderer.mjs +1 -1
  35. package/dist/server/chunks/routes/ws.mjs +1 -1
  36. package/dist/server/index.mjs +1 -1
  37. package/package.json +1 -1
  38. package/dist/public/_nuxt/B-VlGWDb.js +0 -21
  39. package/dist/public/_nuxt/C0azgqnZ.js +0 -1
  40. package/dist/public/_nuxt/CMNdiQCa.js +0 -1
  41. package/dist/public/_nuxt/CPuXQJE_.js +0 -1
  42. package/dist/public/_nuxt/DenksPSi.js +0 -119
  43. package/dist/public/_nuxt/Dkya5WaL.js +0 -9
  44. package/dist/public/_nuxt/HN9OZyaQ.js +0 -25
  45. package/dist/public/_nuxt/JtK-nXxy.js +0 -1
  46. package/dist/public/_nuxt/builds/meta/37e8bb21-a086-45bf-93dc-47eeeada7299.json +0 -1
  47. package/dist/public/_nuxt/entry.r-q4oQC0.css +0 -1
@@ -4270,7 +4270,7 @@ function _expandFromEnv(value) {
4270
4270
  const _inlineRuntimeConfig = {
4271
4271
  "app": {
4272
4272
  "baseURL": "/",
4273
- "buildId": "37e8bb21-a086-45bf-93dc-47eeeada7299",
4273
+ "buildId": "5b933d30-47b4-45ca-8d5a-cba3255174fa",
4274
4274
  "buildAssetsDir": "/_nuxt/",
4275
4275
  "cdnURL": ""
4276
4276
  },
@@ -4298,7 +4298,7 @@ const _inlineRuntimeConfig = {
4298
4298
  }
4299
4299
  },
4300
4300
  "public": {
4301
- "appVersion": "3.0.0",
4301
+ "appVersion": "3.1.0",
4302
4302
  "home": "/Users/tangchenghui"
4303
4303
  },
4304
4304
  "icon": {
@@ -5099,6 +5099,13 @@ function getDateKey(date) {
5099
5099
  const day = (_f = (_e = parts.find((part) => part.type === "day")) == null ? void 0 : _e.value) != null ? _f : "01";
5100
5100
  return `${year}-${month}-${day}`;
5101
5101
  }
5102
+ function getDateKeyFromLabel(label) {
5103
+ const date = new Date(label);
5104
+ if (Number.isNaN(date.getTime())) {
5105
+ return label;
5106
+ }
5107
+ return getDateKey(date);
5108
+ }
5102
5109
  function getPreviousDateKey(dateKey) {
5103
5110
  const [year, month, day] = dateKey.split("-").map((value) => Number.parseInt(value, 10));
5104
5111
  const date = new Date(year || 0, (month || 1) - 1, day || 1);
@@ -5140,6 +5147,65 @@ function buildProjectUsage(sessionUsage) {
5140
5147
  value: formatCurrency(project.costUSD)
5141
5148
  })).sort((a, b) => b.costUSD - a.costUSD);
5142
5149
  }
5150
+ function mergeDailyTokenUsage(items) {
5151
+ var _a, _b;
5152
+ const groups = /* @__PURE__ */ new Map();
5153
+ for (const item of items) {
5154
+ const dateKey = getDateKeyFromLabel(item.date);
5155
+ const group = (_a = groups.get(dateKey)) != null ? _a : {
5156
+ cachedInputTokens: 0,
5157
+ costUSD: 0,
5158
+ date: formatDateLabelFromDateKey(dateKey, item.date),
5159
+ inputTokens: 0,
5160
+ models: /* @__PURE__ */ new Map(),
5161
+ outputTokens: 0,
5162
+ reasoningOutputTokens: 0,
5163
+ totalTokens: 0
5164
+ };
5165
+ group.cachedInputTokens += item.cachedInputTokens;
5166
+ group.costUSD += item.costUSD;
5167
+ group.inputTokens += item.inputTokens;
5168
+ group.outputTokens += item.outputTokens;
5169
+ group.reasoningOutputTokens += item.reasoningOutputTokens;
5170
+ group.totalTokens += item.totalTokens;
5171
+ for (const [modelName, usage] of Object.entries(item.models)) {
5172
+ const model = (_b = group.models.get(modelName)) != null ? _b : createEmptyModelUsage();
5173
+ model.cachedInputTokens += usage.cachedInputTokens;
5174
+ model.inputTokens += usage.inputTokens;
5175
+ model.isFallback = model.isFallback || usage.isFallback;
5176
+ model.outputTokens += usage.outputTokens;
5177
+ model.reasoningOutputTokens += usage.reasoningOutputTokens;
5178
+ model.totalTokens += usage.totalTokens;
5179
+ group.models.set(modelName, model);
5180
+ }
5181
+ groups.set(dateKey, group);
5182
+ }
5183
+ return Array.from(groups.entries()).sort((a, b) => b[0].localeCompare(a[0])).map(([, group]) => ({
5184
+ cachedInputTokens: group.cachedInputTokens,
5185
+ costUSD: roundCurrency(group.costUSD),
5186
+ date: group.date,
5187
+ inputTokens: group.inputTokens,
5188
+ models: Object.fromEntries(group.models.entries()),
5189
+ outputTokens: group.outputTokens,
5190
+ reasoningOutputTokens: group.reasoningOutputTokens,
5191
+ totalTokens: group.totalTokens
5192
+ }));
5193
+ }
5194
+ function mergeMonthlyModelUsage(items) {
5195
+ var _a;
5196
+ const groups = /* @__PURE__ */ new Map();
5197
+ for (const item of items) {
5198
+ const key = `${item.month}__${item.model}`;
5199
+ const group = (_a = groups.get(key)) != null ? _a : {
5200
+ model: item.model,
5201
+ month: item.month,
5202
+ tokenTotal: 0
5203
+ };
5204
+ group.tokenTotal += item.tokenTotal;
5205
+ groups.set(key, group);
5206
+ }
5207
+ return Array.from(groups.values()).sort((a, b) => a.month.localeCompare(b.month) || a.model.localeCompare(b.model));
5208
+ }
5143
5209
  function formatSignedPercent(value) {
5144
5210
  const prefix = value > 0 ? "+" : "";
5145
5211
  return `${prefix}${formatPercent(value)}`;
@@ -5153,6 +5219,16 @@ function getTrendTone(value) {
5153
5219
  }
5154
5220
  return "neutral";
5155
5221
  }
5222
+ function createEmptyModelUsage() {
5223
+ return {
5224
+ cachedInputTokens: 0,
5225
+ inputTokens: 0,
5226
+ isFallback: false,
5227
+ outputTokens: 0,
5228
+ reasoningOutputTokens: 0,
5229
+ totalTokens: 0
5230
+ };
5231
+ }
5156
5232
 
5157
5233
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : "undefined" !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5158
5234
 
@@ -10532,6 +10608,11 @@ class UsageDataRuntime {
10532
10608
  }
10533
10609
  return this.state.projectCatalog;
10534
10610
  }
10611
+ async getAgentDashboard(platform) {
10612
+ var _a;
10613
+ const bootstrap = await this.getBootstrap();
10614
+ return (_a = bootstrap[platform]) != null ? _a : createEmptyLoadUsageResult();
10615
+ }
10535
10616
  async getProjectDataModules(request) {
10536
10617
  await this.initialize();
10537
10618
  const projectLabel = (request.project || "").trim();
@@ -10954,135 +11035,156 @@ const assets = {
10954
11035
  "/logo.svg": {
10955
11036
  "type": "image/svg+xml",
10956
11037
  "etag": "\"1550-fwYFdULdJ83Qp0FjnnX31iQz9oI\"",
10957
- "mtime": "2026-05-21T14:07:55.988Z",
11038
+ "mtime": "2026-05-21T16:46:53.851Z",
10958
11039
  "size": 5456,
10959
11040
  "path": "../public/logo.svg"
10960
11041
  },
11042
+ "/robots.txt": {
11043
+ "type": "text/plain; charset=utf-8",
11044
+ "etag": "\"18-j8OIsL9qGDmNZ+lHhp2tyH4XtaE\"",
11045
+ "mtime": "2026-05-21T16:46:53.851Z",
11046
+ "size": 24,
11047
+ "path": "../public/robots.txt"
11048
+ },
10961
11049
  "/favicon.ico": {
10962
11050
  "type": "image/vnd.microsoft.icon",
10963
11051
  "etag": "\"1083e-LfyFZ+1JmdianDqe/sQN2Ou0IzQ\"",
10964
- "mtime": "2026-05-21T14:07:55.989Z",
11052
+ "mtime": "2026-05-21T16:46:53.852Z",
10965
11053
  "size": 67646,
10966
11054
  "path": "../public/favicon.ico"
10967
11055
  },
10968
- "/robots.txt": {
10969
- "type": "text/plain; charset=utf-8",
10970
- "etag": "\"18-j8OIsL9qGDmNZ+lHhp2tyH4XtaE\"",
10971
- "mtime": "2026-05-21T14:07:55.988Z",
10972
- "size": 24,
10973
- "path": "../public/robots.txt"
11056
+ "/_nuxt/BJUAqwzD.js": {
11057
+ "type": "text/javascript; charset=utf-8",
11058
+ "etag": "\"2a70-GZ1McpMaR0xCy2qugIKve9RzwGg\"",
11059
+ "mtime": "2026-05-21T16:46:53.847Z",
11060
+ "size": 10864,
11061
+ "path": "../public/_nuxt/BJUAqwzD.js"
10974
11062
  },
10975
- "/_nuxt/Be3rizqy.js": {
11063
+ "/_nuxt/BuL2_OVR.js": {
10976
11064
  "type": "text/javascript; charset=utf-8",
10977
- "etag": "\"d7b-uPghmytvQfaT+2HAujJe6LbOwHQ\"",
10978
- "mtime": "2026-05-21T14:07:55.985Z",
10979
- "size": 3451,
10980
- "path": "../public/_nuxt/Be3rizqy.js"
11065
+ "etag": "\"5e1e-DxfLgFGZsqX+9bU3z6B9fDiZ4AE\"",
11066
+ "mtime": "2026-05-21T16:46:53.846Z",
11067
+ "size": 24094,
11068
+ "path": "../public/_nuxt/BuL2_OVR.js"
11069
+ },
11070
+ "/_nuxt/Bz0aA7IQ.js": {
11071
+ "type": "text/javascript; charset=utf-8",
11072
+ "etag": "\"14f4-Ay9z5cYX4MdrsIKT7EU8WauIOWg\"",
11073
+ "mtime": "2026-05-21T16:46:53.846Z",
11074
+ "size": 5364,
11075
+ "path": "../public/_nuxt/Bz0aA7IQ.js"
11076
+ },
11077
+ "/_nuxt/CEZpUSPI.js": {
11078
+ "type": "text/javascript; charset=utf-8",
11079
+ "etag": "\"4399-JAvWSBSTopNzHwq+iq+6/SMVFqY\"",
11080
+ "mtime": "2026-05-21T16:46:53.846Z",
11081
+ "size": 17305,
11082
+ "path": "../public/_nuxt/CEZpUSPI.js"
10981
11083
  },
10982
- "/_nuxt/C0azgqnZ.js": {
11084
+ "/_nuxt/CbwePq4F.js": {
10983
11085
  "type": "text/javascript; charset=utf-8",
10984
- "etag": "\"15e4-yPZxunMgEI4CXPUQDwn1q6EBmXk\"",
10985
- "mtime": "2026-05-21T14:07:55.985Z",
10986
- "size": 5604,
10987
- "path": "../public/_nuxt/C0azgqnZ.js"
11086
+ "etag": "\"9f6b-wBk3LsfCJgMBbXlFKZeYWBKYONs\"",
11087
+ "mtime": "2026-05-21T16:46:53.846Z",
11088
+ "size": 40811,
11089
+ "path": "../public/_nuxt/CbwePq4F.js"
10988
11090
  },
10989
- "/_nuxt/CMNdiQCa.js": {
11091
+ "/_nuxt/Cd5S9Sm2.js": {
10990
11092
  "type": "text/javascript; charset=utf-8",
10991
- "etag": "\"e99-oz7DxIn+5EoC7DZAFZ7FWafzJXg\"",
10992
- "mtime": "2026-05-21T14:07:55.985Z",
10993
- "size": 3737,
10994
- "path": "../public/_nuxt/CMNdiQCa.js"
11093
+ "etag": "\"eb4-oQhmESDPvjVzJo4MOQCuFuOWELA\"",
11094
+ "mtime": "2026-05-21T16:46:53.847Z",
11095
+ "size": 3764,
11096
+ "path": "../public/_nuxt/Cd5S9Sm2.js"
11097
+ },
11098
+ "/_nuxt/CoVMsEv_.js": {
11099
+ "type": "text/javascript; charset=utf-8",
11100
+ "etag": "\"d7b-1Yzo1dpkXMYCgJR83GMRCpKyeVU\"",
11101
+ "mtime": "2026-05-21T16:46:53.847Z",
11102
+ "size": 3451,
11103
+ "path": "../public/_nuxt/CoVMsEv_.js"
10995
11104
  },
10996
- "/_nuxt/B-VlGWDb.js": {
11105
+ "/_nuxt/DS17D0R7.js": {
10997
11106
  "type": "text/javascript; charset=utf-8",
10998
- "etag": "\"113f5-shc1VwW6E59x5YE1XXxkl1+t2Gc\"",
10999
- "mtime": "2026-05-21T14:07:55.985Z",
11000
- "size": 70645,
11001
- "path": "../public/_nuxt/B-VlGWDb.js"
11107
+ "etag": "\"4a32-esBEFuuzT+C/uwGZFLNvzWZSeR8\"",
11108
+ "mtime": "2026-05-21T16:46:53.847Z",
11109
+ "size": 18994,
11110
+ "path": "../public/_nuxt/DS17D0R7.js"
11002
11111
  },
11003
- "/_nuxt/DenksPSi.js": {
11112
+ "/_nuxt/CF27djws.js": {
11004
11113
  "type": "text/javascript; charset=utf-8",
11005
- "etag": "\"9856-WqQjJJ7Aw5Nkcs2n0EwdWNuJkyA\"",
11006
- "mtime": "2026-05-21T14:07:55.986Z",
11007
- "size": 38998,
11008
- "path": "../public/_nuxt/DenksPSi.js"
11114
+ "etag": "\"bc73-BQ1L74oS/PuFdYObp569UMM0eMo\"",
11115
+ "mtime": "2026-05-21T16:46:53.846Z",
11116
+ "size": 48243,
11117
+ "path": "../public/_nuxt/CF27djws.js"
11009
11118
  },
11010
- "/_nuxt/CPuXQJE_.js": {
11119
+ "/_nuxt/D7Qebc1i.js": {
11011
11120
  "type": "text/javascript; charset=utf-8",
11012
- "etag": "\"1950-HPKy+7xTL7js6Fl25JirlOoLWAw\"",
11013
- "mtime": "2026-05-21T14:07:55.986Z",
11014
- "size": 6480,
11015
- "path": "../public/_nuxt/CPuXQJE_.js"
11121
+ "etag": "\"35466-cCIrQbOqRJfWBBngIRNtqv3x48k\"",
11122
+ "mtime": "2026-05-21T16:46:53.847Z",
11123
+ "size": 218214,
11124
+ "path": "../public/_nuxt/D7Qebc1i.js"
11016
11125
  },
11017
- "/_nuxt/7Dy4NLP8.js": {
11126
+ "/_nuxt/Dzuxw4nD.js": {
11018
11127
  "type": "text/javascript; charset=utf-8",
11019
- "etag": "\"4173d-SK0W7IIbbrjxnvZVRUvWgTD6Smk\"",
11020
- "mtime": "2026-05-21T14:07:55.985Z",
11021
- "size": 268093,
11022
- "path": "../public/_nuxt/7Dy4NLP8.js"
11128
+ "etag": "\"11426-pv70HY+NVfodTCuS3Klt71L6jSU\"",
11129
+ "mtime": "2026-05-21T16:46:53.847Z",
11130
+ "size": 70694,
11131
+ "path": "../public/_nuxt/Dzuxw4nD.js"
11023
11132
  },
11024
- "/_nuxt/HN9OZyaQ.js": {
11133
+ "/_nuxt/Dr4nyTE3.js": {
11025
11134
  "type": "text/javascript; charset=utf-8",
11026
- "etag": "\"40ee-JKF9E7g+xtALkpIly5WuUwJ7M3Q\"",
11027
- "mtime": "2026-05-21T14:07:55.986Z",
11028
- "size": 16622,
11029
- "path": "../public/_nuxt/HN9OZyaQ.js"
11135
+ "etag": "\"4135e-qofIZPPY9tTzQ8yOSCRNRDz9K+4\"",
11136
+ "mtime": "2026-05-21T16:46:53.847Z",
11137
+ "size": 267102,
11138
+ "path": "../public/_nuxt/Dr4nyTE3.js"
11030
11139
  },
11031
- "/_nuxt/JtK-nXxy.js": {
11140
+ "/_nuxt/LYzk-FvL.js": {
11032
11141
  "type": "text/javascript; charset=utf-8",
11033
- "etag": "\"426c-xSKk4ZvlDeEzl1dTNXRjcM+KFYM\"",
11034
- "mtime": "2026-05-21T14:07:55.986Z",
11035
- "size": 17004,
11036
- "path": "../public/_nuxt/JtK-nXxy.js"
11142
+ "etag": "\"760b-2NIcRgrYQj1VxIT1Kdxrlx7f15s\"",
11143
+ "mtime": "2026-05-21T16:46:53.847Z",
11144
+ "size": 30219,
11145
+ "path": "../public/_nuxt/LYzk-FvL.js"
11037
11146
  },
11038
11147
  "/_nuxt/error-404.B0EXnOcv.css": {
11039
11148
  "type": "text/css; charset=utf-8",
11040
11149
  "etag": "\"97e-kQ0ZEshAxA5Nrtoiwq6n4Sz6H94\"",
11041
- "mtime": "2026-05-21T14:07:55.986Z",
11150
+ "mtime": "2026-05-21T16:46:53.847Z",
11042
11151
  "size": 2430,
11043
11152
  "path": "../public/_nuxt/error-404.B0EXnOcv.css"
11044
11153
  },
11045
- "/_nuxt/error-500.CnSNZoEG.css": {
11046
- "type": "text/css; charset=utf-8",
11047
- "etag": "\"773-muVEP28ocnl3dl4Mg2tNj2UV4+I\"",
11048
- "mtime": "2026-05-21T14:07:55.986Z",
11049
- "size": 1907,
11050
- "path": "../public/_nuxt/error-500.CnSNZoEG.css"
11051
- },
11052
- "/_nuxt/y3weNNd-.js": {
11053
- "type": "text/javascript; charset=utf-8",
11054
- "etag": "\"54f2-/HDLhbnuRAfdGTmt7fvdXDNup5M\"",
11055
- "mtime": "2026-05-21T14:07:55.987Z",
11056
- "size": 21746,
11057
- "path": "../public/_nuxt/y3weNNd-.js"
11058
- },
11059
11154
  "/_nuxt/builds/latest.json": {
11060
11155
  "type": "application/json",
11061
- "etag": "\"47-IcLUoQwZfawrDpqkP+HWspECjQ0\"",
11062
- "mtime": "2026-05-21T14:07:55.983Z",
11156
+ "etag": "\"47-I/+k0ENVimU/oXLqDF99CdwObCg\"",
11157
+ "mtime": "2026-05-21T16:46:53.841Z",
11063
11158
  "size": 71,
11064
11159
  "path": "../public/_nuxt/builds/latest.json"
11065
11160
  },
11066
- "/_nuxt/builds/meta/37e8bb21-a086-45bf-93dc-47eeeada7299.json": {
11161
+ "/_nuxt/builds/meta/5b933d30-47b4-45ca-8d5a-cba3255174fa.json": {
11067
11162
  "type": "application/json",
11068
- "etag": "\"58-AxGF/Ic8xVVV7mujW5bubFMLmP0\"",
11069
- "mtime": "2026-05-21T14:07:55.980Z",
11163
+ "etag": "\"58-Pbf2kOx8c2+B7oHj2QlELtrJmQs\"",
11164
+ "mtime": "2026-05-21T16:46:53.803Z",
11070
11165
  "size": 88,
11071
- "path": "../public/_nuxt/builds/meta/37e8bb21-a086-45bf-93dc-47eeeada7299.json"
11166
+ "path": "../public/_nuxt/builds/meta/5b933d30-47b4-45ca-8d5a-cba3255174fa.json"
11072
11167
  },
11073
- "/_nuxt/entry.r-q4oQC0.css": {
11168
+ "/_nuxt/WjVGlVHF.js": {
11169
+ "type": "text/javascript; charset=utf-8",
11170
+ "etag": "\"3cf2-aeAvBtrwHwLZDMB1wlUbvrp4E+w\"",
11171
+ "mtime": "2026-05-21T16:46:53.847Z",
11172
+ "size": 15602,
11173
+ "path": "../public/_nuxt/WjVGlVHF.js"
11174
+ },
11175
+ "/_nuxt/error-500.CnSNZoEG.css": {
11074
11176
  "type": "text/css; charset=utf-8",
11075
- "etag": "\"1d4c5-XrvSWxRoEnXFXlc60WKf6SWSUqA\"",
11076
- "mtime": "2026-05-21T14:07:55.986Z",
11077
- "size": 120005,
11078
- "path": "../public/_nuxt/entry.r-q4oQC0.css"
11177
+ "etag": "\"773-muVEP28ocnl3dl4Mg2tNj2UV4+I\"",
11178
+ "mtime": "2026-05-21T16:46:53.847Z",
11179
+ "size": 1907,
11180
+ "path": "../public/_nuxt/error-500.CnSNZoEG.css"
11079
11181
  },
11080
- "/_nuxt/Dkya5WaL.js": {
11081
- "type": "text/javascript; charset=utf-8",
11082
- "etag": "\"4d31c-nuEqRPK/pktpEYKRQKY9wmKH0NI\"",
11083
- "mtime": "2026-05-21T14:07:55.987Z",
11084
- "size": 316188,
11085
- "path": "../public/_nuxt/Dkya5WaL.js"
11182
+ "/_nuxt/entry.vHfFzkyD.css": {
11183
+ "type": "text/css; charset=utf-8",
11184
+ "etag": "\"1d217-AX0vUIWFE2kL17zPKjOPcQBxadQ\"",
11185
+ "mtime": "2026-05-21T16:46:53.847Z",
11186
+ "size": 119319,
11187
+ "path": "../public/_nuxt/entry.vHfFzkyD.css"
11086
11188
  }
11087
11189
  };
11088
11190
 
@@ -13133,6 +13235,338 @@ function _deepFreeze(object) {
13133
13235
  return Object.freeze(object);
13134
13236
  }
13135
13237
 
13238
+ function buildHomeDashboardModules(dashboardsByPlatform) {
13239
+ var _a, _b, _c, _d;
13240
+ const sessionUsage = buildSessionUsage(dashboardsByPlatform);
13241
+ const dailyTokenUsage = mergeDailyTokenUsage(
13242
+ PROJECT_USAGE_PLATFORMS.flatMap((platform) => getPlatformDashboard(dashboardsByPlatform, platform).dailyTokenUsage)
13243
+ );
13244
+ const monthlyModelUsage = mergeMonthlyModelUsage(
13245
+ PROJECT_USAGE_PLATFORMS.flatMap((platform) => getPlatformDashboard(dashboardsByPlatform, platform).monthlyModelUsage)
13246
+ );
13247
+ const projectUsage = buildProjectUsage(sessionUsage);
13248
+ const totalCost = dailyTokenUsage.reduce((sum, item) => sum + item.costUSD, 0);
13249
+ const totalTokens = dailyTokenUsage.reduce((sum, item) => sum + item.totalTokens, 0);
13250
+ const inputTokens = dailyTokenUsage.reduce((sum, item) => sum + item.inputTokens, 0);
13251
+ const cachedInputTokens = dailyTokenUsage.reduce((sum, item) => sum + item.cachedInputTokens, 0);
13252
+ const outputTokens = dailyTokenUsage.reduce((sum, item) => sum + item.outputTokens, 0);
13253
+ const reasoningOutputTokens = dailyTokenUsage.reduce((sum, item) => sum + item.reasoningOutputTokens, 0);
13254
+ const totalSessions = sessionUsage.length;
13255
+ const todayDateKey = getDateKey(/* @__PURE__ */ new Date());
13256
+ const previousDayDateKey = getPreviousDateKey(todayDateKey);
13257
+ const todayDailyUsage = dailyTokenUsage.find((item) => getDateKeyFromLabel(item.date) === todayDateKey);
13258
+ const previousDayDailyUsage = dailyTokenUsage.find((item) => getDateKeyFromLabel(item.date) === previousDayDateKey);
13259
+ const costGrowthTrend = buildGrowthTrend(
13260
+ (_a = todayDailyUsage == null ? void 0 : todayDailyUsage.costUSD) != null ? _a : 0,
13261
+ (_b = previousDayDailyUsage == null ? void 0 : previousDayDailyUsage.costUSD) != null ? _b : 0,
13262
+ formatCurrency
13263
+ );
13264
+ const tokenGrowthTrend = buildGrowthTrend(
13265
+ (_c = todayDailyUsage == null ? void 0 : todayDailyUsage.totalTokens) != null ? _c : 0,
13266
+ (_d = previousDayDailyUsage == null ? void 0 : previousDayDailyUsage.totalTokens) != null ? _d : 0,
13267
+ formatCompactNumber
13268
+ );
13269
+ const efficiencyMetrics = buildEfficiencyMetrics({
13270
+ cachedInputTokens,
13271
+ inputTokens,
13272
+ outputTokens,
13273
+ reasoningOutputTokens,
13274
+ totalTokens
13275
+ });
13276
+ return {
13277
+ dailyTokenUsage,
13278
+ efficiencyMetrics,
13279
+ hotProjects: projectUsage,
13280
+ modelUsage: monthlyModelUsage,
13281
+ overviewCards: buildHomeOverviewCards({
13282
+ cachedInputTokens,
13283
+ costGrowthTrend,
13284
+ inputTokens,
13285
+ tokenGrowthTrend,
13286
+ totalCost,
13287
+ totalSessions,
13288
+ totalTokens
13289
+ }),
13290
+ sessionAnalysis: {
13291
+ items: sessionUsage,
13292
+ totalSessions
13293
+ }
13294
+ };
13295
+ }
13296
+ function getPlatformDashboard(dashboardsByPlatform, platform) {
13297
+ return dashboardsByPlatform[platform];
13298
+ }
13299
+ function buildSessionUsage(dashboardsByPlatform) {
13300
+ return PROJECT_USAGE_PLATFORMS.flatMap((platform) => getPlatformDashboard(dashboardsByPlatform, platform).sessionUsage.map((session) => ({
13301
+ ...session,
13302
+ id: `${platform}:${session.id}`,
13303
+ sessionId: `${platform}:${session.sessionId}`
13304
+ }))).sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
13305
+ }
13306
+ function buildHomeOverviewCards(options) {
13307
+ return [
13308
+ {
13309
+ detail: `${formatCurrency(options.totalCost)} total spend across all tools`,
13310
+ icon: "lucide:wallet",
13311
+ name: "Total Spend",
13312
+ trend: options.costGrowthTrend.trend,
13313
+ trendTone: options.costGrowthTrend.trendTone,
13314
+ value: formatCurrency(options.totalCost)
13315
+ },
13316
+ {
13317
+ detail: `${formatNumber(options.totalTokens)} total tokens across all tools`,
13318
+ icon: "solar:cpu-line-duotone",
13319
+ name: "Token Usage",
13320
+ trend: options.tokenGrowthTrend.trend,
13321
+ trendTone: options.tokenGrowthTrend.trendTone,
13322
+ value: formatCompactNumber(options.totalTokens)
13323
+ },
13324
+ {
13325
+ detail: `${formatNumber(options.cachedInputTokens)} of ${formatNumber(options.inputTokens)} input tokens were served from cache`,
13326
+ icon: "lucide:database-zap",
13327
+ name: "Cache Hit Rate",
13328
+ trend: `${formatCompactNumber(options.cachedInputTokens)} cached`,
13329
+ trendTone: "neutral",
13330
+ value: formatPercent(options.inputTokens > 0 ? options.cachedInputTokens / options.inputTokens : 0)
13331
+ },
13332
+ {
13333
+ detail: `${formatCurrency(options.totalCost)} across ${formatNumber(options.totalSessions)} sessions`,
13334
+ icon: "lucide:receipt-text",
13335
+ name: "Avg Session Cost",
13336
+ trend: "across all tools",
13337
+ trendTone: "neutral",
13338
+ value: formatCurrency(options.totalSessions > 0 ? options.totalCost / options.totalSessions : 0)
13339
+ }
13340
+ ];
13341
+ }
13342
+ function buildEfficiencyMetrics(options) {
13343
+ const cacheHitRate = safeRatio(options.cachedInputTokens, options.inputTokens);
13344
+ const reasoningShare = safeRatio(options.reasoningOutputTokens, options.totalTokens);
13345
+ const outputShare = safeRatio(options.outputTokens, options.totalTokens);
13346
+ return [
13347
+ {
13348
+ detail: `${formatCompactNumber(options.cachedInputTokens)} cached input tokens`,
13349
+ label: "Cache Hit Rate",
13350
+ percent: cacheHitRate * 100,
13351
+ tone: "green",
13352
+ value: formatPercent(cacheHitRate)
13353
+ },
13354
+ {
13355
+ detail: `${formatCompactNumber(options.reasoningOutputTokens)} reasoning output tokens`,
13356
+ label: "Reasoning Token Share",
13357
+ percent: reasoningShare * 100,
13358
+ tone: "amber",
13359
+ value: formatPercent(reasoningShare)
13360
+ },
13361
+ {
13362
+ detail: `${formatCompactNumber(options.outputTokens)} output tokens`,
13363
+ label: "Output Token Share",
13364
+ percent: outputShare * 100,
13365
+ tone: "sky",
13366
+ value: formatPercent(outputShare)
13367
+ }
13368
+ ];
13369
+ }
13370
+ function safeRatio(numerator, denominator) {
13371
+ return denominator > 0 ? numerator / denominator : 0;
13372
+ }
13373
+
13374
+ const PROJECT_USAGE_PLATFORM_META = {
13375
+ amp: {
13376
+ aiIcon: "amp",
13377
+ color: "#f34e3f",
13378
+ label: "Amp",
13379
+ slug: "amp"
13380
+ },
13381
+ claudeCode: {
13382
+ aiIcon: "claude_code",
13383
+ color: "#d97757",
13384
+ label: "Claude Code",
13385
+ slug: "claude_code"
13386
+ },
13387
+ codebuff: {
13388
+ aiIcon: "codebuff",
13389
+ color: "#14b8a6",
13390
+ label: "Codebuff",
13391
+ slug: "codebuff"
13392
+ },
13393
+ codex: {
13394
+ aiIcon: "codex",
13395
+ color: "#111827",
13396
+ label: "Codex",
13397
+ slug: "codex"
13398
+ },
13399
+ copilot: {
13400
+ aiIcon: "copilot",
13401
+ color: "#0f766e",
13402
+ label: "GitHub Copilot",
13403
+ slug: "copilot"
13404
+ },
13405
+ droid: {
13406
+ aiIcon: "droid",
13407
+ color: "#06b6d4",
13408
+ label: "Droid",
13409
+ slug: "droid"
13410
+ },
13411
+ gemini: {
13412
+ aiIcon: "gemini",
13413
+ color: "#0ea5e9",
13414
+ label: "Gemini",
13415
+ slug: "gemini"
13416
+ },
13417
+ goose: {
13418
+ aiIcon: "goose",
13419
+ color: "#22c55e",
13420
+ label: "Goose",
13421
+ slug: "goose"
13422
+ },
13423
+ hermes: {
13424
+ aiIcon: "hermes",
13425
+ color: "#8b5cf6",
13426
+ label: "Hermes",
13427
+ slug: "hermes"
13428
+ },
13429
+ kilo: {
13430
+ aiIcon: "kilo",
13431
+ color: "#f97316",
13432
+ label: "Kilo",
13433
+ slug: "kilo"
13434
+ },
13435
+ kimi: {
13436
+ aiIcon: "kimi_code",
13437
+ color: "#2563eb",
13438
+ label: "Kimi",
13439
+ slug: "kimi"
13440
+ },
13441
+ openclaw: {
13442
+ aiIcon: "openclaw",
13443
+ color: "#ec4899",
13444
+ label: "OpenClaw",
13445
+ slug: "openclaw"
13446
+ },
13447
+ opencode: {
13448
+ aiIcon: "open_code",
13449
+ color: "#4f46e5",
13450
+ label: "OpenCode",
13451
+ slug: "opencode"
13452
+ },
13453
+ pi: {
13454
+ aiIcon: "pi",
13455
+ color: "#a855f7",
13456
+ label: "Pi",
13457
+ slug: "pi"
13458
+ },
13459
+ qwen: {
13460
+ aiIcon: "qwen_code",
13461
+ color: "#623ae7",
13462
+ label: "Qwen",
13463
+ slug: "qwen"
13464
+ }
13465
+ };
13466
+ const platformSlugEntries = PROJECT_USAGE_PLATFORMS.map((platform) => [
13467
+ PROJECT_USAGE_PLATFORM_META[platform].slug,
13468
+ platform
13469
+ ]);
13470
+ const platformBySlug = new Map(platformSlugEntries);
13471
+ function resolveProjectUsagePlatform(value) {
13472
+ var _a;
13473
+ const normalizedValue = value == null ? void 0 : value.trim();
13474
+ if (!normalizedValue) {
13475
+ return null;
13476
+ }
13477
+ if (PROJECT_USAGE_PLATFORMS.includes(normalizedValue)) {
13478
+ return normalizedValue;
13479
+ }
13480
+ return (_a = platformBySlug.get(normalizedValue)) != null ? _a : null;
13481
+ }
13482
+
13483
+ const ANALYSIS_AGENT_TOKEN_TYPES = ["day", "week", "month", "session"];
13484
+ const ANALYSIS_AGENT_TOKEN_ROW_KEYS = {
13485
+ day: "dailyRows",
13486
+ month: "monthlyRows",
13487
+ session: "sessionRows",
13488
+ week: "weeklyRows"
13489
+ };
13490
+
13491
+ function getAnalysisRuntime(event) {
13492
+ const runtimeConfig = useRuntimeConfig(event);
13493
+ const config = resolveConfig(runtimeConfig.public);
13494
+ return getUsageDataRuntime(config);
13495
+ }
13496
+ function getOptionalAnalysisAgent(event) {
13497
+ const agent = normalizeQueryString(getQuery(event).agent);
13498
+ if (!agent) {
13499
+ return null;
13500
+ }
13501
+ const platform = resolveProjectUsagePlatform(agent);
13502
+ if (!platform) {
13503
+ throw createError$1({
13504
+ statusCode: 400,
13505
+ statusMessage: `Unsupported agent: ${agent}.`
13506
+ });
13507
+ }
13508
+ return platform;
13509
+ }
13510
+ function getRequiredAnalysisAgent(event) {
13511
+ const platform = getOptionalAnalysisAgent(event);
13512
+ if (!platform) {
13513
+ throw createError$1({
13514
+ statusCode: 400,
13515
+ statusMessage: "Missing required query parameter: agent."
13516
+ });
13517
+ }
13518
+ return platform;
13519
+ }
13520
+ function getRequiredAnalysisAgentTokenType(event) {
13521
+ const type = normalizeQueryString(getQuery(event).type);
13522
+ if (!type) {
13523
+ throw createError$1({
13524
+ statusCode: 400,
13525
+ statusMessage: "Missing required query parameter: type."
13526
+ });
13527
+ }
13528
+ if (!ANALYSIS_AGENT_TOKEN_TYPES.includes(type)) {
13529
+ throw createError$1({
13530
+ statusCode: 400,
13531
+ statusMessage: `Unsupported token analysis type: ${type}.`
13532
+ });
13533
+ }
13534
+ return type;
13535
+ }
13536
+ function defineHomeAnalysisHandler(select) {
13537
+ return defineEventHandler(async (event) => {
13538
+ return select(await getHomeAnalysisModules(event));
13539
+ });
13540
+ }
13541
+ function defineScopedAnalysisHandler(options) {
13542
+ return defineEventHandler(async (event) => {
13543
+ const agent = getOptionalAnalysisAgent(event);
13544
+ if (agent) {
13545
+ return options.agent(await getAnalysisRuntime(event).getAgentDashboard(agent));
13546
+ }
13547
+ return options.home(await getHomeAnalysisModules(event));
13548
+ });
13549
+ }
13550
+ function defineRequiredAgentAnalysisHandler(select) {
13551
+ return defineEventHandler(async (event) => {
13552
+ const agent = getRequiredAnalysisAgent(event);
13553
+ return select(await getAnalysisRuntime(event).getAgentDashboard(agent), event);
13554
+ });
13555
+ }
13556
+ async function getHomeAnalysisModules(event) {
13557
+ return buildHomeDashboardModules(await getAnalysisRuntime(event).getBootstrap());
13558
+ }
13559
+ function normalizeQueryString(value) {
13560
+ if (Array.isArray(value)) {
13561
+ const firstValue = value[0];
13562
+ return typeof firstValue === "string" ? firstValue.trim() : firstValue === void 0 || firstValue === null ? void 0 : String(firstValue).trim();
13563
+ }
13564
+ if (typeof value === "string") {
13565
+ return value.trim();
13566
+ }
13567
+ return value === void 0 || value === null ? void 0 : String(value).trim();
13568
+ }
13569
+
13136
13570
  const collections = {
13137
13571
  };
13138
13572
 
@@ -13187,6 +13621,15 @@ const _wKCHD4 = defineCachedEventHandler(async (event) => {
13187
13621
  // 1 week
13188
13622
  });
13189
13623
 
13624
+ const _lazy_3BtBIZ = () => import('../routes/api/analysis/agent/session.json.mjs');
13625
+ const _lazy_oxpFyd = () => import('../routes/api/analysis/agent/token.json.mjs');
13626
+ const _lazy_DXgpuR = () => import('../routes/api/analysis/cache.json.mjs');
13627
+ const _lazy_2vWxZA = () => import('../routes/api/analysis/hot-project.json.mjs');
13628
+ const _lazy_L3NWhI = () => import('../routes/api/analysis/model.json.mjs');
13629
+ const _lazy_NXGH0G = () => import('../routes/api/analysis/overview-cards.json.mjs');
13630
+ const _lazy_FZJ5Wh = () => import('../routes/api/analysis/session.json.mjs');
13631
+ const _lazy_k5j8NN = () => import('../routes/api/analysis/token.json.mjs');
13632
+ const _lazy_wkSLy3 = () => import('../routes/api/analysis/token/daily.json.mjs');
13190
13633
  const _lazy_x_4o7G = () => import('../routes/api/payload.json.mjs');
13191
13634
  const _lazy_slsjW6 = () => import('../routes/api/projects/_project/modules.get.mjs');
13192
13635
  const _lazy_K00scR = () => import('../routes/api/projects/catalog.get.mjs');
@@ -13195,6 +13638,15 @@ const _lazy_rWaGII = () => import('../routes/renderer.mjs');
13195
13638
 
13196
13639
  const handlers = [
13197
13640
  { route: '', handler: _4bo09N, lazy: false, middleware: true, method: undefined },
13641
+ { route: '/api/analysis/agent/session.json', handler: _lazy_3BtBIZ, lazy: true, middleware: false, method: undefined },
13642
+ { route: '/api/analysis/agent/token.json', handler: _lazy_oxpFyd, lazy: true, middleware: false, method: undefined },
13643
+ { route: '/api/analysis/cache.json', handler: _lazy_DXgpuR, lazy: true, middleware: false, method: undefined },
13644
+ { route: '/api/analysis/hot-project.json', handler: _lazy_2vWxZA, lazy: true, middleware: false, method: undefined },
13645
+ { route: '/api/analysis/model.json', handler: _lazy_L3NWhI, lazy: true, middleware: false, method: undefined },
13646
+ { route: '/api/analysis/overview-cards.json', handler: _lazy_NXGH0G, lazy: true, middleware: false, method: undefined },
13647
+ { route: '/api/analysis/session.json', handler: _lazy_FZJ5Wh, lazy: true, middleware: false, method: undefined },
13648
+ { route: '/api/analysis/token.json', handler: _lazy_k5j8NN, lazy: true, middleware: false, method: undefined },
13649
+ { route: '/api/analysis/token/daily.json', handler: _lazy_wkSLy3, lazy: true, middleware: false, method: undefined },
13198
13650
  { route: '/api/payload.json', handler: _lazy_x_4o7G, lazy: true, middleware: false, method: undefined },
13199
13651
  { route: '/api/projects/:project/modules', handler: _lazy_slsjW6, lazy: true, middleware: false, method: "get" },
13200
13652
  { route: '/api/projects/catalog', handler: _lazy_K00scR, lazy: true, middleware: false, method: "get" },
@@ -13352,4 +13804,4 @@ const websocket = nitroApp.h3App.websocket ;
13352
13804
  const handler = listener;
13353
13805
  trapUnhandledNodeErrors();
13354
13806
 
13355
- export { getRouterParam as a, getQuery as b, normalizeStringList as c, defineEventHandler as d, defineWebSocketHandler as e, buildAssetsURL as f, getUsageDataRuntime as g, getResponseStatusText as h, getResponseStatus as i, defineRenderHandler as j, createError$1 as k, destr as l, getRouteRules as m, normalizeStringValue as n, joinURL as o, publicAssetsURL as p, useNitroApp as q, resolveConfig as r, commonjsGlobal as s, handler as t, useRuntimeConfig as u, listener as v, withLeadingSlash as w, websocket as x };
13807
+ export { ANALYSIS_AGENT_TOKEN_ROW_KEYS as A, listener as B, websocket as C, defineHomeAnalysisHandler as a, defineScopedAnalysisHandler as b, defineEventHandler as c, defineRequiredAgentAnalysisHandler as d, getUsageDataRuntime as e, getRouterParam as f, getRequiredAnalysisAgentTokenType as g, getQuery as h, normalizeStringList as i, defineWebSocketHandler as j, buildAssetsURL as k, getResponseStatusText as l, getResponseStatus as m, normalizeStringValue as n, defineRenderHandler as o, publicAssetsURL as p, createError$1 as q, resolveConfig as r, destr as s, getRouteRules as t, useRuntimeConfig as u, joinURL as v, withLeadingSlash as w, useNitroApp as x, commonjsGlobal as y, handler as z };