codeam-cli 1.4.52 → 1.4.54
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 +54 -42
- 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.54",
|
|
120
120
|
description: "Remote control Claude Code from your mobile device",
|
|
121
121
|
main: "dist/index.js",
|
|
122
122
|
bin: {
|
|
@@ -1449,51 +1449,63 @@ var OutputService = class _OutputService {
|
|
|
1449
1449
|
});
|
|
1450
1450
|
}
|
|
1451
1451
|
postChunk(body) {
|
|
1452
|
+
const isCritical = body.clear === true || body.type === "new_turn" || body.type === "user_message" || body.done === true;
|
|
1453
|
+
const maxRetries = isCritical ? 3 : 0;
|
|
1454
|
+
const payload = JSON.stringify({
|
|
1455
|
+
sessionId: this.sessionId,
|
|
1456
|
+
pluginId: this.pluginId,
|
|
1457
|
+
...body
|
|
1458
|
+
});
|
|
1452
1459
|
return new Promise((resolve) => {
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
"Content-Length": Buffer.byteLength(payload)
|
|
1460
|
+
const attempt = (attemptsLeft) => {
|
|
1461
|
+
let settled = false;
|
|
1462
|
+
const u = new URL(`${API_BASE4}/api/commands/output`);
|
|
1463
|
+
const transport = u.protocol === "https:" ? https2 : http2;
|
|
1464
|
+
const req = transport.request(
|
|
1465
|
+
{
|
|
1466
|
+
hostname: u.hostname,
|
|
1467
|
+
port: u.port || (u.protocol === "https:" ? 443 : 80),
|
|
1468
|
+
path: u.pathname,
|
|
1469
|
+
method: "POST",
|
|
1470
|
+
headers: {
|
|
1471
|
+
"Content-Type": "application/json",
|
|
1472
|
+
"Content-Length": Buffer.byteLength(payload)
|
|
1473
|
+
},
|
|
1474
|
+
timeout: 8e3
|
|
1469
1475
|
},
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1476
|
+
(res) => {
|
|
1477
|
+
let resData = "";
|
|
1478
|
+
res.on("data", (c) => {
|
|
1479
|
+
resData += c.toString();
|
|
1480
|
+
});
|
|
1481
|
+
res.on("end", () => {
|
|
1482
|
+
if (settled) return;
|
|
1483
|
+
settled = true;
|
|
1484
|
+
if (res.statusCode && res.statusCode >= 400) {
|
|
1485
|
+
process.stderr.write(`[codeam] output API error ${res.statusCode}: ${resData}
|
|
1480
1486
|
`);
|
|
1481
|
-
|
|
1487
|
+
}
|
|
1488
|
+
resolve();
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1492
|
+
req.on("error", () => {
|
|
1493
|
+
if (settled) return;
|
|
1494
|
+
settled = true;
|
|
1495
|
+
if (attemptsLeft > 0) {
|
|
1496
|
+
const delay = 200 * (maxRetries - attemptsLeft + 1);
|
|
1497
|
+
setTimeout(() => attempt(attemptsLeft - 1), delay);
|
|
1498
|
+
} else {
|
|
1482
1499
|
resolve();
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
req.destroy();
|
|
1493
|
-
resolve();
|
|
1494
|
-
});
|
|
1495
|
-
req.write(payload);
|
|
1496
|
-
req.end();
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
req.on("timeout", () => {
|
|
1503
|
+
req.destroy();
|
|
1504
|
+
});
|
|
1505
|
+
req.write(payload);
|
|
1506
|
+
req.end();
|
|
1507
|
+
};
|
|
1508
|
+
attempt(maxRetries);
|
|
1497
1509
|
});
|
|
1498
1510
|
}
|
|
1499
1511
|
};
|