codeam-cli 2.52.6 → 2.52.8
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/CHANGELOG.md +12 -0
- package/dist/index.js +229 -144
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to `codeam-cli` are documented here.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [2.52.7] — 2026-07-03
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **cli:** Wait for Claude native binary before spawning the agent in codespaces
|
|
12
|
+
|
|
13
|
+
## [2.52.6] — 2026-07-03
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **cli:** An invalid pairing latches the output pipeline — no more silent dead-token spam
|
|
18
|
+
|
|
7
19
|
## [2.52.5] — 2026-07-02
|
|
8
20
|
|
|
9
21
|
### CI
|
package/dist/index.js
CHANGED
|
@@ -560,8 +560,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
560
560
|
return decodedFile;
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
|
-
function normalizeWindowsPath(
|
|
564
|
-
return
|
|
563
|
+
function normalizeWindowsPath(path63) {
|
|
564
|
+
return path63.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -3041,9 +3041,9 @@ async function addSourceContext(frames) {
|
|
|
3041
3041
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
3042
3042
|
return frames;
|
|
3043
3043
|
}
|
|
3044
|
-
function getContextLinesFromFile(
|
|
3044
|
+
function getContextLinesFromFile(path63, ranges, output) {
|
|
3045
3045
|
return new Promise((resolve7) => {
|
|
3046
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
3046
|
+
const stream = (0, import_node_fs.createReadStream)(path63);
|
|
3047
3047
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
3048
3048
|
input: stream
|
|
3049
3049
|
});
|
|
@@ -3058,7 +3058,7 @@ function getContextLinesFromFile(path62, ranges, output) {
|
|
|
3058
3058
|
let rangeStart = range[0];
|
|
3059
3059
|
let rangeEnd = range[1];
|
|
3060
3060
|
function onStreamError() {
|
|
3061
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
3061
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path63, 1);
|
|
3062
3062
|
lineReaded.close();
|
|
3063
3063
|
lineReaded.removeAllListeners();
|
|
3064
3064
|
destroyStreamAndResolve();
|
|
@@ -3119,8 +3119,8 @@ function clearLineContext(frame) {
|
|
|
3119
3119
|
delete frame.context_line;
|
|
3120
3120
|
delete frame.post_context;
|
|
3121
3121
|
}
|
|
3122
|
-
function shouldSkipContextLinesForFile(
|
|
3123
|
-
return
|
|
3122
|
+
function shouldSkipContextLinesForFile(path63) {
|
|
3123
|
+
return path63.startsWith("node:") || path63.endsWith(".min.js") || path63.endsWith(".min.cjs") || path63.endsWith(".min.mjs") || path63.startsWith("data:");
|
|
3124
3124
|
}
|
|
3125
3125
|
function shouldSkipContextLinesForFrame(frame) {
|
|
3126
3126
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -5397,7 +5397,7 @@ function readAnonId() {
|
|
|
5397
5397
|
}
|
|
5398
5398
|
function superProperties() {
|
|
5399
5399
|
return {
|
|
5400
|
-
cliVersion: true ? "2.52.
|
|
5400
|
+
cliVersion: true ? "2.52.8" : "0.0.0-dev",
|
|
5401
5401
|
nodeVersion: process.version,
|
|
5402
5402
|
platform: process.platform,
|
|
5403
5403
|
arch: process.arch,
|
|
@@ -5578,7 +5578,7 @@ var os4 = __toESM(require("os"));
|
|
|
5578
5578
|
// package.json
|
|
5579
5579
|
var package_default = {
|
|
5580
5580
|
name: "codeam-cli",
|
|
5581
|
-
version: "2.52.
|
|
5581
|
+
version: "2.52.8",
|
|
5582
5582
|
description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
|
|
5583
5583
|
type: "commonjs",
|
|
5584
5584
|
main: "dist/index.js",
|
|
@@ -12842,11 +12842,11 @@ function parseReview(stdout) {
|
|
|
12842
12842
|
for (const line of lines) {
|
|
12843
12843
|
const m = line.match(HUNK_LINE_RE);
|
|
12844
12844
|
if (!m) continue;
|
|
12845
|
-
const [,
|
|
12846
|
-
if (!
|
|
12845
|
+
const [, path63, lineNo, sevToken, message] = m;
|
|
12846
|
+
if (!path63 || !lineNo || !message) continue;
|
|
12847
12847
|
const cleanedMessage = message.trim().replace(/^[*-]\s+/, "");
|
|
12848
12848
|
hunks.push({
|
|
12849
|
-
path:
|
|
12849
|
+
path: path63.trim(),
|
|
12850
12850
|
line: Number(lineNo),
|
|
12851
12851
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
12852
12852
|
message: cleanedMessage
|
|
@@ -14928,7 +14928,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
14928
14928
|
if (process.env.NODE_ENV === "test") return;
|
|
14929
14929
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
14930
14930
|
if (process.env.CI) return;
|
|
14931
|
-
const current = true ? "2.52.
|
|
14931
|
+
const current = true ? "2.52.8" : null;
|
|
14932
14932
|
if (!current) return;
|
|
14933
14933
|
const cache = readCache();
|
|
14934
14934
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -14945,7 +14945,7 @@ function checkForUpdates() {
|
|
|
14945
14945
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
14946
14946
|
if (process.env.CI) return;
|
|
14947
14947
|
if (!process.stdout.isTTY) return;
|
|
14948
|
-
const current = true ? "2.52.
|
|
14948
|
+
const current = true ? "2.52.8" : null;
|
|
14949
14949
|
if (!current) return;
|
|
14950
14950
|
const cache = readCache();
|
|
14951
14951
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -15647,7 +15647,7 @@ var defaultSpawner = (env, cwd, args2 = []) => (0, import_node_child_process15.s
|
|
|
15647
15647
|
detached: false
|
|
15648
15648
|
});
|
|
15649
15649
|
function currentCliVersion() {
|
|
15650
|
-
return true ? "2.52.
|
|
15650
|
+
return true ? "2.52.8" : null;
|
|
15651
15651
|
}
|
|
15652
15652
|
function runCmd(cmd, args2, timeoutMs) {
|
|
15653
15653
|
return new Promise((resolve7) => {
|
|
@@ -20389,12 +20389,12 @@ function readTokenFromArgs(args2) {
|
|
|
20389
20389
|
}
|
|
20390
20390
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
20391
20391
|
if (fileFlag) {
|
|
20392
|
-
const
|
|
20392
|
+
const path63 = fileFlag.slice("--token-file=".length);
|
|
20393
20393
|
try {
|
|
20394
|
-
const content = fs44.readFileSync(
|
|
20395
|
-
if (content.length === 0) fail(`--token-file ${
|
|
20394
|
+
const content = fs44.readFileSync(path63, "utf8").trim();
|
|
20395
|
+
if (content.length === 0) fail(`--token-file ${path63} is empty`);
|
|
20396
20396
|
try {
|
|
20397
|
-
fs44.unlinkSync(
|
|
20397
|
+
fs44.unlinkSync(path63);
|
|
20398
20398
|
} catch {
|
|
20399
20399
|
}
|
|
20400
20400
|
return content;
|
|
@@ -20997,19 +20997,98 @@ var AgentService = class _AgentService {
|
|
|
20997
20997
|
};
|
|
20998
20998
|
|
|
20999
20999
|
// src/agents/acp/adapters.ts
|
|
21000
|
-
var
|
|
21000
|
+
var path51 = __toESM(require("path"));
|
|
21001
|
+
|
|
21002
|
+
// src/agents/acp/agent-binary.ts
|
|
21003
|
+
var import_fs4 = __toESM(require("fs"));
|
|
21004
|
+
var import_path8 = __toESM(require("path"));
|
|
21005
|
+
var import_child_process23 = require("child_process");
|
|
21006
|
+
function currentPlatformKey() {
|
|
21007
|
+
return `${process.platform}-${process.arch}`;
|
|
21008
|
+
}
|
|
21009
|
+
function defaultSdkDir() {
|
|
21010
|
+
try {
|
|
21011
|
+
const manifest = require.resolve("@anthropic-ai/claude-agent-sdk/package.json");
|
|
21012
|
+
return import_path8.default.dirname(manifest);
|
|
21013
|
+
} catch {
|
|
21014
|
+
return null;
|
|
21015
|
+
}
|
|
21016
|
+
}
|
|
21017
|
+
function resolveClaudeNativeBinary(deps = {}) {
|
|
21018
|
+
const existsSync21 = deps.existsSync ?? import_fs4.default.existsSync;
|
|
21019
|
+
const platformKey = deps.platformKey ?? currentPlatformKey();
|
|
21020
|
+
const sdkDir = deps.sdkDir !== void 0 ? deps.sdkDir : defaultSdkDir();
|
|
21021
|
+
if (!sdkDir) return null;
|
|
21022
|
+
const scopeDir = import_path8.default.dirname(sdkDir);
|
|
21023
|
+
const binName = process.platform === "win32" ? "claude.exe" : "claude";
|
|
21024
|
+
const candidate = import_path8.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
21025
|
+
return existsSync21(candidate) ? candidate : null;
|
|
21026
|
+
}
|
|
21027
|
+
var realSleep = (ms) => new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
21028
|
+
async function waitForClaudeNativeBinary(opts = {}) {
|
|
21029
|
+
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
21030
|
+
const pollMs = opts.pollMs ?? 500;
|
|
21031
|
+
const now = opts.now ?? Date.now;
|
|
21032
|
+
const sleep3 = opts.sleep ?? realSleep;
|
|
21033
|
+
const deps = {
|
|
21034
|
+
sdkDir: opts.sdkDir,
|
|
21035
|
+
platformKey: opts.platformKey,
|
|
21036
|
+
existsSync: opts.existsSync
|
|
21037
|
+
};
|
|
21038
|
+
const deadline = now() + timeoutMs;
|
|
21039
|
+
let found = resolveClaudeNativeBinary(deps);
|
|
21040
|
+
if (found) return found;
|
|
21041
|
+
while (now() < deadline) {
|
|
21042
|
+
await sleep3(pollMs);
|
|
21043
|
+
found = resolveClaudeNativeBinary(deps);
|
|
21044
|
+
if (found) return found;
|
|
21045
|
+
}
|
|
21046
|
+
return resolveClaudeNativeBinary(deps);
|
|
21047
|
+
}
|
|
21048
|
+
function isCommandOnPath(cmd, probe = defaultWhich) {
|
|
21049
|
+
return probe(cmd);
|
|
21050
|
+
}
|
|
21051
|
+
function defaultWhich(cmd) {
|
|
21052
|
+
const finder = process.platform === "win32" ? "where" : "which";
|
|
21053
|
+
try {
|
|
21054
|
+
const res = (0, import_child_process23.spawnSync)(finder, [cmd], { stdio: "ignore" });
|
|
21055
|
+
return res.status === 0;
|
|
21056
|
+
} catch {
|
|
21057
|
+
return false;
|
|
21058
|
+
}
|
|
21059
|
+
}
|
|
21060
|
+
async function waitForCommandOnPath(cmd, opts = {}) {
|
|
21061
|
+
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
21062
|
+
const pollMs = opts.pollMs ?? 500;
|
|
21063
|
+
const now = opts.now ?? Date.now;
|
|
21064
|
+
const sleep3 = opts.sleep ?? realSleep;
|
|
21065
|
+
const probe = opts.probe;
|
|
21066
|
+
const check = () => isCommandOnPath(cmd, probe);
|
|
21067
|
+
const deadline = now() + timeoutMs;
|
|
21068
|
+
if (check()) return true;
|
|
21069
|
+
while (now() < deadline) {
|
|
21070
|
+
await sleep3(pollMs);
|
|
21071
|
+
if (check()) return true;
|
|
21072
|
+
}
|
|
21073
|
+
return check();
|
|
21074
|
+
}
|
|
21075
|
+
|
|
21076
|
+
// src/agents/acp/adapters.ts
|
|
21001
21077
|
var require_ = require;
|
|
21078
|
+
function claudeBinaryWaiter(opts = {}) {
|
|
21079
|
+
return waitForClaudeNativeBinary(opts).then((p2) => p2 !== null);
|
|
21080
|
+
}
|
|
21002
21081
|
function resolveBin(pkgName, binName) {
|
|
21003
21082
|
try {
|
|
21004
21083
|
const manifestPath = require_.resolve(`${pkgName}/package.json`);
|
|
21005
21084
|
const manifest = require_(`${pkgName}/package.json`);
|
|
21006
|
-
const pkgDir =
|
|
21085
|
+
const pkgDir = path51.dirname(manifestPath);
|
|
21007
21086
|
const bin = manifest.bin;
|
|
21008
21087
|
if (!bin) return null;
|
|
21009
|
-
if (typeof bin === "string") return
|
|
21088
|
+
if (typeof bin === "string") return path51.resolve(pkgDir, bin);
|
|
21010
21089
|
const target = binName ?? Object.keys(bin)[0];
|
|
21011
21090
|
if (!target || !bin[target]) return null;
|
|
21012
|
-
return
|
|
21091
|
+
return path51.resolve(pkgDir, bin[target]);
|
|
21013
21092
|
} catch {
|
|
21014
21093
|
return null;
|
|
21015
21094
|
}
|
|
@@ -21021,7 +21100,8 @@ var REGISTRY = {
|
|
|
21021
21100
|
return {
|
|
21022
21101
|
command: process.execPath,
|
|
21023
21102
|
args: [bin],
|
|
21024
|
-
requiresAgentBinary: "claude"
|
|
21103
|
+
requiresAgentBinary: "claude",
|
|
21104
|
+
waitForBinary: claudeBinaryWaiter
|
|
21025
21105
|
};
|
|
21026
21106
|
},
|
|
21027
21107
|
codex: () => {
|
|
@@ -21030,7 +21110,9 @@ var REGISTRY = {
|
|
|
21030
21110
|
return {
|
|
21031
21111
|
command: process.execPath,
|
|
21032
21112
|
args: [bin],
|
|
21033
|
-
requiresAgentBinary: "codex"
|
|
21113
|
+
requiresAgentBinary: "codex",
|
|
21114
|
+
// codex ships via `npm install -g @openai/codex` → PATH binary.
|
|
21115
|
+
waitForBinary: (o) => waitForCommandOnPath("codex", o)
|
|
21034
21116
|
};
|
|
21035
21117
|
},
|
|
21036
21118
|
// Cursor speaks ACP NATIVELY via `cursor-agent acp` ("Start the Cursor
|
|
@@ -21047,7 +21129,8 @@ var REGISTRY = {
|
|
|
21047
21129
|
cursor: () => ({
|
|
21048
21130
|
command: "cursor-agent",
|
|
21049
21131
|
args: ["acp"],
|
|
21050
|
-
requiresAgentBinary: "cursor-agent"
|
|
21132
|
+
requiresAgentBinary: "cursor-agent",
|
|
21133
|
+
waitForBinary: (o) => waitForCommandOnPath("cursor-agent", o)
|
|
21051
21134
|
}),
|
|
21052
21135
|
// Gemini speaks ACP natively via `gemini --acp` — no npm adapter
|
|
21053
21136
|
// package, just the user-installed `gemini` binary on PATH. Same
|
|
@@ -21064,7 +21147,8 @@ var REGISTRY = {
|
|
|
21064
21147
|
// cleaner because it survives whatever shell env the parent
|
|
21065
21148
|
// codeam was launched from.
|
|
21066
21149
|
args: ["--skip-trust", "--acp"],
|
|
21067
|
-
requiresAgentBinary: "gemini"
|
|
21150
|
+
requiresAgentBinary: "gemini",
|
|
21151
|
+
waitForBinary: (o) => waitForCommandOnPath("gemini", o)
|
|
21068
21152
|
})
|
|
21069
21153
|
};
|
|
21070
21154
|
function getAcpAdapter(agent) {
|
|
@@ -21079,8 +21163,8 @@ function requiresAcp(agent) {
|
|
|
21079
21163
|
var import_node_crypto7 = require("crypto");
|
|
21080
21164
|
|
|
21081
21165
|
// src/services/history.service.ts
|
|
21082
|
-
var
|
|
21083
|
-
var
|
|
21166
|
+
var fs46 = __toESM(require("fs"));
|
|
21167
|
+
var path52 = __toESM(require("path"));
|
|
21084
21168
|
var os38 = __toESM(require("os"));
|
|
21085
21169
|
var https7 = __toESM(require("https"));
|
|
21086
21170
|
var http6 = __toESM(require("http"));
|
|
@@ -21108,7 +21192,7 @@ function parseJsonl(filePath) {
|
|
|
21108
21192
|
const messages = [];
|
|
21109
21193
|
let raw;
|
|
21110
21194
|
try {
|
|
21111
|
-
raw =
|
|
21195
|
+
raw = fs46.readFileSync(filePath, "utf8");
|
|
21112
21196
|
} catch (err) {
|
|
21113
21197
|
if (err.code !== "ENOENT") {
|
|
21114
21198
|
log.warn("history:parseJsonl", `read failed for ${filePath}`, err);
|
|
@@ -21249,7 +21333,7 @@ var HistoryService = class _HistoryService {
|
|
|
21249
21333
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
21250
21334
|
}
|
|
21251
21335
|
get projectDir() {
|
|
21252
|
-
return this.runtime.resolveHistoryDir(this.cwd) ??
|
|
21336
|
+
return this.runtime.resolveHistoryDir(this.cwd) ?? path52.join(os38.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
21253
21337
|
}
|
|
21254
21338
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
21255
21339
|
setCurrentConversationId(id) {
|
|
@@ -21261,7 +21345,7 @@ var HistoryService = class _HistoryService {
|
|
|
21261
21345
|
/** Return the current message count in the active conversation. */
|
|
21262
21346
|
getCurrentMessageCount() {
|
|
21263
21347
|
if (!this.currentConversationId) return 0;
|
|
21264
|
-
const filePath =
|
|
21348
|
+
const filePath = path52.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
21265
21349
|
return parseJsonl(filePath).length;
|
|
21266
21350
|
}
|
|
21267
21351
|
/**
|
|
@@ -21272,7 +21356,7 @@ var HistoryService = class _HistoryService {
|
|
|
21272
21356
|
const deadline = Date.now() + timeoutMs;
|
|
21273
21357
|
while (Date.now() < deadline) {
|
|
21274
21358
|
if (!this.currentConversationId) return null;
|
|
21275
|
-
const filePath =
|
|
21359
|
+
const filePath = path52.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
21276
21360
|
const messages = parseJsonl(filePath);
|
|
21277
21361
|
if (messages.length > previousCount) {
|
|
21278
21362
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -21298,16 +21382,16 @@ var HistoryService = class _HistoryService {
|
|
|
21298
21382
|
const dir = this.projectDir;
|
|
21299
21383
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
21300
21384
|
try {
|
|
21301
|
-
const files =
|
|
21385
|
+
const files = fs46.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
21302
21386
|
try {
|
|
21303
|
-
const stat3 =
|
|
21387
|
+
const stat3 = fs46.statSync(path52.join(dir, e.name));
|
|
21304
21388
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
21305
21389
|
} catch {
|
|
21306
21390
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
21307
21391
|
}
|
|
21308
21392
|
}).filter((f) => f.birthtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
21309
21393
|
if (files.length > 0) {
|
|
21310
|
-
this.currentConversationId =
|
|
21394
|
+
this.currentConversationId = path52.basename(files[0].name, ".jsonl");
|
|
21311
21395
|
}
|
|
21312
21396
|
} catch {
|
|
21313
21397
|
}
|
|
@@ -21341,13 +21425,13 @@ var HistoryService = class _HistoryService {
|
|
|
21341
21425
|
const cutoff = this.bootTimeMs - _HistoryService.BIRTHTIME_GRACE_MS;
|
|
21342
21426
|
let entries;
|
|
21343
21427
|
try {
|
|
21344
|
-
entries =
|
|
21428
|
+
entries = fs46.readdirSync(dir, { withFileTypes: true });
|
|
21345
21429
|
} catch {
|
|
21346
21430
|
return null;
|
|
21347
21431
|
}
|
|
21348
21432
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
21349
21433
|
try {
|
|
21350
|
-
const stat3 =
|
|
21434
|
+
const stat3 = fs46.statSync(path52.join(dir, e.name));
|
|
21351
21435
|
return { name: e.name, mtime: stat3.mtimeMs, birthtime: stat3.birthtimeMs };
|
|
21352
21436
|
} catch {
|
|
21353
21437
|
return { name: e.name, mtime: 0, birthtime: 0 };
|
|
@@ -21356,12 +21440,12 @@ var HistoryService = class _HistoryService {
|
|
|
21356
21440
|
if (files.length === 0) return null;
|
|
21357
21441
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
21358
21442
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
21359
|
-
return this.extractUsageFromFile(
|
|
21443
|
+
return this.extractUsageFromFile(path52.join(dir, targetFile));
|
|
21360
21444
|
}
|
|
21361
21445
|
extractUsageFromFile(filePath) {
|
|
21362
21446
|
let raw;
|
|
21363
21447
|
try {
|
|
21364
|
-
raw =
|
|
21448
|
+
raw = fs46.readFileSync(filePath, "utf8");
|
|
21365
21449
|
} catch {
|
|
21366
21450
|
return null;
|
|
21367
21451
|
}
|
|
@@ -21406,9 +21490,9 @@ var HistoryService = class _HistoryService {
|
|
|
21406
21490
|
let totalCost = 0;
|
|
21407
21491
|
let files;
|
|
21408
21492
|
try {
|
|
21409
|
-
files =
|
|
21493
|
+
files = fs46.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
21410
21494
|
try {
|
|
21411
|
-
return
|
|
21495
|
+
return fs46.statSync(path52.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
21412
21496
|
} catch {
|
|
21413
21497
|
return false;
|
|
21414
21498
|
}
|
|
@@ -21419,7 +21503,7 @@ var HistoryService = class _HistoryService {
|
|
|
21419
21503
|
for (const file of files) {
|
|
21420
21504
|
let raw;
|
|
21421
21505
|
try {
|
|
21422
|
-
raw =
|
|
21506
|
+
raw = fs46.readFileSync(path52.join(projectDir, file), "utf8");
|
|
21423
21507
|
} catch {
|
|
21424
21508
|
continue;
|
|
21425
21509
|
}
|
|
@@ -21498,7 +21582,7 @@ var HistoryService = class _HistoryService {
|
|
|
21498
21582
|
if (this.runtime.resolveHistoryFile) {
|
|
21499
21583
|
return this.runtime.resolveHistoryFile(this.cwd, sessionId);
|
|
21500
21584
|
}
|
|
21501
|
-
return
|
|
21585
|
+
return path52.join(this.projectDir, `${sessionId}.jsonl`);
|
|
21502
21586
|
}
|
|
21503
21587
|
/**
|
|
21504
21588
|
* Parse a conversation's messages from disk, agent-aware. Claude uses the
|
|
@@ -21532,7 +21616,7 @@ var HistoryService = class _HistoryService {
|
|
|
21532
21616
|
};
|
|
21533
21617
|
});
|
|
21534
21618
|
}
|
|
21535
|
-
return parseJsonl(
|
|
21619
|
+
return parseJsonl(path52.join(this.projectDir, `${sessionId}.jsonl`));
|
|
21536
21620
|
}
|
|
21537
21621
|
async loadConversation(sessionId) {
|
|
21538
21622
|
const messages = this.readConversation(sessionId);
|
|
@@ -21588,7 +21672,7 @@ var HistoryService = class _HistoryService {
|
|
|
21588
21672
|
if (!filePath) return false;
|
|
21589
21673
|
let mtimeMs;
|
|
21590
21674
|
try {
|
|
21591
|
-
mtimeMs =
|
|
21675
|
+
mtimeMs = fs46.statSync(filePath).mtimeMs;
|
|
21592
21676
|
} catch {
|
|
21593
21677
|
return false;
|
|
21594
21678
|
}
|
|
@@ -21657,10 +21741,10 @@ var HistoryService = class _HistoryService {
|
|
|
21657
21741
|
|
|
21658
21742
|
// src/agents/acp/client.ts
|
|
21659
21743
|
var import_node_child_process17 = require("child_process");
|
|
21660
|
-
var
|
|
21744
|
+
var fs47 = __toESM(require("fs/promises"));
|
|
21661
21745
|
var fsSync = __toESM(require("fs"));
|
|
21662
21746
|
var os39 = __toESM(require("os"));
|
|
21663
|
-
var
|
|
21747
|
+
var path53 = __toESM(require("path"));
|
|
21664
21748
|
var import_node_stream = require("stream");
|
|
21665
21749
|
|
|
21666
21750
|
// ../../node_modules/@agentclientprotocol/sdk/dist/acp.js
|
|
@@ -24493,7 +24577,7 @@ var AcpClient = class {
|
|
|
24493
24577
|
},
|
|
24494
24578
|
readTextFile: async (params) => {
|
|
24495
24579
|
try {
|
|
24496
|
-
const content = await
|
|
24580
|
+
const content = await fs47.readFile(params.path, "utf8");
|
|
24497
24581
|
return applyLineRange(content, params.line ?? null, params.limit ?? null);
|
|
24498
24582
|
} catch (err) {
|
|
24499
24583
|
const code = err.code;
|
|
@@ -24513,7 +24597,7 @@ var AcpClient = class {
|
|
|
24513
24597
|
},
|
|
24514
24598
|
writeTextFile: async (params) => {
|
|
24515
24599
|
try {
|
|
24516
|
-
await
|
|
24600
|
+
await fs47.writeFile(params.path, params.content, "utf8");
|
|
24517
24601
|
return {};
|
|
24518
24602
|
} catch (err) {
|
|
24519
24603
|
const code = err.code;
|
|
@@ -24567,20 +24651,20 @@ function knownAgentBinaryDirs() {
|
|
|
24567
24651
|
out2.push("/tmp/codeam-node20/bin");
|
|
24568
24652
|
for (const root of [
|
|
24569
24653
|
"/usr/local/share/nvm/versions/node",
|
|
24570
|
-
|
|
24654
|
+
path53.join(home, ".nvm/versions/node")
|
|
24571
24655
|
]) {
|
|
24572
24656
|
try {
|
|
24573
24657
|
for (const child of fsSync.readdirSync(root)) {
|
|
24574
|
-
out2.push(
|
|
24658
|
+
out2.push(path53.join(root, child, "bin"));
|
|
24575
24659
|
}
|
|
24576
24660
|
} catch {
|
|
24577
24661
|
}
|
|
24578
24662
|
}
|
|
24579
|
-
out2.push(
|
|
24663
|
+
out2.push(path53.join(home, ".volta/bin"));
|
|
24580
24664
|
out2.push("/usr/local/bin");
|
|
24581
24665
|
out2.push("/usr/bin");
|
|
24582
|
-
out2.push(
|
|
24583
|
-
out2.push(
|
|
24666
|
+
out2.push(path53.join(home, ".local/bin"));
|
|
24667
|
+
out2.push(path53.join(home, "bin"));
|
|
24584
24668
|
return out2.filter((p2) => {
|
|
24585
24669
|
try {
|
|
24586
24670
|
return fsSync.statSync(p2).isDirectory();
|
|
@@ -24591,7 +24675,7 @@ function knownAgentBinaryDirs() {
|
|
|
24591
24675
|
}
|
|
24592
24676
|
function expandPathForAgentBinaries(existingPath) {
|
|
24593
24677
|
const existing = new Set(
|
|
24594
|
-
existingPath.split(
|
|
24678
|
+
existingPath.split(path53.delimiter).filter((p2) => p2.length > 0)
|
|
24595
24679
|
);
|
|
24596
24680
|
const additions = [];
|
|
24597
24681
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -24601,7 +24685,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
24601
24685
|
}
|
|
24602
24686
|
}
|
|
24603
24687
|
if (additions.length === 0) return existingPath;
|
|
24604
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
24688
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path53.delimiter);
|
|
24605
24689
|
}
|
|
24606
24690
|
|
|
24607
24691
|
// src/services/streaming/transport.ts
|
|
@@ -25114,16 +25198,16 @@ function commonPrefixLength(a, b) {
|
|
|
25114
25198
|
}
|
|
25115
25199
|
|
|
25116
25200
|
// src/agents/acp/onboarding.ts
|
|
25117
|
-
var
|
|
25118
|
-
var
|
|
25201
|
+
var import_child_process24 = require("child_process");
|
|
25202
|
+
var fs48 = __toESM(require("fs"));
|
|
25119
25203
|
var os40 = __toESM(require("os"));
|
|
25120
|
-
var
|
|
25204
|
+
var path54 = __toESM(require("path"));
|
|
25121
25205
|
var _onboardingSeam = {
|
|
25122
|
-
markerPath: (sessionId) =>
|
|
25123
|
-
exists: (p2) =>
|
|
25206
|
+
markerPath: (sessionId) => path54.join(os40.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
25207
|
+
exists: (p2) => fs48.existsSync(p2),
|
|
25124
25208
|
write: (p2) => {
|
|
25125
|
-
|
|
25126
|
-
|
|
25209
|
+
fs48.mkdirSync(path54.dirname(p2), { recursive: true });
|
|
25210
|
+
fs48.writeFileSync(p2, "");
|
|
25127
25211
|
},
|
|
25128
25212
|
disabled: () => {
|
|
25129
25213
|
const v = process.env.CODEAM_ONBOARDING_DISABLED;
|
|
@@ -25135,7 +25219,7 @@ var _onboardingSeam = {
|
|
|
25135
25219
|
*/
|
|
25136
25220
|
gitRemoteUrl: (cwd) => {
|
|
25137
25221
|
try {
|
|
25138
|
-
return (0,
|
|
25222
|
+
return (0, import_child_process24.execFileSync)("git", ["-C", cwd, "remote", "get-url", "origin"], {
|
|
25139
25223
|
encoding: "utf8",
|
|
25140
25224
|
stdio: ["ignore", "pipe", "ignore"],
|
|
25141
25225
|
timeout: 2e3
|
|
@@ -25160,7 +25244,7 @@ function resolveRepoName(cwd) {
|
|
|
25160
25244
|
if (name) return name;
|
|
25161
25245
|
}
|
|
25162
25246
|
}
|
|
25163
|
-
const base =
|
|
25247
|
+
const base = path54.basename(cwd || "");
|
|
25164
25248
|
if (base && !isUuid(base)) return base;
|
|
25165
25249
|
return "this project";
|
|
25166
25250
|
}
|
|
@@ -25437,9 +25521,9 @@ function extractSelectPrompt(text) {
|
|
|
25437
25521
|
var import_crypto5 = require("crypto");
|
|
25438
25522
|
|
|
25439
25523
|
// src/services/turn-files/git-changeset.ts
|
|
25440
|
-
var
|
|
25441
|
-
var
|
|
25442
|
-
var
|
|
25524
|
+
var import_child_process25 = require("child_process");
|
|
25525
|
+
var fs49 = __toESM(require("fs/promises"));
|
|
25526
|
+
var path55 = __toESM(require("path"));
|
|
25443
25527
|
async function collectRepoChangeset(opts) {
|
|
25444
25528
|
const status2 = await runGit3(opts.repoRoot, ["status", "--porcelain=v1", "-z"]);
|
|
25445
25529
|
if (status2 === null) return null;
|
|
@@ -25457,7 +25541,7 @@ async function collectRepoChangeset(opts) {
|
|
|
25457
25541
|
let stats;
|
|
25458
25542
|
if (row.fileStatus === "added" && numstatEntry === void 0) {
|
|
25459
25543
|
const lineCount = await readUntrackedLineCount(
|
|
25460
|
-
|
|
25544
|
+
path55.join(opts.repoRoot, row.filePath)
|
|
25461
25545
|
);
|
|
25462
25546
|
stats = { added: lineCount, removed: 0 };
|
|
25463
25547
|
} else {
|
|
@@ -25488,7 +25572,7 @@ function readUntrackedLineCount(absPath) {
|
|
|
25488
25572
|
}
|
|
25489
25573
|
async function defaultReadUntrackedLineCount(absPath) {
|
|
25490
25574
|
try {
|
|
25491
|
-
const content = await
|
|
25575
|
+
const content = await fs49.readFile(absPath, "utf8");
|
|
25492
25576
|
let count = 0;
|
|
25493
25577
|
let pos = -1;
|
|
25494
25578
|
while ((pos = content.indexOf("\n", pos + 1)) !== -1) {
|
|
@@ -25552,7 +25636,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
25552
25636
|
return new Promise((resolve7) => {
|
|
25553
25637
|
let proc;
|
|
25554
25638
|
try {
|
|
25555
|
-
proc = (0,
|
|
25639
|
+
proc = (0, import_child_process25.spawn)("git", args2, { cwd, env: process.env });
|
|
25556
25640
|
} catch {
|
|
25557
25641
|
resolve7(null);
|
|
25558
25642
|
return;
|
|
@@ -25580,7 +25664,7 @@ function defaultRunGit(cwd, args2) {
|
|
|
25580
25664
|
});
|
|
25581
25665
|
}
|
|
25582
25666
|
async function discoverRepos(workingDir, maxDepth = 4) {
|
|
25583
|
-
const
|
|
25667
|
+
const fs53 = await import("fs/promises");
|
|
25584
25668
|
const out2 = [];
|
|
25585
25669
|
await walk(workingDir, 0);
|
|
25586
25670
|
return out2;
|
|
@@ -25588,7 +25672,7 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
25588
25672
|
if (depth > maxDepth) return;
|
|
25589
25673
|
let entries = [];
|
|
25590
25674
|
try {
|
|
25591
|
-
const dirents = await
|
|
25675
|
+
const dirents = await fs53.readdir(dir, { withFileTypes: true });
|
|
25592
25676
|
entries = dirents.filter((d3) => !d3.name.startsWith(".") || d3.name === ".git").map((d3) => ({ name: d3.name, isDirectory: d3.isDirectory() }));
|
|
25593
25677
|
} catch {
|
|
25594
25678
|
return;
|
|
@@ -25599,8 +25683,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
25599
25683
|
if (hasGit) {
|
|
25600
25684
|
out2.push({
|
|
25601
25685
|
repoRoot: dir,
|
|
25602
|
-
repoPath:
|
|
25603
|
-
repoName:
|
|
25686
|
+
repoPath: path55.relative(workingDir, dir),
|
|
25687
|
+
repoName: path55.basename(dir)
|
|
25604
25688
|
});
|
|
25605
25689
|
return;
|
|
25606
25690
|
}
|
|
@@ -25608,14 +25692,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
25608
25692
|
if (!entry.isDirectory) continue;
|
|
25609
25693
|
if (entry.name === "node_modules") continue;
|
|
25610
25694
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
25611
|
-
await walk(
|
|
25695
|
+
await walk(path55.join(dir, entry.name), depth + 1);
|
|
25612
25696
|
}
|
|
25613
25697
|
}
|
|
25614
25698
|
}
|
|
25615
25699
|
|
|
25616
25700
|
// src/services/turn-files/files-outbox.ts
|
|
25617
|
-
var
|
|
25618
|
-
var
|
|
25701
|
+
var fs50 = __toESM(require("fs/promises"));
|
|
25702
|
+
var path56 = __toESM(require("path"));
|
|
25619
25703
|
var import_os7 = require("os");
|
|
25620
25704
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
25621
25705
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -25648,16 +25732,16 @@ var FilesOutbox = class {
|
|
|
25648
25732
|
backoffIndex = 0;
|
|
25649
25733
|
stopped = false;
|
|
25650
25734
|
constructor(opts) {
|
|
25651
|
-
const base = opts.baseDir ??
|
|
25652
|
-
this.filePath =
|
|
25735
|
+
const base = opts.baseDir ?? path56.join(homeDir(), HOME_OUTBOX_DIR);
|
|
25736
|
+
this.filePath = path56.join(base, `${opts.sessionId}.jsonl`);
|
|
25653
25737
|
this.post = opts.post;
|
|
25654
25738
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
25655
25739
|
}
|
|
25656
25740
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
25657
25741
|
* line is durable on disk (not once the POST succeeds). */
|
|
25658
25742
|
async enqueue(entry) {
|
|
25659
|
-
await
|
|
25660
|
-
await
|
|
25743
|
+
await fs50.mkdir(path56.dirname(this.filePath), { recursive: true });
|
|
25744
|
+
await fs50.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
25661
25745
|
this.backoffIndex = 0;
|
|
25662
25746
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
25663
25747
|
}
|
|
@@ -25746,7 +25830,7 @@ var FilesOutbox = class {
|
|
|
25746
25830
|
async readAll() {
|
|
25747
25831
|
let raw = "";
|
|
25748
25832
|
try {
|
|
25749
|
-
raw = await
|
|
25833
|
+
raw = await fs50.readFile(this.filePath, "utf8");
|
|
25750
25834
|
} catch {
|
|
25751
25835
|
return [];
|
|
25752
25836
|
}
|
|
@@ -25770,12 +25854,12 @@ var FilesOutbox = class {
|
|
|
25770
25854
|
async rewrite(entries) {
|
|
25771
25855
|
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
25772
25856
|
if (entries.length === 0) {
|
|
25773
|
-
await
|
|
25857
|
+
await fs50.unlink(this.filePath).catch(() => void 0);
|
|
25774
25858
|
return;
|
|
25775
25859
|
}
|
|
25776
25860
|
const payload = entries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
25777
|
-
await
|
|
25778
|
-
await
|
|
25861
|
+
await fs50.writeFile(tmpPath, payload, "utf8");
|
|
25862
|
+
await fs50.rename(tmpPath, this.filePath);
|
|
25779
25863
|
}
|
|
25780
25864
|
};
|
|
25781
25865
|
function applyJitter(ms) {
|
|
@@ -28404,15 +28488,15 @@ function fetchQuotaUsage(runtime, historySvc) {
|
|
|
28404
28488
|
}
|
|
28405
28489
|
|
|
28406
28490
|
// src/agents/claude/onboarding.ts
|
|
28407
|
-
var
|
|
28491
|
+
var fs51 = __toESM(require("fs"));
|
|
28408
28492
|
var os41 = __toESM(require("os"));
|
|
28409
|
-
var
|
|
28493
|
+
var path57 = __toESM(require("path"));
|
|
28410
28494
|
function ensureClaudeOnboarded() {
|
|
28411
28495
|
try {
|
|
28412
|
-
const file =
|
|
28496
|
+
const file = path57.join(os41.homedir(), ".claude.json");
|
|
28413
28497
|
let config = {};
|
|
28414
28498
|
try {
|
|
28415
|
-
config = JSON.parse(
|
|
28499
|
+
config = JSON.parse(fs51.readFileSync(file, "utf8"));
|
|
28416
28500
|
} catch {
|
|
28417
28501
|
}
|
|
28418
28502
|
if (config.hasCompletedOnboarding === true && typeof config.theme === "string") {
|
|
@@ -28423,8 +28507,8 @@ function ensureClaudeOnboarded() {
|
|
|
28423
28507
|
if (typeof config.lastOnboardingVersion !== "string") {
|
|
28424
28508
|
config.lastOnboardingVersion = "2.1.177";
|
|
28425
28509
|
}
|
|
28426
|
-
|
|
28427
|
-
|
|
28510
|
+
fs51.mkdirSync(path57.dirname(file), { recursive: true });
|
|
28511
|
+
fs51.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
28428
28512
|
log.info("claude", "pre-completed Claude onboarding (skip first-run theme picker)");
|
|
28429
28513
|
} catch (err) {
|
|
28430
28514
|
log.warn("claude", `ensureClaudeOnboarded failed (non-fatal): ${err.message}`);
|
|
@@ -28528,9 +28612,10 @@ async function start(requestedAgent) {
|
|
|
28528
28612
|
const depsReady = process.env.CODESPACES === "true" ? provisionProjectDependencies(cwd).catch(() => void 0) : Promise.resolve();
|
|
28529
28613
|
if (process.env.CODESPACES === "true") {
|
|
28530
28614
|
const GATE_TIMEOUT_MS = 24e4;
|
|
28615
|
+
const agentBinaryReady = getAcpAdapter(session.agent)?.waitForBinary({ timeoutMs: GATE_TIMEOUT_MS }).catch(() => false) ?? Promise.resolve(true);
|
|
28531
28616
|
let gateTimer;
|
|
28532
28617
|
await Promise.race([
|
|
28533
|
-
Promise.all([beadsReady.catch(() => null), depsReady]),
|
|
28618
|
+
Promise.all([beadsReady.catch(() => null), depsReady, agentBinaryReady]),
|
|
28534
28619
|
new Promise((resolve7) => {
|
|
28535
28620
|
gateTimer = setTimeout(resolve7, GATE_TIMEOUT_MS);
|
|
28536
28621
|
})
|
|
@@ -29071,11 +29156,11 @@ async function logout() {
|
|
|
29071
29156
|
var import_picocolors11 = __toESM(require("picocolors"));
|
|
29072
29157
|
|
|
29073
29158
|
// src/services/providers/github-codespaces.ts
|
|
29074
|
-
var
|
|
29159
|
+
var import_child_process26 = require("child_process");
|
|
29075
29160
|
var import_util4 = require("util");
|
|
29076
29161
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
29077
|
-
var
|
|
29078
|
-
var execFileP6 = (0, import_util4.promisify)(
|
|
29162
|
+
var path58 = __toESM(require("path"));
|
|
29163
|
+
var execFileP6 = (0, import_util4.promisify)(import_child_process26.execFile);
|
|
29079
29164
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
29080
29165
|
function resetStdinForChild() {
|
|
29081
29166
|
if (process.stdin.isTTY) {
|
|
@@ -29119,7 +29204,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29119
29204
|
if (!isAuthed) {
|
|
29120
29205
|
resetStdinForChild();
|
|
29121
29206
|
await new Promise((resolve7, reject) => {
|
|
29122
|
-
const proc = (0,
|
|
29207
|
+
const proc = (0, import_child_process26.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
|
|
29123
29208
|
stdio: "inherit"
|
|
29124
29209
|
});
|
|
29125
29210
|
proc.on("exit", (code) => {
|
|
@@ -29153,7 +29238,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29153
29238
|
wt(noteLines.join("\n"), "One more permission needed");
|
|
29154
29239
|
resetStdinForChild();
|
|
29155
29240
|
const refreshCode = await new Promise((resolve7, reject) => {
|
|
29156
|
-
const proc = (0,
|
|
29241
|
+
const proc = (0, import_child_process26.spawn)(
|
|
29157
29242
|
"gh",
|
|
29158
29243
|
["auth", "refresh", "-h", "github.com", "-s", "codespace"],
|
|
29159
29244
|
{ stdio: "inherit" }
|
|
@@ -29303,7 +29388,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29303
29388
|
O2.step(`Installing gh via ${installCmd.describe}\u2026`);
|
|
29304
29389
|
resetStdinForChild();
|
|
29305
29390
|
const ok = await new Promise((resolve7) => {
|
|
29306
|
-
const proc = (0,
|
|
29391
|
+
const proc = (0, import_child_process26.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
|
|
29307
29392
|
proc.on("exit", (code) => resolve7(code === 0));
|
|
29308
29393
|
proc.on("error", () => resolve7(false));
|
|
29309
29394
|
});
|
|
@@ -29330,7 +29415,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29330
29415
|
);
|
|
29331
29416
|
resetStdinForChild();
|
|
29332
29417
|
await new Promise((resolve7, reject) => {
|
|
29333
|
-
const proc = (0,
|
|
29418
|
+
const proc = (0, import_child_process26.spawn)(
|
|
29334
29419
|
"gh",
|
|
29335
29420
|
["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
|
|
29336
29421
|
{ stdio: "inherit" }
|
|
@@ -29508,7 +29593,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29508
29593
|
async streamCommand(workspaceId, command2) {
|
|
29509
29594
|
resetStdinForChild();
|
|
29510
29595
|
return new Promise((resolve7, reject) => {
|
|
29511
|
-
const proc = (0,
|
|
29596
|
+
const proc = (0, import_child_process26.spawn)(
|
|
29512
29597
|
"gh",
|
|
29513
29598
|
["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
|
|
29514
29599
|
{ stdio: "inherit" }
|
|
@@ -29535,11 +29620,11 @@ var GitHubCodespacesProvider = class {
|
|
|
29535
29620
|
`mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
|
|
29536
29621
|
];
|
|
29537
29622
|
await new Promise((resolve7, reject) => {
|
|
29538
|
-
const tar = (0,
|
|
29623
|
+
const tar = (0, import_child_process26.spawn)("tar", tarArgs, {
|
|
29539
29624
|
stdio: ["ignore", "pipe", "pipe"],
|
|
29540
29625
|
env: tarEnv
|
|
29541
29626
|
});
|
|
29542
|
-
const ssh = (0,
|
|
29627
|
+
const ssh = (0, import_child_process26.spawn)("gh", sshArgs, {
|
|
29543
29628
|
stdio: [tar.stdout, "pipe", "pipe"]
|
|
29544
29629
|
});
|
|
29545
29630
|
let tarErr = "";
|
|
@@ -29563,7 +29648,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29563
29648
|
});
|
|
29564
29649
|
}
|
|
29565
29650
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
29566
|
-
const remoteDir =
|
|
29651
|
+
const remoteDir = path58.posix.dirname(remotePath);
|
|
29567
29652
|
const parts = [
|
|
29568
29653
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
29569
29654
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -29573,7 +29658,7 @@ var GitHubCodespacesProvider = class {
|
|
|
29573
29658
|
}
|
|
29574
29659
|
const cmd = parts.join(" && ");
|
|
29575
29660
|
await new Promise((resolve7, reject) => {
|
|
29576
|
-
const proc = (0,
|
|
29661
|
+
const proc = (0, import_child_process26.spawn)(
|
|
29577
29662
|
"gh",
|
|
29578
29663
|
["codespace", "ssh", "-c", workspaceId, "--", cmd],
|
|
29579
29664
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -29631,11 +29716,11 @@ function shellQuote(s) {
|
|
|
29631
29716
|
}
|
|
29632
29717
|
|
|
29633
29718
|
// src/services/providers/gitpod.ts
|
|
29634
|
-
var
|
|
29719
|
+
var import_child_process27 = require("child_process");
|
|
29635
29720
|
var import_util5 = require("util");
|
|
29636
|
-
var
|
|
29721
|
+
var path59 = __toESM(require("path"));
|
|
29637
29722
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
29638
|
-
var execFileP7 = (0, import_util5.promisify)(
|
|
29723
|
+
var execFileP7 = (0, import_util5.promisify)(import_child_process27.execFile);
|
|
29639
29724
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
29640
29725
|
function resetStdinForChild2() {
|
|
29641
29726
|
if (process.stdin.isTTY) {
|
|
@@ -29675,7 +29760,7 @@ var GitpodProvider = class {
|
|
|
29675
29760
|
);
|
|
29676
29761
|
resetStdinForChild2();
|
|
29677
29762
|
await new Promise((resolve7, reject) => {
|
|
29678
|
-
const proc = (0,
|
|
29763
|
+
const proc = (0, import_child_process27.spawn)("gitpod", ["login"], { stdio: "inherit" });
|
|
29679
29764
|
proc.on("exit", (code) => {
|
|
29680
29765
|
if (code === 0) resolve7();
|
|
29681
29766
|
else reject(new Error("gitpod login failed."));
|
|
@@ -29827,7 +29912,7 @@ var GitpodProvider = class {
|
|
|
29827
29912
|
async streamCommand(workspaceId, command2) {
|
|
29828
29913
|
resetStdinForChild2();
|
|
29829
29914
|
return new Promise((resolve7, reject) => {
|
|
29830
|
-
const proc = (0,
|
|
29915
|
+
const proc = (0, import_child_process27.spawn)(
|
|
29831
29916
|
"gitpod",
|
|
29832
29917
|
["workspace", "ssh", workspaceId, "--", "-tt", command2],
|
|
29833
29918
|
{ stdio: "inherit" }
|
|
@@ -29847,11 +29932,11 @@ var GitpodProvider = class {
|
|
|
29847
29932
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
29848
29933
|
const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
|
|
29849
29934
|
await new Promise((resolve7, reject) => {
|
|
29850
|
-
const tar = (0,
|
|
29935
|
+
const tar = (0, import_child_process27.spawn)("tar", tarArgs, {
|
|
29851
29936
|
stdio: ["ignore", "pipe", "pipe"],
|
|
29852
29937
|
env: tarEnv
|
|
29853
29938
|
});
|
|
29854
|
-
const ssh = (0,
|
|
29939
|
+
const ssh = (0, import_child_process27.spawn)(
|
|
29855
29940
|
"gitpod",
|
|
29856
29941
|
["workspace", "ssh", workspaceId, "--", remoteCmd],
|
|
29857
29942
|
{ stdio: [tar.stdout, "pipe", "pipe"] }
|
|
@@ -29873,7 +29958,7 @@ var GitpodProvider = class {
|
|
|
29873
29958
|
});
|
|
29874
29959
|
}
|
|
29875
29960
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
29876
|
-
const remoteDir =
|
|
29961
|
+
const remoteDir = path59.posix.dirname(remotePath);
|
|
29877
29962
|
const parts = [
|
|
29878
29963
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
29879
29964
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -29883,7 +29968,7 @@ var GitpodProvider = class {
|
|
|
29883
29968
|
}
|
|
29884
29969
|
const cmd = parts.join(" && ");
|
|
29885
29970
|
await new Promise((resolve7, reject) => {
|
|
29886
|
-
const proc = (0,
|
|
29971
|
+
const proc = (0, import_child_process27.spawn)(
|
|
29887
29972
|
"gitpod",
|
|
29888
29973
|
["workspace", "ssh", workspaceId, "--", cmd],
|
|
29889
29974
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -29907,10 +29992,10 @@ function shellQuote2(s) {
|
|
|
29907
29992
|
}
|
|
29908
29993
|
|
|
29909
29994
|
// src/services/providers/gitlab-workspaces.ts
|
|
29910
|
-
var
|
|
29995
|
+
var import_child_process28 = require("child_process");
|
|
29911
29996
|
var import_util6 = require("util");
|
|
29912
|
-
var
|
|
29913
|
-
var execFileP8 = (0, import_util6.promisify)(
|
|
29997
|
+
var path60 = __toESM(require("path"));
|
|
29998
|
+
var execFileP8 = (0, import_util6.promisify)(import_child_process28.execFile);
|
|
29914
29999
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
29915
30000
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
29916
30001
|
function resetStdinForChild3() {
|
|
@@ -29952,7 +30037,7 @@ var GitLabWorkspacesProvider = class {
|
|
|
29952
30037
|
);
|
|
29953
30038
|
resetStdinForChild3();
|
|
29954
30039
|
await new Promise((resolve7, reject) => {
|
|
29955
|
-
const proc = (0,
|
|
30040
|
+
const proc = (0, import_child_process28.spawn)(
|
|
29956
30041
|
"glab",
|
|
29957
30042
|
["auth", "login", "--scopes", "api,read_user,read_repository"],
|
|
29958
30043
|
{ stdio: "inherit" }
|
|
@@ -30124,7 +30209,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
30124
30209
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
30125
30210
|
resetStdinForChild3();
|
|
30126
30211
|
return new Promise((resolve7, reject) => {
|
|
30127
|
-
const proc = (0,
|
|
30212
|
+
const proc = (0, import_child_process28.spawn)(
|
|
30128
30213
|
"ssh",
|
|
30129
30214
|
["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
|
|
30130
30215
|
{ stdio: "inherit" }
|
|
@@ -30145,8 +30230,8 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
30145
30230
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
30146
30231
|
const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
|
|
30147
30232
|
await new Promise((resolve7, reject) => {
|
|
30148
|
-
const tar = (0,
|
|
30149
|
-
const ssh = (0,
|
|
30233
|
+
const tar = (0, import_child_process28.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
30234
|
+
const ssh = (0, import_child_process28.spawn)(
|
|
30150
30235
|
"ssh",
|
|
30151
30236
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, remoteCmd],
|
|
30152
30237
|
{ stdio: [tar.stdout, "pipe", "pipe"] }
|
|
@@ -30169,14 +30254,14 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
30169
30254
|
}
|
|
30170
30255
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
30171
30256
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
30172
|
-
const remoteDir =
|
|
30257
|
+
const remoteDir = path60.posix.dirname(remotePath);
|
|
30173
30258
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
30174
30259
|
if (options.mode != null) {
|
|
30175
30260
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
30176
30261
|
}
|
|
30177
30262
|
const cmd = parts.join(" && ");
|
|
30178
30263
|
await new Promise((resolve7, reject) => {
|
|
30179
|
-
const proc = (0,
|
|
30264
|
+
const proc = (0, import_child_process28.spawn)(
|
|
30180
30265
|
"ssh",
|
|
30181
30266
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
|
|
30182
30267
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -30235,10 +30320,10 @@ function shellQuote3(s) {
|
|
|
30235
30320
|
}
|
|
30236
30321
|
|
|
30237
30322
|
// src/services/providers/railway.ts
|
|
30238
|
-
var
|
|
30323
|
+
var import_child_process29 = require("child_process");
|
|
30239
30324
|
var import_util7 = require("util");
|
|
30240
|
-
var
|
|
30241
|
-
var execFileP9 = (0, import_util7.promisify)(
|
|
30325
|
+
var path61 = __toESM(require("path"));
|
|
30326
|
+
var execFileP9 = (0, import_util7.promisify)(import_child_process29.execFile);
|
|
30242
30327
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
30243
30328
|
function resetStdinForChild4() {
|
|
30244
30329
|
if (process.stdin.isTTY) {
|
|
@@ -30279,7 +30364,7 @@ var RailwayProvider = class {
|
|
|
30279
30364
|
);
|
|
30280
30365
|
resetStdinForChild4();
|
|
30281
30366
|
await new Promise((resolve7, reject) => {
|
|
30282
|
-
const proc = (0,
|
|
30367
|
+
const proc = (0, import_child_process29.spawn)("railway", ["login"], { stdio: "inherit" });
|
|
30283
30368
|
proc.on("exit", (code) => {
|
|
30284
30369
|
if (code === 0) resolve7();
|
|
30285
30370
|
else reject(new Error("railway login failed."));
|
|
@@ -30422,7 +30507,7 @@ var RailwayProvider = class {
|
|
|
30422
30507
|
}
|
|
30423
30508
|
resetStdinForChild4();
|
|
30424
30509
|
return new Promise((resolve7, reject) => {
|
|
30425
|
-
const proc = (0,
|
|
30510
|
+
const proc = (0, import_child_process29.spawn)(
|
|
30426
30511
|
"railway",
|
|
30427
30512
|
["shell", "--project", projectId, "--service", serviceId, "--command", command2],
|
|
30428
30513
|
{ stdio: "inherit" }
|
|
@@ -30446,8 +30531,8 @@ var RailwayProvider = class {
|
|
|
30446
30531
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
30447
30532
|
const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
|
|
30448
30533
|
await new Promise((resolve7, reject) => {
|
|
30449
|
-
const tar = (0,
|
|
30450
|
-
const sh = (0,
|
|
30534
|
+
const tar = (0, import_child_process29.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
30535
|
+
const sh = (0, import_child_process29.spawn)(
|
|
30451
30536
|
"railway",
|
|
30452
30537
|
["shell", "--project", projectId, "--service", serviceId, "--command", remoteCmd],
|
|
30453
30538
|
{ stdio: [tar.stdout, "pipe", "pipe"] }
|
|
@@ -30473,14 +30558,14 @@ var RailwayProvider = class {
|
|
|
30473
30558
|
if (!projectId || !serviceId) {
|
|
30474
30559
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
30475
30560
|
}
|
|
30476
|
-
const remoteDir =
|
|
30561
|
+
const remoteDir = path61.posix.dirname(remotePath);
|
|
30477
30562
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
30478
30563
|
if (options.mode != null) {
|
|
30479
30564
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
30480
30565
|
}
|
|
30481
30566
|
const cmd = parts.join(" && ");
|
|
30482
30567
|
await new Promise((resolve7, reject) => {
|
|
30483
|
-
const proc = (0,
|
|
30568
|
+
const proc = (0, import_child_process29.spawn)(
|
|
30484
30569
|
"railway",
|
|
30485
30570
|
["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
|
|
30486
30571
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -31119,8 +31204,8 @@ async function invite() {
|
|
|
31119
31204
|
var import_node_dns = require("dns");
|
|
31120
31205
|
var import_node_util5 = require("util");
|
|
31121
31206
|
var import_node_crypto8 = require("crypto");
|
|
31122
|
-
var
|
|
31123
|
-
var
|
|
31207
|
+
var fs52 = __toESM(require("fs"));
|
|
31208
|
+
var path62 = __toESM(require("path"));
|
|
31124
31209
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
31125
31210
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
31126
31211
|
async function checkDns(apiBase2) {
|
|
@@ -31176,13 +31261,13 @@ async function checkHealth(apiBase2) {
|
|
|
31176
31261
|
}
|
|
31177
31262
|
}
|
|
31178
31263
|
function checkConfigDir() {
|
|
31179
|
-
const dir =
|
|
31264
|
+
const dir = path62.join(require("os").homedir(), ".codeam");
|
|
31180
31265
|
try {
|
|
31181
|
-
|
|
31182
|
-
const probe =
|
|
31183
|
-
|
|
31184
|
-
const read2 =
|
|
31185
|
-
|
|
31266
|
+
fs52.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
31267
|
+
const probe = path62.join(dir, ".doctor-probe");
|
|
31268
|
+
fs52.writeFileSync(probe, "ok", { mode: 384 });
|
|
31269
|
+
const read2 = fs52.readFileSync(probe, "utf8");
|
|
31270
|
+
fs52.unlinkSync(probe);
|
|
31186
31271
|
if (read2 !== "ok") throw new Error("write/read round-trip mismatch");
|
|
31187
31272
|
return {
|
|
31188
31273
|
id: "config-dir",
|
|
@@ -31246,7 +31331,7 @@ function checkNodePty() {
|
|
|
31246
31331
|
detail: "not required on this platform"
|
|
31247
31332
|
};
|
|
31248
31333
|
}
|
|
31249
|
-
const vendoredPath =
|
|
31334
|
+
const vendoredPath = path62.join(__dirname, "vendor", "node-pty");
|
|
31250
31335
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
31251
31336
|
try {
|
|
31252
31337
|
require(target);
|
|
@@ -31288,7 +31373,7 @@ function checkChokidar() {
|
|
|
31288
31373
|
}
|
|
31289
31374
|
async function doctor(args2 = []) {
|
|
31290
31375
|
const json = args2.includes("--json");
|
|
31291
|
-
const cliVersion = true ? "2.52.
|
|
31376
|
+
const cliVersion = true ? "2.52.8" : "0.0.0-dev";
|
|
31292
31377
|
const apiBase2 = resolveApiBaseUrl();
|
|
31293
31378
|
const diagnosticId = (0, import_node_crypto8.randomUUID)();
|
|
31294
31379
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -31487,7 +31572,7 @@ async function completion(args2) {
|
|
|
31487
31572
|
// src/commands/version.ts
|
|
31488
31573
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
31489
31574
|
function version2() {
|
|
31490
|
-
const v = true ? "2.52.
|
|
31575
|
+
const v = true ? "2.52.8" : "unknown";
|
|
31491
31576
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
31492
31577
|
}
|
|
31493
31578
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeam-cli",
|
|
3
|
-
"version": "2.52.
|
|
3
|
+
"version": "2.52.8",
|
|
4
4
|
"description": "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device — async. The terminal companion for CodeAgent Mobile.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|