codeam-cli 1.4.31 → 1.4.32

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 (2) hide show
  1. package/dist/index.js +8 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -116,7 +116,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
116
116
  // package.json
117
117
  var package_default = {
118
118
  name: "codeam-cli",
119
- version: "1.4.31",
119
+ version: "1.4.32",
120
120
  description: "Remote control Claude Code from your mobile device",
121
121
  main: "dist/index.js",
122
122
  bin: {
@@ -1435,6 +1435,7 @@ var HistoryService = class {
1435
1435
  currentConversationId = null;
1436
1436
  _rateLimitReset = null;
1437
1437
  _quotaPercent = null;
1438
+ _quotaFetchedAt = 0;
1438
1439
  /** Store rate limit reset info detected from Claude Code output */
1439
1440
  setRateLimitReset(reset) {
1440
1441
  this._rateLimitReset = reset;
@@ -1445,10 +1446,15 @@ var HistoryService = class {
1445
1446
  /** Store weekly quota usage percentage parsed from /usage output */
1446
1447
  setQuotaPercent(percent) {
1447
1448
  this._quotaPercent = percent;
1449
+ this._quotaFetchedAt = Date.now();
1448
1450
  }
1449
1451
  getQuotaPercent() {
1450
1452
  return this._quotaPercent;
1451
1453
  }
1454
+ /** Check if the quota cache is stale (older than ttlMs, default 30 min) */
1455
+ isQuotaStale(ttlMs = 30 * 60 * 1e3) {
1456
+ return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
1457
+ }
1452
1458
  get projectDir() {
1453
1459
  return path4.join(os4.homedir(), ".claude", "projects", encodeCwd(this.cwd));
1454
1460
  }
@@ -1698,8 +1704,6 @@ async function start() {
1698
1704
  const cwd = process.cwd();
1699
1705
  const ws = new WebSocketService(session.id, pluginId);
1700
1706
  const historySvc = new HistoryService(pluginId, cwd);
1701
- let turnCount = 0;
1702
- const USAGE_FETCH_INTERVAL = 5;
1703
1707
  let quotaFetchInProgress = false;
1704
1708
  function fetchQuotaUsage() {
1705
1709
  if (quotaFetchInProgress) return;
@@ -1808,8 +1812,7 @@ except Exception:sys.exit(0)
1808
1812
  }, (reset) => {
1809
1813
  historySvc.setRateLimitReset(reset);
1810
1814
  }, () => {
1811
- turnCount++;
1812
- if (turnCount % USAGE_FETCH_INTERVAL === 1) {
1815
+ if (historySvc.isQuotaStale()) {
1813
1816
  fetchQuotaUsage();
1814
1817
  }
1815
1818
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.31",
3
+ "version": "1.4.32",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {