tokentracker-cli 0.18.0 → 0.19.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/README.md +3 -2
- package/README.zh-CN.md +2 -1
- package/dashboard/dist/assets/{Card-DaQruAEZ.js → Card-ANC9ZmIT.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-B1ZCjfgB.js → DashboardPage-DpZaCksZ.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-BYn5mp_C.js → FadeIn-WXGyOn0H.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DnKHfm5F.js → HeaderGithubStar-DUkE0Dwd.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-BtYkItYr.js → IpCheckPage-BPF8eGpg.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-C4Ukq_ho.js → LandingPage-0uTpqpAU.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-yWE-j66g.js → LeaderboardPage-DzxRJEzb.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-C3UVE-YJ.js → LeaderboardProfilePage-C3_oUxhG.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-DH2yQZwk.js → LimitsPage-BVuvoeY9.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-BbEBnz58.js → LoginPage-CfkNRmT6.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-B6sNFXGZ.js → PopoverPopup-CfxiYbJm.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-CDVWc_TN.js → ProviderIcon-DiPzAed2.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-CJ2KJuU5.js → SettingsPage-Devu7beE.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-BQHojjxy.js → SkillsPage-CSe8fW4V.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DuUOC5LD.js → WidgetsPage-BrLp5YLk.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-CkMLZDuK.js → chevron-down-nFF6Yj_r.js} +1 -1
- package/dashboard/dist/assets/{download-BjbAqWCN.js → download-DhSZ--68.js} +1 -1
- package/dashboard/dist/assets/{leaderboard-columns-m4UzCZhg.js → leaderboard-columns-CvFdXrw5.js} +1 -1
- package/dashboard/dist/assets/{main-Dgiw16jZ.js → main-DtrPNYb7.js} +5 -3
- package/dashboard/dist/assets/{use-limits-display-prefs-DvnaGeUj.js → use-limits-display-prefs-Yy8t7tbB.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-BPjPcvON.js → use-native-settings-uemf9RSH.js} +1 -1
- package/dashboard/dist/assets/{use-reduced-motion-D1akEyuH.js → use-reduced-motion-DH8DxE18.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-BmK4zEAz.js → use-usage-limits-C3vUT6PH.js} +1 -1
- package/dashboard/dist/brand-logos/codebuddy.svg +1 -0
- package/dashboard/dist/brand-logos/every-code.svg +1 -0
- package/dashboard/dist/brand-logos/grok.svg +1 -0
- package/dashboard/dist/brand-logos/hermes.svg +1 -11
- package/dashboard/dist/brand-logos/kilo-code.svg +1 -0
- package/dashboard/dist/brand-logos/oh-my-pi.svg +1 -0
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/serve.js +5 -1
- package/src/lib/local-api.js +84 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +35 -8
package/src/lib/rollout.js
CHANGED
|
@@ -6229,6 +6229,7 @@ async function parseAntigravityIncremental({
|
|
|
6229
6229
|
const sameFile = prev && prev.inode === inode;
|
|
6230
6230
|
const lastLine = sameFile ? Number(prev.lastLine || 0) : 0;
|
|
6231
6231
|
const initialContextTokens = sameFile ? Number(prev.contextTokens || 0) : 0;
|
|
6232
|
+
const initialPrevContext = sameFile ? Number(prev.previousContextTokens || 0) : 0;
|
|
6232
6233
|
const initialModel = sameFile && typeof prev.currentModel === "string" ? prev.currentModel : null;
|
|
6233
6234
|
|
|
6234
6235
|
const projectContext = projectEnabled
|
|
@@ -6247,6 +6248,7 @@ async function parseAntigravityIncremental({
|
|
|
6247
6248
|
filePath,
|
|
6248
6249
|
lastLine,
|
|
6249
6250
|
initialContextTokens,
|
|
6251
|
+
initialPrevContext,
|
|
6250
6252
|
initialModel,
|
|
6251
6253
|
hourlyState,
|
|
6252
6254
|
touchedBuckets,
|
|
@@ -6263,6 +6265,7 @@ async function parseAntigravityIncremental({
|
|
|
6263
6265
|
mtimeMs,
|
|
6264
6266
|
lastLine: result.lastLine,
|
|
6265
6267
|
contextTokens: result.contextTokens,
|
|
6268
|
+
previousContextTokens: result.previousContextTokens,
|
|
6266
6269
|
currentModel: result.currentModel,
|
|
6267
6270
|
updatedAt: new Date().toISOString(),
|
|
6268
6271
|
};
|
|
@@ -6300,6 +6303,7 @@ async function parseAntigravityFile({
|
|
|
6300
6303
|
filePath,
|
|
6301
6304
|
lastLine,
|
|
6302
6305
|
initialContextTokens,
|
|
6306
|
+
initialPrevContext,
|
|
6303
6307
|
initialModel,
|
|
6304
6308
|
hourlyState,
|
|
6305
6309
|
touchedBuckets,
|
|
@@ -6311,7 +6315,13 @@ async function parseAntigravityFile({
|
|
|
6311
6315
|
}) {
|
|
6312
6316
|
const raw = await fs.readFile(filePath, "utf8").catch(() => "");
|
|
6313
6317
|
if (!raw.trim()) {
|
|
6314
|
-
return {
|
|
6318
|
+
return {
|
|
6319
|
+
lastLine: 0,
|
|
6320
|
+
eventsAggregated: 0,
|
|
6321
|
+
contextTokens: 0,
|
|
6322
|
+
previousContextTokens: 0,
|
|
6323
|
+
currentModel: null,
|
|
6324
|
+
};
|
|
6315
6325
|
}
|
|
6316
6326
|
|
|
6317
6327
|
const lines = raw
|
|
@@ -6325,11 +6335,16 @@ async function parseAntigravityFile({
|
|
|
6325
6335
|
const canResume =
|
|
6326
6336
|
Number.isFinite(lastLine) && lastLine > 0 && lastLine <= lines.length;
|
|
6327
6337
|
const cachedTokens = Number.isFinite(initialContextTokens) ? initialContextTokens : 0;
|
|
6338
|
+
const cachedPrev = Number.isFinite(initialPrevContext) ? initialPrevContext : 0;
|
|
6328
6339
|
const cachedModel = typeof initialModel === "string" ? initialModel : null;
|
|
6329
6340
|
const resumed = canResume && (cachedTokens > 0 || cachedModel !== null);
|
|
6330
6341
|
const scanStart = resumed ? lastLine : 0;
|
|
6331
6342
|
let currentModel = resumed ? cachedModel : null;
|
|
6332
6343
|
let contextTokens = resumed ? cachedTokens : 0;
|
|
6344
|
+
// Snapshot of contextTokens at the last PLANNER_RESPONSE we billed for. Only
|
|
6345
|
+
// tokens accumulated AFTER that point count as new input on the next planner
|
|
6346
|
+
// call — prevents O(N²) double-counting of the full history every turn.
|
|
6347
|
+
let previousContextTokens = resumed ? cachedPrev : 0;
|
|
6333
6348
|
let lastCompletedLine = Math.min(Number.isFinite(lastLine) ? lastLine : 0, lines.length);
|
|
6334
6349
|
|
|
6335
6350
|
for (let i = scanStart; i < lines.length; i++) {
|
|
@@ -6375,22 +6390,28 @@ async function parseAntigravityFile({
|
|
|
6375
6390
|
|
|
6376
6391
|
let model = currentModel || "antigravity-unknown";
|
|
6377
6392
|
let delta = initTotals();
|
|
6393
|
+
let billedPlanner = false;
|
|
6378
6394
|
|
|
6379
6395
|
if (parsed.type === "PLANNER_RESPONSE") {
|
|
6380
6396
|
const content = typeof parsed.content === "string" ? parsed.content : "";
|
|
6381
6397
|
const thinking = typeof parsed.thinking === "string" ? parsed.thinking : "";
|
|
6382
6398
|
|
|
6383
|
-
|
|
6384
|
-
|
|
6399
|
+
const inputDelta = Math.max(0, contextTokens - previousContextTokens);
|
|
6400
|
+
const outputTokens =
|
|
6385
6401
|
antigravityValueTokens(content) + antigravityValueTokens(parsed.tool_calls);
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
delta.
|
|
6402
|
+
const reasoningTokens = antigravityValueTokens(thinking);
|
|
6403
|
+
|
|
6404
|
+
delta.input_tokens = inputDelta;
|
|
6405
|
+
delta.output_tokens = outputTokens;
|
|
6406
|
+
delta.reasoning_output_tokens = reasoningTokens;
|
|
6407
|
+
// Match the mainstream convention (Codebuddy / Kilocode / OMP / Hermes):
|
|
6408
|
+
// total_tokens = sum of every token column. No cache columns here.
|
|
6409
|
+
delta.total_tokens = inputDelta + outputTokens + reasoningTokens;
|
|
6390
6410
|
delta.conversation_count = 1;
|
|
6411
|
+
billedPlanner = delta.total_tokens > 0;
|
|
6391
6412
|
}
|
|
6392
6413
|
|
|
6393
|
-
if (
|
|
6414
|
+
if (!billedPlanner) {
|
|
6394
6415
|
contextTokens += eventContextTokens;
|
|
6395
6416
|
lastCompletedLine = i + 1;
|
|
6396
6417
|
continue;
|
|
@@ -6412,6 +6433,11 @@ async function parseAntigravityFile({
|
|
|
6412
6433
|
projectTouchedBuckets.add(projectBucketKey(projectKey, source, bucketStart));
|
|
6413
6434
|
}
|
|
6414
6435
|
eventsAggregated += 1;
|
|
6436
|
+
// Snapshot the pre-planner context first. The planner's own content+tool_calls
|
|
6437
|
+
// (eventContextTokens, added below) become part of the next turn's history,
|
|
6438
|
+
// so they MUST be billed as input on the next planner — don't fold them into
|
|
6439
|
+
// previousContextTokens or that history vanishes from the totals.
|
|
6440
|
+
previousContextTokens = contextTokens;
|
|
6415
6441
|
contextTokens += eventContextTokens;
|
|
6416
6442
|
lastCompletedLine = i + 1;
|
|
6417
6443
|
}
|
|
@@ -6420,6 +6446,7 @@ async function parseAntigravityFile({
|
|
|
6420
6446
|
lastLine: lastCompletedLine,
|
|
6421
6447
|
eventsAggregated,
|
|
6422
6448
|
contextTokens,
|
|
6449
|
+
previousContextTokens,
|
|
6423
6450
|
currentModel,
|
|
6424
6451
|
};
|
|
6425
6452
|
}
|