tokentracker-cli 0.35.2 → 0.36.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.
Files changed (40) hide show
  1. package/dashboard/dist/assets/{ActivityHeatmap-Bb0omCiI.js → ActivityHeatmap-AynZXL9H.js} +1 -1
  2. package/dashboard/dist/assets/{Card-CtI3QMH6.js → Card-DnMSvw-8.js} +1 -1
  3. package/dashboard/dist/assets/{DashboardPage-jCAhwrGj.js → DashboardPage-BQdAuoZy.js} +1 -1
  4. package/dashboard/dist/assets/{DevicePage-CyWx9gIK.js → DevicePage-C8Hu0_B2.js} +1 -1
  5. package/dashboard/dist/assets/{DialogTitle-C9pIgpxK.js → DialogTitle-e9pHSnUF.js} +1 -1
  6. package/dashboard/dist/assets/{FadeIn-D1DCy1c9.js → FadeIn-DJV5b6ny.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-D2qhRbZX.js → HeaderGithubStar-D5NO9Zqo.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-B_L_cKmD.js → IpCheckPage-ChrS22kx.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-MT2qg0bE.js → LandingPage-P5ooRJZy.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-BXi46kQk.js → LeaderboardAvatar-8qHGUAlc.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-CrhD0iRk.js → LeaderboardPage-CAydwGf5.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-DRylJ_fc.js → LeaderboardProfileModal-gx27y6wc.js} +1 -1
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-DfVriPxC.js → LeaderboardProfilePage-CLTi0y1L.js} +1 -1
  14. package/dashboard/dist/assets/LimitsPage-C0Bfsa5L.js +2 -0
  15. package/dashboard/dist/assets/{LocalOnlyNotice-CQbMwbCe.js → LocalOnlyNotice-D1MjhvWF.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-BuLVMfu2.js → LoginPage-CQskrfGA.js} +1 -1
  17. package/dashboard/dist/assets/{PopoverPopup-BpAU63FH.js → PopoverPopup-Bsx_BMXc.js} +1 -1
  18. package/dashboard/dist/assets/{SettingsPage-DX7f066p.js → SettingsPage-C_zwPu_u.js} +1 -1
  19. package/dashboard/dist/assets/{SkillsPage-BV3LnVvE.js → SkillsPage-BlgwZHg5.js} +1 -1
  20. package/dashboard/dist/assets/{WidgetsPage-C-39lx67.js → WidgetsPage-DnSe3_0m.js} +1 -1
  21. package/dashboard/dist/assets/{WrappedPage-DTDJesAM.js → WrappedPage-vB9Bkmn4.js} +1 -1
  22. package/dashboard/dist/assets/{agent-logos-BKtVvn2f.js → agent-logos-KnLTt2lz.js} +1 -1
  23. package/dashboard/dist/assets/{arrow-up-right-BjAWXJOu.js → arrow-up-right-DVke2dP8.js} +1 -1
  24. package/dashboard/dist/assets/check-D09jAT1P.js +1 -0
  25. package/dashboard/dist/assets/{chevron-down-D6_2sGG-.js → chevron-down-BGAP09jB.js} +1 -1
  26. package/dashboard/dist/assets/{download-BVdUICgW.js → download-DNvHArM6.js} +1 -1
  27. package/dashboard/dist/assets/{info-BUs_fkaX.js → info-KP-YTZRI.js} +1 -1
  28. package/dashboard/dist/assets/{main-BBMM0Tgo.js → main-BY8UDgbs.js} +2 -2
  29. package/dashboard/dist/assets/{use-limits-display-prefs-BJRhaKEd.js → use-limits-display-prefs-F5oc24jY.js} +1 -1
  30. package/dashboard/dist/assets/{use-native-settings-lyrRoQkg.js → use-native-settings-ByQaUuE2.js} +1 -1
  31. package/dashboard/dist/assets/{use-usage-limits-COFMsRkg.js → use-usage-limits-DtqJe6kn.js} +1 -1
  32. package/dashboard/dist/assets/{useCurrency-C3yqfWiI.js → useCurrency-CRhabGRo.js} +1 -1
  33. package/dashboard/dist/index.html +1 -1
  34. package/dashboard/dist/share.html +1 -1
  35. package/package.json +1 -1
  36. package/src/lib/pricing/seed-snapshot.json +1 -1
  37. package/src/lib/subscriptions.js +25 -13
  38. package/src/lib/usage-limits.js +40 -9
  39. package/dashboard/dist/assets/LimitsPage-Ni3_-kEb.js +0 -2
  40. package/dashboard/dist/assets/check-CRcTlhgH.js +0 -1
