@jeffusion/bungee-core 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +85 -21
- package/dist/plugins/ai-transformer/index.js.map +2 -2
- package/dist/plugins/anthropic-request-sanitizer/index.js.map +2 -2
- package/dist/plugins/anthropic-tool-name-transformer/index.js.map +2 -2
- package/dist/plugins/chatgpt-oauth/index.js.map +2 -2
- package/dist/plugins/deepseek-reasoning-fix/index.js.map +2 -2
- package/dist/plugins/model-mapping/index.js.map +2 -2
- package/dist/plugins/openai-messages-to-chat/index.js.map +2 -2
- package/dist/plugins/signature-repair/index.js.map +2 -2
- package/dist/plugins/token-stats/control.js +29 -10
- package/dist/plugins/token-stats/control.js.map +6 -5
- package/dist/plugins/token-stats/index.js +12 -4
- package/dist/plugins/token-stats/index.js.map +6 -5
- package/dist/plugins/token-stats/manifest.json +24 -4
- package/dist/plugins/token-stats/ui/TokenStatsMetric.svelte +31 -9
- package/dist/plugins/token-stats/ui/TokenStatsPage.svelte +29 -41
- package/dist/plugins/token-stats/ui/UsageTimeChart.svelte +132 -70
- package/dist/plugins/token-stats/ui/labels.ts +22 -4
- package/dist/plugins/token-stats/ui/overview-trends.ts +33 -0
- package/dist/plugins/token-stats/ui/stats-resource.ts +5 -2
- package/dist/plugins/token-stats/ui/stats.ts +3 -2
- package/package.json +2 -2
|
@@ -16612,6 +16612,11 @@ function createTokenAccountingSession(input, options = {}) {
|
|
|
16612
16612
|
}
|
|
16613
16613
|
};
|
|
16614
16614
|
}
|
|
16615
|
+
// packages/core/src/token-stats-window.ts
|
|
16616
|
+
var HOUR = 3600000;
|
|
16617
|
+
var TOKEN_STATS_RETENTION_MS = 31 * 24 * HOUR;
|
|
16618
|
+
var TOKEN_STATS_RANGES = ["1h", "12h", "24h", "1d", "7d", "30d", "day", "week", "month"];
|
|
16619
|
+
|
|
16615
16620
|
// plugins/token-stats/server/repository.ts
|
|
16616
16621
|
class TokenStatsRepositoryError extends Error {
|
|
16617
16622
|
constructor(message) {
|
|
@@ -16756,23 +16761,26 @@ class TokenStatsRepository {
|
|
|
16756
16761
|
scheduleDrain();
|
|
16757
16762
|
return true;
|
|
16758
16763
|
}
|
|
16759
|
-
async query(range, groupBy, asOfMs = Date.now()) {
|
|
16760
|
-
if (range
|
|
16764
|
+
async query(range, groupBy, asOfMs = Date.now(), timeZone) {
|
|
16765
|
+
if (!TOKEN_STATS_RANGES.includes(range))
|
|
16761
16766
|
throw new TokenStatsRepositoryError("invalid token-stats range");
|
|
16762
16767
|
if (groupBy !== "model" && groupBy !== "time") {
|
|
16763
16768
|
throw new TokenStatsRepositoryError("invalid token-stats groupBy");
|
|
16764
16769
|
}
|
|
16765
16770
|
if (!Number.isSafeInteger(asOfMs) || asOfMs < 0)
|
|
16766
16771
|
throw new TokenStatsRepositoryError("invalid token-stats asOfMs");
|
|
16767
|
-
const snapshot = await this.metering.queryWindowSnapshot({ asOfMs, range, groupBy });
|
|
16772
|
+
const snapshot = await this.metering.queryWindowSnapshot({ asOfMs, range, groupBy, timeZone });
|
|
16768
16773
|
const total = metricsToDto(snapshot.all);
|
|
16769
16774
|
const { inputTokens, outputTokens, ...summary } = total;
|
|
16770
16775
|
return {
|
|
16771
16776
|
groupBy,
|
|
16777
|
+
asOfMs,
|
|
16772
16778
|
...summary,
|
|
16773
16779
|
totalInputTokens: inputTokens,
|
|
16774
16780
|
totalOutputTokens: outputTokens,
|
|
16775
16781
|
...snapshot.bucketMs === undefined ? {} : { bucketMs: snapshot.bucketMs },
|
|
16782
|
+
...snapshot.bucketStarts === undefined ? {} : { bucketStarts: snapshot.bucketStarts },
|
|
16783
|
+
...snapshot.bucketEndMs === undefined ? {} : { bucketEndMs: snapshot.bucketEndMs },
|
|
16776
16784
|
data: snapshot.data.map((row) => ({
|
|
16777
16785
|
dimension: row.dimension,
|
|
16778
16786
|
...row.bucketStartMs === undefined ? {} : { bucketStartMs: row.bucketStartMs },
|
|
@@ -17688,4 +17696,4 @@ export {
|
|
|
17688
17696
|
server_default as default
|
|
17689
17697
|
};
|
|
17690
17698
|
|
|
17691
|
-
//# debugId=
|
|
17699
|
+
//# debugId=5769627DAE62677664756E2164756E21
|