codeam-cli 1.4.34 → 1.4.36
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 +18 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
|
|
|
116
116
|
// package.json
|
|
117
117
|
var package_default = {
|
|
118
118
|
name: "codeam-cli",
|
|
119
|
-
version: "1.4.
|
|
119
|
+
version: "1.4.36",
|
|
120
120
|
description: "Remote control Claude Code from your mobile device",
|
|
121
121
|
main: "dist/index.js",
|
|
122
122
|
bin: {
|
|
@@ -1387,13 +1387,13 @@ function post(endpoint, body) {
|
|
|
1387
1387
|
},
|
|
1388
1388
|
(res) => {
|
|
1389
1389
|
res.resume();
|
|
1390
|
-
resolve();
|
|
1390
|
+
resolve(res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300);
|
|
1391
1391
|
}
|
|
1392
1392
|
);
|
|
1393
|
-
req.on("error", () => resolve());
|
|
1393
|
+
req.on("error", () => resolve(false));
|
|
1394
1394
|
req.on("timeout", () => {
|
|
1395
1395
|
req.destroy();
|
|
1396
|
-
resolve();
|
|
1396
|
+
resolve(false);
|
|
1397
1397
|
});
|
|
1398
1398
|
req.write(payload);
|
|
1399
1399
|
req.end();
|
|
@@ -1669,22 +1669,28 @@ var HistoryService = class {
|
|
|
1669
1669
|
/**
|
|
1670
1670
|
* Read a specific session's full conversation and POST it to the API in batches.
|
|
1671
1671
|
* Batching avoids Vercel's 4.5 MB body limit for long sessions.
|
|
1672
|
-
*
|
|
1672
|
+
* Every batch MUST be confirmed (2xx) before proceeding — retries with
|
|
1673
|
+
* exponential backoff (500 ms → 1 s → 2 s → 4 s → 8 s). Throws if a batch
|
|
1674
|
+
* still fails after all attempts so callers skip newTurnResume instead of
|
|
1675
|
+
* showing an empty conversation.
|
|
1673
1676
|
*/
|
|
1674
1677
|
async loadConversation(sessionId) {
|
|
1675
1678
|
const filePath = path4.join(this.projectDir, `${sessionId}.jsonl`);
|
|
1676
1679
|
const messages = parseJsonl(filePath);
|
|
1677
1680
|
if (messages.length === 0) return;
|
|
1678
1681
|
const totalBatches = Math.ceil(messages.length / CONVERSATION_BATCH_SIZE);
|
|
1682
|
+
const RETRY_DELAYS = [500, 1e3, 2e3, 4e3, 8e3];
|
|
1679
1683
|
for (let i = 0; i < totalBatches; i++) {
|
|
1680
1684
|
const batch = messages.slice(i * CONVERSATION_BATCH_SIZE, (i + 1) * CONVERSATION_BATCH_SIZE);
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1685
|
+
const body = { pluginId: this.pluginId, sessionId, messages: batch, batchIndex: i, totalBatches };
|
|
1686
|
+
let ok = await post("/api/sessions/claude-conversation", body);
|
|
1687
|
+
for (let attempt = 0; !ok && attempt < RETRY_DELAYS.length; attempt++) {
|
|
1688
|
+
await new Promise((r) => setTimeout(r, RETRY_DELAYS[attempt]));
|
|
1689
|
+
ok = await post("/api/sessions/claude-conversation", body);
|
|
1690
|
+
}
|
|
1691
|
+
if (!ok) {
|
|
1692
|
+
throw new Error(`Failed to upload conversation batch ${i + 1}/${totalBatches} after all retries`);
|
|
1693
|
+
}
|
|
1688
1694
|
}
|
|
1689
1695
|
}
|
|
1690
1696
|
};
|