codeam-cli 2.4.30 → 2.4.32
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 +18 -0
- package/dist/index.js +120 -85
- package/dist/vendor/node-pty/lib/conpty_console_list_agent.js +16 -0
- package/dist/vendor/node-pty/lib/eventEmitter2.js +47 -0
- package/dist/vendor/node-pty/lib/index.js +52 -0
- package/dist/vendor/node-pty/lib/interfaces.js +7 -0
- package/dist/vendor/node-pty/lib/shared/conout.js +11 -0
- package/dist/vendor/node-pty/lib/terminal.js +190 -0
- package/dist/vendor/node-pty/lib/types.js +7 -0
- package/dist/vendor/node-pty/lib/unixTerminal.js +346 -0
- package/dist/vendor/node-pty/lib/utils.js +39 -0
- package/dist/vendor/node-pty/lib/windowsConoutConnection.js +125 -0
- package/dist/vendor/node-pty/lib/windowsPtyAgent.js +320 -0
- package/dist/vendor/node-pty/lib/windowsTerminal.js +199 -0
- package/dist/vendor/node-pty/lib/worker/conoutSocketWorker.js +22 -0
- package/dist/vendor/node-pty/package.json +64 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/pty.node +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/pty.node +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/dist/vendor/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
- package/package.json +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ 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.4.31] — 2026-05-05
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **cli:** Vendor node-pty into dist/ — guarantees ConPTY binary on Windows (v2.4.31)
|
|
12
|
+
|
|
13
|
+
## [2.4.30] — 2026-05-05
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **cli:** Pin node-pty ^1.1.0 + graceful pipe fallback if ConPTY fails (v2.4.30)
|
|
18
|
+
|
|
19
|
+
## [2.4.29] — 2026-05-05
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **cli:** Auto-install Claude Code if missing on first launch (v2.4.29)
|
|
24
|
+
|
|
7
25
|
## [2.4.28] — 2026-05-05
|
|
8
26
|
|
|
9
27
|
### Fixed
|
package/dist/index.js
CHANGED
|
@@ -521,7 +521,7 @@ var require_windowsPtyAgent = __commonJS({
|
|
|
521
521
|
exports2.argsToCommandLine = exports2.WindowsPtyAgent = void 0;
|
|
522
522
|
var fs9 = require("fs");
|
|
523
523
|
var os8 = require("os");
|
|
524
|
-
var
|
|
524
|
+
var path16 = require("path");
|
|
525
525
|
var child_process_1 = require("child_process");
|
|
526
526
|
var net_1 = require("net");
|
|
527
527
|
var windowsConoutConnection_1 = require_windowsConoutConnection();
|
|
@@ -557,7 +557,7 @@ var require_windowsPtyAgent = __commonJS({
|
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
this._ptyNative = this._useConpty ? conptyNative : winptyNative;
|
|
560
|
-
cwd =
|
|
560
|
+
cwd = path16.resolve(cwd);
|
|
561
561
|
var commandLine = argsToCommandLine(file, args2);
|
|
562
562
|
var term;
|
|
563
563
|
if (this._useConpty) {
|
|
@@ -679,7 +679,7 @@ var require_windowsPtyAgent = __commonJS({
|
|
|
679
679
|
WindowsPtyAgent2.prototype._getConsoleProcessList = function() {
|
|
680
680
|
var _this = this;
|
|
681
681
|
return new Promise(function(resolve2) {
|
|
682
|
-
var agent = child_process_1.fork(
|
|
682
|
+
var agent = child_process_1.fork(path16.join(__dirname, "conpty_console_list_agent"), [_this._innerPid.toString()]);
|
|
683
683
|
agent.on("message", function(message) {
|
|
684
684
|
clearTimeout(timeout);
|
|
685
685
|
resolve2(message.consoleProcessList);
|
|
@@ -1013,14 +1013,14 @@ var require_unixTerminal = __commonJS({
|
|
|
1013
1013
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1014
1014
|
exports2.UnixTerminal = void 0;
|
|
1015
1015
|
var fs9 = require("fs");
|
|
1016
|
-
var
|
|
1016
|
+
var path16 = require("path");
|
|
1017
1017
|
var tty = require("tty");
|
|
1018
1018
|
var terminal_1 = require_terminal();
|
|
1019
1019
|
var utils_1 = require_utils();
|
|
1020
1020
|
var native = utils_1.loadNativeModule("pty");
|
|
1021
1021
|
var pty = native.module;
|
|
1022
1022
|
var helperPath = native.dir + "/spawn-helper";
|
|
1023
|
-
helperPath =
|
|
1023
|
+
helperPath = path16.resolve(__dirname, helperPath);
|
|
1024
1024
|
helperPath = helperPath.replace("app.asar", "app.asar.unpacked");
|
|
1025
1025
|
helperPath = helperPath.replace("node_modules.asar", "node_modules.asar.unpacked");
|
|
1026
1026
|
var DEFAULT_FILE = "sh";
|
|
@@ -1392,7 +1392,7 @@ var require_src = __commonJS({
|
|
|
1392
1392
|
// src/commands/start.ts
|
|
1393
1393
|
var fs7 = __toESM(require("fs"));
|
|
1394
1394
|
var os6 = __toESM(require("os"));
|
|
1395
|
-
var
|
|
1395
|
+
var path10 = __toESM(require("path"));
|
|
1396
1396
|
var import_crypto = require("crypto");
|
|
1397
1397
|
var import_child_process5 = require("child_process");
|
|
1398
1398
|
var import_picocolors2 = __toESM(require("picocolors"));
|
|
@@ -1482,7 +1482,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
|
|
|
1482
1482
|
// package.json
|
|
1483
1483
|
var package_default = {
|
|
1484
1484
|
name: "codeam-cli",
|
|
1485
|
-
version: "2.4.
|
|
1485
|
+
version: "2.4.32",
|
|
1486
1486
|
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.",
|
|
1487
1487
|
main: "dist/index.js",
|
|
1488
1488
|
bin: {
|
|
@@ -1495,7 +1495,7 @@ var package_default = {
|
|
|
1495
1495
|
"LICENSE"
|
|
1496
1496
|
],
|
|
1497
1497
|
scripts: {
|
|
1498
|
-
build: "tsup",
|
|
1498
|
+
build: "tsup && node scripts/vendor-node-pty.js",
|
|
1499
1499
|
dev: "tsup --watch",
|
|
1500
1500
|
test: "vitest run",
|
|
1501
1501
|
typecheck: "tsc --noEmit",
|
|
@@ -1556,14 +1556,12 @@ var package_default = {
|
|
|
1556
1556
|
ws: "^8.18.0",
|
|
1557
1557
|
zod: "^4.3.6"
|
|
1558
1558
|
},
|
|
1559
|
-
optionalDependencies: {
|
|
1560
|
-
"node-pty": "^1.1.0"
|
|
1561
|
-
},
|
|
1562
1559
|
devDependencies: {
|
|
1563
1560
|
"@codeagent/shared": "*",
|
|
1564
1561
|
"@types/node": "^22.0.0",
|
|
1565
1562
|
"@types/qrcode-terminal": "^0.12.0",
|
|
1566
1563
|
"@types/ws": "^8.5.0",
|
|
1564
|
+
"node-pty": "^1.1.0",
|
|
1567
1565
|
tsup: "^8.0.0",
|
|
1568
1566
|
typescript: "^6.0.3",
|
|
1569
1567
|
vitest: "^4.1.5"
|
|
@@ -1965,27 +1963,35 @@ var CommandRelayService = class {
|
|
|
1965
1963
|
}
|
|
1966
1964
|
};
|
|
1967
1965
|
|
|
1966
|
+
// src/services/pty/unix.strategy.ts
|
|
1967
|
+
var import_child_process = require("child_process");
|
|
1968
|
+
var fs3 = __toESM(require("fs"));
|
|
1969
|
+
var os3 = __toESM(require("os"));
|
|
1970
|
+
var path3 = __toESM(require("path"));
|
|
1971
|
+
|
|
1968
1972
|
// src/services/pty/types.ts
|
|
1969
1973
|
var fs2 = __toESM(require("fs"));
|
|
1970
1974
|
var path2 = __toESM(require("path"));
|
|
1971
1975
|
function findInPath(name) {
|
|
1972
|
-
const
|
|
1976
|
+
const isWin = process.platform === "win32";
|
|
1977
|
+
const dirs = (process.env.PATH ?? "").split(path2.delimiter).filter(Boolean);
|
|
1978
|
+
const hasExt = path2.extname(name).length > 0;
|
|
1979
|
+
const candidates = isWin && !hasExt ? [`${name}.exe`, `${name}.cmd`, `${name}.bat`, `${name}.ps1`, name] : [name];
|
|
1980
|
+
const accessFlag = isWin ? fs2.constants.F_OK : fs2.constants.X_OK;
|
|
1973
1981
|
for (const dir of dirs) {
|
|
1974
|
-
const
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1982
|
+
for (const candidate of candidates) {
|
|
1983
|
+
const full = path2.join(dir, candidate);
|
|
1984
|
+
try {
|
|
1985
|
+
fs2.accessSync(full, accessFlag);
|
|
1986
|
+
return full;
|
|
1987
|
+
} catch {
|
|
1988
|
+
}
|
|
1979
1989
|
}
|
|
1980
1990
|
}
|
|
1981
1991
|
return null;
|
|
1982
1992
|
}
|
|
1983
1993
|
|
|
1984
1994
|
// src/services/pty/unix.strategy.ts
|
|
1985
|
-
var import_child_process = require("child_process");
|
|
1986
|
-
var fs3 = __toESM(require("fs"));
|
|
1987
|
-
var os3 = __toESM(require("os"));
|
|
1988
|
-
var path3 = __toESM(require("path"));
|
|
1989
1995
|
var PYTHON_PTY_HELPER = `import os,pty,sys,select,signal,struct,fcntl,termios,errno
|
|
1990
1996
|
m,s=pty.openpty()
|
|
1991
1997
|
try:
|
|
@@ -2262,11 +2268,18 @@ var WindowsPtyStrategy = class {
|
|
|
2262
2268
|
};
|
|
2263
2269
|
|
|
2264
2270
|
// src/services/pty/windows-conpty.strategy.ts
|
|
2271
|
+
var path4 = __toESM(require("path"));
|
|
2265
2272
|
function loadNodePty() {
|
|
2273
|
+
const vendoredPath = path4.join(__dirname, "vendor", "node-pty");
|
|
2266
2274
|
try {
|
|
2267
|
-
return
|
|
2268
|
-
} catch {
|
|
2269
|
-
|
|
2275
|
+
return require(vendoredPath);
|
|
2276
|
+
} catch (vendorErr) {
|
|
2277
|
+
try {
|
|
2278
|
+
return require_lib();
|
|
2279
|
+
} catch {
|
|
2280
|
+
void vendorErr;
|
|
2281
|
+
return null;
|
|
2282
|
+
}
|
|
2270
2283
|
}
|
|
2271
2284
|
}
|
|
2272
2285
|
var WindowsConPtyStrategy = class _WindowsConPtyStrategy {
|
|
@@ -2355,7 +2368,7 @@ var WindowsConPtyStrategy = class _WindowsConPtyStrategy {
|
|
|
2355
2368
|
|
|
2356
2369
|
// src/services/claude-installer.ts
|
|
2357
2370
|
var import_child_process3 = require("child_process");
|
|
2358
|
-
var
|
|
2371
|
+
var path5 = __toESM(require("path"));
|
|
2359
2372
|
var os4 = __toESM(require("os"));
|
|
2360
2373
|
|
|
2361
2374
|
// ../../node_modules/@clack/prompts/dist/index.mjs
|
|
@@ -4273,14 +4286,14 @@ function probeInstallDirs() {
|
|
|
4273
4286
|
const home = os4.homedir();
|
|
4274
4287
|
if (process.platform === "win32") {
|
|
4275
4288
|
return [
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4289
|
+
path5.join(home, ".claude", "local"),
|
|
4290
|
+
path5.join(home, "AppData", "Local", "AnthropicClaude"),
|
|
4291
|
+
path5.join(home, "AppData", "Local", "Programs", "AnthropicClaude")
|
|
4279
4292
|
];
|
|
4280
4293
|
}
|
|
4281
4294
|
return [
|
|
4282
|
-
|
|
4283
|
-
|
|
4295
|
+
path5.join(home, ".local", "bin"),
|
|
4296
|
+
path5.join(home, ".claude", "local"),
|
|
4284
4297
|
"/usr/local/bin"
|
|
4285
4298
|
];
|
|
4286
4299
|
}
|
|
@@ -4289,7 +4302,7 @@ function isAvailable() {
|
|
|
4289
4302
|
}
|
|
4290
4303
|
function augmentPath() {
|
|
4291
4304
|
const dirs = probeInstallDirs();
|
|
4292
|
-
const sep2 =
|
|
4305
|
+
const sep2 = path5.delimiter;
|
|
4293
4306
|
const current = process.env.PATH ?? "";
|
|
4294
4307
|
const existing = new Set(current.split(sep2).filter(Boolean));
|
|
4295
4308
|
const additions = dirs.filter((d3) => !existing.has(d3));
|
|
@@ -4346,6 +4359,26 @@ async function ensureClaudeInstalled() {
|
|
|
4346
4359
|
return true;
|
|
4347
4360
|
}
|
|
4348
4361
|
|
|
4362
|
+
// src/services/claude-resolver.ts
|
|
4363
|
+
var path6 = __toESM(require("path"));
|
|
4364
|
+
function buildClaudeLaunch(extraArgs = []) {
|
|
4365
|
+
const found = findInPath("claude") ?? findInPath("claude-code");
|
|
4366
|
+
if (!found) return null;
|
|
4367
|
+
if (process.platform === "win32") {
|
|
4368
|
+
const ext = path6.extname(found).toLowerCase();
|
|
4369
|
+
if (ext === ".cmd" || ext === ".bat") {
|
|
4370
|
+
return { cmd: "cmd.exe", args: ["/c", found, ...extraArgs] };
|
|
4371
|
+
}
|
|
4372
|
+
if (ext === ".ps1") {
|
|
4373
|
+
return {
|
|
4374
|
+
cmd: "powershell.exe",
|
|
4375
|
+
args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", found, ...extraArgs]
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
}
|
|
4379
|
+
return { cmd: found, args: extraArgs };
|
|
4380
|
+
}
|
|
4381
|
+
|
|
4349
4382
|
// src/services/claude.service.ts
|
|
4350
4383
|
var ClaudeService = class {
|
|
4351
4384
|
constructor(opts) {
|
|
@@ -4363,9 +4396,11 @@ var ClaudeService = class {
|
|
|
4363
4396
|
strategy = null;
|
|
4364
4397
|
strategyOpts;
|
|
4365
4398
|
async spawn() {
|
|
4366
|
-
|
|
4399
|
+
let launch = buildClaudeLaunch();
|
|
4400
|
+
if (!launch) {
|
|
4367
4401
|
const installed = await ensureClaudeInstalled();
|
|
4368
|
-
if (
|
|
4402
|
+
if (installed) launch = buildClaudeLaunch();
|
|
4403
|
+
if (!launch) {
|
|
4369
4404
|
const cmd = process.platform === "win32" ? "irm https://claude.ai/install.ps1 | iex" : "curl -fsSL https://claude.ai/install.sh | bash";
|
|
4370
4405
|
console.error(
|
|
4371
4406
|
`
|
|
@@ -4377,12 +4412,11 @@ var ClaudeService = class {
|
|
|
4377
4412
|
process.exit(1);
|
|
4378
4413
|
}
|
|
4379
4414
|
}
|
|
4380
|
-
const claudeCmd = findInPath("claude") ? "claude" : "claude-code";
|
|
4381
4415
|
if (process.platform === "win32") {
|
|
4382
4416
|
const conpty = WindowsConPtyStrategy.tryCreate(this.strategyOpts);
|
|
4383
4417
|
if (conpty) {
|
|
4384
4418
|
try {
|
|
4385
|
-
conpty.spawn(
|
|
4419
|
+
conpty.spawn(launch.cmd, this.opts.cwd, launch.args);
|
|
4386
4420
|
this.strategy = conpty;
|
|
4387
4421
|
return;
|
|
4388
4422
|
} catch (err) {
|
|
@@ -4401,12 +4435,12 @@ var ClaudeService = class {
|
|
|
4401
4435
|
);
|
|
4402
4436
|
}
|
|
4403
4437
|
const pipe = new WindowsPtyStrategy(this.strategyOpts);
|
|
4404
|
-
pipe.spawn(
|
|
4438
|
+
pipe.spawn(launch.cmd, this.opts.cwd, launch.args);
|
|
4405
4439
|
this.strategy = pipe;
|
|
4406
4440
|
return;
|
|
4407
4441
|
}
|
|
4408
4442
|
const unix = new UnixPtyStrategy(this.strategyOpts);
|
|
4409
|
-
unix.spawn(
|
|
4443
|
+
unix.spawn(launch.cmd, this.opts.cwd, launch.args);
|
|
4410
4444
|
this.strategy = unix;
|
|
4411
4445
|
}
|
|
4412
4446
|
/**
|
|
@@ -4484,11 +4518,12 @@ var ClaudeService = class {
|
|
|
4484
4518
|
*/
|
|
4485
4519
|
restart(sessionId, auto = false) {
|
|
4486
4520
|
if (!this.strategy) return;
|
|
4487
|
-
const
|
|
4521
|
+
const extraArgs = ["--resume", sessionId];
|
|
4522
|
+
if (auto) extraArgs.push("--dangerously-skip-permissions");
|
|
4523
|
+
const launch = buildClaudeLaunch(extraArgs);
|
|
4524
|
+
if (!launch) return;
|
|
4488
4525
|
this.strategy.kill();
|
|
4489
|
-
|
|
4490
|
-
if (auto) args2.push("--dangerously-skip-permissions");
|
|
4491
|
-
this.strategy.spawn(claudeCmd, this.opts.cwd, args2);
|
|
4526
|
+
this.strategy.spawn(launch.cmd, this.opts.cwd, launch.args);
|
|
4492
4527
|
}
|
|
4493
4528
|
};
|
|
4494
4529
|
|
|
@@ -5170,7 +5205,7 @@ function _sendOutputChunk(url, headers, payload) {
|
|
|
5170
5205
|
|
|
5171
5206
|
// src/services/history.service.ts
|
|
5172
5207
|
var fs4 = __toESM(require("fs"));
|
|
5173
|
-
var
|
|
5208
|
+
var path7 = __toESM(require("path"));
|
|
5174
5209
|
var os5 = __toESM(require("os"));
|
|
5175
5210
|
var https3 = __toESM(require("https"));
|
|
5176
5211
|
var http3 = __toESM(require("http"));
|
|
@@ -5326,7 +5361,7 @@ var HistoryService = class {
|
|
|
5326
5361
|
return this._quotaPercent === null || Date.now() - this._quotaFetchedAt > ttlMs;
|
|
5327
5362
|
}
|
|
5328
5363
|
get projectDir() {
|
|
5329
|
-
return
|
|
5364
|
+
return path7.join(os5.homedir(), ".claude", "projects", encodeCwd(this.cwd));
|
|
5330
5365
|
}
|
|
5331
5366
|
/** Set the current Claude conversation ID (extracted from /cost command or session start) */
|
|
5332
5367
|
setCurrentConversationId(id) {
|
|
@@ -5338,7 +5373,7 @@ var HistoryService = class {
|
|
|
5338
5373
|
/** Return the current message count in the active conversation. */
|
|
5339
5374
|
getCurrentMessageCount() {
|
|
5340
5375
|
if (!this.currentConversationId) return 0;
|
|
5341
|
-
const filePath =
|
|
5376
|
+
const filePath = path7.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
5342
5377
|
return parseJsonl(filePath).length;
|
|
5343
5378
|
}
|
|
5344
5379
|
/**
|
|
@@ -5349,7 +5384,7 @@ var HistoryService = class {
|
|
|
5349
5384
|
const deadline = Date.now() + timeoutMs;
|
|
5350
5385
|
while (Date.now() < deadline) {
|
|
5351
5386
|
if (!this.currentConversationId) return null;
|
|
5352
|
-
const filePath =
|
|
5387
|
+
const filePath = path7.join(this.projectDir, `${this.currentConversationId}.jsonl`);
|
|
5353
5388
|
const messages = parseJsonl(filePath);
|
|
5354
5389
|
if (messages.length > previousCount) {
|
|
5355
5390
|
for (let i = messages.length - 1; i >= previousCount; i--) {
|
|
@@ -5366,13 +5401,13 @@ var HistoryService = class {
|
|
|
5366
5401
|
try {
|
|
5367
5402
|
const files = fs4.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
5368
5403
|
try {
|
|
5369
|
-
return { name: e.name, mtime: fs4.statSync(
|
|
5404
|
+
return { name: e.name, mtime: fs4.statSync(path7.join(dir, e.name)).mtimeMs };
|
|
5370
5405
|
} catch {
|
|
5371
5406
|
return { name: e.name, mtime: 0 };
|
|
5372
5407
|
}
|
|
5373
5408
|
}).sort((a, b) => b.mtime - a.mtime);
|
|
5374
5409
|
if (files.length > 0) {
|
|
5375
|
-
this.currentConversationId =
|
|
5410
|
+
this.currentConversationId = path7.basename(files[0].name, ".jsonl");
|
|
5376
5411
|
}
|
|
5377
5412
|
} catch {
|
|
5378
5413
|
}
|
|
@@ -5410,7 +5445,7 @@ var HistoryService = class {
|
|
|
5410
5445
|
}
|
|
5411
5446
|
const files = entries.filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => {
|
|
5412
5447
|
try {
|
|
5413
|
-
return { name: e.name, mtime: fs4.statSync(
|
|
5448
|
+
return { name: e.name, mtime: fs4.statSync(path7.join(dir, e.name)).mtimeMs };
|
|
5414
5449
|
} catch {
|
|
5415
5450
|
return { name: e.name, mtime: 0 };
|
|
5416
5451
|
}
|
|
@@ -5418,7 +5453,7 @@ var HistoryService = class {
|
|
|
5418
5453
|
if (files.length === 0) return null;
|
|
5419
5454
|
const targetFile = this.currentConversationId ? `${this.currentConversationId}.jsonl` : files[0].name;
|
|
5420
5455
|
if (!files.some((f) => f.name === targetFile)) return null;
|
|
5421
|
-
return this.extractUsageFromFile(
|
|
5456
|
+
return this.extractUsageFromFile(path7.join(dir, targetFile));
|
|
5422
5457
|
}
|
|
5423
5458
|
extractUsageFromFile(filePath) {
|
|
5424
5459
|
let raw;
|
|
@@ -5470,7 +5505,7 @@ var HistoryService = class {
|
|
|
5470
5505
|
try {
|
|
5471
5506
|
files = fs4.readdirSync(projectDir).filter((f) => f.endsWith(".jsonl")).filter((f) => {
|
|
5472
5507
|
try {
|
|
5473
|
-
return fs4.statSync(
|
|
5508
|
+
return fs4.statSync(path7.join(projectDir, f)).mtimeMs >= monthStartMs;
|
|
5474
5509
|
} catch {
|
|
5475
5510
|
return false;
|
|
5476
5511
|
}
|
|
@@ -5481,7 +5516,7 @@ var HistoryService = class {
|
|
|
5481
5516
|
for (const file of files) {
|
|
5482
5517
|
let raw;
|
|
5483
5518
|
try {
|
|
5484
|
-
raw = fs4.readFileSync(
|
|
5519
|
+
raw = fs4.readFileSync(path7.join(projectDir, file), "utf8");
|
|
5485
5520
|
} catch {
|
|
5486
5521
|
continue;
|
|
5487
5522
|
}
|
|
@@ -5523,8 +5558,8 @@ var HistoryService = class {
|
|
|
5523
5558
|
const sessions2 = [];
|
|
5524
5559
|
for (const entry of entries) {
|
|
5525
5560
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
5526
|
-
const id =
|
|
5527
|
-
const filePath =
|
|
5561
|
+
const id = path7.basename(entry.name, ".jsonl");
|
|
5562
|
+
const filePath = path7.join(dir, entry.name);
|
|
5528
5563
|
let mtime = Date.now();
|
|
5529
5564
|
try {
|
|
5530
5565
|
mtime = fs4.statSync(filePath).mtimeMs;
|
|
@@ -5565,7 +5600,7 @@ var HistoryService = class {
|
|
|
5565
5600
|
* showing an empty conversation.
|
|
5566
5601
|
*/
|
|
5567
5602
|
async loadConversation(sessionId) {
|
|
5568
|
-
const filePath =
|
|
5603
|
+
const filePath = path7.join(this.projectDir, `${sessionId}.jsonl`);
|
|
5569
5604
|
const messages = parseJsonl(filePath);
|
|
5570
5605
|
if (messages.length === 0) return;
|
|
5571
5606
|
const totalBatches = Math.ceil(messages.length / CONVERSATION_BATCH_SIZE);
|
|
@@ -5621,7 +5656,7 @@ function parsePayload(schema, raw) {
|
|
|
5621
5656
|
|
|
5622
5657
|
// src/services/file-ops.service.ts
|
|
5623
5658
|
var fs5 = __toESM(require("fs/promises"));
|
|
5624
|
-
var
|
|
5659
|
+
var path8 = __toESM(require("path"));
|
|
5625
5660
|
var MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
5626
5661
|
var MAX_WALK_DEPTH = 6;
|
|
5627
5662
|
var MAX_VISITED_DIRS = 5e3;
|
|
@@ -5656,8 +5691,8 @@ var SUBDIR_IGNORE = /* @__PURE__ */ new Set([
|
|
|
5656
5691
|
"__pycache__"
|
|
5657
5692
|
]);
|
|
5658
5693
|
function isUnder(parent, candidate) {
|
|
5659
|
-
const rel =
|
|
5660
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
5694
|
+
const rel = path8.relative(parent, candidate);
|
|
5695
|
+
return rel === "" || !rel.startsWith("..") && !path8.isAbsolute(rel);
|
|
5661
5696
|
}
|
|
5662
5697
|
async function isExistingFile(absPath) {
|
|
5663
5698
|
try {
|
|
@@ -5680,7 +5715,7 @@ async function walkForSuffix(dir, needleVariants, depth, ctx) {
|
|
|
5680
5715
|
}
|
|
5681
5716
|
for (const e of entries) {
|
|
5682
5717
|
if (!e.isFile()) continue;
|
|
5683
|
-
const full =
|
|
5718
|
+
const full = path8.join(dir, e.name);
|
|
5684
5719
|
if (needleVariants.some((needle) => full.endsWith(needle))) {
|
|
5685
5720
|
ctx.matches.push(full);
|
|
5686
5721
|
if (ctx.matches.length >= ctx.cap) return;
|
|
@@ -5690,21 +5725,21 @@ async function walkForSuffix(dir, needleVariants, depth, ctx) {
|
|
|
5690
5725
|
if (!e.isDirectory()) continue;
|
|
5691
5726
|
if (SUBDIR_IGNORE.has(e.name)) continue;
|
|
5692
5727
|
if (e.name.startsWith(".") && SUBDIR_IGNORE.has(e.name)) continue;
|
|
5693
|
-
await walkForSuffix(
|
|
5728
|
+
await walkForSuffix(path8.join(dir, e.name), needleVariants, depth + 1, ctx);
|
|
5694
5729
|
if (ctx.matches.length >= ctx.cap) return;
|
|
5695
5730
|
}
|
|
5696
5731
|
}
|
|
5697
5732
|
async function findFile(rawPath) {
|
|
5698
5733
|
const cwd = process.cwd();
|
|
5699
|
-
if (
|
|
5700
|
-
const abs =
|
|
5734
|
+
if (path8.isAbsolute(rawPath)) {
|
|
5735
|
+
const abs = path8.normalize(rawPath);
|
|
5701
5736
|
if (isUnder(cwd, abs) && await isExistingFile(abs)) return abs;
|
|
5702
5737
|
}
|
|
5703
|
-
const direct =
|
|
5738
|
+
const direct = path8.resolve(cwd, rawPath);
|
|
5704
5739
|
if (isUnder(cwd, direct) && await isExistingFile(direct)) return direct;
|
|
5705
|
-
const normalized =
|
|
5740
|
+
const normalized = path8.normalize(rawPath).replace(/^[./\\]+/, "");
|
|
5706
5741
|
const needles = [
|
|
5707
|
-
`${
|
|
5742
|
+
`${path8.sep}${normalized}`,
|
|
5708
5743
|
`/${normalized}`
|
|
5709
5744
|
].filter((v, i, a) => a.indexOf(v) === i);
|
|
5710
5745
|
const ctx = { visited: 0, matches: [], cap: 16 };
|
|
@@ -5718,7 +5753,7 @@ async function findWriteTarget(rawPath) {
|
|
|
5718
5753
|
const found = await findFile(rawPath);
|
|
5719
5754
|
if (found) return found;
|
|
5720
5755
|
const cwd = process.cwd();
|
|
5721
|
-
const fallback =
|
|
5756
|
+
const fallback = path8.isAbsolute(rawPath) ? path8.normalize(rawPath) : path8.resolve(cwd, rawPath);
|
|
5722
5757
|
if (!isUnder(cwd, fallback)) return null;
|
|
5723
5758
|
return fallback;
|
|
5724
5759
|
}
|
|
@@ -5758,7 +5793,7 @@ async function writeProjectFile(rawPath, content) {
|
|
|
5758
5793
|
if (Buffer.byteLength(content, "utf-8") > MAX_FILE_BYTES) {
|
|
5759
5794
|
return { error: "Content too large." };
|
|
5760
5795
|
}
|
|
5761
|
-
await fs5.mkdir(
|
|
5796
|
+
await fs5.mkdir(path8.dirname(abs), { recursive: true });
|
|
5762
5797
|
await fs5.writeFile(abs, content, "utf-8");
|
|
5763
5798
|
return { ok: true };
|
|
5764
5799
|
} catch (e) {
|
|
@@ -5771,7 +5806,7 @@ async function writeProjectFile(rawPath, content) {
|
|
|
5771
5806
|
var import_child_process4 = require("child_process");
|
|
5772
5807
|
var import_util = require("util");
|
|
5773
5808
|
var fs6 = __toESM(require("fs/promises"));
|
|
5774
|
-
var
|
|
5809
|
+
var path9 = __toESM(require("path"));
|
|
5775
5810
|
var execFileP = (0, import_util.promisify)(import_child_process4.execFile);
|
|
5776
5811
|
var PROJECT_IGNORE = /* @__PURE__ */ new Set([
|
|
5777
5812
|
"node_modules",
|
|
@@ -5829,12 +5864,12 @@ async function listProjectFiles(opts = {}) {
|
|
|
5829
5864
|
return;
|
|
5830
5865
|
}
|
|
5831
5866
|
if (PROJECT_IGNORE.has(e.name)) continue;
|
|
5832
|
-
const full =
|
|
5867
|
+
const full = path9.join(dir, e.name);
|
|
5833
5868
|
if (e.isDirectory()) {
|
|
5834
5869
|
if (depth >= 12) continue;
|
|
5835
5870
|
await walk(full, depth + 1);
|
|
5836
5871
|
} else if (e.isFile()) {
|
|
5837
|
-
const rel =
|
|
5872
|
+
const rel = path9.relative(root, full);
|
|
5838
5873
|
if (q2 && !rel.toLowerCase().includes(q2) && !e.name.toLowerCase().includes(q2)) {
|
|
5839
5874
|
continue;
|
|
5840
5875
|
}
|
|
@@ -5942,7 +5977,7 @@ async function gitStatus(cwd) {
|
|
|
5942
5977
|
let hasMergeInProgress = false;
|
|
5943
5978
|
try {
|
|
5944
5979
|
const gitDir = (await git(["rev-parse", "--git-dir"], root)).stdout.trim();
|
|
5945
|
-
const mergeHead =
|
|
5980
|
+
const mergeHead = path9.isAbsolute(gitDir) ? path9.join(gitDir, "MERGE_HEAD") : path9.join(root, gitDir, "MERGE_HEAD");
|
|
5946
5981
|
await fs6.access(mergeHead);
|
|
5947
5982
|
hasMergeInProgress = true;
|
|
5948
5983
|
} catch {
|
|
@@ -6020,7 +6055,7 @@ async function gitResolve(file, side, cwd) {
|
|
|
6020
6055
|
function saveFilesTemp(files) {
|
|
6021
6056
|
return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
|
|
6022
6057
|
const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
|
|
6023
|
-
const tmpPath =
|
|
6058
|
+
const tmpPath = path10.join(os6.tmpdir(), `codeam-${(0, import_crypto.randomUUID)()}-${safeName}`);
|
|
6024
6059
|
fs7.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
|
|
6025
6060
|
return tmpPath;
|
|
6026
6061
|
});
|
|
@@ -6094,7 +6129,7 @@ try:
|
|
|
6094
6129
|
sys.exit((st>>8)&0xFF)
|
|
6095
6130
|
except Exception:sys.exit(0)
|
|
6096
6131
|
`;
|
|
6097
|
-
const helperPath =
|
|
6132
|
+
const helperPath = path10.join(os6.tmpdir(), "codeam-quota-helper.py");
|
|
6098
6133
|
fs7.writeFileSync(helperPath, helperScript, { mode: 420 });
|
|
6099
6134
|
const python = findInPath("python3") ?? findInPath("python");
|
|
6100
6135
|
if (!python) {
|
|
@@ -6697,7 +6732,7 @@ async function logout() {
|
|
|
6697
6732
|
var import_child_process10 = require("child_process");
|
|
6698
6733
|
var fs8 = __toESM(require("fs"));
|
|
6699
6734
|
var os7 = __toESM(require("os"));
|
|
6700
|
-
var
|
|
6735
|
+
var path15 = __toESM(require("path"));
|
|
6701
6736
|
var import_util6 = require("util");
|
|
6702
6737
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
6703
6738
|
|
|
@@ -6705,7 +6740,7 @@ var import_picocolors9 = __toESM(require("picocolors"));
|
|
|
6705
6740
|
var import_child_process6 = require("child_process");
|
|
6706
6741
|
var import_util2 = require("util");
|
|
6707
6742
|
var import_picocolors7 = __toESM(require("picocolors"));
|
|
6708
|
-
var
|
|
6743
|
+
var path11 = __toESM(require("path"));
|
|
6709
6744
|
var execFileP2 = (0, import_util2.promisify)(import_child_process6.execFile);
|
|
6710
6745
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
6711
6746
|
function resetStdinForChild() {
|
|
@@ -7194,7 +7229,7 @@ var GitHubCodespacesProvider = class {
|
|
|
7194
7229
|
});
|
|
7195
7230
|
}
|
|
7196
7231
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
7197
|
-
const remoteDir =
|
|
7232
|
+
const remoteDir = path11.posix.dirname(remotePath);
|
|
7198
7233
|
const parts = [
|
|
7199
7234
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
7200
7235
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -7264,7 +7299,7 @@ function shellQuote(s) {
|
|
|
7264
7299
|
// src/services/providers/gitpod.ts
|
|
7265
7300
|
var import_child_process7 = require("child_process");
|
|
7266
7301
|
var import_util3 = require("util");
|
|
7267
|
-
var
|
|
7302
|
+
var path12 = __toESM(require("path"));
|
|
7268
7303
|
var import_picocolors8 = __toESM(require("picocolors"));
|
|
7269
7304
|
var execFileP3 = (0, import_util3.promisify)(import_child_process7.execFile);
|
|
7270
7305
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -7504,7 +7539,7 @@ var GitpodProvider = class {
|
|
|
7504
7539
|
});
|
|
7505
7540
|
}
|
|
7506
7541
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
7507
|
-
const remoteDir =
|
|
7542
|
+
const remoteDir = path12.posix.dirname(remotePath);
|
|
7508
7543
|
const parts = [
|
|
7509
7544
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
7510
7545
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -7540,7 +7575,7 @@ function shellQuote2(s) {
|
|
|
7540
7575
|
// src/services/providers/gitlab-workspaces.ts
|
|
7541
7576
|
var import_child_process8 = require("child_process");
|
|
7542
7577
|
var import_util4 = require("util");
|
|
7543
|
-
var
|
|
7578
|
+
var path13 = __toESM(require("path"));
|
|
7544
7579
|
var execFileP4 = (0, import_util4.promisify)(import_child_process8.execFile);
|
|
7545
7580
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
7546
7581
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -7800,7 +7835,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
7800
7835
|
}
|
|
7801
7836
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
7802
7837
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
7803
|
-
const remoteDir =
|
|
7838
|
+
const remoteDir = path13.posix.dirname(remotePath);
|
|
7804
7839
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
7805
7840
|
if (options.mode != null) {
|
|
7806
7841
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
@@ -7868,7 +7903,7 @@ function shellQuote3(s) {
|
|
|
7868
7903
|
// src/services/providers/railway.ts
|
|
7869
7904
|
var import_child_process9 = require("child_process");
|
|
7870
7905
|
var import_util5 = require("util");
|
|
7871
|
-
var
|
|
7906
|
+
var path14 = __toESM(require("path"));
|
|
7872
7907
|
var execFileP5 = (0, import_util5.promisify)(import_child_process9.execFile);
|
|
7873
7908
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
7874
7909
|
function resetStdinForChild4() {
|
|
@@ -8104,7 +8139,7 @@ var RailwayProvider = class {
|
|
|
8104
8139
|
if (!projectId || !serviceId) {
|
|
8105
8140
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
8106
8141
|
}
|
|
8107
|
-
const remoteDir =
|
|
8142
|
+
const remoteDir = path14.posix.dirname(remotePath);
|
|
8108
8143
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
8109
8144
|
if (options.mode != null) {
|
|
8110
8145
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
@@ -8296,7 +8331,7 @@ async function deploy() {
|
|
|
8296
8331
|
process.exit(1);
|
|
8297
8332
|
}
|
|
8298
8333
|
}
|
|
8299
|
-
const localClaudeDir =
|
|
8334
|
+
const localClaudeDir = path15.join(os7.homedir(), ".claude");
|
|
8300
8335
|
const localCredsKind = await detectLocalClaudeCredentials(localClaudeDir);
|
|
8301
8336
|
let bridged = "none";
|
|
8302
8337
|
if (localCredsKind !== "none") {
|
|
@@ -8394,7 +8429,7 @@ async function deploy() {
|
|
|
8394
8429
|
}
|
|
8395
8430
|
}
|
|
8396
8431
|
if (bridged !== "none") {
|
|
8397
|
-
const localClaudeJson =
|
|
8432
|
+
const localClaudeJson = path15.join(os7.homedir(), ".claude.json");
|
|
8398
8433
|
if (fs8.existsSync(localClaudeJson)) {
|
|
8399
8434
|
try {
|
|
8400
8435
|
const contents = fs8.readFileSync(localClaudeJson);
|
|
@@ -8587,7 +8622,7 @@ async function runRemoteClaudeLogin(provider, workspaceId) {
|
|
|
8587
8622
|
}
|
|
8588
8623
|
}
|
|
8589
8624
|
async function detectLocalClaudeCredentials(localClaudeDir) {
|
|
8590
|
-
if (fs8.existsSync(
|
|
8625
|
+
if (fs8.existsSync(path15.join(localClaudeDir, ".credentials.json"))) {
|
|
8591
8626
|
return "flat-file";
|
|
8592
8627
|
}
|
|
8593
8628
|
if (process.platform === "darwin") {
|
|
@@ -8620,7 +8655,7 @@ async function verifyClaudeAuth(provider, workspaceId) {
|
|
|
8620
8655
|
}
|
|
8621
8656
|
}
|
|
8622
8657
|
async function bridgeClaudeCredentials(provider, workspaceId, localClaudeDir) {
|
|
8623
|
-
const fileBased =
|
|
8658
|
+
const fileBased = path15.join(localClaudeDir, ".credentials.json");
|
|
8624
8659
|
if (fs8.existsSync(fileBased)) return "flat-file";
|
|
8625
8660
|
if (process.platform === "darwin") {
|
|
8626
8661
|
try {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
4
|
+
*
|
|
5
|
+
* This module fetches the console process list for a particular PID. It must be
|
|
6
|
+
* called from a different process (child_process.fork) as there can only be a
|
|
7
|
+
* single console attached to a process.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
var utils_1 = require("./utils");
|
|
11
|
+
var getConsoleProcessList = utils_1.loadNativeModule('conpty_console_list').module.getConsoleProcessList;
|
|
12
|
+
var shellPid = parseInt(process.argv[2], 10);
|
|
13
|
+
var consoleProcessList = getConsoleProcessList(shellPid);
|
|
14
|
+
process.send({ consoleProcessList: consoleProcessList });
|
|
15
|
+
process.exit(0);
|
|
16
|
+
//# sourceMappingURL=conpty_console_list_agent.js.map
|