codeam-cli 1.4.8 → 1.4.10

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 +31 -6
  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.8",
118
+ version: "1.4.10",
119
119
  description: "Remote control Claude Code from your mobile device",
120
120
  main: "dist/index.js",
121
121
  bin: {
@@ -1121,9 +1121,10 @@ function filterChrome(lines) {
1121
1121
  return result;
1122
1122
  }
1123
1123
  var OutputService = class _OutputService {
1124
- constructor(sessionId, pluginId) {
1124
+ constructor(sessionId, pluginId, onSessionIdDetected) {
1125
1125
  this.sessionId = sessionId;
1126
1126
  this.pluginId = pluginId;
1127
+ this.onSessionIdDetected = onSessionIdDetected;
1127
1128
  }
1128
1129
  sessionId;
1129
1130
  pluginId;
@@ -1133,6 +1134,7 @@ var OutputService = class _OutputService {
1133
1134
  startTime = 0;
1134
1135
  active = false;
1135
1136
  lastPushTime = 0;
1137
+ onSessionIdDetected;
1136
1138
  static POLL_MS = 1e3;
1137
1139
  static IDLE_MS = 3e3;
1138
1140
  /** Shorter idle threshold for selector detection (UI is ready immediately). */
@@ -1170,7 +1172,26 @@ var OutputService = class _OutputService {
1170
1172
  if (!this.active) return;
1171
1173
  this.rawBuffer += raw;
1172
1174
  const printable = raw.replace(/\x1B\[[^@-~]*[@-~]/g, "").replace(/[\x00-\x1F\x7F]/g, "");
1173
- if (printable.trim()) this.lastPushTime = Date.now();
1175
+ if (printable.trim()) {
1176
+ this.lastPushTime = Date.now();
1177
+ this.tryExtractSessionId(printable);
1178
+ }
1179
+ }
1180
+ /** Extract Claude conversation ID from output text (e.g., from /cost command or session resume) */
1181
+ tryExtractSessionId(text) {
1182
+ const patterns = [
1183
+ /Resuming session[:\s]+([a-f0-9-]{36})/i,
1184
+ /Session[:\s]+([a-f0-9-]{36})/i,
1185
+ /Conversation[:\s]+([a-f0-9-]{36})/i,
1186
+ /Session\s+ID[:\s]+([a-f0-9-]{36})/i
1187
+ ];
1188
+ for (const pattern of patterns) {
1189
+ const match = text.match(pattern);
1190
+ if (match && this.onSessionIdDetected) {
1191
+ this.onSessionIdDetected(match[1]);
1192
+ return;
1193
+ }
1194
+ }
1174
1195
  }
1175
1196
  dispose() {
1176
1197
  this.stopPoll();
@@ -1503,9 +1524,12 @@ async function start() {
1503
1524
  const pluginId = session.pluginId ?? ensurePluginId();
1504
1525
  showInfo(`${session.userName} \xB7 ${import_picocolors2.default.cyan(session.plan)}`);
1505
1526
  showInfo("Launching Claude Code...\n");
1527
+ const cwd = process.cwd();
1506
1528
  const ws = new WebSocketService(session.id, pluginId);
1507
- const outputSvc = new OutputService(session.id, pluginId);
1508
- const historySvc = new HistoryService(pluginId, process.cwd());
1529
+ const historySvc = new HistoryService(pluginId, cwd);
1530
+ const outputSvc = new OutputService(session.id, pluginId, (conversationId) => {
1531
+ historySvc.setCurrentConversationId(conversationId);
1532
+ });
1509
1533
  function sendPrompt(prompt) {
1510
1534
  outputSvc.newTurn();
1511
1535
  claude.sendCommand(prompt);
@@ -1555,7 +1579,8 @@ async function start() {
1555
1579
  break;
1556
1580
  case "get_context": {
1557
1581
  const usage = historySvc.getCurrentUsage();
1558
- await relay.sendResult(cmd.id, "completed", usage ?? { error: "No usage data found" });
1582
+ const result = usage ?? { used: 0, total: 2e5, percent: 0, model: null, outputTokens: 0, cacheReadTokens: 0, error: "No usage data found" };
1583
+ await relay.sendResult(cmd.id, "completed", result);
1559
1584
  break;
1560
1585
  }
1561
1586
  case "resume_session": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.8",
3
+ "version": "1.4.10",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {