codeam-cli 1.4.45 → 1.4.47
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 +97 -1
- 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.47",
|
|
120
120
|
description: "Remote control Claude Code from your mobile device",
|
|
121
121
|
main: "dist/index.js",
|
|
122
122
|
bin: {
|
|
@@ -896,6 +896,81 @@ var ClaudeService = class {
|
|
|
896
896
|
// src/services/output.service.ts
|
|
897
897
|
var https2 = __toESM(require("https"));
|
|
898
898
|
var http2 = __toESM(require("http"));
|
|
899
|
+
|
|
900
|
+
// src/services/parseChrome.ts
|
|
901
|
+
var SPINNER_RE = /^[✳✢✶✻✽✴✷✸✹⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏◐◑◒◓▁▂▃▄▅▆▇█]\s/;
|
|
902
|
+
var BULLET_TOOL_RE = /^•\s+(?:Read(?:ing)?|Edit(?:ing)?|Writ(?:e|ing)|Bash|Runn(?:ing)?|Search(?:ing)?|Glob(?:bing)?|Grep(?:ping)?|Creat(?:e|ing)|Execut(?:e|ing)|Task|Agent|NotebookEdit)\b/i;
|
|
903
|
+
var TREE_LINE_RE = /^└\s/;
|
|
904
|
+
var STATUS_LINE_RE = /^\+\s/;
|
|
905
|
+
function isChromeLine(line) {
|
|
906
|
+
const t = line.trim();
|
|
907
|
+
if (!t) return false;
|
|
908
|
+
if (/^[─━—═─\-]{3,}$/.test(t)) return true;
|
|
909
|
+
if (SPINNER_RE.test(t)) return true;
|
|
910
|
+
if (BULLET_TOOL_RE.test(t)) return true;
|
|
911
|
+
if (TREE_LINE_RE.test(t)) return true;
|
|
912
|
+
if (STATUS_LINE_RE.test(t) && /\d+\s*s\s*[·•]|\bthought\s+for\b|\d+\s*tokens/i.test(t)) return true;
|
|
913
|
+
if (/esc.{0,5}to.{0,5}interrupt/i.test(t)) return true;
|
|
914
|
+
if (/high\s*[·•]\s*\/effort/i.test(t)) return true;
|
|
915
|
+
if (/^[❯>]\s*$/.test(t)) return true;
|
|
916
|
+
if (/^\(thinking\)\s*$/.test(t)) return true;
|
|
917
|
+
if (/^\?\s.*shortcut/i.test(t)) return true;
|
|
918
|
+
if (/spending limit|usage limit/i.test(t) && t.length < 80) return true;
|
|
919
|
+
if (/↑\s*\/?\s*↓\s*to\s*navigate/i.test(t)) return true;
|
|
920
|
+
if (t.replace(/\s/g, "").length === 1) return true;
|
|
921
|
+
if ((t.match(/─/g)?.length ?? 0) >= 6) return true;
|
|
922
|
+
if (/ctrl\+?o\s+to\s+expand/i.test(t)) return true;
|
|
923
|
+
const stripped = t.replace(/^[│╭╰╮╯┌└┐┘├┤┬┴┼]\s?/, "");
|
|
924
|
+
if (/^[❯>]\s+\S/.test(stripped) && !/^[❯>]\s*\d+\./.test(stripped)) return true;
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
function parseChromeLine(line) {
|
|
928
|
+
const t = line.trim();
|
|
929
|
+
if (!t) return null;
|
|
930
|
+
if (/^[─━—═─\-]{3,}$/.test(t)) return null;
|
|
931
|
+
if (/^[❯>]\s*$/.test(t)) return null;
|
|
932
|
+
if (t.replace(/\s/g, "").length === 1) return null;
|
|
933
|
+
if ((t.match(/─/g)?.length ?? 0) >= 6) return null;
|
|
934
|
+
if (/^\(thinking\)\s*$/.test(t)) {
|
|
935
|
+
return { tool: "thinking", label: "Thinking\u2026", status: "running" };
|
|
936
|
+
}
|
|
937
|
+
if (TREE_LINE_RE.test(t)) return null;
|
|
938
|
+
if (STATUS_LINE_RE.test(t) && /\d+\s*s\s*[·•]|\bthought\s+for\b|\d+\s*tokens/i.test(t)) {
|
|
939
|
+
const label = t.slice(2).replace(/\s*\(\d+s.*\)$/, "").replace(/…$/, "").trim() || "Thinking\u2026";
|
|
940
|
+
return { tool: "thinking", label, status: "running" };
|
|
941
|
+
}
|
|
942
|
+
let text = t;
|
|
943
|
+
if (SPINNER_RE.test(t)) {
|
|
944
|
+
text = t.slice(2).trim();
|
|
945
|
+
} else if (BULLET_TOOL_RE.test(t)) {
|
|
946
|
+
text = t.slice(2).trim();
|
|
947
|
+
text = text.replace(/\s*\(ctrl\+?o[^)]*\)/gi, "").replace(/,\s*reading\s+\d+\s+files?\s*…?/gi, "").replace(/,\s*\d+\s+files?\s*…?/gi, "").replace(/…$/, "").trim();
|
|
948
|
+
}
|
|
949
|
+
if (!text) return null;
|
|
950
|
+
return classifyStep(text);
|
|
951
|
+
}
|
|
952
|
+
function classifyStep(text) {
|
|
953
|
+
if (/^Read(?:ing)?\s+/i.test(text)) {
|
|
954
|
+
const label2 = text.replace(/^Read(?:ing)?\s+/i, "").replace(/\.\.\.$/, "").trim();
|
|
955
|
+
return { tool: "read", label: label2, status: "running" };
|
|
956
|
+
}
|
|
957
|
+
if (/^Edit(?:ing)?\s+|^Writ(?:e|ing|ing to)\s+|^Creat(?:e|ing)\s+/i.test(text)) {
|
|
958
|
+
const label2 = text.replace(/^(?:Edit(?:ing)?|Writ(?:e|ing(?: to)?)|Creat(?:e|ing))\s+/i, "").replace(/\.\.\.$/, "").trim();
|
|
959
|
+
return { tool: "edit", label: label2, status: "running" };
|
|
960
|
+
}
|
|
961
|
+
if (/^Runn(?:ing)?\s+|^Execut(?:e|ing)\s+|^Bash(?:ing)?\s*:|^\$\s+/i.test(text)) {
|
|
962
|
+
const label2 = text.replace(/^(?:Runn(?:ing)?|Execut(?:e|ing)|Bash(?:ing)?:|\$)\s+/i, "").replace(/\.\.\.$/, "").trim();
|
|
963
|
+
return { tool: "bash", label: label2, status: "running" };
|
|
964
|
+
}
|
|
965
|
+
if (/^Search(?:ing)?\s+for\s+|^Grep(?:ping)?\s*:/i.test(text)) {
|
|
966
|
+
const label2 = text.replace(/^(?:Search(?:ing)?\s+for|Grep(?:ping)?:)\s+/i, "").replace(/\.\.\.$/, "").trim();
|
|
967
|
+
return { tool: "search", label: label2, status: "running" };
|
|
968
|
+
}
|
|
969
|
+
const label = text.replace(/\.\.\.$/, "").trim();
|
|
970
|
+
return { tool: "other", label, status: "running" };
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
// src/services/output.service.ts
|
|
899
974
|
var API_BASE4 = process.env.CODEAM_API_URL ?? "https://codeagent-mobile-api.vercel.app";
|
|
900
975
|
function renderToLines(raw) {
|
|
901
976
|
const screen = [""];
|
|
@@ -1132,6 +1207,12 @@ function filterChrome(lines) {
|
|
|
1132
1207
|
if (t.replace(/\s/g, "").length === 1) continue;
|
|
1133
1208
|
if ((t.match(/─/g)?.length ?? 0) >= 6) continue;
|
|
1134
1209
|
if (/ctrl\+?o\s+to\s+expand/i.test(t)) continue;
|
|
1210
|
+
if (/^•\s+(?:Read(?:ing)?|Edit(?:ing)?|Writ(?:e|ing)|Bash|Runn(?:ing)?|Search(?:ing)?|Glob(?:bing)?|Grep(?:ping)?|Creat(?:e|ing)|Execut(?:e|ing)|Task|Agent|NotebookEdit)\b/i.test(
|
|
1211
|
+
t
|
|
1212
|
+
))
|
|
1213
|
+
continue;
|
|
1214
|
+
if (/^└\s/.test(t)) continue;
|
|
1215
|
+
if (/^\+\s/.test(t) && /\d+\s*s\s*[·•]|\bthought\s+for\b|\d+\s*tokens/i.test(t)) continue;
|
|
1135
1216
|
const stripped = t.replace(/^[│╭╰╮╯┌└┐┘├┤┬┴┼]\s?/, "");
|
|
1136
1217
|
if (/^[❯>]\s+\S/.test(stripped) && !/^[❯>]\s*\d+\./.test(stripped)) {
|
|
1137
1218
|
skipEchoContinuation = true;
|
|
@@ -1155,6 +1236,7 @@ var OutputService = class _OutputService {
|
|
|
1155
1236
|
pluginId;
|
|
1156
1237
|
rawBuffer = "";
|
|
1157
1238
|
lastSentContent = "";
|
|
1239
|
+
lastSentChromeStepsJson = "";
|
|
1158
1240
|
pollTimer = null;
|
|
1159
1241
|
startTime = 0;
|
|
1160
1242
|
active = false;
|
|
@@ -1189,6 +1271,7 @@ var OutputService = class _OutputService {
|
|
|
1189
1271
|
this.stopPoll();
|
|
1190
1272
|
this.rawBuffer = "";
|
|
1191
1273
|
this.lastSentContent = "";
|
|
1274
|
+
this.lastSentChromeStepsJson = "";
|
|
1192
1275
|
this.lastPushTime = 0;
|
|
1193
1276
|
this.active = true;
|
|
1194
1277
|
this.startTime = Date.now();
|
|
@@ -1203,6 +1286,7 @@ var OutputService = class _OutputService {
|
|
|
1203
1286
|
this.stopPoll();
|
|
1204
1287
|
this.rawBuffer = "";
|
|
1205
1288
|
this.lastSentContent = "";
|
|
1289
|
+
this.lastSentChromeStepsJson = "";
|
|
1206
1290
|
this.lastPushTime = 0;
|
|
1207
1291
|
this.active = true;
|
|
1208
1292
|
this.terminalTurnPending = false;
|
|
@@ -1220,6 +1304,7 @@ var OutputService = class _OutputService {
|
|
|
1220
1304
|
this.stopPoll();
|
|
1221
1305
|
this.rawBuffer = "";
|
|
1222
1306
|
this.lastSentContent = "";
|
|
1307
|
+
this.lastSentChromeStepsJson = "";
|
|
1223
1308
|
this.lastPushTime = 0;
|
|
1224
1309
|
this.active = true;
|
|
1225
1310
|
this.startTime = Date.now();
|
|
@@ -1283,6 +1368,7 @@ var OutputService = class _OutputService {
|
|
|
1283
1368
|
}
|
|
1284
1369
|
if (elapsed < _OutputService.WARMUP_MS) return;
|
|
1285
1370
|
const lines = renderToLines(this.rawBuffer);
|
|
1371
|
+
this.postChromeSteps(lines);
|
|
1286
1372
|
const selector = detectSelector(lines) ?? detectListSelector(lines);
|
|
1287
1373
|
if (selector) {
|
|
1288
1374
|
const idleMs2 = this.lastPushTime > 0 ? now - this.lastPushTime : elapsed;
|
|
@@ -1312,6 +1398,7 @@ var OutputService = class _OutputService {
|
|
|
1312
1398
|
}
|
|
1313
1399
|
finalize() {
|
|
1314
1400
|
const lines = renderToLines(this.rawBuffer);
|
|
1401
|
+
this.postChromeSteps(lines);
|
|
1315
1402
|
const selector = detectSelector(lines) ?? detectListSelector(lines);
|
|
1316
1403
|
this.stopPoll();
|
|
1317
1404
|
this.active = false;
|
|
@@ -1331,6 +1418,15 @@ var OutputService = class _OutputService {
|
|
|
1331
1418
|
this.pollTimer = null;
|
|
1332
1419
|
}
|
|
1333
1420
|
}
|
|
1421
|
+
postChromeSteps(lines) {
|
|
1422
|
+
const steps = lines.filter((l) => isChromeLine(l)).map((l) => parseChromeLine(l)).filter((s) => s !== null);
|
|
1423
|
+
if (steps.length === 0) return;
|
|
1424
|
+
const json = JSON.stringify(steps);
|
|
1425
|
+
if (json === this.lastSentChromeStepsJson) return;
|
|
1426
|
+
this.lastSentChromeStepsJson = json;
|
|
1427
|
+
this.postChunk({ type: "chrome_steps", content: "", steps }).catch(() => {
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1334
1430
|
postChunk(body) {
|
|
1335
1431
|
return new Promise((resolve) => {
|
|
1336
1432
|
const payload = JSON.stringify({
|