@@ -10,10 +10,19 @@ const { probeOpenclawSessionPluginState } = require("./openclaw-session-plugin")
10
10
  const OPENAI_AUTH_CLAIM = "https://api.openai.com/auth";
11
11
  const MACOS_SECURITY_BIN = "/usr/bin/security";
12
12
  const CLAUDE_CODE_KEYCHAIN_SERVICES = ["Claude Code-credentials"];
13
- // On Linux, Claude Code persists the same OAuth payload as a plain JSON file
14
- // (~/.claude/.credentials.json) instead of the macOS Keychain. The payload
15
- // shape is identical: { claudeAiOauth: { accessToken, subscriptionType, ... } }
13
+ // On Linux and Windows, Claude Code persists the same OAuth payload as a plain
14
+ // JSON file instead of the macOS Keychain — at ~/.claude/.credentials.json on
15
+ // Linux and %USERPROFILE%\.claude\.credentials.json on Windows (both resolve via
16
+ // os.homedir()). The payload shape is identical:
17
+ // { claudeAiOauth: { accessToken, subscriptionType, ... } }
16
18
  const CLAUDE_CODE_CREDENTIALS_FILE = ".credentials.json";
19
+ // Platforms where Claude Code stores credentials in the plain JSON file above
20
+ // rather than the macOS Keychain.
21
+ const CLAUDE_CODE_CREDENTIALS_FILE_PLATFORMS = new Set(["linux", "win32"]);
22
+
23
+ function usesClaudeCodeCredentialsFile(platform) {
24
+ return CLAUDE_CODE_CREDENTIALS_FILE_PLATFORMS.has(platform);
25
+ }
17
26
 
18
27
  function normalizeString(value) {
19
28
  if (typeof value !== "string") return null;
@@ -197,7 +206,7 @@ function readMacosKeychainPassword({ service, securityRunner, timeoutMs } = {})
197
206
  return trimmed.length > 0 ? trimmed : null;
198
207
  }
199
208
 
