codeam-cli 1.4.33 → 1.4.35

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 +21 -15
  2. 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.33",
119
+ version: "1.4.35",
120
120
  description: "Remote control Claude Code from your mobile device",
121
121
  main: "dist/index.js",
122
122
  bin: {
@@ -1338,8 +1338,7 @@ function extractText(content) {
1338
1338
  }
1339
1339
  return "";
1340
1340
  }
1341
- var MAX_CONVERSATION_MESSAGES = 100;
1342
- var MAX_MESSAGE_TEXT_LENGTH = 2e3;
1341
+ var CONVERSATION_BATCH_SIZE = 30;
1343
1342
  function parseJsonl(filePath) {
1344
1343
  const messages = [];
1345
1344
  let raw;
@@ -1359,15 +1358,15 @@ function parseJsonl(filePath) {
1359
1358
  const uuid = record["uuid"] ?? `${Date.now()}-${Math.random()}`;
1360
1359
  if (type === "user" && msg) {
1361
1360
  const text = extractText(msg["content"]).trim();
1362
- if (text) messages.push({ id: uuid, role: "user", text: text.slice(0, MAX_MESSAGE_TEXT_LENGTH), timestamp });
1361
+ if (text) messages.push({ id: uuid, role: "user", text, timestamp });
1363
1362
  } else if (type === "assistant" && msg) {
1364
1363
  const text = extractText(msg["content"]).trim();
1365
- if (text) messages.push({ id: uuid, role: "agent", text: text.slice(0, MAX_MESSAGE_TEXT_LENGTH), timestamp });
1364
+ if (text) messages.push({ id: uuid, role: "agent", text, timestamp });
1366
1365
  }
1367
1366
  } catch {
1368
1367
  }
1369
1368
  }
1370
- return messages.slice(-MAX_CONVERSATION_MESSAGES);
1369
+ return messages;
1371
1370
  }
1372
1371
  function post(endpoint, body) {
1373
1372
  return new Promise((resolve) => {
@@ -1388,13 +1387,13 @@ function post(endpoint, body) {
1388
1387
  },
1389
1388
  (res) => {
1390
1389
  res.resume();
1391
- resolve();
1390
+ resolve(res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300);
1392
1391
  }
1393
1392
  );
1394
- req.on("error", () => resolve());
1393
+ req.on("error", () => resolve(false));
1395
1394
  req.on("timeout", () => {
1396
1395
  req.destroy();
1397
- resolve();
1396
+ resolve(false);
1398
1397
  });
1399
1398
  req.write(payload);
1400
1399
  req.end();
@@ -1668,17 +1667,24 @@ var HistoryService = class {
1668
1667
  await post("/api/sessions/claude-sessions", { pluginId: this.pluginId, sessions: sessions2 });
1669
1668
  }
1670
1669
  /**
1671
- * Read a specific session's full conversation and POST it to the API.
1670
+ * Read a specific session's full conversation and POST it to the API in batches.
1671
+ * Batching avoids Vercel's 4.5 MB body limit for long sessions.
1672
1672
  * Called before sending the resume signal so clients can fetch it immediately.
1673
1673
  */
1674
1674
  async loadConversation(sessionId) {
1675
1675
  const filePath = path4.join(this.projectDir, `${sessionId}.jsonl`);
1676
1676
  const messages = parseJsonl(filePath);
1677
- await post("/api/sessions/claude-conversation", {
1678
- pluginId: this.pluginId,
1679
- sessionId,
1680
- messages
1681
- });
1677
+ if (messages.length === 0) return;
1678
+ const totalBatches = Math.ceil(messages.length / CONVERSATION_BATCH_SIZE);
1679
+ for (let i = 0; i < totalBatches; i++) {
1680
+ const batch = messages.slice(i * CONVERSATION_BATCH_SIZE, (i + 1) * CONVERSATION_BATCH_SIZE);
1681
+ const body = { pluginId: this.pluginId, sessionId, messages: batch, batchIndex: i, totalBatches };
1682
+ const ok = await post("/api/sessions/claude-conversation", body);
1683
+ if (!ok) {
1684
+ await new Promise((r) => setTimeout(r, 1e3));
1685
+ await post("/api/sessions/claude-conversation", body);
1686
+ }
1687
+ }
1682
1688
  }
1683
1689
  };
1684
1690
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.33",
3
+ "version": "1.4.35",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {