codeam-cli 1.4.20 → 1.4.22

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 +25 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -115,7 +115,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
115
115
  // package.json
116
116
  var package_default = {
117
117
  name: "codeam-cli",
118
- version: "1.4.20",
118
+ version: "1.4.22",
119
119
  description: "Remote control Claude Code from your mobile device",
120
120
  main: "dist/index.js",
121
121
  bin: {
@@ -1125,10 +1125,11 @@ function filterChrome(lines) {
1125
1125
  return result;
1126
1126
  }
1127
1127
  var OutputService = class _OutputService {
1128
- constructor(sessionId, pluginId, onSessionIdDetected) {
1128
+ constructor(sessionId, pluginId, onSessionIdDetected, onRateLimitDetected) {
1129
1129
  this.sessionId = sessionId;
1130
1130
  this.pluginId = pluginId;
1131
1131
  this.onSessionIdDetected = onSessionIdDetected;
1132
+ this.onRateLimitDetected = onRateLimitDetected;
1132
1133
  }
1133
1134
  sessionId;
1134
1135
  pluginId;
@@ -1139,6 +1140,7 @@ var OutputService = class _OutputService {
1139
1140
  active = false;
1140
1141
  lastPushTime = 0;
1141
1142
  onSessionIdDetected;
1143
+ onRateLimitDetected;
1142
1144
  static POLL_MS = 1e3;
1143
1145
  static IDLE_MS = 3e3;
1144
1146
  /** Shorter idle threshold for selector detection (UI is ready immediately). */
@@ -1179,6 +1181,7 @@ var OutputService = class _OutputService {
1179
1181
  if (printable.trim()) {
1180
1182
  this.lastPushTime = Date.now();
1181
1183
  this.tryExtractSessionId(printable);
1184
+ this.tryDetectRateLimit(printable);
1182
1185
  }
1183
1186
  }
1184
1187
  /** Extract Claude conversation ID from output text (e.g., from /cost command or session resume) */
@@ -1197,6 +1200,13 @@ var OutputService = class _OutputService {
1197
1200
  }
1198
1201
  }
1199
1202
  }
1203
+ /** Detect rate limit messages from Claude Code output (e.g. "You've hit your limit · resets Apr 16 at 1pm") */
1204
+ tryDetectRateLimit(text) {
1205
+ const match = text.match(/hit your limit.*resets\s+(.+?)(?:\s*\(|$)/i) ?? text.match(/rate.?limit.*resets\s+(.+?)(?:\s*\(|$)/i);
1206
+ if (match && this.onRateLimitDetected) {
1207
+ this.onRateLimitDetected(match[1].trim());
1208
+ }
1209
+ }
1200
1210
  dispose() {
1201
1211
  this.stopPoll();
1202
1212
  this.active = false;
@@ -1419,6 +1429,14 @@ var HistoryService = class {
1419
1429
  pluginId;
1420
1430
  cwd;
1421
1431
  currentConversationId = null;
1432
+ _rateLimitReset = null;
1433
+ /** Store rate limit reset info detected from Claude Code output */
1434
+ setRateLimitReset(reset) {
1435
+ this._rateLimitReset = reset;
1436
+ }
1437
+ getRateLimitReset() {
1438
+ return this._rateLimitReset;
1439
+ }
1422
1440
  get projectDir() {
1423
1441
  return path4.join(os4.homedir(), ".claude", "projects", encodeCwd(this.cwd));
1424
1442
  }
@@ -1670,6 +1688,8 @@ async function start() {
1670
1688
  const historySvc = new HistoryService(pluginId, cwd);
1671
1689
  const outputSvc = new OutputService(session.id, pluginId, (conversationId) => {
1672
1690
  historySvc.setCurrentConversationId(conversationId);
1691
+ }, (reset) => {
1692
+ historySvc.setRateLimitReset(reset);
1673
1693
  });
1674
1694
  function sendPrompt(prompt) {
1675
1695
  outputSvc.newTurn();
@@ -1721,7 +1741,9 @@ async function start() {
1721
1741
  case "get_context": {
1722
1742
  const usage = historySvc.getCurrentUsage();
1723
1743
  const monthlyCost = historySvc.getMonthlyEstimatedCost();
1724
- const result = usage ? { ...usage, monthlyCost } : { used: 0, total: 2e5, percent: 0, model: null, outputTokens: 0, cacheReadTokens: 0, monthlyCost, error: "No usage data found" };
1744
+ const rateLimitReset = historySvc.getRateLimitReset();
1745
+ const base = usage ? { ...usage, monthlyCost } : { used: 0, total: 2e5, percent: 0, model: null, outputTokens: 0, cacheReadTokens: 0, monthlyCost, error: "No usage data found" };
1746
+ const result = rateLimitReset ? { ...base, rateLimitReset } : base;
1725
1747
  await relay.sendResult(cmd.id, "completed", result);
1726
1748
  break;
1727
1749
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.20",
3
+ "version": "1.4.22",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {