tokentracker-cli 0.10.0 → 0.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokentracker-cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Token usage tracker for AI agent CLIs (Claude Code, Codex, Cursor, Gemini, Kiro, OpenCode, OpenClaw, Every Code, Hermes, GitHub Copilot, Kimi Code, CodeBuddy, oh-my-pi, pi, Craft Agents)",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -67,7 +67,11 @@ const CURSOR_UNKNOWN_MIGRATION_KEY = "cursorUnknownPurge_2026_04";
67
67
  const ROLLOUT_CUMULATIVE_DELTA_MIGRATION_KEY = "rolloutCumulativeDeltaReparse_2026_05";
68
68
  const CLAUDE_MEM_OBSERVER_REINCLUDE_KEY = "claudeMemObserverReinclude_2026_05_v3";
69
69
  const CLAUDE_MEM_OBSERVER_PATH_SEGMENT = "--claude-mem-observer-sessions";
70
- const CLAUDE_GROUND_TRUTH_REPAIR_KEY = "claudeGroundTruthRepair_2026_05_v1";
70
+ // v1 had a cursor-format bug (wrote plain integer instead of {inode, offset,
71
+ // updatedAt}), which made parseClaudeIncremental reread every jsonl from
72
+ // byte 0 on the next sync and double everything. v2 fixes the format and
73
+ // re-runs the repair regardless of whether v1 already applied.
74
+ const CLAUDE_GROUND_TRUTH_REPAIR_KEY = "claudeGroundTruthRepair_2026_05_v2";
71
75
 
72
76
  async function cmdSync(argv) {
73
77
  const opts = parseArgs(argv);
@@ -1320,17 +1324,27 @@ async function repairClaudeQueueFromGroundTruth({ cursors, queuePath, queueState
1320
1324
  }
1321
1325
 
1322
1326
  // 3. Reset per-file cursors so future incremental sync only reads genuinely
1323
- // new tail content.
1327
+ // new tail content. Format must match what rollout.js expects:
1328
+ // { inode, offset, updatedAt }. Setting a plain integer here breaks
1329
+ // the inode-equality check inside parseClaudeFile, which would treat
1330
+ // the file as untracked and re-read it from byte 0 — silently doubling
1331
+ // everything. (That was the actual cause of the regression after the
1332
+ // first repair attempt.)
1324
1333
  cursors.files ||= {};
1325
1334
  let filesReset = 0;
1335
+ const nowIso = new Date().toISOString();
1326
1336
  for (const fp of fileList) {
1327
- let size = 0;
1337
+ let st;
1328
1338
  try {
1329
- size = fssync.statSync(fp).size;
1339
+ st = fssync.statSync(fp);
1330
1340
  } catch (_e) {
1331
1341
  continue;
1332
1342
  }
1333
- cursors.files[fp] = size;
1343
+ cursors.files[fp] = {
1344
+ inode: st.ino || 0,
1345
+ offset: st.size,
1346
+ updatedAt: nowIso,
1347
+ };
1334
1348
  filesReset += 1;
1335
1349
  }
1336
1350
  cursors.claudeHashes = seenHashes;