200
- function readClaudeCodeCredentialsLinuxFile({ home, fsReader } = {}) {
209
+ function readClaudeCodeCredentialsFile({ home, fsReader } = {}) {
201
210
  const homeDir = typeof home === "string" && home ? home : os.homedir();
202
211
  const credPath = path.join(homeDir, ".claude", CLAUDE_CODE_CREDENTIALS_FILE);
203
212
  const reader = typeof fsReader === "function" ? fsReader : fs.readFileSync;
@@ -228,11 +237,12 @@ function detectClaudeCodeCredentialsPresence({ platform, securityRunner, home, f
228
237
  return null;
229
238
  }
230
239
 
231
- if (platform !== "linux") return null;
240
+ if (!usesClaudeCodeCredentialsFile(platform)) return null;
232
241
 
233
- // Linux: credentials live in ~/.claude/.credentials.json (mode 0600).
234
- // Existence-only: just check that the file is readable and contains the OAuth key.
235
- const raw = readClaudeCodeCredentialsLinuxFile({ home, fsReader });
242
+ // Linux/Windows: credentials live in the .credentials.json file (mode 0600 on
243
+ // Linux; user-profile ACLs on Windows). Existence-only: just check that the
244
+ // file is readable and contains the OAuth key.
245
+ const raw = readClaudeCodeCredentialsFile({ home, fsReader });
236
246
  if (!raw) return null;
237
247
  try {
238
248
  const payload = JSON.parse(raw);
@@ -270,8 +280,8 @@ function detectClaudeCodeSubscriptionDetails({ platform, securityRunner, home, f
270
280
  const raw = readMacosKeychainPassword({ service, securityRunner });
271
281
  if (raw) rawPayloads.push(raw);
272
282
  }
273
- } else if (platform === "linux") {
274
- const raw = readClaudeCodeCredentialsLinuxFile({ home, fsReader });
283
+ } else if (usesClaudeCodeCredentialsFile(platform)) {
284
+ const raw = readClaudeCodeCredentialsFile({ home, fsReader });
275
285
  if (raw) rawPayloads.push(raw);
276
286
  } else {
277
287
  return null;
@@ -369,10 +379,11 @@ function readClaudeCodeAccessToken({ platform, securityRunner, home, fsReader }
369
379
  return null;
370
380
  }
371
381
 
372
- if (platform !== "linux") return null;
382
+ if (!usesClaudeCodeCredentialsFile(platform)) return null;
373
383
 
374
- // Linux: Claude Code stores the OAuth payload as a JSON file with mode 0600.
375
- const raw = readClaudeCodeCredentialsLinuxFile({ home, fsReader });
384
+ // Linux/Windows: Claude Code stores the OAuth payload as a JSON file
385
+ // (mode 0600 on Linux; user-profile ACLs on Windows).
386
+ const raw = readClaudeCodeCredentialsFile({ home, fsReader });
376
387
  if (!raw) return null;
377
388
  try {
378
389
  const payload = JSON.parse(raw);
@@ -435,6 +446,7 @@ async function readCodexAuthBundle({ home, env } = {}) {
435
446
 
436
447
  module.exports = {
437
448
  collectLocalSubscriptions,
449
+ detectClaudeCodeSubscriptionDetails,
438
450
  readClaudeCodeAccessToken,
439
451
  readCodexAccessToken,
440
452
  readCodexAuthBundle,
@@ -6,6 +6,7 @@ const http = require("node:http");
6
6
  const https = require("node:https");
7
7
 
8
8
  const {
9
+ detectClaudeCodeSubscriptionDetails,
9
10
  readClaudeCodeAccessToken,
10
11
  readCodexAccessToken,
11
12
  readCodexAuthBundle,
@@ -1598,6 +1599,33 @@ async function fetchAntigravityLimits({ home, commandRunner, requestFn, timeoutM
1598
1599
  }
1599
1600
  }
1600
1601
 
1602
+ function toTitleCase(s) {
1603
+ return s.split(/\s+/).filter(Boolean)
1604
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ");
1605
+ }
1606
+
1607
+ // Normalize a plan tier name: free/empty/placeholder -> null; otherwise strip the
1608
+ // leading brand word and Title Case the rest.
1609
+ function normalizePlanLabel(raw, brand) {
1610
+ if (raw == null) return null;
1611
+ let s = String(raw).trim();
1612
+ if (!s) return null;
1613
+ const lower = s.toLowerCase();
1614
+ if (["free", "none", "unknown"].includes(lower)) return null;
1615
+ if (brand && lower === brand.toLowerCase()) return null; // e.g. Kiro defaults plan_name to "Kiro" when parse fails
1616
+ if (brand) {
1617
+ s = s.replace(new RegExp("^" + brand + "\\s+", "i"), "").trim();
1618
+ if (!s) return null;
1619
+ }
1620
+ return toTitleCase(s);
1621
+ }
1622
+
1623
+ // Attach plan_label only to a configured, error-free provider object (immutable).
1624
+ function withPlanLabel(obj, raw, brand) {
1625
+ if (!obj || !obj.configured || obj.error) return obj;
1626
+ return { ...obj, plan_label: normalizePlanLabel(raw, brand) };
1627
+ }
1628
+
1601
1629
  async function getUsageLimits({
1602
1630
  home,
1603
1631
  env,
@@ -1614,10 +1642,12 @@ async function getUsageLimits({
1614
1642
  return cache.data;
1615
1643
  }
1616
1644
 
1617
- const [claudeToken, codexAuth] = await Promise.all([
1645
+ const [claudeToken, claudeSubscription, codexAuth] = await Promise.all([
1618
1646
  Promise.resolve().then(() => readClaudeCodeAccessToken({ platform, securityRunner, home })),
1647
+ Promise.resolve().then(() => detectClaudeCodeSubscriptionDetails({ platform, securityRunner, home })),
1619
1648
  readCodexAuthBundle({ home, env }),
1620
1649
  ]);
1650
+ const claudePlanType = claudeSubscription?.planType || null;
1621
1651
 
1622
1652
  // Proactively refresh Codex tokens that are >8 days stale, mirroring CodexBar's
1623
1653
  // CodexTokenRefresher.swift. Without this, users who logged in once and didn't run
@@ -1724,14 +1754,14 @@ async function getUsageLimits({
1724
1754
 
1725
1755
  const data = {
1726
1756
  fetched_at: new Date(nowMs).toISOString(),
1727
- claude,
1728
- codex,
1729
- cursor,
1730
- kimi,
1731
- gemini,
1732
- kiro,
1733
- antigravity,
1734
- copilot,
1757
+ claude: withPlanLabel(claude, claudePlanType, "Claude"),
1758
+ codex: withPlanLabel(codex, codex.plan_type, "Codex"),
1759
+ cursor: withPlanLabel(cursor, cursor.membership_type, "Cursor"),
1760
+ kimi: withPlanLabel(kimi, kimi.subscription_type || kimi.membership_level, "Kimi"),
1761
+ gemini: withPlanLabel(gemini, gemini.account_plan, "Gemini"),
1762
+ kiro: withPlanLabel(kiro, kiro.plan_name, "Kiro"),
1763
+ antigravity: withPlanLabel(antigravity, antigravity.account_plan, "Antigravity"),
1764
+ copilot: withPlanLabel(copilot, copilot.plan_name, "Copilot"),
1735
1765
  };
1736
1766
 
1737
1767
  cache = { data, fetchedAt: nowMs };
@@ -1744,6 +1774,7 @@ function resetUsageLimitsCache() {
1744
1774
 
1745
1775
  module.exports = {
1746
1776
  getUsageLimits,
1777
+ normalizePlanLabel,
1747
1778
  resetUsageLimitsCache,
1748
1779
  extractGeminiOauthClientCredentials,
1749
1780
  loadKimiCredentials,
@@ -1,2 +0,0 @@
1
- import{j as i,M as f,A as s,r as E,ax as I,i as P,L as M,ay as R}from"./main-BBMM0Tgo.js";import{u as C}from"./use-usage-limits-COFMsRkg.js";import{L as u,u as O}from"./use-limits-display-prefs-BJRhaKEd.js";import{C as j}from"./Card-CtI3QMH6.js";import{F as T}from"./FadeIn-D1DCy1c9.js";import{L as S}from"./LocalOnlyNotice-CQbMwbCe.js";import"./arrow-up-right-BjAWXJOu.js";import"./download-BVdUICgW.js";const A=[3,2,3,3,2,2,3];function x({className:t}){return i.jsx("div",{className:f("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function D(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(x,{className:"h-3 w-12 shrink-0"}),i.jsx(x,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(x,{className:"h-3 w-[30px] shrink-0"}),i.jsx(x,{className:"h-3 w-6 shrink-0"})]})}function G({bars:t,index:e}){const r=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(x,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(x,{className:f("h-4",r)})]}),Array.from({length:t},(n,a)=>i.jsx(D,{},a))]})}function H(){return i.jsx(j,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(x,{className:"h-3.5 w-28"}),A.map((t,e)=>i.jsx(G,{bars:t,index:e},e))]})})}function o(t){if(!t)return null;const e=typeof t=="number"?t*1e3:Date.parse(t);if(!Number.isFinite(e))return null;const r=e-Date.now();if(r<=0)return s("shared.time.now");const n=Math.floor(r/6e4);if(n<60)return`${n}m`;const a=Math.floor(n/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function $(t,e){const r=e===u.REMAINING?100-t:t;return r>=90?"bg-red-500":r>=70?"bg-amber-500":"bg-emerald-500"}function l({label:t,pct:e,reset:r,mode:n=u.USED}){const a=Math.max(0,Math.min(100,Number(e)||0)),d=n===u.REMAINING?100-a:a,p=Math.round(d),y=d>0&&p===0?Math.max(d,.35):d,w=d>0&&p===0?"<1":String(p);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:t}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${$(d,n)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${y}%`,minWidth:d>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[w,"%"]}),r?i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r}):null]})}function m({name:t,icon:e,children:r}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:a}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:t})]}),r]})}const F=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],B={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:t,tone:e="neutral"}){const r=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:t})}function U(t,e,r){const n=B[t];if(!n)return null;if(!e?.configured)return i.jsx(m,{name:n.name,icon:n.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},t);if(e.error)return i.jsx(m,{name:n.name,icon:n.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},t);switch(t){case"claude":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.five_hour?i.jsx(l,{label:"5h",pct:e.five_hour.utilization,reset:o(e.five_hour.resets_at),mode:r}):null,e.seven_day?i.jsx(l,{label:"7d",pct:e.seven_day.utilization,reset:o(e.seven_day.resets_at),mode:r}):null,e.seven_day_opus?i.jsx(l,{label:"Opus",pct:e.seven_day_opus.utilization,reset:o(e.seven_day_opus.resets_at),mode:r}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:"5h",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:"7d",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:"Pro",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:"Flash",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:"Lite",pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"kiro":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:"Claude",pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:"G Pro",pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,e.tertiary_window?i.jsx(l,{label:"Flash",pct:e.tertiary_window.used_percent,reset:o(e.tertiary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(m,{name:n.name,icon:n.icon,children:[e.primary_window?i.jsx(l,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:o(e.primary_window.reset_at),mode:r}):null,e.secondary_window?i.jsx(l,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:o(e.secondary_window.reset_at),mode:r}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx(z,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function z({defaultDir:t}){const[e,r]=E.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
2
- `),d=async()=>{try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:s("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:s("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:a}),i.jsx("button",{type:"button",onClick:d,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?s("limits.copilot.otelHint.copied"):s("limits.copilot.otelHint.copy")})]})}function Y({claude:t,codex:e,cursor:r,gemini:n,kimi:a,kiro:d,antigravity:p,copilot:y,order:w,visibility:h,displayMode:v}){const k={claude:t,codex:e,cursor:r,gemini:n,kimi:a,kiro:d,antigravity:p,copilot:y},N=Array.isArray(w)&&w.length>0?w:F,g=v===u.REMAINING?u.REMAINING:u.USED,L=g===u.REMAINING?s("limits.settings.display_mode_remaining"):s("limits.settings.display_mode_used"),b=N.filter(_=>!h||h[_]!==!1).map(_=>U(_,k[_],g)).filter(Boolean);return i.jsx(T,{delay:.15,children:i.jsx(j,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[s("limits.panel.title"),s("limits.panel.mode_separator"),L]}),b.length>0?b:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const K=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function ie(){const t=I(),{data:e,error:r,isLoading:n}=C(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),a=O();return!K&&!P()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(S,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:s("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:s("limits.page.subtitle")})]}),i.jsx(M,{to:"/settings","aria-label":s("limits.page.openSettings"),title:s("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(R,{className:"h-4 w-4","aria-hidden":!0})})]}),n?i.jsx(H,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:r})}):null,i.jsx(Y,{claude:e?.claude,codex:e?.codex,cursor:e?.cursor,gemini:e?.gemini,kimi:e?.kimi,kiro:e?.kiro,antigravity:e?.antigravity,copilot:e?.copilot,order:a.order,visibility:a.visibility,displayMode:a.displayMode})]})]})})})}export{ie as LimitsPage};
@@ -1 +0,0 @@
1
- import{c}from"./main-BBMM0Tgo.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};