tokentracker-cli 0.96.4 → 0.97.1
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/dashboard/dist/assets/{AchievementBadge-CCcvmz6R.js → AchievementBadge-BdvqY4Qb.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-C5jdktOK.js → AchievementsPage-CrqvRxnb.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BFMtUzn1.js → AchievementsSection-wyLAM9N7.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-Be8gM7tM.js → BadgeDetailModal-CquST3dj.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-CXTGR71z.js → BotAnimated-EXhdUHSg.js} +1 -1
- package/dashboard/dist/assets/{Card-CsUsp3CV.js → Card-Il2WWgOG.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-BEjpZjEE.js → ClawdAnimated-DioF5wa-.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-CHc_Z1r8.js → CommandPalette-CaDx06tM.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-Gs6kZ_Mp.js → CommunityStatsModal-BbYWzM07.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-niHkpv2O.js → ConfirmModal-BHWQLUCM.js} +1 -1
- package/dashboard/dist/assets/{Controls-X2Z1UNUx.js → Controls--LFhExZX.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-B66s3Exi.js → DashboardPage-DuqJOpHL.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DQdLdEI8.js → DevicePage-RKTirqz0.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-CCUjTxl8.js → DialogClose-DPFsTKmJ.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DgaV8Gtk.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CgkUGAag.js → DialogTitle-DolLpmFL.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-D4QD1bPo.js → FadeIn-92GGNCPe.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-D0my-Z3a.js → HeaderGithubStar-GfXudotT.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-nSWgrKlK.js → HoverTooltip-n7gbPEsq.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-4hfqHAgi.js → IpCheckPage-BaQOTbXi.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-wIc4tVRI.js → LandingPage-D3JcvxW_.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-DGlN8Vy8.js → LeaderboardAvatar-tVaWJXZ3.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-CybuzE87.js → LeaderboardPage-NqHcStnk.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-D9la3tNd.js → LeaderboardProfileModal-DmvcCVS7.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-gxXSeJYb.js → LeaderboardProfilePage-VSv3IlzS.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CZH3G54Y.js → LimitsPage-CtxgT20z.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-Ckc7zohC.js → LocalOnlyNotice-O9o586G8.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-BqeRHqWK.js → LoginCard-JCejigVu.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-BjH6aIBG.js → LoginModal-CJ3g7tBc.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-BOyPLNU3.js → LoginPage-DPWzPywx.js} +1 -1
- package/dashboard/dist/assets/{PetPage-BXRXG40D.js → PetPage-MSJ3jseK.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-Dad1ZYVd.js → PopoverPopup-nL3YOLPO.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-BDmrNJSl.js → ProviderIcon-C5RX_xPk.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-CZpE6qfa.js → ResetPasswordPage-DW_NCwA_.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-CE1hrQFi.js → SegmentedControl-CS6wQtck.js} +1 -1
- package/dashboard/dist/assets/{Select-YVj7u6Nv.js → Select-YqlqvbT5.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-BMYGgQ3o.js → SelectItemText-BahqsiIc.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-HehjDbZg.js → ServiceStatusPage-DyhutLUy.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-Chvu4YqZ.js → SessionsPage-wbvi4EHi.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BXjS7u9_.js → SettingsPage-HGSwpV1O.js} +2 -2
- package/dashboard/dist/assets/{SkillsPage-q3Rjlj9h.js → SkillsPage-BbVT9oyh.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-BqZyj82r.js → TokenGalaxy-Cej6MLu6.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-Ch8ueI_C.js → ToolbarRootContext-D9pPY73U.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-C2aTL9p1.js → TrendMonitor-BtBcCjx-.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DYaIai8j.js → WidgetsPage-BSNl2WIL.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-51B0v-Sr.js → WrappedPage-d5oiNV4T.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-Cp7dNuCm.js → __vite-browser-external-CjrP5KfC.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-DXrPSAdX.js → agent-logos-CCVzO3uU.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-BFkf7l0U.js → arrow-up-right-AKItXMyh.js} +1 -1
- package/dashboard/dist/assets/{check--N8wmgIJ.js → check-BQw5n0V0.js} +1 -1
- package/dashboard/dist/assets/{composite-zF5Pj94e.js → composite-CWz1s64R.js} +1 -1
- package/dashboard/dist/assets/{copy-BG0JMr6A.js → copy-CF8XNmv3.js} +1 -1
- package/dashboard/dist/assets/{download-CPFJf-Sf.js → download-BZvLU_hD.js} +1 -1
- package/dashboard/dist/assets/{external-link-D2yF0kgP.js → external-link-bZrcVkeE.js} +1 -1
- package/dashboard/dist/assets/{flame-l460AFx9.js → flame-CMHolW1z.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DKO4ljuH.js → format-tokens-Bs2YotMr.js} +1 -1
- package/dashboard/dist/assets/{icons-RoxRGkz4.js → icons-OKyij2y_.js} +1 -1
- package/dashboard/dist/assets/{index-PTJ4368-.js → index-C8nY1OaT.js} +1 -1
- package/dashboard/dist/assets/{index--ouT5L4N.js → index-CN7xY7j_.js} +1 -1
- package/dashboard/dist/assets/{index-DhyLCvvv.js → index-DOwPCQx2.js} +1 -1
- package/dashboard/dist/assets/{info-DNWMO4Ca.js → info-CU7bMBhU.js} +1 -1
- package/dashboard/dist/assets/{link-2-DzWXAz1h.js → link-2-wwoUOujz.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-BzGMqXNu.js → loader-circle-BK3Ltc-j.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-Dkpyk4x3.js → maximize-2-DIPnLqR8.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-lggHUQpW.js → modifiers.esm-D_aVVjx5.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-Ck0-gz9l.js → monitor-smartphone-4NOM9BHb.js} +1 -1
- package/dashboard/dist/assets/{plus-qTJpnn43.js → plus-JqSTJ28Y.js} +1 -1
- package/dashboard/dist/assets/{provider-display-psY26qmp.js → provider-display-CEFlg9ho.js} +1 -1
- package/dashboard/dist/assets/{react-CYS24KmX.js → react-jS0-5kwE.js} +1 -1
- package/dashboard/dist/assets/{search-CUzE6zxr.js → search-CbBetPN7.js} +1 -1
- package/dashboard/dist/assets/{skills-api-D9SzxPFG.js → skills-api-PwUMTdmV.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-Bl2hAUyR.js → sortable.esm-BDdw7tkz.js} +1 -1
- package/dashboard/dist/assets/{store-mHSJAJtE.js → store-CFdu9yv_.js} +1 -1
- package/dashboard/dist/assets/{terminal-BlQNEvn1.js → terminal-Dh7Sh6IG.js} +1 -1
- package/dashboard/dist/assets/{trash-CHdgmOyk.js → trash-B6_OaEVL.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-DUiCs91N.js → use-community-stats-D55oU9bu.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-ehXfkvuU.js → use-latest-request-guard-BO89yQ3n.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CcwwQ0Fq.js → use-limits-display-prefs-C358N7B0.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-CCOtI3Wa.js → use-ordered-list-B9ZYDS1K.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DWHVI51t.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-CYRDpcc_.js → use-session-efficiency-pref-CwGRDyVq.js} +1 -1
- package/dashboard/dist/assets/{use-transform-btLlTJpj.js → use-transform-9S4Ruq_s.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-BGr5sR-c.js → use-usage-limits-CpnM5V06.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-CNutuEKd.js → useCurrency-BKJGW_4l.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-C0bAJFMC.js → useTokenFormat-CTB5svOB.js} +1 -1
- package/dashboard/dist/assets/{zap-B2fbyjbc.js → zap-DGdBuT6m.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/codex-rollout-parser.js +48 -1
- package/src/lib/codex-service-tier.js +49 -0
- package/src/lib/pricing/curated-overrides.json +2 -1
- package/src/lib/pricing/index.js +61 -3
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +83 -2
- package/src/lib/session-analytics.js +11 -0
- package/dashboard/dist/assets/DialogDescription-CjMjYG3N.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-CDlahPqe.js +0 -1
package/src/lib/rollout.js
CHANGED
|
@@ -21,6 +21,11 @@ const {
|
|
|
21
21
|
currentCodexModel,
|
|
22
22
|
snapshotCodexModelAttributionState,
|
|
23
23
|
} = require("./codex-model-attribution");
|
|
24
|
+
const {
|
|
25
|
+
CODEX_SERVICE_TIER_MARKER,
|
|
26
|
+
readCodexServiceTier,
|
|
27
|
+
isPriorityServiceTier,
|
|
28
|
+
} = require("./codex-service-tier");
|
|
24
29
|
const {
|
|
25
30
|
DEVIN_TABLE_PROBE_SQL,
|
|
26
31
|
devinUsageSql,
|
|
@@ -471,6 +476,7 @@ async function parseRolloutIncremental({
|
|
|
471
476
|
? prev.tokenUsageBaselines || null
|
|
472
477
|
: null;
|
|
473
478
|
const lastModel = sameInode && !truncated ? prev.lastModel || null : null;
|
|
479
|
+
const lastServiceTier = sameInode && !truncated ? prev.lastServiceTier || null : null;
|
|
474
480
|
const modelAttributionState = sameInode && !truncated
|
|
475
481
|
? prev.modelAttributionState || null
|
|
476
482
|
: null;
|
|
@@ -551,6 +557,7 @@ async function parseRolloutIncremental({
|
|
|
551
557
|
lastTotal,
|
|
552
558
|
tokenUsageBaselines,
|
|
553
559
|
lastModel,
|
|
560
|
+
lastServiceTier,
|
|
554
561
|
modelAttributionState,
|
|
555
562
|
projectState,
|
|
556
563
|
projectMetaCache,
|
|
@@ -566,6 +573,7 @@ async function parseRolloutIncremental({
|
|
|
566
573
|
lastTotal,
|
|
567
574
|
tokenUsageBaselines,
|
|
568
575
|
lastModel,
|
|
576
|
+
lastServiceTier,
|
|
569
577
|
modelAttributionState,
|
|
570
578
|
hourlyState,
|
|
571
579
|
touchedBuckets,
|
|
@@ -589,6 +597,7 @@ async function parseRolloutIncremental({
|
|
|
589
597
|
lastTotal: result.lastTotal,
|
|
590
598
|
tokenUsageBaselines: result.tokenUsageBaselines,
|
|
591
599
|
lastModel: result.lastModel,
|
|
600
|
+
lastServiceTier: result.lastServiceTier || null,
|
|
592
601
|
modelAttributionState: result.modelAttributionState,
|
|
593
602
|
updatedAt: new Date().toISOString(),
|
|
594
603
|
};
|
|
@@ -2060,6 +2069,7 @@ async function parseRolloutFile({
|
|
|
2060
2069
|
lastTotal,
|
|
2061
2070
|
tokenUsageBaselines,
|
|
2062
2071
|
lastModel,
|
|
2072
|
+
lastServiceTier,
|
|
2063
2073
|
modelAttributionState: previousModelAttributionState,
|
|
2064
2074
|
hourlyState,
|
|
2065
2075
|
touchedBuckets,
|
|
@@ -2086,6 +2096,7 @@ async function parseRolloutFile({
|
|
|
2086
2096
|
lastTotal,
|
|
2087
2097
|
tokenUsageBaselines,
|
|
2088
2098
|
lastModel,
|
|
2099
|
+
lastServiceTier: typeof lastServiceTier === "string" ? lastServiceTier : null,
|
|
2089
2100
|
modelAttributionState: previousModelAttributionState,
|
|
2090
2101
|
eventsAggregated: 0,
|
|
2091
2102
|
projectFileContexts,
|
|
@@ -2098,6 +2109,12 @@ async function parseRolloutFile({
|
|
|
2098
2109
|
});
|
|
2099
2110
|
|
|
2100
2111
|
let model = typeof lastModel === "string" ? lastModel : null;
|
|
2112
|
+
// Codex writes thread_settings_applied before the turn_context of the turn it
|
|
2113
|
+
// takes effect on, and token_count rows carry no turn id, so a row's tier is
|
|
2114
|
+
// whatever the last such record said. A session's first turn has none, and
|
|
2115
|
+
// most CLI sessions have none at all — that stays null, and null is billed at
|
|
2116
|
+
// Standard rather than guessed from the current config.
|
|
2117
|
+
let serviceTier = typeof lastServiceTier === "string" ? lastServiceTier : null;
|
|
2101
2118
|
const modelAttributionState = createCodexModelAttributionState(
|
|
2102
2119
|
previousModelAttributionState || { model },
|
|
2103
2120
|
);
|
|
@@ -2148,7 +2165,10 @@ async function parseRolloutFile({
|
|
|
2148
2165
|
line.includes('"cwd"') ||
|
|
2149
2166
|
line.includes('"current_date"') ||
|
|
2150
2167
|
line.includes('"forked_from_id"'));
|
|
2151
|
-
|
|
2168
|
+
const maybeServiceTier =
|
|
2169
|
+
!maybeTokenCount && !maybeModelReroute && !maybeTurnContext &&
|
|
2170
|
+
line.includes(CODEX_SERVICE_TIER_MARKER);
|
|
2171
|
+
if (!maybeTokenCount && !maybeTurnContext && !maybeModelReroute && !maybeServiceTier) {
|
|
2152
2172
|
if (invalidRecordPolicy === "throw" || !record.terminated) {
|
|
2153
2173
|
try {
|
|
2154
2174
|
JSON.parse(line);
|
|
@@ -2174,6 +2194,12 @@ async function parseRolloutFile({
|
|
|
2174
2194
|
applyCodexModelEvent(modelAttributionState, obj);
|
|
2175
2195
|
model = currentCodexModel(modelAttributionState) || model;
|
|
2176
2196
|
|
|
2197
|
+
const appliedServiceTier = readCodexServiceTier(obj);
|
|
2198
|
+
if (appliedServiceTier) {
|
|
2199
|
+
serviceTier = appliedServiceTier;
|
|
2200
|
+
continue;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2177
2203
|
if (
|
|
2178
2204
|
(obj?.type === "turn_context" || obj?.type === "session_meta") &&
|
|
2179
2205
|
obj?.payload &&
|
|
@@ -2301,6 +2327,9 @@ async function parseRolloutFile({
|
|
|
2301
2327
|
|
|
2302
2328
|
const bucket = getHourlyBucket(hourlyState, source, model, bucketStart);
|
|
2303
2329
|
addTotals(bucket.totals, delta);
|
|
2330
|
+
// Only the model bucket gets the subset: the project bucket below carries
|
|
2331
|
+
// no model, so no per-model rate can be applied to it anyway.
|
|
2332
|
+
if (isPriorityServiceTier(serviceTier)) addPriorityUsage(bucket.totals, delta);
|
|
2304
2333
|
touchedBuckets.add(bucketKey(source, model, bucketStart));
|
|
2305
2334
|
if (currentProjectKey && projectState && projectTouchedBuckets) {
|
|
2306
2335
|
const projectBucket = getProjectBucket(
|
|
@@ -2321,6 +2350,7 @@ async function parseRolloutFile({
|
|
|
2321
2350
|
lastTotal: latestTotal,
|
|
2322
2351
|
tokenUsageBaselines: snapshotUsageBaselines(usageDeltaState),
|
|
2323
2352
|
lastModel: model,
|
|
2353
|
+
lastServiceTier: serviceTier,
|
|
2324
2354
|
modelAttributionState: snapshotCodexModelAttributionState(modelAttributionState),
|
|
2325
2355
|
eventsAggregated,
|
|
2326
2356
|
projectFileContexts,
|
|
@@ -2333,6 +2363,7 @@ async function scanRolloutProjectFileContexts({
|
|
|
2333
2363
|
lastTotal,
|
|
2334
2364
|
tokenUsageBaselines,
|
|
2335
2365
|
lastModel,
|
|
2366
|
+
lastServiceTier,
|
|
2336
2367
|
modelAttributionState,
|
|
2337
2368
|
projectState,
|
|
2338
2369
|
projectMetaCache,
|
|
@@ -2351,6 +2382,7 @@ async function scanRolloutProjectFileContexts({
|
|
|
2351
2382
|
lastTotal,
|
|
2352
2383
|
tokenUsageBaselines,
|
|
2353
2384
|
lastModel,
|
|
2385
|
+
lastServiceTier: lastServiceTier || null,
|
|
2354
2386
|
modelAttributionState,
|
|
2355
2387
|
eventsAggregated: 0,
|
|
2356
2388
|
projectFileContexts,
|
|
@@ -2428,6 +2460,7 @@ async function scanRolloutProjectFileContexts({
|
|
|
2428
2460
|
lastTotal,
|
|
2429
2461
|
tokenUsageBaselines,
|
|
2430
2462
|
lastModel,
|
|
2463
|
+
lastServiceTier: lastServiceTier || null,
|
|
2431
2464
|
modelAttributionState,
|
|
2432
2465
|
eventsAggregated: 0,
|
|
2433
2466
|
projectFileContexts,
|
|
@@ -3003,6 +3036,7 @@ async function enqueueTouchedBuckets({ queuePath, hourlyState, touchedBuckets })
|
|
|
3003
3036
|
billable_total_tokens: totals.billable_total_tokens ?? totals.total_tokens,
|
|
3004
3037
|
total_cost_usd: totals.total_cost_usd || 0,
|
|
3005
3038
|
usage_precision: usagePrecision || undefined,
|
|
3039
|
+
...prioritySubsetOf(totals),
|
|
3006
3040
|
conversation_count: totals.conversation_count,
|
|
3007
3041
|
}),
|
|
3008
3042
|
);
|
|
@@ -3083,6 +3117,7 @@ async function enqueueTouchedBuckets({ queuePath, hourlyState, touchedBuckets })
|
|
|
3083
3117
|
billable_total_tokens: unknownBucket.totals.billable_total_tokens ?? unknownBucket.totals.total_tokens,
|
|
3084
3118
|
total_cost_usd: unknownBucket.totals.total_cost_usd || 0,
|
|
3085
3119
|
usage_precision: usagePrecision || undefined,
|
|
3120
|
+
...prioritySubsetOf(unknownBucket.totals),
|
|
3086
3121
|
conversation_count: unknownBucket.totals.conversation_count,
|
|
3087
3122
|
}),
|
|
3088
3123
|
);
|
|
@@ -3131,6 +3166,7 @@ async function enqueueTouchedBuckets({ queuePath, hourlyState, touchedBuckets })
|
|
|
3131
3166
|
total_tokens: group.totals.total_tokens,
|
|
3132
3167
|
billable_total_tokens: group.totals.billable_total_tokens ?? group.totals.total_tokens,
|
|
3133
3168
|
total_cost_usd: group.totals.total_cost_usd || 0,
|
|
3169
|
+
...prioritySubsetOf(group.totals),
|
|
3134
3170
|
conversation_count: group.totals.conversation_count,
|
|
3135
3171
|
}),
|
|
3136
3172
|
);
|
|
@@ -3716,7 +3752,43 @@ function initTotals() {
|
|
|
3716
3752
|
};
|
|
3717
3753
|
}
|
|
3718
3754
|
|
|
3755
|
+
// Observed-subset markers, same shape as the session sidecar's
|
|
3756
|
+
// long_context_* columns: "how much of the columns above came from requests on
|
|
3757
|
+
// the priority (Astra Fast) service tier". They annotate the existing columns
|
|
3758
|
+
// and are NEVER part of any sum — total_tokens stays
|
|
3759
|
+
// input + output + cache_creation + cache_read + reasoning_output. They are
|
|
3760
|
+
// omitted entirely when zero so no other provider's queue rows change.
|
|
3761
|
+
const PRIORITY_SUBSET_FIELDS = [
|
|
3762
|
+
["priority_input_tokens", "input_tokens"],
|
|
3763
|
+
["priority_cached_input_tokens", "cached_input_tokens"],
|
|
3764
|
+
["priority_cache_creation_input_tokens", "cache_creation_input_tokens"],
|
|
3765
|
+
["priority_output_tokens", "output_tokens"],
|
|
3766
|
+
["priority_reasoning_output_tokens", "reasoning_output_tokens"],
|
|
3767
|
+
];
|
|
3768
|
+
|
|
3769
|
+
// The whole delta belongs to a priority request, so every base column it
|
|
3770
|
+
// carries is priority usage.
|
|
3771
|
+
function addPriorityUsage(target, delta) {
|
|
3772
|
+
for (const [field, base] of PRIORITY_SUBSET_FIELDS) {
|
|
3773
|
+
const value = Number(delta?.[base] || 0);
|
|
3774
|
+
if (value > 0) target[field] = (Number(target[field]) || 0) + value;
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
function prioritySubsetOf(totals) {
|
|
3779
|
+
const subset = {};
|
|
3780
|
+
for (const [field] of PRIORITY_SUBSET_FIELDS) {
|
|
3781
|
+
const value = Number(totals?.[field]) || 0;
|
|
3782
|
+
if (value > 0) subset[field] = value;
|
|
3783
|
+
}
|
|
3784
|
+
return subset;
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3719
3787
|
function addTotals(target, delta) {
|
|
3788
|
+
for (const [field] of PRIORITY_SUBSET_FIELDS) {
|
|
3789
|
+
const value = Number(delta?.[field]) || 0;
|
|
3790
|
+
if (value > 0) target[field] = (Number(target[field]) || 0) + value;
|
|
3791
|
+
}
|
|
3720
3792
|
target.input_tokens += delta.input_tokens || 0;
|
|
3721
3793
|
target.cached_input_tokens += delta.cached_input_tokens || 0;
|
|
3722
3794
|
target.cache_creation_input_tokens += delta.cache_creation_input_tokens || 0;
|
|
@@ -3731,6 +3803,11 @@ function addTotals(target, delta) {
|
|
|
3731
3803
|
}
|
|
3732
3804
|
|
|
3733
3805
|
function subtractTotals(target, totals) {
|
|
3806
|
+
for (const [field] of PRIORITY_SUBSET_FIELDS) {
|
|
3807
|
+
const current = Number(target[field]) || 0;
|
|
3808
|
+
if (current <= 0) continue;
|
|
3809
|
+
target[field] = Math.max(0, current - (Number(totals?.[field]) || 0));
|
|
3810
|
+
}
|
|
3734
3811
|
target.input_tokens = Math.max(0, target.input_tokens - (totals.input_tokens || 0));
|
|
3735
3812
|
target.cached_input_tokens = Math.max(
|
|
3736
3813
|
0,
|
|
@@ -3764,7 +3841,7 @@ function subtractTotals(target, totals) {
|
|
|
3764
3841
|
}
|
|
3765
3842
|
|
|
3766
3843
|
function totalsKey(totals) {
|
|
3767
|
-
|
|
3844
|
+
const base = [
|
|
3768
3845
|
totals.input_tokens || 0,
|
|
3769
3846
|
totals.cached_input_tokens || 0,
|
|
3770
3847
|
totals.cache_creation_input_tokens || 0,
|
|
@@ -3775,6 +3852,10 @@ function totalsKey(totals) {
|
|
|
3775
3852
|
totals.total_cost_usd || 0,
|
|
3776
3853
|
totals.conversation_count || 0,
|
|
3777
3854
|
].join("|");
|
|
3855
|
+
// Appended only when a priority subset exists, so buckets that never see the
|
|
3856
|
+
// tier keep their previously persisted queuedKey and are not re-enqueued.
|
|
3857
|
+
const priority = PRIORITY_SUBSET_FIELDS.map(([field]) => Number(totals[field]) || 0);
|
|
3858
|
+
return priority.some((value) => value > 0) ? `${base}|p:${priority.join(",")}` : base;
|
|
3778
3859
|
}
|
|
3779
3860
|
|
|
3780
3861
|
function toUtcHalfHourStart(ts) {
|
|
@@ -131,9 +131,20 @@ const MODEL_USAGE_SUM_FIELDS = [
|
|
|
131
131
|
"long_context_cache_creation_input_tokens",
|
|
132
132
|
"long_context_output_tokens",
|
|
133
133
|
"long_context_reasoning_output_tokens",
|
|
134
|
+
"priority_input_tokens",
|
|
135
|
+
"priority_cached_input_tokens",
|
|
136
|
+
"priority_cache_creation_input_tokens",
|
|
137
|
+
"priority_output_tokens",
|
|
138
|
+
"priority_reasoning_output_tokens",
|
|
139
|
+
"priority_long_context_input_tokens",
|
|
140
|
+
"priority_long_context_cached_input_tokens",
|
|
141
|
+
"priority_long_context_cache_creation_input_tokens",
|
|
142
|
+
"priority_long_context_output_tokens",
|
|
143
|
+
"priority_long_context_reasoning_output_tokens",
|
|
134
144
|
"usage_events",
|
|
135
145
|
"rerouted_usage_events",
|
|
136
146
|
"long_context_usage_events",
|
|
147
|
+
"priority_usage_events",
|
|
137
148
|
// Not a token counter: an edit turn is a turn, and turn_context both marks
|
|
138
149
|
// where a turn begins and names its model, so an edit turn has exactly one
|
|
139
150
|
// owner. Splitting it here keeps by_model.tokens_per_edit a ratio over one
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,v as a}from"./__vite-browser-external-Cp7dNuCm.js";import{u as p}from"./DialogTitle-CgkUGAag.js";import{u as c}from"./composite-zF5Pj94e.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,i=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o}from"./__vite-browser-external-Cp7dNuCm.js";import{h as r,i as t,p as s}from"./react-CYS24KmX.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};
|