codeam-cli 1.4.44 → 1.4.45

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 +24 -12
  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.44",
119
+ version: "1.4.45",
120
120
  description: "Remote control Claude Code from your mobile device",
121
121
  main: "dist/index.js",
122
122
  bin: {
@@ -1527,13 +1527,28 @@ var HistoryService = class {
1527
1527
  getCurrentConversationId() {
1528
1528
  return this.currentConversationId;
1529
1529
  }
1530
- /** Return the text of the last user message in the current conversation, or null. */
1531
- getLastUserMessage() {
1532
- if (!this.currentConversationId) return null;
1530
+ /** Return the current message count in the active conversation. */
1531
+ getCurrentMessageCount() {
1532
+ if (!this.currentConversationId) return 0;
1533
1533
  const filePath = path4.join(this.projectDir, `${this.currentConversationId}.jsonl`);
1534
- const messages = parseJsonl(filePath);
1535
- for (let i = messages.length - 1; i >= 0; i--) {
1536
- if (messages[i].role === "user") return messages[i].text;
1534
+ return parseJsonl(filePath).length;
1535
+ }
1536
+ /**
1537
+ * Poll the JSONL until a new user message appears after previousCount entries.
1538
+ * Returns the text of the new user message, or null if not found within timeoutMs.
1539
+ */
1540
+ async waitForNewUserMessage(previousCount, timeoutMs = 4e3) {
1541
+ const deadline = Date.now() + timeoutMs;
1542
+ while (Date.now() < deadline) {
1543
+ if (!this.currentConversationId) return null;
1544
+ const filePath = path4.join(this.projectDir, `${this.currentConversationId}.jsonl`);
1545
+ const messages = parseJsonl(filePath);
1546
+ if (messages.length > previousCount) {
1547
+ for (let i = messages.length - 1; i >= previousCount; i--) {
1548
+ if (messages[i].role === "user") return messages[i].text;
1549
+ }
1550
+ }
1551
+ await new Promise((r) => setTimeout(r, 150));
1537
1552
  }
1538
1553
  return null;
1539
1554
  }
@@ -1898,11 +1913,8 @@ except Exception:sys.exit(0)
1898
1913
  fetchQuotaUsage();
1899
1914
  }
1900
1915
  }, () => {
1901
- setTimeout(() => {
1902
- const userText = historySvc.getLastUserMessage() ?? void 0;
1903
- outputSvc.startTerminalTurn(userText).catch(() => {
1904
- });
1905
- }, 300);
1916
+ const prevCount = historySvc.getCurrentMessageCount();
1917
+ historySvc.waitForNewUserMessage(prevCount).then((userText) => outputSvc.startTerminalTurn(userText ?? void 0)).catch(() => outputSvc.startTerminalTurn(void 0));
1906
1918
  });
1907
1919
  function sendPrompt(prompt) {
1908
1920
  outputSvc.newTurn();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.4.44",
3
+ "version": "1.4.45",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {