tokentracker-cli 0.93.3 → 0.93.5

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 (105) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dashboard/dist/assets/{AchievementBadge-Bl3bWjZw.js → AchievementBadge-td60VwNO.js} +1 -1
  4. package/dashboard/dist/assets/{AchievementsPage-B6FrDjg8.js → AchievementsPage-C3yKXgId.js} +2 -2
  5. package/dashboard/dist/assets/{AchievementsSection-D5TJtcI5.js → AchievementsSection-XM39rQkD.js} +1 -1
  6. package/dashboard/dist/assets/{BadgeDetailModal-BFlrt34z.js → BadgeDetailModal-2TgBBPmw.js} +1 -1
  7. package/dashboard/dist/assets/{BotAnimated-KONFZbQT.js → BotAnimated-CG6_x0d2.js} +1 -1
  8. package/dashboard/dist/assets/{Card-DDZHhXlQ.js → Card-BUnCudVB.js} +1 -1
  9. package/dashboard/dist/assets/{ClawdAnimated-DMw54QJ_.js → ClawdAnimated-CNRu6v7I.js} +2 -2
  10. package/dashboard/dist/assets/{CommandPalette-CxVv0uo_.js → CommandPalette-D5vVqYkW.js} +1 -1
  11. package/dashboard/dist/assets/{CommunityStatsModal-CR2MuFo3.js → CommunityStatsModal-D0V4iTI6.js} +1 -1
  12. package/dashboard/dist/assets/{ConfirmModal-B-jvLsxn.js → ConfirmModal-CzxTtnXo.js} +1 -1
  13. package/dashboard/dist/assets/{Controls-DXA3Zxx0.js → Controls-nR5gzX__.js} +1 -1
  14. package/dashboard/dist/assets/{DashboardPage-0jQPu59U.js → DashboardPage-CpHXkuZn.js} +1 -1
  15. package/dashboard/dist/assets/{DevicePage-CMR7jT8-.js → DevicePage-Emw9iVMd.js} +1 -1
  16. package/dashboard/dist/assets/{DialogClose-B1j73B1g.js → DialogClose-Bh-pvxsM.js} +1 -1
  17. package/dashboard/dist/assets/DialogDescription-DJ-RHxIt.js +1 -0
  18. package/dashboard/dist/assets/{DialogTitle-eIgptOU-.js → DialogTitle-BG3ngtew.js} +1 -1
  19. package/dashboard/dist/assets/{FadeIn-B8aisUg4.js → FadeIn-DOEfAW5p.js} +1 -1
  20. package/dashboard/dist/assets/{HeaderGithubStar-B7MEGODn.js → HeaderGithubStar-DslGxMu4.js} +1 -1
  21. package/dashboard/dist/assets/{HoverTooltip-DfBzMfW7.js → HoverTooltip-O2OKCBc3.js} +1 -1
  22. package/dashboard/dist/assets/{IpCheckPage-BBvSL0Zz.js → IpCheckPage-Dv6LbNU_.js} +1 -1
  23. package/dashboard/dist/assets/{LandingPage-CcX03ndP.js → LandingPage-BBfteqDF.js} +2 -2
  24. package/dashboard/dist/assets/{LeaderboardAvatar-Dk4UJx-j.js → LeaderboardAvatar-Ct6QagwN.js} +1 -1
  25. package/dashboard/dist/assets/{LeaderboardPage-CcIp7sjv.js → LeaderboardPage-CSbIdSm7.js} +2 -2
  26. package/dashboard/dist/assets/{LeaderboardProfileModal-DzXfmNhy.js → LeaderboardProfileModal-BuUWkmBN.js} +3 -3
  27. package/dashboard/dist/assets/{LeaderboardProfilePage-18ijOFN-.js → LeaderboardProfilePage-fVnV0Lo-.js} +1 -1
  28. package/dashboard/dist/assets/{LimitsPage-ZeRD1J97.js → LimitsPage-BHkkA3xN.js} +1 -1
  29. package/dashboard/dist/assets/{LocalOnlyNotice-DQ_wPyho.js → LocalOnlyNotice-BLlrqreb.js} +1 -1
  30. package/dashboard/dist/assets/{LoginCard-DX5-Bxhr.js → LoginCard-CKV1uACo.js} +1 -1
  31. package/dashboard/dist/assets/{LoginModal-_Rt3qUyK.js → LoginModal-RCpQtFuG.js} +1 -1
  32. package/dashboard/dist/assets/{LoginPage-CvYcDpeR.js → LoginPage-vMV2kpef.js} +1 -1
  33. package/dashboard/dist/assets/{PetPage-D0D4mRwd.js → PetPage-CTgwpnsA.js} +1 -1
  34. package/dashboard/dist/assets/{PopoverPopup-Bz3yRvv6.js → PopoverPopup-Bddr9R6x.js} +1 -1
  35. package/dashboard/dist/assets/{ProviderIcon-PauvxgNb.js → ProviderIcon-BeXu2voQ.js} +1 -1
  36. package/dashboard/dist/assets/{ResetPasswordPage-BiC1Us4d.js → ResetPasswordPage-CilGTQWZ.js} +1 -1
  37. package/dashboard/dist/assets/{SegmentedControl-bW8MsUDI.js → SegmentedControl-r5MP3Uyx.js} +1 -1
  38. package/dashboard/dist/assets/{Select-BSpIj6-K.js → Select-BBUIbPTj.js} +1 -1
  39. package/dashboard/dist/assets/{SelectItemText-taYIkVIw.js → SelectItemText-CbuN7Sui.js} +1 -1
  40. package/dashboard/dist/assets/{ServiceStatusPage-GMkqBtrt.js → ServiceStatusPage-WgmQviZa.js} +1 -1
  41. package/dashboard/dist/assets/{SessionsPage-QydYL4yt.js → SessionsPage-BDkdXQhW.js} +1 -1
  42. package/dashboard/dist/assets/{SettingsPage-BFvCcos0.js → SettingsPage-CsF8cG7I.js} +2 -2
  43. package/dashboard/dist/assets/{SkillsPage-CKci6NM2.js → SkillsPage-CVGra4ar.js} +1 -1
  44. package/dashboard/dist/assets/{TokenGalaxy-DMof07_u.js → TokenGalaxy-B0kFIG0N.js} +1 -1
  45. package/dashboard/dist/assets/{ToolbarRootContext-CAsiI0PJ.js → ToolbarRootContext-BlWkiH2k.js} +1 -1
  46. package/dashboard/dist/assets/{TrendMonitor-Dj2Uxs9x.js → TrendMonitor-C18_ADhU.js} +1 -1
  47. package/dashboard/dist/assets/{WidgetsPage-DOr-nMn1.js → WidgetsPage-Ck7L4vBj.js} +1 -1
  48. package/dashboard/dist/assets/{WrappedPage-BZUv1rX5.js → WrappedPage-Bm5HMj3a.js} +1 -1
  49. package/dashboard/dist/assets/{__vite-browser-external-WKiEWJ30.js → __vite-browser-external-BCyVFzdP.js} +15 -15
  50. package/dashboard/dist/assets/{agent-logos-1FaE1SqE.js → agent-logos-PZX7lWJo.js} +1 -1
  51. package/dashboard/dist/assets/{arrow-up-right-Bs5oicPH.js → arrow-up-right-DPSDEZPh.js} +1 -1
  52. package/dashboard/dist/assets/{check-Be2PwUMS.js → check-GGrgivnu.js} +1 -1
  53. package/dashboard/dist/assets/{chevron-right-DH93vlVo.js → chevron-right-CmSOUizu.js} +1 -1
  54. package/dashboard/dist/assets/{copy-xOLhiaQa.js → copy-ChMyV-hy.js} +1 -1
  55. package/dashboard/dist/assets/{download-qUjPQH7V.js → download-DGUkE9Jc.js} +1 -1
  56. package/dashboard/dist/assets/{external-link-D0nLaYYu.js → external-link-B_W-UDpi.js} +1 -1
  57. package/dashboard/dist/assets/{flame-DFEEnwot.js → flame-C9ccP-R8.js} +1 -1
  58. package/dashboard/dist/assets/{format-tokens-BPq1moPg.js → format-tokens-CkXJmbVP.js} +1 -1
  59. package/dashboard/dist/assets/{icons-DxM91e9c.js → icons-D37cRKGk.js} +1 -1
  60. package/dashboard/dist/assets/{index-CEl88_eC.js → index-C-_fimm3.js} +1 -1
  61. package/dashboard/dist/assets/{index-C8Sb5l3M.js → index-C9OzYqU0.js} +1 -1
  62. package/dashboard/dist/assets/{index-BEi52jGG.js → index-Dt6WIU71.js} +1 -1
  63. package/dashboard/dist/assets/{info-C43iVFmY.js → info-C3-0C2W0.js} +1 -1
  64. package/dashboard/dist/assets/{limits-providers-xNF55jgX.js → limits-providers-DB1Zr3WN.js} +1 -1
  65. package/dashboard/dist/assets/{link-2-CfarpF4W.js → link-2-DqNEbzji.js} +1 -1
  66. package/dashboard/dist/assets/{loader-circle-CIKyaEoN.js → loader-circle-BYoKm-f5.js} +1 -1
  67. package/dashboard/dist/assets/{maximize-2-DlTJ_PyX.js → maximize-2-lVQDTDqs.js} +1 -1
  68. package/dashboard/dist/assets/{modifiers.esm-CXV6l89k.js → modifiers.esm-Bww85WOd.js} +1 -1
  69. package/dashboard/dist/assets/module-D2D5r9gC.js +3 -0
  70. package/dashboard/dist/assets/{monitor-smartphone-6dCO7HCP.js → monitor-smartphone--KubNwvP.js} +1 -1
  71. package/dashboard/dist/assets/{provider-display-DNEUispM.js → provider-display-COV_Ft4A.js} +1 -1
  72. package/dashboard/dist/assets/{react-us685QUG.js → react-lNnu0y7U.js} +1 -1
  73. package/dashboard/dist/assets/{search-NcbnjXYq.js → search-CpHNMxpD.js} +1 -1
  74. package/dashboard/dist/assets/{skills-api-CFSZ441M.js → skills-api-Cf2qRQ1h.js} +1 -1
  75. package/dashboard/dist/assets/{sortable.esm-DiFLdkJ7.js → sortable.esm-DWdlF_7j.js} +1 -1
  76. package/dashboard/dist/assets/{store-B-d1Nz34.js → store-DJQqZJtg.js} +1 -1
  77. package/dashboard/dist/assets/{terminal-D3L94ngT.js → terminal-Cban5byW.js} +1 -1
  78. package/dashboard/dist/assets/{trash-2-esrIc05L.js → trash-2-nelaUHSh.js} +1 -1
  79. package/dashboard/dist/assets/{use-community-stats-C4nPlCzJ.js → use-community-stats-CBupXLW7.js} +1 -1
  80. package/dashboard/dist/assets/{use-limits-display-prefs-iXm2ziaO.js → use-limits-display-prefs-B4y_kzcd.js} +1 -1
  81. package/dashboard/dist/assets/{use-ordered-list-DU8WcVsn.js → use-ordered-list-DEV58tGc.js} +1 -1
  82. package/dashboard/dist/assets/use-reduced-motion-CRf4pBTt.js +1 -0
  83. package/dashboard/dist/assets/{use-session-efficiency-pref-CpGicS2y.js → use-session-efficiency-pref-wSk1wV6R.js} +1 -1
  84. package/dashboard/dist/assets/{use-transform-WxJRtugr.js → use-transform-NKavwYrX.js} +1 -1
  85. package/dashboard/dist/assets/{use-usage-limits-55w4KAqE.js → use-usage-limits-Blr1HBCj.js} +1 -1
  86. package/dashboard/dist/assets/{useCurrency-C6HKlFA6.js → useCurrency-B2704dMx.js} +1 -1
  87. package/dashboard/dist/assets/{useScrollLock-CZ1Na38Y.js → useScrollLock-BuPQ8T9m.js} +1 -1
  88. package/dashboard/dist/assets/{useTokenFormat-BR7kJQ6x.js → useTokenFormat-DPxAFuMj.js} +1 -1
  89. package/dashboard/dist/assets/{zap-BcwbN9j5.js → zap-BgtTdM4q.js} +1 -1
  90. package/dashboard/dist/index.html +1 -1
  91. package/dashboard/dist/ip-check.html +1 -1
  92. package/dashboard/dist/leaderboard.html +1 -1
  93. package/dashboard/dist/share.html +1 -1
  94. package/package.json +1 -1
  95. package/src/commands/serve.js +115 -4
  96. package/src/commands/status.js +3 -3
  97. package/src/commands/sync.js +146 -3
  98. package/src/lib/opencode-go-limits.js +85 -30
  99. package/src/lib/pricing/seed-snapshot.json +1 -1
  100. package/src/lib/rollout.js +372 -29
  101. package/src/lib/trae-cn-config.js +11 -2
  102. package/src/lib/usage-limits.js +119 -1
  103. package/dashboard/dist/assets/DialogDescription-ZS29ikF4.js +0 -1
  104. package/dashboard/dist/assets/module-CV1mYFsv.js +0 -3
  105. package/dashboard/dist/assets/use-reduced-motion-DDhy4yg_.js +0 -1
