tokentracker-cli 0.57.0 → 0.57.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.
Files changed (44) hide show
  1. package/README.ja.md +5 -3
  2. package/README.ko.md +5 -3
  3. package/README.md +5 -3
  4. package/README.zh-CN.md +5 -3
  5. package/dashboard/dist/assets/{ActivityHeatmap-BzYFi7If.js → ActivityHeatmap-BvbV3_J7.js} +1 -1
  6. package/dashboard/dist/assets/{Card-CWlC0TT9.js → Card-DJZ6ntik.js} +1 -1
  7. package/dashboard/dist/assets/{DashboardPage-CI6QAWEh.js → DashboardPage-Bu3v5Fm2.js} +1 -1
  8. package/dashboard/dist/assets/{DevicePage-CkLOUytF.js → DevicePage-DW6XIKeU.js} +1 -1
  9. package/dashboard/dist/assets/{DialogTitle-qpnoyCDp.js → DialogTitle-BsrlMQVP.js} +1 -1
  10. package/dashboard/dist/assets/{FadeIn-rEScv_td.js → FadeIn-XjqQkcHf.js} +1 -1
  11. package/dashboard/dist/assets/{HeaderGithubStar-DNOf-bAX.js → HeaderGithubStar-DcwDZDfU.js} +1 -1
  12. package/dashboard/dist/assets/{IpCheckPage-DwsvZICX.js → IpCheckPage-DwWHgam0.js} +1 -1
  13. package/dashboard/dist/assets/{LandingPage-BzQCcu83.js → LandingPage-BqtWjGwE.js} +1 -1
  14. package/dashboard/dist/assets/{LeaderboardAvatar-BnXyZa5v.js → LeaderboardAvatar-BeBtwC-_.js} +1 -1
  15. package/dashboard/dist/assets/{LeaderboardPage-W9W6St_R.js → LeaderboardPage-0TwqZOxu.js} +3 -3
  16. package/dashboard/dist/assets/{LeaderboardProfileModal-udtOlLe2.js → LeaderboardProfileModal-3HwkYdbM.js} +1 -1
  17. package/dashboard/dist/assets/{LeaderboardProfilePage-gSEw4uv8.js → LeaderboardProfilePage-865y5FBU.js} +1 -1
  18. package/dashboard/dist/assets/{LimitsPage-Cw4N6JeE.js → LimitsPage-CfGYwdDz.js} +1 -1
  19. package/dashboard/dist/assets/{LocalOnlyNotice-BZlvc0vN.js → LocalOnlyNotice-CTKip6yZ.js} +1 -1
  20. package/dashboard/dist/assets/{LoginPage-B565FVDA.js → LoginPage-DhfoXUgm.js} +1 -1
  21. package/dashboard/dist/assets/{PopoverPopup-BamnkoKk.js → PopoverPopup-3YotW-4M.js} +1 -1
  22. package/dashboard/dist/assets/{ResetPasswordPage-C0-ziJ-w.js → ResetPasswordPage-CqEEo2VL.js} +1 -1
  23. package/dashboard/dist/assets/{Select-DT22H5j7.js → Select-BjnA__CB.js} +1 -1
  24. package/dashboard/dist/assets/{SelectItemText-B6Wn709O.js → SelectItemText-CoQ0e4TL.js} +1 -1
  25. package/dashboard/dist/assets/{SettingsPage-Dal75OgQ.js → SettingsPage-ushnnb65.js} +1 -1
  26. package/dashboard/dist/assets/{SkillsPage-HoRP1WBr.js → SkillsPage-CW4mBNzt.js} +1 -1
  27. package/dashboard/dist/assets/{WidgetsPage-e-mw3Vkq.js → WidgetsPage-BiwEsW3y.js} +1 -1
  28. package/dashboard/dist/assets/{WrappedPage-BBFbsssQ.js → WrappedPage-vu2gEGcG.js} +1 -1
  29. package/dashboard/dist/assets/{agent-logos-q4KY3SrS.js → agent-logos-CvsRxSzl.js} +1 -1
  30. package/dashboard/dist/assets/{arrow-up-right-BF3pw1i_.js → arrow-up-right-DwYMKA3i.js} +1 -1
  31. package/dashboard/dist/assets/{download-8G10BzKF.js → download-BpLBXlyg.js} +1 -1
  32. package/dashboard/dist/assets/{info-D62z4eaa.js → info-D7gs3LAC.js} +1 -1
  33. package/dashboard/dist/assets/{main-BqomqDjC.js → main-D2iJg7iA.js} +2 -2
  34. package/dashboard/dist/assets/{use-limits-display-prefs-C0ttQ7qt.js → use-limits-display-prefs-BDCL1zsb.js} +1 -1
  35. package/dashboard/dist/assets/{use-native-settings-DJPC20Xw.js → use-native-settings-C-JvsUqt.js} +1 -1
  36. package/dashboard/dist/assets/{use-usage-limits-Ccr9ZCYy.js → use-usage-limits-DfKKdPYm.js} +1 -1
  37. package/dashboard/dist/assets/{useCurrency-DwQhSqB1.js → useCurrency-CAzf_Pmi.js} +1 -1
  38. package/dashboard/dist/assets/{useScrollLock-DZ9md-qB.js → useScrollLock-DNuJyLo9.js} +1 -1
  39. package/dashboard/dist/index.html +1 -1
  40. package/dashboard/dist/share.html +1 -1
  41. package/package.json +1 -1
  42. package/src/commands/sync.js +159 -4
  43. package/src/lib/pricing/seed-snapshot.json +1 -1
  44. package/src/lib/rollout.js +24 -55
