codeam-cli 1.4.9 → 1.4.11

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 +13 -32
  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.9",
118
+ version: "1.4.11",
119
119
  description: "Remote control Claude Code from your mobile device",
120
120
  main: "dist/index.js",
121
121
  bin: {
@@ -492,12 +492,15 @@ var CommandRelayService = class {
492
492
  const commands = data?.data;
493
493
  if (!Array.isArray(commands)) return;
494
494
  for (const obj of commands) {
495
- this.onCommand({
496
- id: obj.id,
497
- sessionId: obj.sessionId,
498
- type: obj.type,
499
- payload: obj.payload ?? {}
500
- });
495
+ try {
496
+ await this.onCommand({
497
+ id: obj.id,
498
+ sessionId: obj.sessionId,
499
+ type: obj.type,
500
+ payload: obj.payload ?? {}
501
+ });
502
+ } catch {
503
+ }
501
504
  }
502
505
  } catch {
503
506
  }
@@ -1420,13 +1423,10 @@ var HistoryService = class {
1420
1423
  */
1421
1424
  getCurrentUsage() {
1422
1425
  const dir = this.projectDir;
1423
- console.log(`[HistoryService] Looking for sessions in: ${dir}`);
1424
- console.log(`[HistoryService] Current conversation ID: ${this.currentConversationId ?? "not set"}`);
1425
1426
  let entries;
1426
1427
  try {
1427
1428
  entries = fs4.readdirSync(dir, { withFileTypes: true });
1428
- } catch (err) {
1429
- console.log(`[HistoryService] Failed to read directory: ${err}`);
1429
+ } catch {
1430
1430
  return null;
1431
1431
  }
1432
1432
  const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
@@ -1436,28 +1436,19 @@ var HistoryService = class {
1436
1436
  return { name: e.name, mtime: 0 };
1437
1437
  }
1438
1438
  }).sort((a, b) => b.mtime - a.mtime);
1439
- if (files.length === 0) {
1440
- console.log(`[HistoryService] No .jsonl files found in directory`);
1441
- return null;
1442
- }
1439
+ if (files.length === 0) return null;
1443
1440
  let targetFile = files[0].name;
1444
1441
  if (this.currentConversationId) {
1445
1442
  const conversationFile = `${this.currentConversationId}.jsonl`;
1446
1443
  const exists = files.some((f) => f.name === conversationFile);
1447
1444
  if (exists) {
1448
1445
  targetFile = conversationFile;
1449
- console.log(`[HistoryService] Using tracked conversation file: ${targetFile}`);
1450
- } else {
1451
- console.log(`[HistoryService] Tracked conversation file not found, using most recent: ${targetFile}`);
1452
1446
  }
1453
- } else {
1454
- console.log(`[HistoryService] No tracked conversation, using most recent: ${targetFile}`);
1455
1447
  }
1456
1448
  let raw;
1457
1449
  try {
1458
1450
  raw = fs4.readFileSync(path4.join(dir, targetFile), "utf8");
1459
- } catch (err) {
1460
- console.log(`[HistoryService] Failed to read file: ${err}`);
1451
+ } catch {
1461
1452
  return null;
1462
1453
  }
1463
1454
  let lastUsage = null;
@@ -1465,7 +1456,6 @@ var HistoryService = class {
1465
1456
  let assistantMessageCount = 0;
1466
1457
  let hasAnyMessages = false;
1467
1458
  const lines = raw.split("\n").filter(Boolean);
1468
- console.log(`[HistoryService] File has ${lines.length} lines`);
1469
1459
  for (const line of lines) {
1470
1460
  try {
1471
1461
  const record = JSON.parse(line);
@@ -1478,20 +1468,16 @@ var HistoryService = class {
1478
1468
  const usage = msg?.["usage"];
1479
1469
  if (usage && (usage["input_tokens"] !== void 0 || usage["prompt_tokens"] !== void 0)) {
1480
1470
  lastUsage = usage;
1481
- console.log(`[HistoryService] Found usage data: ${JSON.stringify(lastUsage)}`);
1482
1471
  }
1483
1472
  if (msg?.["model"]) lastModel = msg["model"];
1484
1473
  }
1485
1474
  } catch {
1486
1475
  }
1487
1476
  }
1488
- console.log(`[HistoryService] Processed ${assistantMessageCount} assistant messages, hasAnyMessages: ${hasAnyMessages}, lastUsage: ${lastUsage ? "found" : "not found"}, lastModel: ${lastModel}`);
1489
1477
  if (!lastUsage) {
1490
1478
  if (hasAnyMessages) {
1491
- console.log(`[HistoryService] File has messages but no usage data (Claude Code may not have recorded usage yet)`);
1492
1479
  return { used: 0, total: 2e5, percent: 0, model: lastModel, outputTokens: 0, cacheReadTokens: 0 };
1493
1480
  }
1494
- console.log(`[HistoryService] No messages or usage data found in session file`);
1495
1481
  return null;
1496
1482
  }
1497
1483
  const inputTokens = (lastUsage["input_tokens"] ?? lastUsage["prompt_tokens"] ?? 0) + (lastUsage["cache_read_input_tokens"] ?? 0) + (lastUsage["cache_creation_input_tokens"] ?? 0);
@@ -1585,12 +1571,9 @@ async function start() {
1585
1571
  showInfo(`${session.userName} \xB7 ${import_picocolors2.default.cyan(session.plan)}`);
1586
1572
  showInfo("Launching Claude Code...\n");
1587
1573
  const cwd = process.cwd();
1588
- console.log(`[CLI] Starting with cwd: ${cwd}`);
1589
- console.log(`[CLI] Session: ${session.id}, Plugin: ${pluginId}`);
1590
1574
  const ws = new WebSocketService(session.id, pluginId);
1591
1575
  const historySvc = new HistoryService(pluginId, cwd);
1592
1576
  const outputSvc = new OutputService(session.id, pluginId, (conversationId) => {
1593
- console.log(`[CLI] Detected Claude conversation ID: ${conversationId}`);
1594
1577
  historySvc.setCurrentConversationId(conversationId);
1595
1578
  });
1596
1579
  function sendPrompt(prompt) {
@@ -1641,10 +1624,8 @@ async function start() {
1641
1624
  claude.interrupt();
1642
1625
  break;
1643
1626
  case "get_context": {
1644
- console.log(`[CLI] Received get_context command, fetching usage...`);
1645
1627
  const usage = historySvc.getCurrentUsage();
1646
1628
  const result = usage ?? { used: 0, total: 2e5, percent: 0, model: null, outputTokens: 0, cacheReadTokens: 0, error: "No usage data found" };
1647
- console.log(`[CLI] Sending context result: ${JSON.stringify(result)}`);
1648
1629
  await relay.sendResult(cmd.id, "completed", result);
1649
1630
  break;
1650
1631
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {