codeam-cli 1.4.19 → 1.4.21

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 +32 -6
  2. package/package.json +3 -2
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.19",
118
+ version: "1.4.21",
119
119
  description: "Remote control Claude Code from your mobile device",
120
120
  main: "dist/index.js",
121
121
  bin: {
@@ -139,7 +139,8 @@ var package_default = {
139
139
  "ai",
140
140
  "cli",
141
141
  "remote-control",
142
- "codeagent"
142
+ "codeagent",
143
+ "codeam"
143
144
  ],
144
145
  author: "Edgar Durand",
145
146
  repository: {
@@ -1124,10 +1125,11 @@ function filterChrome(lines) {
1124
1125
  return result;
1125
1126
  }
1126
1127
  var OutputService = class _OutputService {
1127
- constructor(sessionId, pluginId, onSessionIdDetected) {
1128
+ constructor(sessionId, pluginId, onSessionIdDetected, onRateLimitDetected) {
1128
1129
  this.sessionId = sessionId;
1129
1130
  this.pluginId = pluginId;
1130
1131
  this.onSessionIdDetected = onSessionIdDetected;
1132
+ this.onRateLimitDetected = onRateLimitDetected;
1131
1133
  }
1132
1134
  sessionId;
1133
1135
  pluginId;
@@ -1138,6 +1140,7 @@ var OutputService = class _OutputService {
1138
1140
  active = false;
1139
1141
  lastPushTime = 0;
1140
1142
  onSessionIdDetected;
1143
+ onRateLimitDetected;
1141
1144
  static POLL_MS = 1e3;
1142
1145
  static IDLE_MS = 3e3;
1143
1146
  /** Shorter idle threshold for selector detection (UI is ready immediately). */
@@ -1178,6 +1181,7 @@ var OutputService = class _OutputService {
1178
1181
  if (printable.trim()) {
1179
1182
  this.lastPushTime = Date.now();
1180
1183
  this.tryExtractSessionId(printable);
1184
+ this.tryDetectRateLimit(printable);
1181
1185
  }
1182
1186
  }
1183
1187
  /** Extract Claude conversation ID from output text (e.g., from /cost command or session resume) */
@@ -1196,6 +1200,13 @@ var OutputService = class _OutputService {
1196
1200
  }
1197
1201
  }
1198
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
+ }
1199
1210
  dispose() {
1200
1211
  this.stopPoll();
1201
1212
  this.active = false;
@@ -1418,6 +1429,14 @@ var HistoryService = class {
1418
1429
  pluginId;
1419
1430
  cwd;
1420
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
+ }
1421
1440
  get projectDir() {
1422
1441
  return path4.join(os4.homedir(), ".claude", "projects", encodeCwd(this.cwd));
1423
1442
  }
@@ -1509,10 +1528,13 @@ var HistoryService = class {
1509
1528
  } catch {
1510
1529
  }
1511
1530
  }
1512
- if (!lastUsage) return null;
1531
+ const total = getContextWindow(lastModel);
1532
+ if (!lastUsage) {
1533
+ if (!lastModel) return null;
1534
+ return { used: 0, total, percent: 0, model: lastModel, outputTokens: 0, cacheReadTokens: 0 };
1535
+ }
1513
1536
  const inputTokens = (lastUsage["input_tokens"] ?? lastUsage["prompt_tokens"] ?? 0) + (lastUsage["cache_read_input_tokens"] ?? 0) + (lastUsage["cache_creation_input_tokens"] ?? 0);
1514
1537
  const outputTokens = lastUsage["output_tokens"] ?? lastUsage["completion_tokens"] ?? 0;
1515
- const total = getContextWindow(lastModel);
1516
1538
  const percent = Math.min(100, Math.round(inputTokens / total * 100));
1517
1539
  return { used: inputTokens, total, percent, model: lastModel, outputTokens, cacheReadTokens: lastUsage["cache_read_input_tokens"] ?? 0 };
1518
1540
  }
@@ -1666,6 +1688,8 @@ async function start() {
1666
1688
  const historySvc = new HistoryService(pluginId, cwd);
1667
1689
  const outputSvc = new OutputService(session.id, pluginId, (conversationId) => {
1668
1690
  historySvc.setCurrentConversationId(conversationId);
1691
+ }, (reset) => {
1692
+ historySvc.setRateLimitReset(reset);
1669
1693
  });
1670
1694
  function sendPrompt(prompt) {
1671
1695
  outputSvc.newTurn();
@@ -1717,7 +1741,9 @@ async function start() {
1717
1741
  case "get_context": {
1718
1742
  const usage = historySvc.getCurrentUsage();
1719
1743
  const monthlyCost = historySvc.getMonthlyEstimatedCost();
1720
- 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;
1721
1747
  await relay.sendResult(cmd.id, "completed", result);
1722
1748
  break;
1723
1749
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.19",
3
+ "version": "1.4.21",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -24,7 +24,8 @@
24
24
  "ai",
25
25
  "cli",
26
26
  "remote-control",
27
- "codeagent"
27
+ "codeagent",
28
+ "codeam"
28
29
  ],
29
30
  "author": "Edgar Durand",
30
31
  "repository": {