codeam-cli 1.4.15 → 1.4.17
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.
- package/dist/index.js +23 -15
- 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.
|
|
118
|
+
version: "1.4.17",
|
|
119
119
|
description: "Remote control Claude Code from your mobile device",
|
|
120
120
|
main: "dist/index.js",
|
|
121
121
|
bin: {
|
|
@@ -1411,6 +1411,23 @@ var HistoryService = class {
|
|
|
1411
1411
|
setCurrentConversationId(id) {
|
|
1412
1412
|
this.currentConversationId = id;
|
|
1413
1413
|
}
|
|
1414
|
+
/** Detect the active conversation by finding the most recently modified JSONL file */
|
|
1415
|
+
detectCurrentConversation() {
|
|
1416
|
+
const dir = this.projectDir;
|
|
1417
|
+
try {
|
|
1418
|
+
const files = fs4.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
1419
|
+
try {
|
|
1420
|
+
return { name: e.name, mtime: fs4.statSync(path4.join(dir, e.name)).mtimeMs };
|
|
1421
|
+
} catch {
|
|
1422
|
+
return { name: e.name, mtime: 0 };
|
|
1423
|
+
}
|
|
1424
|
+
}).sort((a, b) => b.mtime - a.mtime);
|
|
1425
|
+
if (files.length > 0) {
|
|
1426
|
+
this.currentConversationId = path4.basename(files[0].name, ".jsonl");
|
|
1427
|
+
}
|
|
1428
|
+
} catch {
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1414
1431
|
/** Extract conversation ID from Claude output (e.g., from session resume messages) */
|
|
1415
1432
|
tryExtractConversationIdFromOutput(output) {
|
|
1416
1433
|
const patterns = [
|
|
@@ -1450,20 +1467,9 @@ var HistoryService = class {
|
|
|
1450
1467
|
}
|
|
1451
1468
|
}).sort((a, b) => b.mtime - a.mtime);
|
|
1452
1469
|
if (files.length === 0) return null;
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
if (idx > 0) {
|
|
1457
|
-
const [target] = files.splice(idx, 1);
|
|
1458
|
-
files.unshift(target);
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
const MAX_FILES_TO_TRY = 10;
|
|
1462
|
-
for (let i = 0; i < Math.min(files.length, MAX_FILES_TO_TRY); i++) {
|
|
1463
|
-
const result = this.extractUsageFromFile(path4.join(dir, files[i].name));
|
|
1464
|
-
if (result) return result;
|
|
1465
|
-
}
|
|
1466
|
-
return null;
|
|
1470
|
+
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
1471
|
+
if (!files.some((f) => f.name === targetFile)) return null;
|
|
1472
|
+
return this.extractUsageFromFile(path4.join(dir, targetFile));
|
|
1467
1473
|
}
|
|
1468
1474
|
extractUsageFromFile(filePath) {
|
|
1469
1475
|
let raw;
|
|
@@ -1701,6 +1707,7 @@ async function start() {
|
|
|
1701
1707
|
const id = cmd.payload.id;
|
|
1702
1708
|
const auto = cmd.payload.auto ?? false;
|
|
1703
1709
|
if (!id) break;
|
|
1710
|
+
historySvc.setCurrentConversationId(id);
|
|
1704
1711
|
await historySvc.loadConversation(id);
|
|
1705
1712
|
await outputSvc.newTurnResume(id);
|
|
1706
1713
|
claude.restart(id, auto);
|
|
@@ -1787,6 +1794,7 @@ async function start() {
|
|
|
1787
1794
|
process.once("SIGINT", sigintHandler);
|
|
1788
1795
|
claude.spawn();
|
|
1789
1796
|
setTimeout(() => {
|
|
1797
|
+
historySvc.detectCurrentConversation();
|
|
1790
1798
|
historySvc.load().catch(() => {
|
|
1791
1799
|
});
|
|
1792
1800
|
}, 2e3);
|