@@ -66,6 +66,13 @@ const CLAUDE_LIMITS_CACHE_FRESH_TTL_MS = 10 * 60 * 1000;
66
66
  // error, mirroring the Claude stale-fallback path.
67
67
  const CODEX_LIMITS_CACHE_FILE = "codex-usage-limits-cache.json";
68
68
  const CODEX_LIMITS_CACHE_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
69
+ // OpenCode Go hits opencode.ai over the public internet (15s timeout) with no local CLI to
70
+ // fall back on. A transient 5xx / timeout previously left the panel blank until the next
71
+ // 2-minute poll — persist the last successful windows so a blip serves stale bars instead
72
+ // of a flash of "fetch failed" (mirrors Claude / Codex / Antigravity).
73
+ const OPENCODE_GO_LIMITS_CACHE_FILE = "opencode-go-usage-limits-cache.json";
74
+ const OPENCODE_GO_LIMITS_CACHE_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
75
+ const OPENCODE_GO_LOCAL_ESTIMATE_CACHE_MAX_AGE_MS = 60 * 60 * 1000;
69
76
  // A 429 from the usage endpoint carries a long `retry-after` (often 20+ minutes). Persist
70
77
  // the cooldown so every surface — this process, the menu bar app's embedded server, a later
71
78
  // restart — stops calling until it expires. Hammering during the cooldown just renews the
@@ -2398,6 +2405,82 @@ function writeCodexLimitsCache(limits, { home, nowMs = Date.now() } = {}) {
2398
2405
  } catch (_error) {}
2399
2406
  }
2400
2407
 
2408
+ function resolveOpencodeGoLimitsCachePath({ home } = {}) {
2409
+ return path.join(home || os.homedir(), ".tokentracker", "tracker", OPENCODE_GO_LIMITS_CACHE_FILE);
2410
+ }
2411
+
2412
+ function hasOpencodeGoWindow(limits) {
2413
+ return Boolean(limits?.primary_window || limits?.secondary_window || limits?.tertiary_window);
2414
+ }
2415
+
2416
+ function isOpencodeGoCacheWindowUsable(window, { nowMs } = {}) {
2417
+ if (!window || typeof window !== "object") return false;
2418
+ const resetAtMs = parseTimeMs(window.reset_at);
2419
+ if (resetAtMs === null) return true;
2420
+ return resetAtMs > nowMs;
2421
+ }
2422
+
2423
+ function normalizeOpencodeGoCachedLimits(
2424
+ raw,
2425
+ { nowMs = Date.now(), maxAgeMs } = {},
2426
+ ) {
2427
+ const effectiveMaxAge = Number.isFinite(maxAgeMs)
2428
+ ? maxAgeMs
2429
+ : raw?.source === "local-estimate"
2430
+ ? OPENCODE_GO_LOCAL_ESTIMATE_CACHE_MAX_AGE_MS
2431
+ : OPENCODE_GO_LIMITS_CACHE_MAX_AGE_MS;
2432
+ const cachedAtMs = parseTimeMs(raw?.cached_at);
2433
+ if (!Number.isFinite(cachedAtMs)) return null;
2434
+ if (cachedAtMs > nowMs + 60_000) return null;
2435
+ if (nowMs - cachedAtMs > effectiveMaxAge) return null;
2436
+
2437
+ const cached = {
2438
+ configured: true,
2439
+ error: null,
2440
+ source: typeof raw?.source === "string" ? raw.source : "api",
2441
+ subscription_status: typeof raw?.subscription_status === "string" ? raw.subscription_status : null,
2442
+ plan_label: typeof raw?.plan_label === "string" ? raw.plan_label : null,
2443
+ primary_window: isOpencodeGoCacheWindowUsable(raw?.primary_window, { nowMs }) ? raw.primary_window : null,
2444
+ secondary_window: isOpencodeGoCacheWindowUsable(raw?.secondary_window, { nowMs }) ? raw.secondary_window : null,
2445
+ tertiary_window: isOpencodeGoCacheWindowUsable(raw?.tertiary_window, { nowMs }) ? raw.tertiary_window : null,
2446
+ stale: true,
2447
+ cached_at: raw.cached_at,
2448
+ };
2449
+ return hasOpencodeGoWindow(cached) ? cached : null;
2450
+ }
2451
+
2452
+ function readOpencodeGoLimitsCache({ home, nowMs = Date.now() } = {}) {
2453
+ const cachePath = resolveOpencodeGoLimitsCachePath({ home });
2454
+ try {
2455
+ const parsed = JSON.parse(fs.readFileSync(cachePath, "utf8"));
2456
+ return normalizeOpencodeGoCachedLimits(parsed?.opencodeGo, { nowMs });
2457
+ } catch (_error) {
2458
+ return null;
2459
+ }
2460
+ }
2461
+
2462
+ function writeOpencodeGoLimitsCache(limits, { home, nowMs = Date.now() } = {}) {
2463
+ if (!limits?.configured || limits.error || !hasOpencodeGoWindow(limits)) return;
2464
+ const cachePath = resolveOpencodeGoLimitsCachePath({ home });
2465
+ const payload = {
2466
+ opencodeGo: {
2467
+ source: limits.source || "api",
2468
+ subscription_status: limits.subscription_status || null,
2469
+ plan_label: limits.plan_label || null,
2470
+ primary_window: limits.primary_window || null,
2471
+ secondary_window: limits.secondary_window || null,
2472
+ tertiary_window: limits.tertiary_window || null,
2473
+ cached_at: new Date(nowMs).toISOString(),
2474
+ },
2475
+ };
2476
+ try {
2477
+ fs.mkdirSync(path.dirname(cachePath), { recursive: true });
2478
+ const tmpPath = `${cachePath}.${process.pid}.tmp`;
2479
+ fs.writeFileSync(tmpPath, JSON.stringify(payload, null, 2), { encoding: "utf8", mode: 0o600 });
2480
+ fs.renameSync(tmpPath, cachePath);
2481
+ } catch (_error) {}
2482
+ }
2483
+
2401
2484
  function resolveClaudeRateLimitPath({ home } = {}) {
2402
2485
  return path.join(home || os.homedir(), ".tokentracker", "tracker", CLAUDE_RATE_LIMIT_FILE);
2403
2486
  }
@@ -3063,7 +3146,7 @@ async function fetchUsageLimitsUncached({
3063
3146
  : null;
3064
3147
 
3065
3148
  const providerFetch = withFetchTimeout(fetchImpl, providerTimeoutMs);
3066
- const [claudeResult, codexResult, cursor, kimi, gemini, kiro, antigravity, copilot, grok, zcode, opencodeGo, qoder, qoderCn, codingPlan, claudeServiceStatus] = await Promise.all([
3149
+ const [claudeResult, codexResult, cursor, kimi, gemini, kiro, antigravity, copilot, grok, zcode, opencodeGoRaw, qoder, qoderCn, codingPlan, claudeServiceStatus] = await Promise.all([
3067
3150
  claudeToken && !freshClaudeCache && !claudeRetryAtMs
3068
3151
  ? withProviderTimeout(fetchClaudeUsageLimits(claudeToken, { fetchImpl: providerFetch, maxAttempts: 1 }), "Claude", providerTimeoutMs).then(
3069
3152
  (value) => ({ status: "fulfilled", value }),
@@ -3276,6 +3359,41 @@ async function fetchUsageLimitsUncached({
3276
3359
  }
3277
3360
  }
3278
3361
 
3362
+ // OpenCode Go: persist last successful windows so a transient timeout/5xx
3363
+ // (common on GFW-affected routes to opencode.ai) serves stale bars instead of
3364
+ // a flashing "fetch failed". Mirrors Codex / Claude / Antigravity.
3365
+ // Auth errors (401/403 invalid key, missing subscription, expired cookie) are
3366
+ // actionable and must not be hidden behind stale cache — they carry
3367
+ // `auth_error:true` from opencode-go-limits.js.
3368
+ const opencodeGoIsAuthError =
3369
+ Boolean(opencodeGoRaw?.auth_error) ||
3370
+ (typeof opencodeGoRaw?.error === "string" &&
3371
+ /Not signed in|auth cookie|Refresh the auth cookie|Failed to resolve Workspace ID.*401|Failed to resolve Workspace ID.*403/i.test(
3372
+ opencodeGoRaw.error,
3373
+ ));
3374
+ let opencodeGo;
3375
+ if (opencodeGoRaw && opencodeGoRaw.configured === false) {
3376
+ opencodeGo = opencodeGoRaw;
3377
+ } else if (opencodeGoIsAuthError) {
3378
+ opencodeGo = opencodeGoRaw;
3379
+ } else if (opencodeGoRaw?.subscription_status === "inactive") {
3380
+ opencodeGo = opencodeGoRaw;
3381
+ } else if (opencodeGoRaw && !opencodeGoRaw.error && hasOpencodeGoWindow(opencodeGoRaw)) {
3382
+ opencodeGo = {
3383
+ ...opencodeGoRaw,
3384
+ stale: false,
3385
+ cached_at: new Date(nowMs).toISOString(),
3386
+ };
3387
+ writeOpencodeGoLimitsCache(opencodeGo, { home, nowMs });
3388
+ } else {
3389
+ const cached = readOpencodeGoLimitsCache({ home, nowMs });
3390
+ if (cached) {
3391
+ opencodeGo = cached;
3392
+ } else {
3393
+ opencodeGo = opencodeGoRaw || { configured: true, error: "Unknown error" };
3394
+ }
3395
+ }
3396
+
3279
3397
  const data = {
3280
3398
  fetched_at: new Date(nowMs).toISOString(),
3281
3399
  claude: withPlanLabel(claude, claudePlanType, "Claude"),
@@ -1 +0,0 @@
1
- import{r as n,z as a}from"./__vite-browser-external-WKiEWJ30.js";import{u as p}from"./DialogTitle-eIgptOU-.js";import{u as c}from"./useScrollLock-CZ1Na38Y.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};