codeam-cli 2.12.0 → 2.12.1
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 +101 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1919,7 +1919,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
|
|
|
1919
1919
|
// package.json
|
|
1920
1920
|
var package_default = {
|
|
1921
1921
|
name: "codeam-cli",
|
|
1922
|
-
version: "2.12.
|
|
1922
|
+
version: "2.12.1",
|
|
1923
1923
|
description: "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands \u2014 from anywhere.",
|
|
1924
1924
|
type: "commonjs",
|
|
1925
1925
|
main: "dist/index.js",
|
|
@@ -5676,39 +5676,116 @@ var import_node_path2 = __toESM(require("path"));
|
|
|
5676
5676
|
var import_node_os = __toESM(require("os"));
|
|
5677
5677
|
function resolveHistoryDir2(_cwd, homeOverride) {
|
|
5678
5678
|
const home = homeOverride ?? import_node_os.default.homedir();
|
|
5679
|
-
const
|
|
5680
|
-
if (!import_node_fs2.default.existsSync(
|
|
5681
|
-
|
|
5679
|
+
const sessionsRoot = import_node_path2.default.join(home, ".codex", "sessions");
|
|
5680
|
+
if (!import_node_fs2.default.existsSync(sessionsRoot)) return null;
|
|
5681
|
+
const now = /* @__PURE__ */ new Date();
|
|
5682
|
+
const yyyy = String(now.getUTCFullYear());
|
|
5683
|
+
const mm = String(now.getUTCMonth() + 1).padStart(2, "0");
|
|
5684
|
+
const dd = String(now.getUTCDate()).padStart(2, "0");
|
|
5685
|
+
const todayDir = import_node_path2.default.join(sessionsRoot, yyyy, mm, dd);
|
|
5686
|
+
if (!import_node_fs2.default.existsSync(todayDir)) return null;
|
|
5687
|
+
return todayDir;
|
|
5688
|
+
}
|
|
5689
|
+
function parseLine(line) {
|
|
5690
|
+
try {
|
|
5691
|
+
const parsed = JSON.parse(line);
|
|
5692
|
+
if (parsed && typeof parsed === "object" && typeof parsed.timestamp === "string" && typeof parsed.type === "string") {
|
|
5693
|
+
return parsed;
|
|
5694
|
+
}
|
|
5695
|
+
} catch {
|
|
5696
|
+
}
|
|
5697
|
+
return null;
|
|
5698
|
+
}
|
|
5699
|
+
function extractMessageText(content) {
|
|
5700
|
+
if (!Array.isArray(content)) return "";
|
|
5701
|
+
const parts = [];
|
|
5702
|
+
for (const block of content) {
|
|
5703
|
+
if (!block || typeof block !== "object") continue;
|
|
5704
|
+
if (typeof block.text === "string" && block.text.length > 0) {
|
|
5705
|
+
if (block.type === "input_text" || block.type === "output_text") {
|
|
5706
|
+
parts.push(block.text);
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
}
|
|
5710
|
+
return parts.join("\n");
|
|
5682
5711
|
}
|
|
5683
|
-
function
|
|
5684
|
-
if (
|
|
5685
|
-
|
|
5686
|
-
return
|
|
5712
|
+
function mapRole(codexRole) {
|
|
5713
|
+
if (codexRole === "user") return "user";
|
|
5714
|
+
if (codexRole === "assistant") return "agent";
|
|
5715
|
+
return "system";
|
|
5687
5716
|
}
|
|
5688
5717
|
function parseHistoryFile2(filePath) {
|
|
5689
5718
|
const raw = import_node_fs2.default.readFileSync(filePath, "utf8");
|
|
5719
|
+
const lines = raw.split("\n").filter(Boolean);
|
|
5720
|
+
for (const line of lines) {
|
|
5721
|
+
const rec = parseLine(line);
|
|
5722
|
+
if (!rec) continue;
|
|
5723
|
+
if (rec.type === "session_meta") {
|
|
5724
|
+
const meta = rec.payload;
|
|
5725
|
+
if (meta && typeof meta.cwd === "string") {
|
|
5726
|
+
let resolvedMeta;
|
|
5727
|
+
let resolvedCurrent;
|
|
5728
|
+
try {
|
|
5729
|
+
resolvedMeta = import_node_fs2.default.realpathSync(meta.cwd);
|
|
5730
|
+
resolvedCurrent = import_node_fs2.default.realpathSync(process.cwd());
|
|
5731
|
+
} catch {
|
|
5732
|
+
resolvedMeta = import_node_path2.default.resolve(meta.cwd);
|
|
5733
|
+
resolvedCurrent = import_node_path2.default.resolve(process.cwd());
|
|
5734
|
+
}
|
|
5735
|
+
if (resolvedMeta !== resolvedCurrent) {
|
|
5736
|
+
return [];
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
break;
|
|
5740
|
+
}
|
|
5741
|
+
}
|
|
5690
5742
|
const out = [];
|
|
5691
5743
|
let idx = 0;
|
|
5692
|
-
for (const line of
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5744
|
+
for (const line of lines) {
|
|
5745
|
+
const rec = parseLine(line);
|
|
5746
|
+
if (!rec) continue;
|
|
5747
|
+
if (rec.type !== "response_item") continue;
|
|
5748
|
+
const payload = rec.payload;
|
|
5749
|
+
const msg = payload?.Message;
|
|
5750
|
+
if (!msg) continue;
|
|
5751
|
+
const text = extractMessageText(msg.content);
|
|
5752
|
+
if (!text) continue;
|
|
5700
5753
|
out.push({
|
|
5701
|
-
id:
|
|
5702
|
-
role:
|
|
5703
|
-
text
|
|
5704
|
-
timestamp:
|
|
5754
|
+
id: `rollout:${idx}`,
|
|
5755
|
+
role: mapRole(msg.role),
|
|
5756
|
+
text,
|
|
5757
|
+
timestamp: rec.timestamp
|
|
5705
5758
|
});
|
|
5706
5759
|
idx++;
|
|
5707
5760
|
}
|
|
5708
5761
|
return out;
|
|
5709
5762
|
}
|
|
5710
|
-
function getCurrentUsage2(
|
|
5711
|
-
return null;
|
|
5763
|
+
function getCurrentUsage2(historyDir) {
|
|
5764
|
+
if (!import_node_fs2.default.existsSync(historyDir)) return null;
|
|
5765
|
+
const files = import_node_fs2.default.readdirSync(historyDir).filter((f) => f.startsWith("rollout-") && f.endsWith(".jsonl")).map((f) => ({ name: f, full: import_node_path2.default.join(historyDir, f) })).map((e) => ({ ...e, mtime: import_node_fs2.default.statSync(e.full).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
5766
|
+
if (files.length === 0) return null;
|
|
5767
|
+
const latest = files[0].full;
|
|
5768
|
+
const raw = import_node_fs2.default.readFileSync(latest, "utf8");
|
|
5769
|
+
let lastTokenCount = null;
|
|
5770
|
+
for (const line of raw.split("\n").filter(Boolean)) {
|
|
5771
|
+
const rec = parseLine(line);
|
|
5772
|
+
if (!rec || rec.type !== "event_msg") continue;
|
|
5773
|
+
const payload = rec.payload;
|
|
5774
|
+
const info = payload?.TokenCount?.info;
|
|
5775
|
+
const total2 = info?.total_token_usage?.total_tokens;
|
|
5776
|
+
const window = info?.model_context_window;
|
|
5777
|
+
if (typeof total2 === "number" && typeof window === "number" && window > 0) {
|
|
5778
|
+
lastTokenCount = { total: total2, window };
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
if (!lastTokenCount) return null;
|
|
5782
|
+
const used = lastTokenCount.total;
|
|
5783
|
+
const total = lastTokenCount.window;
|
|
5784
|
+
return {
|
|
5785
|
+
used,
|
|
5786
|
+
total,
|
|
5787
|
+
percent: Math.min(100, Math.round(used / total * 100))
|
|
5788
|
+
};
|
|
5712
5789
|
}
|
|
5713
5790
|
|
|
5714
5791
|
// src/agents/codex/runtime.ts
|
|
@@ -9963,7 +10040,7 @@ async function stopWorkspaceFromLocal(target) {
|
|
|
9963
10040
|
// src/commands/version.ts
|
|
9964
10041
|
var import_picocolors11 = __toESM(require("picocolors"));
|
|
9965
10042
|
function version() {
|
|
9966
|
-
const v = true ? "2.12.
|
|
10043
|
+
const v = true ? "2.12.1" : "unknown";
|
|
9967
10044
|
console.log(`${import_picocolors11.default.bold("codeam-cli")} ${import_picocolors11.default.cyan(v)}`);
|
|
9968
10045
|
}
|
|
9969
10046
|
|
|
@@ -10098,7 +10175,7 @@ function checkForUpdates() {
|
|
|
10098
10175
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
10099
10176
|
if (process.env.CI) return;
|
|
10100
10177
|
if (!process.stdout.isTTY) return;
|
|
10101
|
-
const current = true ? "2.12.
|
|
10178
|
+
const current = true ? "2.12.1" : null;
|
|
10102
10179
|
if (!current) return;
|
|
10103
10180
|
const cache = readCache();
|
|
10104
10181
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeam-cli",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"description": "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands — from anywhere.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|