@@ -2520,65 +2520,34 @@ function readOpencodeDbMessages(dbPath, sqliteOptions = {}) {
2520
2520
  return out;
2521
2521
  }
2522
2522
 
2523
- // Mimo (mimocode) reuses OpenCode's `message` table schema, but its DB ALSO
2524
- // contains the user's imported Claude Code history: on install, mimocode reads
2525
- // ~/.claude/projects/*.jsonl and copies those sessions into its own DB,
2526
- // recording each in the `claude_import` table (source_path session_id +
2527
- // message_ids). Those imported messages are already counted by the Claude
2528
- // parser, so counting them here would double-count Claude usage AND mislabel it
2529
- // as "mimo".
2523
+ // mimocode mirrors the user's Claude Code + claude-mem history into its own
2524
+ // `message` table via an explicit `claude_import` AND a live observer /
2525
+ // session sync so the overwhelming majority of rows are anthropic-endpoint
2526
+ // turns (providerID="anthropic") the Claude parser ALREADY counts as
2527
+ // source=claude. On the dev's box that's ~3.9B mirrored tokens vs ~22M genuine
2528
+ // mimo tokens. Counting the mirror under "mimo" double-counts and mislabels
2529
+ // Claude usage (user saw claude-* rows under the MIMO provider).
2530
2530
  //
2531
- // `message_ids` was added to claude_import via a migration, so rows written by
2532
- // an older mimocode have it NULL. For those we fall back to excluding the whole
2533
- // imported session by session_id a claude_import.session_id is always an
2534
- // import-created session, never a native mimo one, so this is safe. Rows that
2535
- // DO carry message_ids use precise per-id exclusion, which preserves any native
2536
- // turns the user later added to an imported session.
2537
- function readMimoImportedKeys(dbPath, sqliteOptions = {}) {
2538
- const sql = `SELECT session_id, message_ids FROM claude_import`;
2539
- let rows;
2540
- try {
2541
- rows = readSqliteJsonRows(dbPath, sql, {
2542
- label: "Mimo import",
2543
- maxBuffer: 200 * 1024 * 1024,
2544
- timeout: 30_000,
2545
- ...sqliteOptions,
2546
- });
2547
- } catch (_e) {
2548
- // claude_import table absent (older/newer mimocode) → treat as no imports.
2549
- return { ids: new Set(), sessions: new Set() };
2550
- }
2551
- const ids = new Set();
2552
- const sessions = new Set();
2553
- for (const row of rows) {
2554
- if (!row) continue;
2555
- let arr = null;
2556
- if (typeof row.message_ids === "string") {
2557
- try {
2558
- arr = JSON.parse(row.message_ids);
2559
- } catch (_e) {
2560
- arr = null;
2561
- }
2562
- }
2563
- if (Array.isArray(arr) && arr.length > 0) {
2564
- for (const id of arr) if (typeof id === "string") ids.add(id);
2565
- } else if (typeof row.session_id === "string" && row.session_id) {
2566
- sessions.add(row.session_id);
2567
- }
2568
- }
2569
- return { ids, sessions };
2570
- }
2571
-
2572
- // Read only NATIVE mimo assistant messages — token-bearing rows that are not
2573
- // part of any claude_import row (by message id, or session id for legacy import
2574
- // rows without message_ids). See readMimoImportedKeys for why.
2531
+ // The discriminator is providerID, NOT the model id. mimo's own runtime tags
2532
+ // turns providerID="mimo" (its auto router) or "xiaomi". providerID="anthropic"
2533
+ // means the turn went through a Claude-compatible endpoint plain Claude Code,
2534
+ // OR a mimo-named model the user picked IN Claude Code (e.g. model=mimo-v2.5-pro
2535
+ // run inside Claude Code, logged in ~/.claude, counted as source=claude). Keying
2536
+ // off the model id would wrongly re-count that mimo-v2.5-pro. claude_import is
2537
+ // irrelevant it never covers the observer/session mirror; the provider rule
2538
+ // subsumes it.
2539
+ function isMimoNativeMessage(data) {
2540
+ if (!data) return false;
2541
+ const provider = String(data.providerID || "").toLowerCase();
2542
+ return provider === "mimo" || provider === "xiaomi";
2543
+ }
2544
+
2545
+ // Read only genuine mimo assistant messages (mimo's own models), dropping the
2546
+ // mirrored Claude/claude-mem rows. See isMimoNativeMessage for why.
2575
2547
  function readMimoDbMessages(dbPath, sqliteOptions = {}) {
2576
2548
  if (!dbPath || !fssync.existsSync(dbPath)) return [];
2577
2549
  const all = readOpencodeDbMessages(dbPath, sqliteOptions);
2578
- if (all.length === 0) return all;
2579
- const { ids, sessions } = readMimoImportedKeys(dbPath, sqliteOptions);
2580
- if (ids.size === 0 && sessions.size === 0) return all;
2581
- return all.filter((m) => !ids.has(m.id) && !sessions.has(m.sessionID));
2550
+ return all.filter((m) => isMimoNativeMessage(m.data));
2582
2551
  }
2583
2552
 
2584
2553
  async function parseOpencodeDbIncremental({