codeam-cli 2.61.68 → 2.61.69
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 +6 -0
- package/dist/index.js +428 -378
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -119,7 +119,7 @@ async function runHttpRelay(delivery, client3, id) {
|
|
|
119
119
|
requestInit: { headers: buildHttpHeaders(delivery.httpHeaders, token) }
|
|
120
120
|
});
|
|
121
121
|
const stdioTransport = new StdioServerTransport();
|
|
122
|
-
await new Promise((
|
|
122
|
+
await new Promise((resolve9, reject) => {
|
|
123
123
|
let done = false;
|
|
124
124
|
const finish = (err) => {
|
|
125
125
|
if (done) return;
|
|
@@ -127,7 +127,7 @@ async function runHttpRelay(delivery, client3, id) {
|
|
|
127
127
|
void httpTransport.close().catch(() => void 0);
|
|
128
128
|
void stdioTransport.close().catch(() => void 0);
|
|
129
129
|
if (err) reject(err);
|
|
130
|
-
else
|
|
130
|
+
else resolve9();
|
|
131
131
|
};
|
|
132
132
|
stdioTransport.onmessage = (msg) => {
|
|
133
133
|
void httpTransport.send(msg).catch((e) => {
|
|
@@ -1882,8 +1882,8 @@ var HEADROOM_MODELS = [
|
|
|
1882
1882
|
}
|
|
1883
1883
|
];
|
|
1884
1884
|
function headroomSnapshotDownloadLine(model, opts = {}) {
|
|
1885
|
-
const
|
|
1886
|
-
const patterns = model.allowPatterns.map((p2) => `"${p2}"`).join(
|
|
1885
|
+
const sep7 = opts.spaceAfterComma ? ", " : ",";
|
|
1886
|
+
const patterns = model.allowPatterns.map((p2) => `"${p2}"`).join(sep7);
|
|
1887
1887
|
return `snapshot_download("${model.repo}", allow_patterns=[${patterns}])`;
|
|
1888
1888
|
}
|
|
1889
1889
|
function headroomModelPredownloadScript(opts = {}) {
|
|
@@ -2172,11 +2172,11 @@ function quiet(fn) {
|
|
|
2172
2172
|
log.debug(TAG, "ignored sync error", err);
|
|
2173
2173
|
}
|
|
2174
2174
|
}
|
|
2175
|
-
function rmIfExistsQuiet(
|
|
2175
|
+
function rmIfExistsQuiet(path80) {
|
|
2176
2176
|
try {
|
|
2177
|
-
fs2.rmSync(
|
|
2177
|
+
fs2.rmSync(path80, { force: true });
|
|
2178
2178
|
} catch (err) {
|
|
2179
|
-
log.debug(TAG, `rmIfExists failed for ${
|
|
2179
|
+
log.debug(TAG, `rmIfExists failed for ${path80}`, err);
|
|
2180
2180
|
}
|
|
2181
2181
|
}
|
|
2182
2182
|
function killQuiet(target, signal = "SIGTERM") {
|
|
@@ -2360,8 +2360,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? (0, import_pat
|
|
|
2360
2360
|
return decodedFile;
|
|
2361
2361
|
};
|
|
2362
2362
|
}
|
|
2363
|
-
function normalizeWindowsPath(
|
|
2364
|
-
return
|
|
2363
|
+
function normalizeWindowsPath(path80) {
|
|
2364
|
+
return path80.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
2365
2365
|
}
|
|
2366
2366
|
|
|
2367
2367
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -4841,15 +4841,15 @@ async function addSourceContext(frames) {
|
|
|
4841
4841
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
4842
4842
|
return frames;
|
|
4843
4843
|
}
|
|
4844
|
-
function getContextLinesFromFile(
|
|
4845
|
-
return new Promise((
|
|
4846
|
-
const stream = (0, import_node_fs.createReadStream)(
|
|
4844
|
+
function getContextLinesFromFile(path80, ranges, output) {
|
|
4845
|
+
return new Promise((resolve9) => {
|
|
4846
|
+
const stream = (0, import_node_fs.createReadStream)(path80);
|
|
4847
4847
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
4848
4848
|
input: stream
|
|
4849
4849
|
});
|
|
4850
4850
|
function destroyStreamAndResolve() {
|
|
4851
4851
|
stream.destroy();
|
|
4852
|
-
|
|
4852
|
+
resolve9();
|
|
4853
4853
|
}
|
|
4854
4854
|
let lineNumber = 0;
|
|
4855
4855
|
let currentRangeIndex = 0;
|
|
@@ -4858,7 +4858,7 @@ function getContextLinesFromFile(path79, ranges, output) {
|
|
|
4858
4858
|
let rangeStart = range[0];
|
|
4859
4859
|
let rangeEnd = range[1];
|
|
4860
4860
|
function onStreamError() {
|
|
4861
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
4861
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path80, 1);
|
|
4862
4862
|
lineReaded.close();
|
|
4863
4863
|
lineReaded.removeAllListeners();
|
|
4864
4864
|
destroyStreamAndResolve();
|
|
@@ -4919,8 +4919,8 @@ function clearLineContext(frame) {
|
|
|
4919
4919
|
delete frame.context_line;
|
|
4920
4920
|
delete frame.post_context;
|
|
4921
4921
|
}
|
|
4922
|
-
function shouldSkipContextLinesForFile(
|
|
4923
|
-
return
|
|
4922
|
+
function shouldSkipContextLinesForFile(path80) {
|
|
4923
|
+
return path80.startsWith("node:") || path80.endsWith(".min.js") || path80.endsWith(".min.cjs") || path80.endsWith(".min.mjs") || path80.startsWith("data:");
|
|
4924
4924
|
}
|
|
4925
4925
|
function shouldSkipContextLinesForFrame(frame) {
|
|
4926
4926
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -6136,9 +6136,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
6136
6136
|
if (!waitUntil) return;
|
|
6137
6137
|
if (this.disabled || this.optedOut) return;
|
|
6138
6138
|
if (!this._waitUntilCycle) {
|
|
6139
|
-
let
|
|
6139
|
+
let resolve9;
|
|
6140
6140
|
const promise = new Promise((r) => {
|
|
6141
|
-
|
|
6141
|
+
resolve9 = r;
|
|
6142
6142
|
});
|
|
6143
6143
|
try {
|
|
6144
6144
|
waitUntil(promise);
|
|
@@ -6146,7 +6146,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
6146
6146
|
return;
|
|
6147
6147
|
}
|
|
6148
6148
|
this._waitUntilCycle = {
|
|
6149
|
-
resolve:
|
|
6149
|
+
resolve: resolve9,
|
|
6150
6150
|
startedAt: Date.now(),
|
|
6151
6151
|
timer: void 0
|
|
6152
6152
|
};
|
|
@@ -6170,12 +6170,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
6170
6170
|
return cycle?.resolve;
|
|
6171
6171
|
}
|
|
6172
6172
|
async resolveWaitUntilFlush() {
|
|
6173
|
-
const
|
|
6173
|
+
const resolve9 = this._consumeWaitUntilCycle();
|
|
6174
6174
|
try {
|
|
6175
6175
|
await super.flush();
|
|
6176
6176
|
} catch {
|
|
6177
6177
|
} finally {
|
|
6178
|
-
|
|
6178
|
+
resolve9?.();
|
|
6179
6179
|
}
|
|
6180
6180
|
}
|
|
6181
6181
|
getPersistedProperty(key) {
|
|
@@ -6267,15 +6267,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
6267
6267
|
async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
|
|
6268
6268
|
if (this.isLocalEvaluationReady()) return true;
|
|
6269
6269
|
if (void 0 === this.featureFlagsPoller) return false;
|
|
6270
|
-
return new Promise((
|
|
6270
|
+
return new Promise((resolve9) => {
|
|
6271
6271
|
const timeout = setTimeout(() => {
|
|
6272
6272
|
cleanup();
|
|
6273
|
-
|
|
6273
|
+
resolve9(false);
|
|
6274
6274
|
}, timeoutMs);
|
|
6275
6275
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
6276
6276
|
clearTimeout(timeout);
|
|
6277
6277
|
cleanup();
|
|
6278
|
-
|
|
6278
|
+
resolve9(count > 0);
|
|
6279
6279
|
});
|
|
6280
6280
|
});
|
|
6281
6281
|
}
|
|
@@ -6712,13 +6712,13 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
6712
6712
|
this.context?.enter(data, options);
|
|
6713
6713
|
}
|
|
6714
6714
|
async _shutdown(shutdownTimeoutMs) {
|
|
6715
|
-
const
|
|
6715
|
+
const resolve9 = this._consumeWaitUntilCycle();
|
|
6716
6716
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
6717
6717
|
this.errorTracking.shutdown();
|
|
6718
6718
|
try {
|
|
6719
6719
|
return await super._shutdown(shutdownTimeoutMs);
|
|
6720
6720
|
} finally {
|
|
6721
|
-
|
|
6721
|
+
resolve9?.();
|
|
6722
6722
|
}
|
|
6723
6723
|
}
|
|
6724
6724
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -7074,7 +7074,7 @@ function readAnonId() {
|
|
|
7074
7074
|
}
|
|
7075
7075
|
function superProperties() {
|
|
7076
7076
|
return {
|
|
7077
|
-
cliVersion: true ? "2.61.
|
|
7077
|
+
cliVersion: true ? "2.61.69" : "0.0.0-dev",
|
|
7078
7078
|
nodeVersion: process.version,
|
|
7079
7079
|
platform: process.platform,
|
|
7080
7080
|
arch: process.arch,
|
|
@@ -7221,10 +7221,10 @@ var _execSeam = {
|
|
|
7221
7221
|
}
|
|
7222
7222
|
};
|
|
7223
7223
|
var _execSeamAsync = {
|
|
7224
|
-
exec: (file, args2, opts) => new Promise((
|
|
7224
|
+
exec: (file, args2, opts) => new Promise((resolve9, reject) => {
|
|
7225
7225
|
(0, import_child_process.execFile)(file, args2, opts, (err, stdout) => {
|
|
7226
7226
|
if (err) reject(err);
|
|
7227
|
-
else
|
|
7227
|
+
else resolve9(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
|
|
7228
7228
|
});
|
|
7229
7229
|
})
|
|
7230
7230
|
};
|
|
@@ -7255,7 +7255,7 @@ var os4 = __toESM(require("os"));
|
|
|
7255
7255
|
// package.json
|
|
7256
7256
|
var package_default = {
|
|
7257
7257
|
name: "codeam-cli",
|
|
7258
|
-
version: "2.61.
|
|
7258
|
+
version: "2.61.69",
|
|
7259
7259
|
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.",
|
|
7260
7260
|
type: "commonjs",
|
|
7261
7261
|
main: "dist/index.js",
|
|
@@ -7381,8 +7381,8 @@ async function requestCode(pluginId, pluginSecretHash) {
|
|
|
7381
7381
|
});
|
|
7382
7382
|
let timer;
|
|
7383
7383
|
const timeoutSentinel = /* @__PURE__ */ Symbol("request-code-timeout");
|
|
7384
|
-
const timeoutPromise = new Promise((
|
|
7385
|
-
timer = setTimeout(() =>
|
|
7384
|
+
const timeoutPromise = new Promise((resolve9) => {
|
|
7385
|
+
timer = setTimeout(() => resolve9(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
|
|
7386
7386
|
});
|
|
7387
7387
|
const result = await Promise.race([post2, timeoutPromise]);
|
|
7388
7388
|
clearTimeout(timer);
|
|
@@ -7713,7 +7713,7 @@ async function postBeadsProvisioning(input) {
|
|
|
7713
7713
|
}
|
|
7714
7714
|
}
|
|
7715
7715
|
async function _postJsonAuthed(url2, body, pluginAuthToken) {
|
|
7716
|
-
return new Promise((
|
|
7716
|
+
return new Promise((resolve9, reject) => {
|
|
7717
7717
|
const data = JSON.stringify(body);
|
|
7718
7718
|
const u2 = new URL(url2);
|
|
7719
7719
|
const transport = u2.protocol === "https:" ? https : http;
|
|
@@ -7745,9 +7745,9 @@ async function _postJsonAuthed(url2, body, pluginAuthToken) {
|
|
|
7745
7745
|
return;
|
|
7746
7746
|
}
|
|
7747
7747
|
try {
|
|
7748
|
-
|
|
7748
|
+
resolve9(JSON.parse(responseBody));
|
|
7749
7749
|
} catch {
|
|
7750
|
-
|
|
7750
|
+
resolve9(null);
|
|
7751
7751
|
}
|
|
7752
7752
|
});
|
|
7753
7753
|
}
|
|
@@ -7772,7 +7772,7 @@ function makeHttpError(statusCode, retryAfterHeader, responseBody) {
|
|
|
7772
7772
|
return err;
|
|
7773
7773
|
}
|
|
7774
7774
|
async function _postJson(url2, body, extraHeaders) {
|
|
7775
|
-
return new Promise((
|
|
7775
|
+
return new Promise((resolve9, reject) => {
|
|
7776
7776
|
const data = JSON.stringify(body);
|
|
7777
7777
|
const u2 = new URL(url2);
|
|
7778
7778
|
const transport = u2.protocol === "https:" ? https : http;
|
|
@@ -7802,9 +7802,9 @@ async function _postJson(url2, body, extraHeaders) {
|
|
|
7802
7802
|
return;
|
|
7803
7803
|
}
|
|
7804
7804
|
try {
|
|
7805
|
-
|
|
7805
|
+
resolve9(JSON.parse(body2));
|
|
7806
7806
|
} catch {
|
|
7807
|
-
|
|
7807
|
+
resolve9(null);
|
|
7808
7808
|
}
|
|
7809
7809
|
});
|
|
7810
7810
|
}
|
|
@@ -7819,7 +7819,7 @@ async function _postJson(url2, body, extraHeaders) {
|
|
|
7819
7819
|
});
|
|
7820
7820
|
}
|
|
7821
7821
|
async function _getJson(url2, extraHeaders) {
|
|
7822
|
-
return new Promise((
|
|
7822
|
+
return new Promise((resolve9, reject) => {
|
|
7823
7823
|
const u2 = new URL(url2);
|
|
7824
7824
|
const transport = u2.protocol === "https:" ? https : http;
|
|
7825
7825
|
const req = transport.request(
|
|
@@ -7843,9 +7843,9 @@ async function _getJson(url2, extraHeaders) {
|
|
|
7843
7843
|
return;
|
|
7844
7844
|
}
|
|
7845
7845
|
try {
|
|
7846
|
-
|
|
7846
|
+
resolve9(JSON.parse(body));
|
|
7847
7847
|
} catch {
|
|
7848
|
-
|
|
7848
|
+
resolve9(null);
|
|
7849
7849
|
}
|
|
7850
7850
|
});
|
|
7851
7851
|
}
|
|
@@ -8427,7 +8427,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
8427
8427
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
8428
8428
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
8429
8429
|
// pair/reconnect). Older backends ignore the extra field.
|
|
8430
|
-
..."2.61.
|
|
8430
|
+
..."2.61.69" ? { ideVersion: "2.61.69" } : {}
|
|
8431
8431
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
8432
8432
|
}
|
|
8433
8433
|
/**
|
|
@@ -8591,7 +8591,7 @@ var _transport2 = {
|
|
|
8591
8591
|
post: _post
|
|
8592
8592
|
};
|
|
8593
8593
|
function _post(url2, headers, payload) {
|
|
8594
|
-
return new Promise((
|
|
8594
|
+
return new Promise((resolve9, reject) => {
|
|
8595
8595
|
let settled = false;
|
|
8596
8596
|
const u2 = new URL(url2);
|
|
8597
8597
|
const lib = u2.protocol === "https:" ? https3 : http3;
|
|
@@ -8616,7 +8616,7 @@ function _post(url2, headers, payload) {
|
|
|
8616
8616
|
res.on("end", () => {
|
|
8617
8617
|
if (settled) return;
|
|
8618
8618
|
settled = true;
|
|
8619
|
-
|
|
8619
|
+
resolve9({ statusCode: res.statusCode ?? 0, body });
|
|
8620
8620
|
});
|
|
8621
8621
|
}
|
|
8622
8622
|
);
|
|
@@ -8654,10 +8654,10 @@ var WINDOWS_LEGACY_JUNCTIONS = [
|
|
|
8654
8654
|
/[\\/]Start Menu([\\/]|$)/i,
|
|
8655
8655
|
/[\\/]Templates([\\/]|$)/i
|
|
8656
8656
|
];
|
|
8657
|
-
function isUnsafeWindowsWatchRoot(dir,
|
|
8657
|
+
function isUnsafeWindowsWatchRoot(dir, homedir48) {
|
|
8658
8658
|
const norm = (p2) => p2.replace(/\//g, "\\").replace(/\\+$/, "").toLowerCase();
|
|
8659
8659
|
const cwd = norm(dir);
|
|
8660
|
-
const home = norm(
|
|
8660
|
+
const home = norm(homedir48);
|
|
8661
8661
|
if (cwd === home) return true;
|
|
8662
8662
|
if (/^[a-z]:$/.test(cwd)) return true;
|
|
8663
8663
|
const sysRoots = [
|
|
@@ -9304,12 +9304,12 @@ var _gitSeam = {
|
|
|
9304
9304
|
run: _runGitImpl
|
|
9305
9305
|
};
|
|
9306
9306
|
async function _runGitImpl(cwd, args2, opts = {}) {
|
|
9307
|
-
return new Promise((
|
|
9307
|
+
return new Promise((resolve9) => {
|
|
9308
9308
|
let proc;
|
|
9309
9309
|
try {
|
|
9310
9310
|
proc = (0, import_child_process3.spawn)("git", args2, { cwd, env: process.env });
|
|
9311
9311
|
} catch {
|
|
9312
|
-
|
|
9312
|
+
resolve9(null);
|
|
9313
9313
|
return;
|
|
9314
9314
|
}
|
|
9315
9315
|
let stdout = "";
|
|
@@ -9320,13 +9320,13 @@ async function _runGitImpl(cwd, args2, opts = {}) {
|
|
|
9320
9320
|
proc.stderr?.on("data", (c2) => {
|
|
9321
9321
|
stderr += c2.toString();
|
|
9322
9322
|
});
|
|
9323
|
-
proc.on("error", () =>
|
|
9323
|
+
proc.on("error", () => resolve9(null));
|
|
9324
9324
|
proc.on("close", (code) => {
|
|
9325
9325
|
if (code === 0 || opts.allowNonZeroExit) {
|
|
9326
|
-
|
|
9326
|
+
resolve9(stdout);
|
|
9327
9327
|
} else {
|
|
9328
9328
|
log.trace("fileWatcher", `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`);
|
|
9329
|
-
|
|
9329
|
+
resolve9(null);
|
|
9330
9330
|
}
|
|
9331
9331
|
});
|
|
9332
9332
|
});
|
|
@@ -9412,7 +9412,7 @@ var ChunkEmitter = class {
|
|
|
9412
9412
|
if (this.pairingInvalid) {
|
|
9413
9413
|
return Promise.resolve({ dead: true });
|
|
9414
9414
|
}
|
|
9415
|
-
return new Promise((
|
|
9415
|
+
return new Promise((resolve9) => {
|
|
9416
9416
|
let refreshedOnce = false;
|
|
9417
9417
|
const attempt = (attemptsLeft) => {
|
|
9418
9418
|
_transport3.post(this.url, this.headers, payload).then(({ statusCode, body: resBody }) => {
|
|
@@ -9420,13 +9420,13 @@ var ChunkEmitter = class {
|
|
|
9420
9420
|
if (statusCode === 410 || statusCode === 404 && /SESSION_NOT_FOUND|SESSION_GONE/.test(resBody)) {
|
|
9421
9421
|
process.stderr.write("[codeam] session was deleted/disconnected \u2014 stopping output stream.\n");
|
|
9422
9422
|
log.info("chunkEmitter", `dead status=${statusCode} took=${tookMs}ms`);
|
|
9423
|
-
|
|
9423
|
+
resolve9({ dead: true });
|
|
9424
9424
|
return;
|
|
9425
9425
|
}
|
|
9426
9426
|
if (statusCode === 401 || statusCode === 403) {
|
|
9427
9427
|
if (refreshedOnce) {
|
|
9428
9428
|
this.markPairingInvalid(statusCode, tookMs);
|
|
9429
|
-
|
|
9429
|
+
resolve9({ dead: true });
|
|
9430
9430
|
return;
|
|
9431
9431
|
}
|
|
9432
9432
|
log.warn("chunkEmitter", `auth ${statusCode} took=${tookMs}ms \u2014 attempting silent refresh`);
|
|
@@ -9442,10 +9442,10 @@ var ChunkEmitter = class {
|
|
|
9442
9442
|
}
|
|
9443
9443
|
if (refresh.kind === "gone") {
|
|
9444
9444
|
this.markPairingInvalid(statusCode, tookMs);
|
|
9445
|
-
|
|
9445
|
+
resolve9({ dead: true });
|
|
9446
9446
|
return;
|
|
9447
9447
|
}
|
|
9448
|
-
|
|
9448
|
+
resolve9({ dead: false });
|
|
9449
9449
|
})();
|
|
9450
9450
|
return;
|
|
9451
9451
|
}
|
|
@@ -9456,7 +9456,7 @@ var ChunkEmitter = class {
|
|
|
9456
9456
|
} else {
|
|
9457
9457
|
log.info("chunkEmitter", `ok status=${statusCode} took=${tookMs}ms`);
|
|
9458
9458
|
}
|
|
9459
|
-
|
|
9459
|
+
resolve9({ dead: false });
|
|
9460
9460
|
}).catch((err) => {
|
|
9461
9461
|
log.warn(
|
|
9462
9462
|
"chunkEmitter",
|
|
@@ -9467,7 +9467,7 @@ var ChunkEmitter = class {
|
|
|
9467
9467
|
const delay = 200 * (maxRetries - attemptsLeft + 1);
|
|
9468
9468
|
setTimeout(() => attempt(attemptsLeft - 1), delay);
|
|
9469
9469
|
} else {
|
|
9470
|
-
|
|
9470
|
+
resolve9({ dead: false });
|
|
9471
9471
|
}
|
|
9472
9472
|
});
|
|
9473
9473
|
};
|
|
@@ -9490,7 +9490,7 @@ var _transport3 = {
|
|
|
9490
9490
|
post: _post2
|
|
9491
9491
|
};
|
|
9492
9492
|
function _post2(url2, headers, payload) {
|
|
9493
|
-
return new Promise((
|
|
9493
|
+
return new Promise((resolve9, reject) => {
|
|
9494
9494
|
let settled = false;
|
|
9495
9495
|
const u2 = new URL(url2);
|
|
9496
9496
|
const transport = u2.protocol === "https:" ? https4 : http4;
|
|
@@ -9514,7 +9514,7 @@ function _post2(url2, headers, payload) {
|
|
|
9514
9514
|
res.on("end", () => {
|
|
9515
9515
|
if (settled) return;
|
|
9516
9516
|
settled = true;
|
|
9517
|
-
|
|
9517
|
+
resolve9({ statusCode: res.statusCode ?? 0, body: resData });
|
|
9518
9518
|
});
|
|
9519
9519
|
}
|
|
9520
9520
|
);
|
|
@@ -10589,12 +10589,12 @@ async function applyFileReview(workingDir, filePath, action) {
|
|
|
10589
10589
|
return { ok: true, action, filePath, repoRoot };
|
|
10590
10590
|
}
|
|
10591
10591
|
function runGit2(cwd, args2) {
|
|
10592
|
-
return new Promise((
|
|
10592
|
+
return new Promise((resolve9) => {
|
|
10593
10593
|
let proc;
|
|
10594
10594
|
try {
|
|
10595
10595
|
proc = (0, import_child_process6.spawn)("git", args2, { cwd, env: process.env });
|
|
10596
10596
|
} catch (err) {
|
|
10597
|
-
|
|
10597
|
+
resolve9({ ok: false, code: -1, stdout: "", stderr: err.message });
|
|
10598
10598
|
return;
|
|
10599
10599
|
}
|
|
10600
10600
|
let stdout = "";
|
|
@@ -10607,11 +10607,11 @@ function runGit2(cwd, args2) {
|
|
|
10607
10607
|
});
|
|
10608
10608
|
proc.on(
|
|
10609
10609
|
"error",
|
|
10610
|
-
(err) =>
|
|
10610
|
+
(err) => resolve9({ ok: false, code: -1, stdout, stderr: stderr + err.message })
|
|
10611
10611
|
);
|
|
10612
10612
|
proc.on(
|
|
10613
10613
|
"close",
|
|
10614
|
-
(code) =>
|
|
10614
|
+
(code) => resolve9({ ok: code === 0, code: code ?? -1, stdout, stderr })
|
|
10615
10615
|
);
|
|
10616
10616
|
});
|
|
10617
10617
|
}
|
|
@@ -13283,10 +13283,10 @@ function buildForPlatform(platform3) {
|
|
|
13283
13283
|
var import_node_crypto4 = require("crypto");
|
|
13284
13284
|
|
|
13285
13285
|
// src/agents/claude/resolver.ts
|
|
13286
|
-
function buildClaudeLaunch(extraArgs = [],
|
|
13287
|
-
const found =
|
|
13286
|
+
function buildClaudeLaunch(extraArgs = [], os60 = createOsStrategy()) {
|
|
13287
|
+
const found = os60.findInPath("claude") ?? os60.findInPath("claude-code");
|
|
13288
13288
|
if (!found) return null;
|
|
13289
|
-
return
|
|
13289
|
+
return os60.buildLaunch(found, extraArgs);
|
|
13290
13290
|
}
|
|
13291
13291
|
|
|
13292
13292
|
// src/agents/claude/installer.ts
|
|
@@ -13313,12 +13313,12 @@ function isAvailable() {
|
|
|
13313
13313
|
}
|
|
13314
13314
|
function augmentPath() {
|
|
13315
13315
|
const dirs = probeInstallDirs();
|
|
13316
|
-
const
|
|
13316
|
+
const sep7 = path16.delimiter;
|
|
13317
13317
|
const current = process.env.PATH ?? "";
|
|
13318
|
-
const existing = new Set(current.split(
|
|
13318
|
+
const existing = new Set(current.split(sep7).filter(Boolean));
|
|
13319
13319
|
const additions = dirs.filter((d3) => !existing.has(d3));
|
|
13320
13320
|
if (additions.length === 0) return;
|
|
13321
|
-
process.env.PATH = additions.join(
|
|
13321
|
+
process.env.PATH = additions.join(sep7) + sep7 + current;
|
|
13322
13322
|
}
|
|
13323
13323
|
function runInstaller() {
|
|
13324
13324
|
const isWindows = process.platform === "win32";
|
|
@@ -13330,15 +13330,15 @@ function runInstaller() {
|
|
|
13330
13330
|
"-Command",
|
|
13331
13331
|
"irm https://claude.ai/install.ps1 | iex"
|
|
13332
13332
|
] : ["-c", "curl -fsSL https://claude.ai/install.sh | bash"];
|
|
13333
|
-
return new Promise((
|
|
13333
|
+
return new Promise((resolve9) => {
|
|
13334
13334
|
const proc = (0, import_child_process9.spawn)(cmd, args2, { stdio: "inherit" });
|
|
13335
13335
|
proc.on("error", (err) => {
|
|
13336
13336
|
console.error(`
|
|
13337
13337
|
\u2717 Installer failed to launch: ${err.message}`);
|
|
13338
|
-
|
|
13338
|
+
resolve9(false);
|
|
13339
13339
|
});
|
|
13340
13340
|
proc.on("exit", (code) => {
|
|
13341
|
-
|
|
13341
|
+
resolve9(code === 0);
|
|
13342
13342
|
});
|
|
13343
13343
|
});
|
|
13344
13344
|
}
|
|
@@ -13471,7 +13471,7 @@ function extractSetupTokenFromOutput(output) {
|
|
|
13471
13471
|
return m ? m[0] : null;
|
|
13472
13472
|
}
|
|
13473
13473
|
function captureClaudeSetupToken() {
|
|
13474
|
-
return new Promise((
|
|
13474
|
+
return new Promise((resolve9, reject) => {
|
|
13475
13475
|
const child = (0, import_node_child_process3.spawn)("claude", ["setup-token"], {
|
|
13476
13476
|
stdio: ["inherit", "pipe", "inherit"]
|
|
13477
13477
|
});
|
|
@@ -13485,7 +13485,7 @@ function captureClaudeSetupToken() {
|
|
|
13485
13485
|
child.on("exit", (code) => {
|
|
13486
13486
|
const token = extractSetupTokenFromOutput(out2);
|
|
13487
13487
|
if (token) {
|
|
13488
|
-
|
|
13488
|
+
resolve9({ method: "setup_token", credential: token, source: "setup-token" });
|
|
13489
13489
|
return;
|
|
13490
13490
|
}
|
|
13491
13491
|
reject(
|
|
@@ -13571,17 +13571,17 @@ function parseUsageOutput(raw) {
|
|
|
13571
13571
|
return { percent, resetAt };
|
|
13572
13572
|
}
|
|
13573
13573
|
async function fetchClaudeQuota() {
|
|
13574
|
-
return new Promise((
|
|
13574
|
+
return new Promise((resolve9) => {
|
|
13575
13575
|
const claudeCmd = findInPath("claude") ? "claude" : "claude-code";
|
|
13576
13576
|
if (!claudeCmd) {
|
|
13577
|
-
|
|
13577
|
+
resolve9(null);
|
|
13578
13578
|
return;
|
|
13579
13579
|
}
|
|
13580
13580
|
const helperPath = path18.join(os13.tmpdir(), "codeam-quota-helper.py");
|
|
13581
13581
|
fs15.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
|
|
13582
13582
|
const python = findInPath("python3") ?? findInPath("python");
|
|
13583
13583
|
if (!python) {
|
|
13584
|
-
|
|
13584
|
+
resolve9(null);
|
|
13585
13585
|
return;
|
|
13586
13586
|
}
|
|
13587
13587
|
const proc = (0, import_child_process10.spawn)(python, [helperPath, claudeCmd, "--tools", ""], {
|
|
@@ -13608,13 +13608,13 @@ async function fetchClaudeQuota() {
|
|
|
13608
13608
|
fs15.unlinkSync(helperPath);
|
|
13609
13609
|
} catch {
|
|
13610
13610
|
}
|
|
13611
|
-
|
|
13611
|
+
resolve9(result);
|
|
13612
13612
|
}, 5e3);
|
|
13613
13613
|
}, 8e3);
|
|
13614
13614
|
setTimeout(() => {
|
|
13615
13615
|
if (!resolved) {
|
|
13616
13616
|
resolved = true;
|
|
13617
|
-
|
|
13617
|
+
resolve9(null);
|
|
13618
13618
|
}
|
|
13619
13619
|
try {
|
|
13620
13620
|
proc.kill();
|
|
@@ -13639,12 +13639,12 @@ function killActiveSpawnAndCaptureChildren() {
|
|
|
13639
13639
|
}
|
|
13640
13640
|
async function spawnAndCapture(cmd, args2, opts = {}) {
|
|
13641
13641
|
const timeoutMs = opts.timeoutMs ?? 6e4;
|
|
13642
|
-
return new Promise((
|
|
13642
|
+
return new Promise((resolve9) => {
|
|
13643
13643
|
let settled = false;
|
|
13644
13644
|
const settle = (value) => {
|
|
13645
13645
|
if (settled) return;
|
|
13646
13646
|
settled = true;
|
|
13647
|
-
|
|
13647
|
+
resolve9(value);
|
|
13648
13648
|
};
|
|
13649
13649
|
let child;
|
|
13650
13650
|
try {
|
|
@@ -13876,8 +13876,8 @@ var ClaudeRuntimeStrategy = class {
|
|
|
13876
13876
|
meta = getAgent("claude");
|
|
13877
13877
|
mode = "interactive";
|
|
13878
13878
|
os;
|
|
13879
|
-
constructor(
|
|
13880
|
-
this.os =
|
|
13879
|
+
constructor(os60) {
|
|
13880
|
+
this.os = os60;
|
|
13881
13881
|
}
|
|
13882
13882
|
/**
|
|
13883
13883
|
* Claude Code's react-ink TUI enables bracketed-paste mode at
|
|
@@ -14555,7 +14555,7 @@ function newestRolloutIdSince(sessionsRoot, resolvedCwd, floorMs) {
|
|
|
14555
14555
|
return bestId;
|
|
14556
14556
|
}
|
|
14557
14557
|
function sleep2(ms) {
|
|
14558
|
-
return new Promise((
|
|
14558
|
+
return new Promise((resolve9) => setTimeout(resolve9, ms));
|
|
14559
14559
|
}
|
|
14560
14560
|
function getCurrentUsage2(historyDir) {
|
|
14561
14561
|
if (!import_node_fs3.default.existsSync(historyDir)) return null;
|
|
@@ -14657,8 +14657,8 @@ function codexCredentialLocator() {
|
|
|
14657
14657
|
function codexLoginLauncher() {
|
|
14658
14658
|
return {
|
|
14659
14659
|
async ensureInstalled() {
|
|
14660
|
-
const
|
|
14661
|
-
return
|
|
14660
|
+
const os60 = createOsStrategy();
|
|
14661
|
+
return os60.findInPath("codex") !== null;
|
|
14662
14662
|
},
|
|
14663
14663
|
launch() {
|
|
14664
14664
|
return (0, import_node_child_process4.spawn)("codex", ["login"], { stdio: "inherit" });
|
|
@@ -14681,8 +14681,8 @@ var CodexRuntimeStrategy = class {
|
|
|
14681
14681
|
meta = getAgent("codex");
|
|
14682
14682
|
mode = "interactive";
|
|
14683
14683
|
os;
|
|
14684
|
-
constructor(
|
|
14685
|
-
this.os =
|
|
14684
|
+
constructor(os60) {
|
|
14685
|
+
this.os = os60;
|
|
14686
14686
|
}
|
|
14687
14687
|
async prepareLaunch() {
|
|
14688
14688
|
let binary = this.os.findInPath("codex");
|
|
@@ -14791,16 +14791,16 @@ var CodexRuntimeStrategy = class {
|
|
|
14791
14791
|
});
|
|
14792
14792
|
}
|
|
14793
14793
|
};
|
|
14794
|
-
function resolveNpm(
|
|
14795
|
-
return
|
|
14794
|
+
function resolveNpm(os60) {
|
|
14795
|
+
return os60.id === "win32" ? "npm.cmd" : "npm";
|
|
14796
14796
|
}
|
|
14797
|
-
async function installCodexViaNpm(
|
|
14798
|
-
return new Promise((
|
|
14799
|
-
const proc = (0, import_node_child_process5.spawn)(resolveNpm(
|
|
14797
|
+
async function installCodexViaNpm(os60) {
|
|
14798
|
+
return new Promise((resolve9, reject) => {
|
|
14799
|
+
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os60), ["install", "-g", "@openai/codex"], {
|
|
14800
14800
|
stdio: "inherit"
|
|
14801
14801
|
});
|
|
14802
14802
|
proc.on("close", (code) => {
|
|
14803
|
-
if (code === 0)
|
|
14803
|
+
if (code === 0) resolve9();
|
|
14804
14804
|
else reject(new Error(`npm install -g @openai/codex exited ${code}`));
|
|
14805
14805
|
});
|
|
14806
14806
|
proc.on("error", (err) => {
|
|
@@ -14813,16 +14813,16 @@ async function installCodexViaNpm(os59) {
|
|
|
14813
14813
|
});
|
|
14814
14814
|
});
|
|
14815
14815
|
}
|
|
14816
|
-
function augmentNpmGlobalBin(
|
|
14816
|
+
function augmentNpmGlobalBin(os60) {
|
|
14817
14817
|
try {
|
|
14818
|
-
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(
|
|
14818
|
+
const result = (0, import_node_child_process5.spawnSync)(resolveNpm(os60), ["prefix", "-g"], {
|
|
14819
14819
|
stdio: ["ignore", "pipe", "ignore"]
|
|
14820
14820
|
});
|
|
14821
14821
|
if (result.status !== 0) return;
|
|
14822
14822
|
const prefix = result.stdout.toString().trim();
|
|
14823
14823
|
if (!prefix) return;
|
|
14824
|
-
const binDir =
|
|
14825
|
-
|
|
14824
|
+
const binDir = os60.id === "win32" ? prefix : path24.join(prefix, "bin");
|
|
14825
|
+
os60.augmentPath([binDir]);
|
|
14826
14826
|
} catch {
|
|
14827
14827
|
}
|
|
14828
14828
|
}
|
|
@@ -14906,16 +14906,16 @@ var import_node_child_process8 = require("child_process");
|
|
|
14906
14906
|
// src/agents/coderabbit/installer.ts
|
|
14907
14907
|
var import_node_child_process6 = require("child_process");
|
|
14908
14908
|
var INSTALL_URL = "https://cli.coderabbit.ai/install.sh";
|
|
14909
|
-
async function ensureCoderabbitInstalled(
|
|
14910
|
-
if (
|
|
14911
|
-
if (
|
|
14909
|
+
async function ensureCoderabbitInstalled(os60) {
|
|
14910
|
+
if (os60.findInPath("coderabbit")) return true;
|
|
14911
|
+
if (os60.id === "win32") {
|
|
14912
14912
|
console.error(
|
|
14913
14913
|
"\n \u2717 CodeRabbit on Windows requires WSL.\n Install the CLI inside your WSL distribution\n (curl -fsSL https://cli.coderabbit.ai/install.sh | sh)\n then re-run `codeam link coderabbit` from WSL.\n"
|
|
14914
14914
|
);
|
|
14915
14915
|
return false;
|
|
14916
14916
|
}
|
|
14917
14917
|
console.log("\n CodeRabbit CLI not found \u2014 installing via the official script\u2026\n");
|
|
14918
|
-
const ok = await new Promise((
|
|
14918
|
+
const ok = await new Promise((resolve9) => {
|
|
14919
14919
|
const INSTALL_TIMEOUT_MS2 = 15e4;
|
|
14920
14920
|
const proc = (0, import_node_child_process6.spawn)(
|
|
14921
14921
|
"sh",
|
|
@@ -14927,7 +14927,7 @@ async function ensureCoderabbitInstalled(os59) {
|
|
|
14927
14927
|
if (settled) return;
|
|
14928
14928
|
settled = true;
|
|
14929
14929
|
clearTimeout(timer);
|
|
14930
|
-
|
|
14930
|
+
resolve9(v);
|
|
14931
14931
|
};
|
|
14932
14932
|
const timer = setTimeout(() => {
|
|
14933
14933
|
console.error("\n \u2717 CodeRabbit install timed out \u2014 check network egress and retry.\n");
|
|
@@ -14941,8 +14941,8 @@ async function ensureCoderabbitInstalled(os59) {
|
|
|
14941
14941
|
proc.on("error", () => finish(false));
|
|
14942
14942
|
});
|
|
14943
14943
|
if (!ok) return false;
|
|
14944
|
-
|
|
14945
|
-
return
|
|
14944
|
+
os60.augmentPath([`${os60.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
14945
|
+
return os60.findInPath("coderabbit") !== null;
|
|
14946
14946
|
}
|
|
14947
14947
|
|
|
14948
14948
|
// src/agents/coderabbit/link.ts
|
|
@@ -14977,10 +14977,10 @@ function coderabbitCredentialLocator() {
|
|
|
14977
14977
|
validate: validateNonEmptyCredential
|
|
14978
14978
|
};
|
|
14979
14979
|
}
|
|
14980
|
-
function coderabbitLoginLauncher(
|
|
14980
|
+
function coderabbitLoginLauncher(os60) {
|
|
14981
14981
|
return {
|
|
14982
14982
|
async ensureInstalled() {
|
|
14983
|
-
return ensureCoderabbitInstalled(
|
|
14983
|
+
return ensureCoderabbitInstalled(os60);
|
|
14984
14984
|
},
|
|
14985
14985
|
launch() {
|
|
14986
14986
|
return (0, import_node_child_process7.spawn)("coderabbit", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -15036,8 +15036,8 @@ function pickLine(obj) {
|
|
|
15036
15036
|
function toHunk(raw, groupSeverity) {
|
|
15037
15037
|
if (!raw || typeof raw !== "object") return null;
|
|
15038
15038
|
const o = raw;
|
|
15039
|
-
const
|
|
15040
|
-
if (!
|
|
15039
|
+
const path80 = asString(pick(o, ["file_path", "filePath", "file", "path", "filename", "fileName"])) ?? asString(pick(o, ["location"])?.path);
|
|
15040
|
+
if (!path80) return null;
|
|
15041
15041
|
const message = asString(
|
|
15042
15042
|
pick(o, [
|
|
15043
15043
|
"comment",
|
|
@@ -15054,7 +15054,7 @@ function toHunk(raw, groupSeverity) {
|
|
|
15054
15054
|
const severity = normSeverity(pick(o, ["severity", "level", "priority", "impact"])) ?? normSeverity(groupSeverity);
|
|
15055
15055
|
const locObj = pick(o, ["location"]) ?? o;
|
|
15056
15056
|
return {
|
|
15057
|
-
path:
|
|
15057
|
+
path: path80.trim(),
|
|
15058
15058
|
line: pickLine(o) ?? pickLine(locObj),
|
|
15059
15059
|
severity,
|
|
15060
15060
|
message: (title && message ? `${title}: ${message}` : title || message).trim() || "(no message)"
|
|
@@ -15137,10 +15137,10 @@ function parsePlain(stdout) {
|
|
|
15137
15137
|
for (const line of stdout.split(/\r?\n/)) {
|
|
15138
15138
|
const m = line.match(HUNK_LINE_RE);
|
|
15139
15139
|
if (!m) continue;
|
|
15140
|
-
const [,
|
|
15141
|
-
if (!
|
|
15140
|
+
const [, path80, lineNo, sevToken, message] = m;
|
|
15141
|
+
if (!path80 || !lineNo || !message) continue;
|
|
15142
15142
|
hunks.push({
|
|
15143
|
-
path:
|
|
15143
|
+
path: path80.trim(),
|
|
15144
15144
|
line: Number(lineNo),
|
|
15145
15145
|
severity: sevToken ? SEVERITY_MAP[sevToken.toLowerCase()] : void 0,
|
|
15146
15146
|
message: message.trim().replace(/^[*-]\s+/, "")
|
|
@@ -15200,8 +15200,8 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
15200
15200
|
meta = getAgent("coderabbit");
|
|
15201
15201
|
mode = "batch";
|
|
15202
15202
|
os;
|
|
15203
|
-
constructor(
|
|
15204
|
-
this.os =
|
|
15203
|
+
constructor(os60) {
|
|
15204
|
+
this.os = os60;
|
|
15205
15205
|
}
|
|
15206
15206
|
getDefaultArgs() {
|
|
15207
15207
|
return ["review", "--agent"];
|
|
@@ -15237,7 +15237,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
15237
15237
|
}
|
|
15238
15238
|
async runOneShot(input) {
|
|
15239
15239
|
const launch = await this.prepareInvocation(input);
|
|
15240
|
-
return new Promise((
|
|
15240
|
+
return new Promise((resolve9, reject) => {
|
|
15241
15241
|
const stdoutBuf = [];
|
|
15242
15242
|
const stderrBuf = [];
|
|
15243
15243
|
const proc = (0, import_node_child_process8.spawn)(launch.cmd, launch.args, {
|
|
@@ -15249,7 +15249,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
15249
15249
|
if (settled) return;
|
|
15250
15250
|
settled = true;
|
|
15251
15251
|
clearTimeout(timer);
|
|
15252
|
-
|
|
15252
|
+
resolve9(out2);
|
|
15253
15253
|
};
|
|
15254
15254
|
const timer = setTimeout(() => {
|
|
15255
15255
|
if (settled) return;
|
|
@@ -15472,10 +15472,10 @@ function cursorCredentialLocator() {
|
|
|
15472
15472
|
validate: validateNonEmptyCredential
|
|
15473
15473
|
};
|
|
15474
15474
|
}
|
|
15475
|
-
function cursorLoginLauncher(
|
|
15475
|
+
function cursorLoginLauncher(os60) {
|
|
15476
15476
|
return {
|
|
15477
15477
|
async ensureInstalled() {
|
|
15478
|
-
if (
|
|
15478
|
+
if (os60.findInPath("cursor-agent")) return true;
|
|
15479
15479
|
console.error(
|
|
15480
15480
|
"\n \u2717 cursor-agent binary not on PATH.\n Install Cursor (https://cursor.com/) and ensure the CLI\n plugin is enabled, then re-run `codeam link cursor`.\n"
|
|
15481
15481
|
);
|
|
@@ -15539,8 +15539,8 @@ var CursorRuntimeStrategy = class {
|
|
|
15539
15539
|
meta = getAgent("cursor");
|
|
15540
15540
|
mode = "interactive";
|
|
15541
15541
|
os;
|
|
15542
|
-
constructor(
|
|
15543
|
-
this.os =
|
|
15542
|
+
constructor(os60) {
|
|
15543
|
+
this.os = os60;
|
|
15544
15544
|
}
|
|
15545
15545
|
async prepareLaunch() {
|
|
15546
15546
|
const binary = this.os.findInPath("cursor-agent");
|
|
@@ -15756,10 +15756,10 @@ function aiderCredentialLocator() {
|
|
|
15756
15756
|
validate: validateNonEmptyCredential
|
|
15757
15757
|
};
|
|
15758
15758
|
}
|
|
15759
|
-
function aiderLoginLauncher(
|
|
15759
|
+
function aiderLoginLauncher(os60) {
|
|
15760
15760
|
return {
|
|
15761
15761
|
async ensureInstalled() {
|
|
15762
|
-
if (
|
|
15762
|
+
if (os60.findInPath("aider")) return true;
|
|
15763
15763
|
console.error(
|
|
15764
15764
|
"\n \u2717 aider binary not on PATH.\n Install Aider:\n pip install aider-chat\n then re-run `codeam link aider`.\n"
|
|
15765
15765
|
);
|
|
@@ -15769,7 +15769,7 @@ function aiderLoginLauncher(os59) {
|
|
|
15769
15769
|
console.error(
|
|
15770
15770
|
"\n Aider has no interactive login flow.\n Set ANTHROPIC_API_KEY or OPENAI_API_KEY in your shell,\n or re-run `codeam link aider --api-key=<your-key>`.\n"
|
|
15771
15771
|
);
|
|
15772
|
-
return (0, import_node_child_process11.spawn)(
|
|
15772
|
+
return (0, import_node_child_process11.spawn)(os60.id === "win32" ? "cmd.exe" : "sh", os60.id === "win32" ? ["/c", "exit", "0"] : ["-c", "exit 0"], {
|
|
15773
15773
|
stdio: "ignore"
|
|
15774
15774
|
});
|
|
15775
15775
|
}
|
|
@@ -15841,8 +15841,8 @@ var AiderRuntimeStrategy = class {
|
|
|
15841
15841
|
meta = getAgent("aider");
|
|
15842
15842
|
mode = "interactive";
|
|
15843
15843
|
os;
|
|
15844
|
-
constructor(
|
|
15845
|
-
this.os =
|
|
15844
|
+
constructor(os60) {
|
|
15845
|
+
this.os = os60;
|
|
15846
15846
|
}
|
|
15847
15847
|
async prepareLaunch() {
|
|
15848
15848
|
const binary = this.os.findInPath("aider");
|
|
@@ -15974,8 +15974,8 @@ function geminiCredentialLocator() {
|
|
|
15974
15974
|
function geminiLoginLauncher() {
|
|
15975
15975
|
return {
|
|
15976
15976
|
async ensureInstalled() {
|
|
15977
|
-
const
|
|
15978
|
-
return
|
|
15977
|
+
const os60 = createOsStrategy();
|
|
15978
|
+
return os60.findInPath("gemini") !== null;
|
|
15979
15979
|
},
|
|
15980
15980
|
launch() {
|
|
15981
15981
|
return (0, import_node_child_process12.spawn)("gemini", ["auth", "login"], { stdio: "inherit" });
|
|
@@ -16165,8 +16165,8 @@ var GeminiRuntimeStrategy = class {
|
|
|
16165
16165
|
meta = getAgent("gemini");
|
|
16166
16166
|
mode = "interactive";
|
|
16167
16167
|
os;
|
|
16168
|
-
constructor(
|
|
16169
|
-
this.os =
|
|
16168
|
+
constructor(os60) {
|
|
16169
|
+
this.os = os60;
|
|
16170
16170
|
}
|
|
16171
16171
|
async prepareLaunch() {
|
|
16172
16172
|
const binary = this.os.findInPath("gemini");
|
|
@@ -16380,7 +16380,7 @@ function newestSessionSince(bucket, floorMs) {
|
|
|
16380
16380
|
return bestId;
|
|
16381
16381
|
}
|
|
16382
16382
|
function sleep3(ms) {
|
|
16383
|
-
return new Promise((
|
|
16383
|
+
return new Promise((resolve9) => setTimeout(resolve9, ms));
|
|
16384
16384
|
}
|
|
16385
16385
|
function joinTextParts(parts) {
|
|
16386
16386
|
if (!Array.isArray(parts)) return "";
|
|
@@ -16457,8 +16457,8 @@ var KimiRuntimeStrategy = class {
|
|
|
16457
16457
|
meta = getAgent("kimi");
|
|
16458
16458
|
mode = "interactive";
|
|
16459
16459
|
os;
|
|
16460
|
-
constructor(
|
|
16461
|
-
this.os =
|
|
16460
|
+
constructor(os60) {
|
|
16461
|
+
this.os = os60;
|
|
16462
16462
|
}
|
|
16463
16463
|
async prepareLaunch() {
|
|
16464
16464
|
const binary = this.os.findInPath("kimi");
|
|
@@ -16600,8 +16600,8 @@ var OpencodeRuntimeStrategy = class {
|
|
|
16600
16600
|
meta = getAgent("opencode");
|
|
16601
16601
|
mode = "interactive";
|
|
16602
16602
|
os;
|
|
16603
|
-
constructor(
|
|
16604
|
-
this.os =
|
|
16603
|
+
constructor(os60) {
|
|
16604
|
+
this.os = os60;
|
|
16605
16605
|
}
|
|
16606
16606
|
async prepareLaunch() {
|
|
16607
16607
|
const binary = this.os.findInPath("opencode");
|
|
@@ -16685,20 +16685,20 @@ var OpencodeRuntimeStrategy = class {
|
|
|
16685
16685
|
|
|
16686
16686
|
// src/agents/registry.ts
|
|
16687
16687
|
var runtimeBuilders = {
|
|
16688
|
-
claude: (
|
|
16689
|
-
codex: (
|
|
16690
|
-
coderabbit: (
|
|
16691
|
-
cursor: (
|
|
16692
|
-
aider: (
|
|
16693
|
-
gemini: (
|
|
16694
|
-
kimi: (
|
|
16695
|
-
opencode: (
|
|
16688
|
+
claude: (os60) => new ClaudeRuntimeStrategy(os60),
|
|
16689
|
+
codex: (os60) => new CodexRuntimeStrategy(os60),
|
|
16690
|
+
coderabbit: (os60) => new CoderabbitRuntimeStrategy(os60),
|
|
16691
|
+
cursor: (os60) => new CursorRuntimeStrategy(os60),
|
|
16692
|
+
aider: (os60) => new AiderRuntimeStrategy(os60),
|
|
16693
|
+
gemini: (os60) => new GeminiRuntimeStrategy(os60),
|
|
16694
|
+
kimi: (os60) => new KimiRuntimeStrategy(os60),
|
|
16695
|
+
opencode: (os60) => new OpencodeRuntimeStrategy(os60)
|
|
16696
16696
|
};
|
|
16697
16697
|
var deployBuilders = {
|
|
16698
16698
|
claude: () => new ClaudeDeployStrategy(),
|
|
16699
16699
|
codex: () => new CodexDeployStrategy()
|
|
16700
16700
|
};
|
|
16701
|
-
function createAgentStrategy(agent,
|
|
16701
|
+
function createAgentStrategy(agent, os60 = createOsStrategy()) {
|
|
16702
16702
|
if (!AGENT_REGISTRY[agent]?.enabled) {
|
|
16703
16703
|
throw new Error(
|
|
16704
16704
|
`Agent "${agent}" is not supported in this codeam-cli version. Upgrade with 'npm i -g codeam-cli@latest'.`
|
|
@@ -16708,10 +16708,10 @@ function createAgentStrategy(agent, os59 = createOsStrategy()) {
|
|
|
16708
16708
|
if (!build) {
|
|
16709
16709
|
throw new Error(`No runtime strategy registered for agent "${agent}"`);
|
|
16710
16710
|
}
|
|
16711
|
-
return build(
|
|
16711
|
+
return build(os60);
|
|
16712
16712
|
}
|
|
16713
|
-
function createInteractiveAgentStrategy(agent,
|
|
16714
|
-
const s = createAgentStrategy(agent,
|
|
16713
|
+
function createInteractiveAgentStrategy(agent, os60 = createOsStrategy()) {
|
|
16714
|
+
const s = createAgentStrategy(agent, os60);
|
|
16715
16715
|
if (s.mode !== "interactive") {
|
|
16716
16716
|
throw new Error(
|
|
16717
16717
|
`Agent "${agent}" is a batch agent; use createAgentStrategy + .runOneShot for one-shot reviews.`
|
|
@@ -16827,7 +16827,7 @@ async function link(args2 = []) {
|
|
|
16827
16827
|
waitSpin.start(waitMsg());
|
|
16828
16828
|
const countdown = setInterval(() => waitSpin.message(waitMsg()), 1e3);
|
|
16829
16829
|
countdown.unref?.();
|
|
16830
|
-
const paired = await new Promise((
|
|
16830
|
+
const paired = await new Promise((resolve9, reject) => {
|
|
16831
16831
|
let stopPoll = null;
|
|
16832
16832
|
const sigint = () => {
|
|
16833
16833
|
clearInterval(countdown);
|
|
@@ -16840,7 +16840,7 @@ async function link(args2 = []) {
|
|
|
16840
16840
|
process.removeListener("SIGINT", sigint);
|
|
16841
16841
|
clearInterval(countdown);
|
|
16842
16842
|
waitSpin.stop("Paired");
|
|
16843
|
-
|
|
16843
|
+
resolve9(info);
|
|
16844
16844
|
},
|
|
16845
16845
|
() => {
|
|
16846
16846
|
clearInterval(countdown);
|
|
@@ -16998,14 +16998,14 @@ async function captureFreshCredentials(ctx) {
|
|
|
16998
16998
|
}
|
|
16999
16999
|
};
|
|
17000
17000
|
try {
|
|
17001
|
-
const token = await new Promise((
|
|
17001
|
+
const token = await new Promise((resolve9, reject) => {
|
|
17002
17002
|
let settled = false;
|
|
17003
17003
|
const tryExtract = async () => {
|
|
17004
17004
|
if (settled) return;
|
|
17005
17005
|
const t2 = await ctx.locator.extract();
|
|
17006
17006
|
if (t2 && !settled) {
|
|
17007
17007
|
settled = true;
|
|
17008
|
-
|
|
17008
|
+
resolve9(t2);
|
|
17009
17009
|
}
|
|
17010
17010
|
};
|
|
17011
17011
|
watcher.on("add", () => void tryExtract());
|
|
@@ -17214,7 +17214,7 @@ function deliverPendingCoderabbitCallback(callbackUrl) {
|
|
|
17214
17214
|
function runCoderabbitOAuthLogin(deps) {
|
|
17215
17215
|
const timeoutMs = deps.timeoutMs ?? 18e4;
|
|
17216
17216
|
const spawnProc = deps.spawn ?? spawnCoderabbitLoginProc;
|
|
17217
|
-
return new Promise((
|
|
17217
|
+
return new Promise((resolve9) => {
|
|
17218
17218
|
let settled = false;
|
|
17219
17219
|
let stdout = "";
|
|
17220
17220
|
let last = null;
|
|
@@ -17227,13 +17227,13 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
17227
17227
|
child.kill("SIGKILL");
|
|
17228
17228
|
} catch {
|
|
17229
17229
|
}
|
|
17230
|
-
|
|
17230
|
+
resolve9(r);
|
|
17231
17231
|
};
|
|
17232
17232
|
let child;
|
|
17233
17233
|
try {
|
|
17234
17234
|
child = spawnProc("coderabbit", ["auth", "login", "--agent"]);
|
|
17235
17235
|
} catch (err) {
|
|
17236
|
-
|
|
17236
|
+
resolve9({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
|
|
17237
17237
|
return;
|
|
17238
17238
|
}
|
|
17239
17239
|
const timer = setTimeout(
|
|
@@ -17408,26 +17408,26 @@ function restoreCoderabbitOauthBlob(value) {
|
|
|
17408
17408
|
(0, import_node_fs5.writeFileSync)(path36.join(dir, file), contents, { mode: 384 });
|
|
17409
17409
|
}
|
|
17410
17410
|
async function configureCoderabbit(input, deps = {}) {
|
|
17411
|
-
const
|
|
17411
|
+
const os60 = deps.os ?? createOsStrategy();
|
|
17412
17412
|
const ensureInstalled = deps.ensureInstalled ?? ensureCoderabbitInstalled;
|
|
17413
17413
|
const isLoggedIn = deps.isLoggedIn ?? defaultIsLoggedIn;
|
|
17414
17414
|
const runOAuth = deps.runOAuthLogin ?? runCoderabbitOAuthLogin;
|
|
17415
17415
|
const snapshot = deps.snapshotDir ?? (() => snapshotCredentialDir());
|
|
17416
17416
|
const capture2 = deps.captureCredential ?? ((b) => diffCapturedCredential(b));
|
|
17417
17417
|
const loginWithApiKey = deps.loginWithApiKey ?? defaultLoginWithApiKey;
|
|
17418
|
-
const home =
|
|
17419
|
-
|
|
17420
|
-
|
|
17418
|
+
const home = os60.homeDir();
|
|
17419
|
+
os60.augmentPath(
|
|
17420
|
+
os60.id === "win32" ? [
|
|
17421
17421
|
path36.join(home, ".local", "bin"),
|
|
17422
17422
|
path36.join(process.env.APPDATA ?? path36.join(home, "AppData", "Roaming"), "npm"),
|
|
17423
17423
|
path36.join(home, "scoop", "shims")
|
|
17424
17424
|
] : [path36.join(home, ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
|
|
17425
17425
|
);
|
|
17426
|
-
const installed2 =
|
|
17426
|
+
const installed2 = os60.findInPath("coderabbit") !== null;
|
|
17427
17427
|
const base = () => ({
|
|
17428
17428
|
action: input.action,
|
|
17429
17429
|
supported: true,
|
|
17430
|
-
installed:
|
|
17430
|
+
installed: os60.findInPath("coderabbit") !== null,
|
|
17431
17431
|
loggedIn: false
|
|
17432
17432
|
});
|
|
17433
17433
|
if (input.action === "status") {
|
|
@@ -17441,7 +17441,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
17441
17441
|
const key = (input.apiKey ?? "").trim();
|
|
17442
17442
|
if (!key) return { ...res2, error: "No API key provided" };
|
|
17443
17443
|
if (!res2.installed) {
|
|
17444
|
-
const ok = await ensureInstalled(
|
|
17444
|
+
const ok = await ensureInstalled(os60);
|
|
17445
17445
|
res2.installed = ok;
|
|
17446
17446
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
17447
17447
|
}
|
|
@@ -17465,7 +17465,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
17465
17465
|
}
|
|
17466
17466
|
if (!res2.installed) {
|
|
17467
17467
|
deps.onEvent?.({ kind: "installing" });
|
|
17468
|
-
const ok = await ensureInstalled(
|
|
17468
|
+
const ok = await ensureInstalled(os60);
|
|
17469
17469
|
res2.installed = ok;
|
|
17470
17470
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
17471
17471
|
}
|
|
@@ -17495,7 +17495,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
17495
17495
|
const res2 = base();
|
|
17496
17496
|
if (!installed2) {
|
|
17497
17497
|
deps.onEvent?.({ kind: "installing" });
|
|
17498
|
-
const ok = await ensureInstalled(
|
|
17498
|
+
const ok = await ensureInstalled(os60);
|
|
17499
17499
|
res2.installed = ok;
|
|
17500
17500
|
if (!ok) return { ...res2, error: "CodeRabbit CLI could not be installed" };
|
|
17501
17501
|
}
|
|
@@ -17535,7 +17535,7 @@ async function configureCoderabbit(input, deps = {}) {
|
|
|
17535
17535
|
}
|
|
17536
17536
|
const res = base();
|
|
17537
17537
|
if (!res.installed) {
|
|
17538
|
-
const ok = await ensureInstalled(
|
|
17538
|
+
const ok = await ensureInstalled(os60);
|
|
17539
17539
|
res.installed = ok;
|
|
17540
17540
|
if (!ok) return { ...res, error: "CodeRabbit CLI is not installed" };
|
|
17541
17541
|
}
|
|
@@ -17692,23 +17692,23 @@ async function reviewPullRequest(params, deps) {
|
|
|
17692
17692
|
return report;
|
|
17693
17693
|
}
|
|
17694
17694
|
function defaultRunGh(args2) {
|
|
17695
|
-
return new Promise((
|
|
17695
|
+
return new Promise((resolve9) => {
|
|
17696
17696
|
const stdout = [];
|
|
17697
17697
|
const stderr = [];
|
|
17698
17698
|
let proc;
|
|
17699
17699
|
try {
|
|
17700
17700
|
proc = (0, import_node_child_process17.spawn)("gh", args2, { stdio: ["ignore", "pipe", "pipe"] });
|
|
17701
17701
|
} catch (err) {
|
|
17702
|
-
|
|
17702
|
+
resolve9({ code: -1, stdout: "", stderr: err instanceof Error ? err.message : String(err) });
|
|
17703
17703
|
return;
|
|
17704
17704
|
}
|
|
17705
17705
|
proc.stdout?.on("data", (b) => stdout.push(b));
|
|
17706
17706
|
proc.stderr?.on("data", (b) => stderr.push(b));
|
|
17707
17707
|
proc.on("error", (err) => {
|
|
17708
|
-
|
|
17708
|
+
resolve9({ code: -1, stdout: "", stderr: err.message });
|
|
17709
17709
|
});
|
|
17710
17710
|
proc.on("close", (code) => {
|
|
17711
|
-
|
|
17711
|
+
resolve9({
|
|
17712
17712
|
code: code ?? 0,
|
|
17713
17713
|
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
17714
17714
|
stderr: Buffer.concat(stderr).toString("utf8")
|
|
@@ -18680,7 +18680,7 @@ var defaultGitToolingRunner = {
|
|
|
18680
18680
|
}
|
|
18681
18681
|
},
|
|
18682
18682
|
run(cmd, args2, opts = {}) {
|
|
18683
|
-
return new Promise((
|
|
18683
|
+
return new Promise((resolve9) => {
|
|
18684
18684
|
const child = (0, import_node_child_process20.spawn)(cmd, args2, {
|
|
18685
18685
|
stdio: [opts.input !== void 0 ? "pipe" : "ignore", "ignore", "pipe"]
|
|
18686
18686
|
});
|
|
@@ -18689,7 +18689,7 @@ var defaultGitToolingRunner = {
|
|
|
18689
18689
|
const done = (code) => {
|
|
18690
18690
|
if (settled) return;
|
|
18691
18691
|
settled = true;
|
|
18692
|
-
|
|
18692
|
+
resolve9({ code, stderr });
|
|
18693
18693
|
};
|
|
18694
18694
|
child.stderr?.on("data", (b) => {
|
|
18695
18695
|
stderr += b.toString();
|
|
@@ -18847,7 +18847,7 @@ var defaultHeadroomRunner = {
|
|
|
18847
18847
|
}
|
|
18848
18848
|
},
|
|
18849
18849
|
run(cmd, args2, opts = {}) {
|
|
18850
|
-
return new Promise((
|
|
18850
|
+
return new Promise((resolve9) => {
|
|
18851
18851
|
const spawnEnv = opts.env ?? process.env;
|
|
18852
18852
|
const child = (0, import_node_child_process21.spawn)(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], env: spawnEnv });
|
|
18853
18853
|
let stderrBuf = "";
|
|
@@ -18856,7 +18856,7 @@ var defaultHeadroomRunner = {
|
|
|
18856
18856
|
const done = (code) => {
|
|
18857
18857
|
if (settled) return;
|
|
18858
18858
|
settled = true;
|
|
18859
|
-
|
|
18859
|
+
resolve9({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
18860
18860
|
};
|
|
18861
18861
|
child.stdout?.on("data", (b) => {
|
|
18862
18862
|
const chunk = b.toString();
|
|
@@ -19427,14 +19427,14 @@ function compareSemver(a, b) {
|
|
|
19427
19427
|
return 0;
|
|
19428
19428
|
}
|
|
19429
19429
|
function fetchLatest() {
|
|
19430
|
-
return new Promise((
|
|
19430
|
+
return new Promise((resolve9) => {
|
|
19431
19431
|
const req = https6.get(
|
|
19432
19432
|
REGISTRY_URL,
|
|
19433
19433
|
{ headers: { Accept: "application/json" }, timeout: REQUEST_TIMEOUT_MS },
|
|
19434
19434
|
(res) => {
|
|
19435
19435
|
if (res.statusCode !== 200) {
|
|
19436
19436
|
res.resume();
|
|
19437
|
-
|
|
19437
|
+
resolve9(null);
|
|
19438
19438
|
return;
|
|
19439
19439
|
}
|
|
19440
19440
|
let buf = "";
|
|
@@ -19446,21 +19446,21 @@ function fetchLatest() {
|
|
|
19446
19446
|
try {
|
|
19447
19447
|
const json = JSON.parse(buf);
|
|
19448
19448
|
if (typeof json.version === "string") {
|
|
19449
|
-
|
|
19449
|
+
resolve9(json.version);
|
|
19450
19450
|
} else {
|
|
19451
|
-
|
|
19451
|
+
resolve9(null);
|
|
19452
19452
|
}
|
|
19453
19453
|
} catch {
|
|
19454
|
-
|
|
19454
|
+
resolve9(null);
|
|
19455
19455
|
}
|
|
19456
19456
|
});
|
|
19457
19457
|
}
|
|
19458
19458
|
);
|
|
19459
19459
|
req.on("timeout", () => {
|
|
19460
19460
|
req.destroy();
|
|
19461
|
-
|
|
19461
|
+
resolve9(null);
|
|
19462
19462
|
});
|
|
19463
|
-
req.on("error", () =>
|
|
19463
|
+
req.on("error", () => resolve9(null));
|
|
19464
19464
|
});
|
|
19465
19465
|
}
|
|
19466
19466
|
function notifyIfStale(currentVersion, latest) {
|
|
@@ -19536,7 +19536,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
19536
19536
|
if (process.env.NODE_ENV === "test") return;
|
|
19537
19537
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
19538
19538
|
if (process.env.CI) return;
|
|
19539
|
-
const current = true ? "2.61.
|
|
19539
|
+
const current = true ? "2.61.69" : null;
|
|
19540
19540
|
if (!current) return;
|
|
19541
19541
|
const cache = readCache();
|
|
19542
19542
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -19553,7 +19553,7 @@ function checkForUpdates() {
|
|
|
19553
19553
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
19554
19554
|
if (process.env.CI) return;
|
|
19555
19555
|
if (!process.stdout.isTTY) return;
|
|
19556
|
-
const current = true ? "2.61.
|
|
19556
|
+
const current = true ? "2.61.69" : null;
|
|
19557
19557
|
if (!current) return;
|
|
19558
19558
|
const cache = readCache();
|
|
19559
19559
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -19573,13 +19573,13 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
19573
19573
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
19574
19574
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
19575
19575
|
function currentCliVersion() {
|
|
19576
|
-
return true ? "2.61.
|
|
19576
|
+
return true ? "2.61.69" : null;
|
|
19577
19577
|
}
|
|
19578
19578
|
function runCmd(cmd, args2, timeoutMs) {
|
|
19579
|
-
return new Promise((
|
|
19579
|
+
return new Promise((resolve9) => {
|
|
19580
19580
|
(0, import_node_child_process23.execFile)(cmd, args2, { timeout: timeoutMs }, (err, stdout, stderr) => {
|
|
19581
19581
|
const code = err && typeof err.code === "number" ? err.code : err ? null : 0;
|
|
19582
|
-
|
|
19582
|
+
resolve9({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
|
|
19583
19583
|
});
|
|
19584
19584
|
});
|
|
19585
19585
|
}
|
|
@@ -19902,7 +19902,7 @@ function buildFleetBoxRunArgs(p2) {
|
|
|
19902
19902
|
var DOCKER_RUN_TIMEOUT_MS = 12e4;
|
|
19903
19903
|
var defaultDockerRunner = {
|
|
19904
19904
|
run(args2, opts = {}) {
|
|
19905
|
-
return new Promise((
|
|
19905
|
+
return new Promise((resolve9) => {
|
|
19906
19906
|
const child = (0, import_node_child_process25.spawn)("docker", args2, {
|
|
19907
19907
|
stdio: ["ignore", "pipe", "pipe"],
|
|
19908
19908
|
env: { ...process.env, ...opts.env }
|
|
@@ -19921,7 +19921,7 @@ var defaultDockerRunner = {
|
|
|
19921
19921
|
if (settled) return;
|
|
19922
19922
|
settled = true;
|
|
19923
19923
|
clearTimeout(timer);
|
|
19924
|
-
|
|
19924
|
+
resolve9({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
19925
19925
|
};
|
|
19926
19926
|
child.stdout?.on("data", (b) => {
|
|
19927
19927
|
stdoutBuf += b.toString();
|
|
@@ -20772,7 +20772,7 @@ var HostAgentSupervisor = class {
|
|
|
20772
20772
|
* host-agent whose env may lack it.
|
|
20773
20773
|
*/
|
|
20774
20774
|
runAgentInstall(script) {
|
|
20775
|
-
return new Promise((
|
|
20775
|
+
return new Promise((resolve9) => {
|
|
20776
20776
|
const home = process.env.HOME || os38.homedir();
|
|
20777
20777
|
const child = (0, import_node_child_process25.spawn)("sh", ["-c", script], {
|
|
20778
20778
|
env: { ...process.env, HOME: home },
|
|
@@ -20788,7 +20788,7 @@ var HostAgentSupervisor = class {
|
|
|
20788
20788
|
const done = () => {
|
|
20789
20789
|
if (settled) return;
|
|
20790
20790
|
settled = true;
|
|
20791
|
-
|
|
20791
|
+
resolve9();
|
|
20792
20792
|
};
|
|
20793
20793
|
const timer = setTimeout(() => {
|
|
20794
20794
|
log.warn(
|
|
@@ -21250,12 +21250,12 @@ async function isExecutableBinary(p2) {
|
|
|
21250
21250
|
}
|
|
21251
21251
|
}
|
|
21252
21252
|
function extractTgz(tgzPath, destDir) {
|
|
21253
|
-
return new Promise((
|
|
21253
|
+
return new Promise((resolve9, reject) => {
|
|
21254
21254
|
const child = (0, import_child_process15.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
|
|
21255
21255
|
child.on("error", (err) => reject(err));
|
|
21256
21256
|
child.on(
|
|
21257
21257
|
"exit",
|
|
21258
|
-
(code) => code === 0 ?
|
|
21258
|
+
(code) => code === 0 ? resolve9() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
|
|
21259
21259
|
);
|
|
21260
21260
|
});
|
|
21261
21261
|
}
|
|
@@ -21469,12 +21469,12 @@ function parseExpoUrl(stdout) {
|
|
|
21469
21469
|
// src/services/preview/port-ready.ts
|
|
21470
21470
|
var net = __toESM(require("net"));
|
|
21471
21471
|
function isPortListening(port, host2 = "127.0.0.1") {
|
|
21472
|
-
return new Promise((
|
|
21472
|
+
return new Promise((resolve9) => {
|
|
21473
21473
|
const socket = new net.Socket();
|
|
21474
21474
|
const done = (result) => {
|
|
21475
21475
|
socket.removeAllListeners();
|
|
21476
21476
|
socket.destroy();
|
|
21477
|
-
|
|
21477
|
+
resolve9(result);
|
|
21478
21478
|
};
|
|
21479
21479
|
socket.setTimeout(1e3);
|
|
21480
21480
|
socket.once("connect", () => done(true));
|
|
@@ -21500,7 +21500,7 @@ var import_path6 = __toESM(require("path"));
|
|
|
21500
21500
|
// src/services/preview/run-setup.ts
|
|
21501
21501
|
var import_child_process17 = require("child_process");
|
|
21502
21502
|
function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
21503
|
-
return new Promise((
|
|
21503
|
+
return new Promise((resolve9) => {
|
|
21504
21504
|
const child = (0, import_child_process17.spawn)(cmd, args2, {
|
|
21505
21505
|
cwd,
|
|
21506
21506
|
env: { ...process.env, ...env ?? {} },
|
|
@@ -21520,20 +21520,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
|
21520
21520
|
settled = true;
|
|
21521
21521
|
log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
|
|
21522
21522
|
killQuiet(child);
|
|
21523
|
-
|
|
21523
|
+
resolve9({ status: "timeout", code: null });
|
|
21524
21524
|
}, opts.timeoutMs);
|
|
21525
21525
|
child.once("exit", (code) => {
|
|
21526
21526
|
if (settled) return;
|
|
21527
21527
|
settled = true;
|
|
21528
21528
|
clearTimeout(timer);
|
|
21529
|
-
if (code === 0)
|
|
21530
|
-
else
|
|
21529
|
+
if (code === 0) resolve9({ status: "ok", code: 0 });
|
|
21530
|
+
else resolve9({ status: "failed", code });
|
|
21531
21531
|
});
|
|
21532
21532
|
child.once("error", () => {
|
|
21533
21533
|
if (settled) return;
|
|
21534
21534
|
settled = true;
|
|
21535
21535
|
clearTimeout(timer);
|
|
21536
|
-
|
|
21536
|
+
resolve9({ status: "failed", code: null });
|
|
21537
21537
|
});
|
|
21538
21538
|
});
|
|
21539
21539
|
}
|
|
@@ -21775,23 +21775,23 @@ async function awaitTunnelRegistered(candidate, hostname4, deadlineMs) {
|
|
|
21775
21775
|
ac.signal.addEventListener("abort", detach, { once: true });
|
|
21776
21776
|
};
|
|
21777
21777
|
try {
|
|
21778
|
-
return await new Promise((
|
|
21778
|
+
return await new Promise((resolve9) => {
|
|
21779
21779
|
const onChunk = (chunk) => {
|
|
21780
21780
|
const s = chunk.toString();
|
|
21781
21781
|
if (!url2) url2 = parseCloudflaredUrl(s);
|
|
21782
21782
|
if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
|
|
21783
21783
|
const trimmed = s.replace(/\n+$/g, "");
|
|
21784
21784
|
if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
|
|
21785
|
-
if (url2 && registered)
|
|
21785
|
+
if (url2 && registered) resolve9({ kind: "registered", url: url2 });
|
|
21786
21786
|
};
|
|
21787
21787
|
const onExit = (code) => {
|
|
21788
|
-
|
|
21788
|
+
resolve9({ kind: "exited", sawUrl: url2 != null, code });
|
|
21789
21789
|
};
|
|
21790
21790
|
const { stdout, stderr } = candidate;
|
|
21791
21791
|
if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
|
|
21792
21792
|
if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
|
|
21793
21793
|
scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
|
|
21794
|
-
timer = setTimeout(() =>
|
|
21794
|
+
timer = setTimeout(() => resolve9({ kind: "timeout", sawUrl: url2 != null }), deadlineMs);
|
|
21795
21795
|
});
|
|
21796
21796
|
} finally {
|
|
21797
21797
|
ac.abort();
|
|
@@ -22328,12 +22328,12 @@ var _spawnSeam = {
|
|
|
22328
22328
|
run: _defaultSpawn
|
|
22329
22329
|
};
|
|
22330
22330
|
function _defaultSpawn(binaryPath, args2, opts) {
|
|
22331
|
-
return new Promise((
|
|
22331
|
+
return new Promise((resolve9) => {
|
|
22332
22332
|
let proc;
|
|
22333
22333
|
try {
|
|
22334
22334
|
proc = (0, import_child_process19.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
|
|
22335
22335
|
} catch (err) {
|
|
22336
|
-
|
|
22336
|
+
resolve9({ code: -1, stdout: "", stderr: err.message });
|
|
22337
22337
|
return;
|
|
22338
22338
|
}
|
|
22339
22339
|
let stdout = "";
|
|
@@ -22344,8 +22344,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
|
|
|
22344
22344
|
proc.stderr?.on("data", (c2) => {
|
|
22345
22345
|
stderr += c2.toString();
|
|
22346
22346
|
});
|
|
22347
|
-
proc.on("error", (err) =>
|
|
22348
|
-
proc.on("close", (code) =>
|
|
22347
|
+
proc.on("error", (err) => resolve9({ code: -1, stdout, stderr: err.message }));
|
|
22348
|
+
proc.on("close", (code) => resolve9({ code: code ?? -1, stdout, stderr }));
|
|
22349
22349
|
});
|
|
22350
22350
|
}
|
|
22351
22351
|
var _adapterSeam = {
|
|
@@ -22522,22 +22522,22 @@ var _installSpawnSeam = {
|
|
|
22522
22522
|
run: _defaultInstallSpawn
|
|
22523
22523
|
};
|
|
22524
22524
|
function _defaultInstallSpawn(strategy) {
|
|
22525
|
-
return new Promise((
|
|
22525
|
+
return new Promise((resolve9) => {
|
|
22526
22526
|
let proc;
|
|
22527
22527
|
try {
|
|
22528
22528
|
proc = (0, import_child_process20.spawn)(strategy.command, strategy.args, { env: process.env });
|
|
22529
22529
|
} catch (err) {
|
|
22530
|
-
|
|
22530
|
+
resolve9({ ok: false, code: -1, stderr: err.message });
|
|
22531
22531
|
return;
|
|
22532
22532
|
}
|
|
22533
22533
|
let stderr = "";
|
|
22534
22534
|
proc.stderr?.on("data", (c2) => {
|
|
22535
22535
|
stderr += c2.toString();
|
|
22536
22536
|
});
|
|
22537
|
-
proc.on("error", (err) =>
|
|
22537
|
+
proc.on("error", (err) => resolve9({ ok: false, code: -1, stderr: err.message }));
|
|
22538
22538
|
proc.on(
|
|
22539
22539
|
"close",
|
|
22540
|
-
(code) =>
|
|
22540
|
+
(code) => resolve9({ ok: code === 0, code: code ?? -1, stderr })
|
|
22541
22541
|
);
|
|
22542
22542
|
});
|
|
22543
22543
|
}
|
|
@@ -22598,11 +22598,11 @@ function resolveDoltInstallStrategy(platform3) {
|
|
|
22598
22598
|
}
|
|
22599
22599
|
var DOLT_RELEASE_BASE = "https://github.com/dolthub/dolt/releases/latest/download";
|
|
22600
22600
|
function doltPlatformTuple(platform3, arch2) {
|
|
22601
|
-
const
|
|
22601
|
+
const os60 = platform3 === "win32" ? "windows" : platform3 === "darwin" ? "darwin" : "linux";
|
|
22602
22602
|
const a = arch2 === "x64" ? "amd64" : arch2 === "arm64" ? "arm64" : null;
|
|
22603
22603
|
if (!a) return null;
|
|
22604
|
-
if (
|
|
22605
|
-
return `${
|
|
22604
|
+
if (os60 === "windows" && a !== "amd64") return null;
|
|
22605
|
+
return `${os60}-${a}`;
|
|
22606
22606
|
}
|
|
22607
22607
|
function resolveDoltTarballStrategy(targetDir, platform3, arch2) {
|
|
22608
22608
|
const tuple = doltPlatformTuple(platform3, arch2);
|
|
@@ -22706,14 +22706,14 @@ var _doltInstallSpawnSeam = {
|
|
|
22706
22706
|
};
|
|
22707
22707
|
var DOLT_INSTALL_TIMEOUT_MS = 12e4;
|
|
22708
22708
|
function _defaultDoltInstallSpawn(strategy) {
|
|
22709
|
-
return new Promise((
|
|
22709
|
+
return new Promise((resolve9) => {
|
|
22710
22710
|
let settled = false;
|
|
22711
22711
|
let timer;
|
|
22712
22712
|
const finish = (r) => {
|
|
22713
22713
|
if (settled) return;
|
|
22714
22714
|
settled = true;
|
|
22715
22715
|
if (timer) clearTimeout(timer);
|
|
22716
|
-
|
|
22716
|
+
resolve9(r);
|
|
22717
22717
|
};
|
|
22718
22718
|
let proc;
|
|
22719
22719
|
try {
|
|
@@ -24329,7 +24329,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
24329
24329
|
});
|
|
24330
24330
|
const token = ctx.pluginAuthToken;
|
|
24331
24331
|
void (async () => {
|
|
24332
|
-
const
|
|
24332
|
+
const os60 = createOsStrategy();
|
|
24333
24333
|
try {
|
|
24334
24334
|
const report = await reviewPullRequest(
|
|
24335
24335
|
{
|
|
@@ -24338,7 +24338,7 @@ var vcsAgentReviewH = async (ctx, cmd, parsed) => {
|
|
|
24338
24338
|
baseBranch: parsed.baseBranch
|
|
24339
24339
|
},
|
|
24340
24340
|
{
|
|
24341
|
-
runReview: (input) => new CoderabbitRuntimeStrategy(
|
|
24341
|
+
runReview: (input) => new CoderabbitRuntimeStrategy(os60).runOneShot(input),
|
|
24342
24342
|
runGh: (args2) => defaultRunGh(args2),
|
|
24343
24343
|
postReport: async (r) => {
|
|
24344
24344
|
if (!token) return;
|
|
@@ -24570,16 +24570,16 @@ async function runNpmInstallLatest() {
|
|
|
24570
24570
|
const invocation = buildNpmInstallInvocation({ sudo: useSudo });
|
|
24571
24571
|
const useShell = process.platform === "win32";
|
|
24572
24572
|
const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
|
|
24573
|
-
const result = await new Promise((
|
|
24573
|
+
const result = await new Promise((resolve9) => {
|
|
24574
24574
|
(0, import_child_process24.execFile)(
|
|
24575
24575
|
command2,
|
|
24576
24576
|
invocation.args,
|
|
24577
24577
|
{ timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
|
|
24578
24578
|
(err, _stdout, stderr) => {
|
|
24579
24579
|
if (!err) {
|
|
24580
|
-
|
|
24580
|
+
resolve9({ ok: true });
|
|
24581
24581
|
} else {
|
|
24582
|
-
|
|
24582
|
+
resolve9({ ok: false, error: (stderr || err.message).slice(0, 300) });
|
|
24583
24583
|
}
|
|
24584
24584
|
}
|
|
24585
24585
|
);
|
|
@@ -25174,7 +25174,7 @@ function buildKeepAlive(ctx) {
|
|
|
25174
25174
|
let timer = null;
|
|
25175
25175
|
async function setIdleTimeout(minutes) {
|
|
25176
25176
|
if (!ctx.inCodespace || !ctx.codespaceName) return;
|
|
25177
|
-
await new Promise((
|
|
25177
|
+
await new Promise((resolve9) => {
|
|
25178
25178
|
const proc = (0, import_child_process25.spawn)(
|
|
25179
25179
|
"gh",
|
|
25180
25180
|
[
|
|
@@ -25188,8 +25188,8 @@ function buildKeepAlive(ctx) {
|
|
|
25188
25188
|
{ stdio: "ignore", detached: true }
|
|
25189
25189
|
);
|
|
25190
25190
|
proc.unref();
|
|
25191
|
-
proc.on("exit", () =>
|
|
25192
|
-
proc.on("error", () =>
|
|
25191
|
+
proc.on("exit", () => resolve9());
|
|
25192
|
+
proc.on("error", () => resolve9());
|
|
25193
25193
|
});
|
|
25194
25194
|
}
|
|
25195
25195
|
return {
|
|
@@ -25407,11 +25407,11 @@ function resolveTokenValue(args2) {
|
|
|
25407
25407
|
}
|
|
25408
25408
|
const fileFlag = args2.find((a) => a.startsWith("--token-file="));
|
|
25409
25409
|
if (fileFlag) {
|
|
25410
|
-
const
|
|
25410
|
+
const path80 = fileFlag.slice("--token-file=".length);
|
|
25411
25411
|
try {
|
|
25412
|
-
const content = fs58.readFileSync(
|
|
25413
|
-
if (content.length === 0) fail(`--token-file ${
|
|
25414
|
-
rmIfExistsQuiet(
|
|
25412
|
+
const content = fs58.readFileSync(path80, "utf8").trim();
|
|
25413
|
+
if (content.length === 0) fail(`--token-file ${path80} is empty`);
|
|
25414
|
+
rmIfExistsQuiet(path80);
|
|
25415
25415
|
return content;
|
|
25416
25416
|
} catch (err) {
|
|
25417
25417
|
fail(`Could not read --token-file: ${err.message}`);
|
|
@@ -25668,10 +25668,10 @@ function wrapWithHeadroom(launch, opts) {
|
|
|
25668
25668
|
var _present;
|
|
25669
25669
|
function headroomPresent() {
|
|
25670
25670
|
if (_present !== void 0) return Promise.resolve(_present);
|
|
25671
|
-
return new Promise((
|
|
25671
|
+
return new Promise((resolve9) => {
|
|
25672
25672
|
(0, import_node_child_process26.execFile)("headroom", ["--version"], (err) => {
|
|
25673
25673
|
_present = !err;
|
|
25674
|
-
|
|
25674
|
+
resolve9(_present);
|
|
25675
25675
|
});
|
|
25676
25676
|
});
|
|
25677
25677
|
}
|
|
@@ -26061,7 +26061,7 @@ function resolveClaudeNativeBinary(deps = {}) {
|
|
|
26061
26061
|
const candidate = import_path8.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
26062
26062
|
return existsSync27(candidate) ? candidate : null;
|
|
26063
26063
|
}
|
|
26064
|
-
var realSleep = (ms) => new Promise((
|
|
26064
|
+
var realSleep = (ms) => new Promise((resolve9) => setTimeout(resolve9, ms));
|
|
26065
26065
|
async function waitForClaudeNativeBinary(opts = {}) {
|
|
26066
26066
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
26067
26067
|
const pollMs = opts.pollMs ?? 500;
|
|
@@ -26142,7 +26142,7 @@ var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no lo
|
|
|
26142
26142
|
function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
26143
26143
|
const livenessMs = opts.livenessMs ?? 400;
|
|
26144
26144
|
const spawnFn = opts.spawnFn ?? import_child_process26.spawn;
|
|
26145
|
-
return new Promise((
|
|
26145
|
+
return new Promise((resolve9) => {
|
|
26146
26146
|
let settled = false;
|
|
26147
26147
|
let stderr = "";
|
|
26148
26148
|
let timer;
|
|
@@ -26155,12 +26155,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
|
26155
26155
|
child?.kill("SIGKILL");
|
|
26156
26156
|
} catch {
|
|
26157
26157
|
}
|
|
26158
|
-
|
|
26158
|
+
resolve9(r);
|
|
26159
26159
|
};
|
|
26160
26160
|
try {
|
|
26161
26161
|
child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
|
|
26162
26162
|
} catch {
|
|
26163
|
-
|
|
26163
|
+
resolve9("ok");
|
|
26164
26164
|
return;
|
|
26165
26165
|
}
|
|
26166
26166
|
child.stderr?.on("data", (d3) => {
|
|
@@ -26211,10 +26211,10 @@ function augmentPath2() {
|
|
|
26211
26211
|
if (!parts.includes(dir)) process.env.PATH = `${dir}:${process.env.PATH ?? ""}`;
|
|
26212
26212
|
}
|
|
26213
26213
|
async function runInstaller2() {
|
|
26214
|
-
return new Promise((
|
|
26214
|
+
return new Promise((resolve9) => {
|
|
26215
26215
|
const proc = (0, import_node_child_process27.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL2} | bash`], { stdio: "inherit" });
|
|
26216
|
-
proc.on("close", (code) =>
|
|
26217
|
-
proc.on("error", () =>
|
|
26216
|
+
proc.on("close", (code) => resolve9(code === 0));
|
|
26217
|
+
proc.on("error", () => resolve9(false));
|
|
26218
26218
|
});
|
|
26219
26219
|
}
|
|
26220
26220
|
async function ensureKimiInstalled() {
|
|
@@ -26263,10 +26263,10 @@ function augmentPath3() {
|
|
|
26263
26263
|
if (!parts.includes(dir)) process.env.PATH = `${dir}:${process.env.PATH ?? ""}`;
|
|
26264
26264
|
}
|
|
26265
26265
|
async function runInstaller3() {
|
|
26266
|
-
return new Promise((
|
|
26266
|
+
return new Promise((resolve9) => {
|
|
26267
26267
|
const proc = (0, import_node_child_process28.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL3} | bash`], { stdio: "inherit" });
|
|
26268
|
-
proc.on("close", (code) =>
|
|
26269
|
-
proc.on("error", () =>
|
|
26268
|
+
proc.on("close", (code) => resolve9(code === 0));
|
|
26269
|
+
proc.on("error", () => resolve9(false));
|
|
26270
26270
|
});
|
|
26271
26271
|
}
|
|
26272
26272
|
async function ensureOpencodeInstalled() {
|
|
@@ -26441,11 +26441,11 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
|
|
|
26441
26441
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_ADAPTER_RETRY_TIMEOUT_MS;
|
|
26442
26442
|
const pollMs = opts.pollMs ?? DEFAULT_ADAPTER_RETRY_POLL_MS;
|
|
26443
26443
|
const now = opts.now ?? Date.now;
|
|
26444
|
-
const sleep5 = opts.sleep ?? ((ms) => new Promise((
|
|
26445
|
-
const
|
|
26444
|
+
const sleep5 = opts.sleep ?? ((ms) => new Promise((resolve10) => setTimeout(resolve10, ms)));
|
|
26445
|
+
const resolve9 = opts.resolve ?? getAcpAdapter;
|
|
26446
26446
|
const attempt = () => {
|
|
26447
26447
|
try {
|
|
26448
|
-
return
|
|
26448
|
+
return resolve9(agent);
|
|
26449
26449
|
} catch {
|
|
26450
26450
|
return null;
|
|
26451
26451
|
}
|
|
@@ -26531,7 +26531,7 @@ function parseJsonl(filePath) {
|
|
|
26531
26531
|
return messages;
|
|
26532
26532
|
}
|
|
26533
26533
|
function post(endpoint, body, pluginAuthToken) {
|
|
26534
|
-
return new Promise((
|
|
26534
|
+
return new Promise((resolve9) => {
|
|
26535
26535
|
const payload = JSON.stringify(body);
|
|
26536
26536
|
const u2 = new URL(`${API_BASE8}${endpoint}`);
|
|
26537
26537
|
const transport = u2.protocol === "https:" ? https7 : http6;
|
|
@@ -26556,17 +26556,17 @@ function post(endpoint, body, pluginAuthToken) {
|
|
|
26556
26556
|
res.resume();
|
|
26557
26557
|
const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
|
|
26558
26558
|
if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
|
|
26559
|
-
|
|
26559
|
+
resolve9(ok);
|
|
26560
26560
|
}
|
|
26561
26561
|
);
|
|
26562
26562
|
req.on("error", (err) => {
|
|
26563
26563
|
log.warn("history:post", `${endpoint} network error`, err);
|
|
26564
|
-
|
|
26564
|
+
resolve9(false);
|
|
26565
26565
|
});
|
|
26566
26566
|
req.on("timeout", () => {
|
|
26567
26567
|
log.warn("history:post", `${endpoint} timeout after 15s`);
|
|
26568
26568
|
req.destroy();
|
|
26569
|
-
|
|
26569
|
+
resolve9(false);
|
|
26570
26570
|
});
|
|
26571
26571
|
req.write(payload);
|
|
26572
26572
|
req.end();
|
|
@@ -27063,8 +27063,8 @@ var HistoryService = class _HistoryService {
|
|
|
27063
27063
|
var import_node_child_process29 = require("child_process");
|
|
27064
27064
|
var fs61 = __toESM(require("fs/promises"));
|
|
27065
27065
|
var fsSync = __toESM(require("fs"));
|
|
27066
|
-
var
|
|
27067
|
-
var
|
|
27066
|
+
var os53 = __toESM(require("os"));
|
|
27067
|
+
var path67 = __toESM(require("path"));
|
|
27068
27068
|
var import_node_stream = require("stream");
|
|
27069
27069
|
|
|
27070
27070
|
// ../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
@@ -29103,12 +29103,12 @@ var Connection = class {
|
|
|
29103
29103
|
const id = this.nextRequestId++;
|
|
29104
29104
|
let cancel = () => {
|
|
29105
29105
|
};
|
|
29106
|
-
const responsePromise = new Promise((
|
|
29106
|
+
const responsePromise = new Promise((resolve9, reject) => {
|
|
29107
29107
|
const pendingResponse = {
|
|
29108
29108
|
resolve: (response) => {
|
|
29109
29109
|
try {
|
|
29110
29110
|
const value = mapResponse ? mapResponse(response) : response;
|
|
29111
|
-
|
|
29111
|
+
resolve9(value);
|
|
29112
29112
|
} catch (error) {
|
|
29113
29113
|
reject(error);
|
|
29114
29114
|
}
|
|
@@ -29186,8 +29186,8 @@ var Connection = class {
|
|
|
29186
29186
|
initialize(stream, handlers2) {
|
|
29187
29187
|
this.stream = stream;
|
|
29188
29188
|
this.staticHandlers = handlers2;
|
|
29189
|
-
this.closedPromise = new Promise((
|
|
29190
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
29189
|
+
this.closedPromise = new Promise((resolve9) => {
|
|
29190
|
+
this.abortController.signal.addEventListener("abort", () => resolve9());
|
|
29191
29191
|
});
|
|
29192
29192
|
void this.receive();
|
|
29193
29193
|
}
|
|
@@ -29975,8 +29975,8 @@ var AsyncQueue = class {
|
|
|
29975
29975
|
if (this.failed) {
|
|
29976
29976
|
return Promise.reject(this.failure);
|
|
29977
29977
|
}
|
|
29978
|
-
return new Promise((
|
|
29979
|
-
this.waiters.push({ resolve:
|
|
29978
|
+
return new Promise((resolve9, reject) => {
|
|
29979
|
+
this.waiters.push({ resolve: resolve9, reject });
|
|
29980
29980
|
});
|
|
29981
29981
|
}
|
|
29982
29982
|
};
|
|
@@ -31089,6 +31089,40 @@ function createIdleTimeout(idleMs, makeError, activeIdleMs = idleMs) {
|
|
|
31089
31089
|
};
|
|
31090
31090
|
}
|
|
31091
31091
|
|
|
31092
|
+
// src/agents/acp/internal-paths.ts
|
|
31093
|
+
var path66 = __toESM(require("path"));
|
|
31094
|
+
var os52 = __toESM(require("os"));
|
|
31095
|
+
var INTERNAL_TOKENS = [".codeam", "house-claude"];
|
|
31096
|
+
function textReferencesInternal(text) {
|
|
31097
|
+
if (!text) return false;
|
|
31098
|
+
return INTERNAL_TOKENS.some((t2) => text.includes(t2));
|
|
31099
|
+
}
|
|
31100
|
+
function pathIsInternal(p2, homeDir2 = os52.homedir()) {
|
|
31101
|
+
if (!p2) return false;
|
|
31102
|
+
const abs = path66.resolve(p2);
|
|
31103
|
+
const home = path66.resolve(homeDir2);
|
|
31104
|
+
const within = (root) => abs === root || abs.startsWith(root + path66.sep);
|
|
31105
|
+
return within(path66.join(home, ".codeam")) || within(path66.join(home, ".beads")) || abs === path66.join(home, ".codeam-host.log") || abs.includes(`${path66.sep}house-claude${path66.sep}`) || abs.endsWith(`${path66.sep}house-claude`);
|
|
31106
|
+
}
|
|
31107
|
+
function toolCallReferencesInternal(call) {
|
|
31108
|
+
if (textReferencesInternal(call.title)) return true;
|
|
31109
|
+
if (call.rawInput != null) {
|
|
31110
|
+
try {
|
|
31111
|
+
return textReferencesInternal(JSON.stringify(call.rawInput));
|
|
31112
|
+
} catch {
|
|
31113
|
+
return false;
|
|
31114
|
+
}
|
|
31115
|
+
}
|
|
31116
|
+
return false;
|
|
31117
|
+
}
|
|
31118
|
+
function internalPathPermissionOutcome(request) {
|
|
31119
|
+
if (!toolCallReferencesInternal(request.toolCall)) return null;
|
|
31120
|
+
const reject = request.options.find((o) => o.kind === "reject_always") ?? request.options.find((o) => o.kind === "reject_once");
|
|
31121
|
+
if (reject) return { outcome: { outcome: "selected", optionId: reject.optionId } };
|
|
31122
|
+
return { outcome: { outcome: "cancelled" } };
|
|
31123
|
+
}
|
|
31124
|
+
var INTERNAL_BLOCK_REASON = "This path is a CodeAgent platform internal (CodeAgent's own runtime plumbing, not part of the user's project) and is off-limits. Continue with the user's own project files.";
|
|
31125
|
+
|
|
31092
31126
|
// src/agents/acp/client.ts
|
|
31093
31127
|
var TRANSIENT_ADAPTER_SPAWN_RE = /ETXTBSY|ENOENT/;
|
|
31094
31128
|
var MAX_START_ATTEMPTS = 5;
|
|
@@ -31780,14 +31814,14 @@ var AcpClient = class {
|
|
|
31780
31814
|
this.sessionId = null;
|
|
31781
31815
|
try {
|
|
31782
31816
|
child.kill("SIGTERM");
|
|
31783
|
-
const grace = new Promise((
|
|
31817
|
+
const grace = new Promise((resolve9) => {
|
|
31784
31818
|
const t2 = setTimeout(() => {
|
|
31785
31819
|
killQuiet(child, "SIGKILL");
|
|
31786
|
-
|
|
31820
|
+
resolve9();
|
|
31787
31821
|
}, 2e3);
|
|
31788
31822
|
child.once("exit", () => {
|
|
31789
31823
|
clearTimeout(t2);
|
|
31790
|
-
|
|
31824
|
+
resolve9();
|
|
31791
31825
|
});
|
|
31792
31826
|
});
|
|
31793
31827
|
await grace;
|
|
@@ -31848,6 +31882,9 @@ var AcpClient = class {
|
|
|
31848
31882
|
}
|
|
31849
31883
|
},
|
|
31850
31884
|
readTextFile: async (params) => {
|
|
31885
|
+
if (!isLocalSession() && pathIsInternal(params.path)) {
|
|
31886
|
+
throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
|
|
31887
|
+
}
|
|
31851
31888
|
try {
|
|
31852
31889
|
const content = await fs61.readFile(params.path, "utf8");
|
|
31853
31890
|
return applyLineRange(content, params.line ?? null, params.limit ?? null);
|
|
@@ -31868,6 +31905,9 @@ var AcpClient = class {
|
|
|
31868
31905
|
}
|
|
31869
31906
|
},
|
|
31870
31907
|
writeTextFile: async (params) => {
|
|
31908
|
+
if (!isLocalSession() && pathIsInternal(params.path)) {
|
|
31909
|
+
throw new RequestError(-32002, INTERNAL_BLOCK_REASON, { uri: params.path });
|
|
31910
|
+
}
|
|
31871
31911
|
try {
|
|
31872
31912
|
await fs61.writeFile(params.path, params.content, "utf8");
|
|
31873
31913
|
return {};
|
|
@@ -31929,29 +31969,29 @@ function applyLineRange(content, line, limit) {
|
|
|
31929
31969
|
return { content: lines.slice(start2, end).join("\n") };
|
|
31930
31970
|
}
|
|
31931
31971
|
function knownAgentBinaryDirs() {
|
|
31932
|
-
const home =
|
|
31972
|
+
const home = os53.homedir();
|
|
31933
31973
|
const out2 = [];
|
|
31934
31974
|
out2.push("/tmp/codeam-node20/bin");
|
|
31935
31975
|
for (const root of [
|
|
31936
31976
|
"/usr/local/share/nvm/versions/node",
|
|
31937
|
-
|
|
31977
|
+
path67.join(home, ".nvm/versions/node")
|
|
31938
31978
|
]) {
|
|
31939
31979
|
try {
|
|
31940
31980
|
for (const child of fsSync.readdirSync(root)) {
|
|
31941
|
-
out2.push(
|
|
31981
|
+
out2.push(path67.join(root, child, "bin"));
|
|
31942
31982
|
}
|
|
31943
31983
|
} catch {
|
|
31944
31984
|
}
|
|
31945
31985
|
}
|
|
31946
|
-
out2.push(
|
|
31986
|
+
out2.push(path67.join(home, ".volta/bin"));
|
|
31947
31987
|
out2.push("/usr/local/bin");
|
|
31948
31988
|
out2.push("/usr/bin");
|
|
31949
|
-
out2.push(
|
|
31950
|
-
out2.push(
|
|
31989
|
+
out2.push(path67.join(home, ".local/bin"));
|
|
31990
|
+
out2.push(path67.join(home, "bin"));
|
|
31951
31991
|
if (process.platform === "win32") {
|
|
31952
31992
|
const { LOCALAPPDATA, APPDATA } = process.env;
|
|
31953
|
-
if (LOCALAPPDATA) out2.push(
|
|
31954
|
-
if (APPDATA) out2.push(
|
|
31993
|
+
if (LOCALAPPDATA) out2.push(path67.join(LOCALAPPDATA, "cursor-agent"));
|
|
31994
|
+
if (APPDATA) out2.push(path67.join(APPDATA, "npm"));
|
|
31955
31995
|
}
|
|
31956
31996
|
return out2.filter((p2) => {
|
|
31957
31997
|
try {
|
|
@@ -31963,7 +32003,7 @@ function knownAgentBinaryDirs() {
|
|
|
31963
32003
|
}
|
|
31964
32004
|
function expandPathForAgentBinaries(existingPath) {
|
|
31965
32005
|
const existing = new Set(
|
|
31966
|
-
existingPath.split(
|
|
32006
|
+
existingPath.split(path67.delimiter).filter((p2) => p2.length > 0)
|
|
31967
32007
|
);
|
|
31968
32008
|
const additions = [];
|
|
31969
32009
|
for (const dir of knownAgentBinaryDirs()) {
|
|
@@ -31973,7 +32013,7 @@ function expandPathForAgentBinaries(existingPath) {
|
|
|
31973
32013
|
}
|
|
31974
32014
|
}
|
|
31975
32015
|
if (additions.length === 0) return existingPath;
|
|
31976
|
-
return [...additions, existingPath].filter((p2) => p2.length > 0).join(
|
|
32016
|
+
return [...additions, existingPath].filter((p2) => p2.length > 0).join(path67.delimiter);
|
|
31977
32017
|
}
|
|
31978
32018
|
|
|
31979
32019
|
// src/agents/acp/headroom-budget-proxy.ts
|
|
@@ -32016,7 +32056,7 @@ var _transport4 = {
|
|
|
32016
32056
|
get: _get
|
|
32017
32057
|
};
|
|
32018
32058
|
function _post3(url2, headers, payload) {
|
|
32019
|
-
return new Promise((
|
|
32059
|
+
return new Promise((resolve9, reject) => {
|
|
32020
32060
|
let settled = false;
|
|
32021
32061
|
const u2 = new URL(url2);
|
|
32022
32062
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -32041,7 +32081,7 @@ function _post3(url2, headers, payload) {
|
|
|
32041
32081
|
res.on("end", () => {
|
|
32042
32082
|
if (settled) return;
|
|
32043
32083
|
settled = true;
|
|
32044
|
-
|
|
32084
|
+
resolve9({ statusCode: res.statusCode ?? 0, body });
|
|
32045
32085
|
});
|
|
32046
32086
|
}
|
|
32047
32087
|
);
|
|
@@ -32058,7 +32098,7 @@ function _post3(url2, headers, payload) {
|
|
|
32058
32098
|
});
|
|
32059
32099
|
}
|
|
32060
32100
|
function _get(url2, headers) {
|
|
32061
|
-
return new Promise((
|
|
32101
|
+
return new Promise((resolve9, reject) => {
|
|
32062
32102
|
let settled = false;
|
|
32063
32103
|
const u2 = new URL(url2);
|
|
32064
32104
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -32082,7 +32122,7 @@ function _get(url2, headers) {
|
|
|
32082
32122
|
res.on("end", () => {
|
|
32083
32123
|
if (settled) return;
|
|
32084
32124
|
settled = true;
|
|
32085
|
-
|
|
32125
|
+
resolve9({ statusCode: res.statusCode ?? 0, body });
|
|
32086
32126
|
});
|
|
32087
32127
|
}
|
|
32088
32128
|
);
|
|
@@ -32456,13 +32496,13 @@ function commonPrefixLength(a, b) {
|
|
|
32456
32496
|
// src/agents/acp/onboarding.ts
|
|
32457
32497
|
var import_child_process27 = require("child_process");
|
|
32458
32498
|
var fs62 = __toESM(require("fs"));
|
|
32459
|
-
var
|
|
32460
|
-
var
|
|
32499
|
+
var os54 = __toESM(require("os"));
|
|
32500
|
+
var path68 = __toESM(require("path"));
|
|
32461
32501
|
var _onboardingSeam = {
|
|
32462
|
-
markerPath: (sessionId) =>
|
|
32502
|
+
markerPath: (sessionId) => path68.join(os54.homedir(), ".codeam", "welcomed", `${sessionId}.done`),
|
|
32463
32503
|
exists: (p2) => fs62.existsSync(p2),
|
|
32464
32504
|
write: (p2) => {
|
|
32465
|
-
fs62.mkdirSync(
|
|
32505
|
+
fs62.mkdirSync(path68.dirname(p2), { recursive: true });
|
|
32466
32506
|
fs62.writeFileSync(p2, "");
|
|
32467
32507
|
},
|
|
32468
32508
|
disabled: () => {
|
|
@@ -32500,7 +32540,7 @@ function resolveRepoName(cwd) {
|
|
|
32500
32540
|
if (name) return name;
|
|
32501
32541
|
}
|
|
32502
32542
|
}
|
|
32503
|
-
const base =
|
|
32543
|
+
const base = path68.basename(cwd || "");
|
|
32504
32544
|
if (base && !isUuid(base)) return base;
|
|
32505
32545
|
return "this project";
|
|
32506
32546
|
}
|
|
@@ -32753,12 +32793,12 @@ var import_crypto5 = require("crypto");
|
|
|
32753
32793
|
// src/services/turn-files/git-changeset.ts
|
|
32754
32794
|
var import_child_process28 = require("child_process");
|
|
32755
32795
|
var fs64 = __toESM(require("fs/promises"));
|
|
32756
|
-
var
|
|
32796
|
+
var path70 = __toESM(require("path"));
|
|
32757
32797
|
|
|
32758
32798
|
// src/services/turn-files/review-ignore.ts
|
|
32759
32799
|
var import_ignore2 = __toESM(require("ignore"));
|
|
32760
32800
|
var fs63 = __toESM(require("fs"));
|
|
32761
|
-
var
|
|
32801
|
+
var path69 = __toESM(require("path"));
|
|
32762
32802
|
var CURATED_REVIEW_IGNORE = [
|
|
32763
32803
|
// Google Cloud SDK (the incident) — installs a huge python tree.
|
|
32764
32804
|
"google-cloud-sdk/",
|
|
@@ -32797,7 +32837,7 @@ var CURATED_REVIEW_IGNORE = [
|
|
|
32797
32837
|
function makeReviewIgnore(repoRoot) {
|
|
32798
32838
|
const ig = (0, import_ignore2.default)().add(CURATED_REVIEW_IGNORE);
|
|
32799
32839
|
try {
|
|
32800
|
-
const custom = fs63.readFileSync(
|
|
32840
|
+
const custom = fs63.readFileSync(path69.join(repoRoot, ".codeam", "reviewignore"), "utf8");
|
|
32801
32841
|
ig.add(custom);
|
|
32802
32842
|
} catch {
|
|
32803
32843
|
}
|
|
@@ -32842,7 +32882,7 @@ async function collectRepoChangeset(opts) {
|
|
|
32842
32882
|
let stats;
|
|
32843
32883
|
if (!truncated && row.fileStatus === "added" && numstatEntry === void 0) {
|
|
32844
32884
|
const lineCount = await readUntrackedLineCount(
|
|
32845
|
-
|
|
32885
|
+
path70.join(opts.repoRoot, row.filePath)
|
|
32846
32886
|
);
|
|
32847
32887
|
stats = { added: lineCount, removed: 0 };
|
|
32848
32888
|
} else {
|
|
@@ -32934,12 +32974,12 @@ function runGit3(cwd, args2) {
|
|
|
32934
32974
|
return _runGitImpl2.run(cwd, args2);
|
|
32935
32975
|
}
|
|
32936
32976
|
function defaultRunGit(cwd, args2) {
|
|
32937
|
-
return new Promise((
|
|
32977
|
+
return new Promise((resolve9) => {
|
|
32938
32978
|
let proc;
|
|
32939
32979
|
try {
|
|
32940
32980
|
proc = (0, import_child_process28.spawn)("git", args2, { cwd, env: process.env });
|
|
32941
32981
|
} catch {
|
|
32942
|
-
|
|
32982
|
+
resolve9(null);
|
|
32943
32983
|
return;
|
|
32944
32984
|
}
|
|
32945
32985
|
let stdout = "";
|
|
@@ -32950,16 +32990,16 @@ function defaultRunGit(cwd, args2) {
|
|
|
32950
32990
|
proc.stderr?.on("data", (c2) => {
|
|
32951
32991
|
stderr += c2.toString();
|
|
32952
32992
|
});
|
|
32953
|
-
proc.on("error", () =>
|
|
32993
|
+
proc.on("error", () => resolve9(null));
|
|
32954
32994
|
proc.on("close", (code) => {
|
|
32955
32995
|
if (code === 0) {
|
|
32956
|
-
|
|
32996
|
+
resolve9(stdout);
|
|
32957
32997
|
} else {
|
|
32958
32998
|
log.trace(
|
|
32959
32999
|
"turnFiles",
|
|
32960
33000
|
`git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
|
|
32961
33001
|
);
|
|
32962
|
-
|
|
33002
|
+
resolve9(null);
|
|
32963
33003
|
}
|
|
32964
33004
|
});
|
|
32965
33005
|
});
|
|
@@ -32984,8 +33024,8 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
32984
33024
|
if (hasGit) {
|
|
32985
33025
|
out2.push({
|
|
32986
33026
|
repoRoot: dir,
|
|
32987
|
-
repoPath:
|
|
32988
|
-
repoName:
|
|
33027
|
+
repoPath: path70.relative(workingDir, dir),
|
|
33028
|
+
repoName: path70.basename(dir)
|
|
32989
33029
|
});
|
|
32990
33030
|
return;
|
|
32991
33031
|
}
|
|
@@ -32993,14 +33033,14 @@ async function discoverRepos(workingDir, maxDepth = 4) {
|
|
|
32993
33033
|
if (!entry.isDirectory) continue;
|
|
32994
33034
|
if (entry.name === "node_modules") continue;
|
|
32995
33035
|
if (entry.name === "dist" || entry.name === "build") continue;
|
|
32996
|
-
await walk(
|
|
33036
|
+
await walk(path70.join(dir, entry.name), depth + 1);
|
|
32997
33037
|
}
|
|
32998
33038
|
}
|
|
32999
33039
|
}
|
|
33000
33040
|
|
|
33001
33041
|
// src/services/turn-files/files-outbox.ts
|
|
33002
33042
|
var fs65 = __toESM(require("fs/promises"));
|
|
33003
|
-
var
|
|
33043
|
+
var path71 = __toESM(require("path"));
|
|
33004
33044
|
var import_os12 = require("os");
|
|
33005
33045
|
var HOME_OUTBOX_DIR = ".codeam/outbox";
|
|
33006
33046
|
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -33033,15 +33073,15 @@ var FilesOutbox = class {
|
|
|
33033
33073
|
backoffIndex = 0;
|
|
33034
33074
|
stopped = false;
|
|
33035
33075
|
constructor(opts) {
|
|
33036
|
-
const base = opts.baseDir ??
|
|
33037
|
-
this.filePath =
|
|
33076
|
+
const base = opts.baseDir ?? path71.join(homeDir(), HOME_OUTBOX_DIR);
|
|
33077
|
+
this.filePath = path71.join(base, `${opts.sessionId}.jsonl`);
|
|
33038
33078
|
this.post = opts.post;
|
|
33039
33079
|
this.autoSchedule = opts.autoSchedule !== false;
|
|
33040
33080
|
}
|
|
33041
33081
|
/** Persist the entry to disk and trigger a flush. Returns once the
|
|
33042
33082
|
* line is durable on disk (not once the POST succeeds). */
|
|
33043
33083
|
async enqueue(entry) {
|
|
33044
|
-
await fs65.mkdir(
|
|
33084
|
+
await fs65.mkdir(path71.dirname(this.filePath), { recursive: true });
|
|
33045
33085
|
await fs65.appendFile(this.filePath, JSON.stringify(entry) + "\n", "utf8");
|
|
33046
33086
|
this.backoffIndex = 0;
|
|
33047
33087
|
if (this.autoSchedule) this.scheduleFlush(0);
|
|
@@ -33347,25 +33387,25 @@ function baselineKey(entry) {
|
|
|
33347
33387
|
|
|
33348
33388
|
// src/agents/acp/withTimeout.ts
|
|
33349
33389
|
function withTimeout(p2, ms) {
|
|
33350
|
-
return new Promise((
|
|
33390
|
+
return new Promise((resolve9) => {
|
|
33351
33391
|
let settled = false;
|
|
33352
33392
|
const timer = setTimeout(() => {
|
|
33353
33393
|
if (settled) return;
|
|
33354
33394
|
settled = true;
|
|
33355
|
-
|
|
33395
|
+
resolve9(void 0);
|
|
33356
33396
|
}, ms);
|
|
33357
33397
|
p2.then(
|
|
33358
33398
|
(v) => {
|
|
33359
33399
|
if (settled) return;
|
|
33360
33400
|
settled = true;
|
|
33361
33401
|
clearTimeout(timer);
|
|
33362
|
-
|
|
33402
|
+
resolve9(v);
|
|
33363
33403
|
},
|
|
33364
33404
|
() => {
|
|
33365
33405
|
if (settled) return;
|
|
33366
33406
|
settled = true;
|
|
33367
33407
|
clearTimeout(timer);
|
|
33368
|
-
|
|
33408
|
+
resolve9(void 0);
|
|
33369
33409
|
}
|
|
33370
33410
|
);
|
|
33371
33411
|
});
|
|
@@ -34304,7 +34344,7 @@ var StreamingState = class {
|
|
|
34304
34344
|
* default-reject. Caller is the SDK's `onRequestPermission`.
|
|
34305
34345
|
*/
|
|
34306
34346
|
registerPermission(args2) {
|
|
34307
|
-
return new Promise((
|
|
34347
|
+
return new Promise((resolve9) => {
|
|
34308
34348
|
const timeoutTimer = setTimeout(() => {
|
|
34309
34349
|
if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
|
|
34310
34350
|
log.warn(
|
|
@@ -34312,7 +34352,7 @@ var StreamingState = class {
|
|
|
34312
34352
|
`permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
|
|
34313
34353
|
);
|
|
34314
34354
|
this.pending = null;
|
|
34315
|
-
|
|
34355
|
+
resolve9({ outcome: { outcome: "cancelled" } });
|
|
34316
34356
|
}
|
|
34317
34357
|
}, PERMISSION_TIMEOUT_MS);
|
|
34318
34358
|
this.pending = {
|
|
@@ -34320,7 +34360,7 @@ var StreamingState = class {
|
|
|
34320
34360
|
questionId: args2.questionId,
|
|
34321
34361
|
labels: args2.labels,
|
|
34322
34362
|
optionIdByLabel: args2.optionIdByLabel,
|
|
34323
|
-
resolve:
|
|
34363
|
+
resolve: resolve9,
|
|
34324
34364
|
timeoutTimer
|
|
34325
34365
|
};
|
|
34326
34366
|
});
|
|
@@ -34352,14 +34392,14 @@ var StreamingState = class {
|
|
|
34352
34392
|
const label = this.pending.labels[index];
|
|
34353
34393
|
const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
|
|
34354
34394
|
clearTimeout(this.pending.timeoutTimer);
|
|
34355
|
-
const
|
|
34395
|
+
const resolve9 = this.pending.resolve;
|
|
34356
34396
|
this.pending = null;
|
|
34357
34397
|
if (!optionId) {
|
|
34358
34398
|
log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
|
|
34359
|
-
|
|
34399
|
+
resolve9({ outcome: { outcome: "cancelled" } });
|
|
34360
34400
|
return { kind: "resolved" };
|
|
34361
34401
|
}
|
|
34362
|
-
|
|
34402
|
+
resolve9({ outcome: { outcome: "selected", optionId } });
|
|
34363
34403
|
return { kind: "resolved" };
|
|
34364
34404
|
}
|
|
34365
34405
|
const text = this.pending.options[index];
|
|
@@ -34799,6 +34839,16 @@ async function runAcpSession(opts) {
|
|
|
34799
34839
|
beginLoadReplay: () => streaming.beginLoadReplay(),
|
|
34800
34840
|
endLoadReplay: () => streaming.endLoadReplay(),
|
|
34801
34841
|
onRequestPermission: async (request) => {
|
|
34842
|
+
if (!isLocalSession()) {
|
|
34843
|
+
const denied = internalPathPermissionOutcome(request);
|
|
34844
|
+
if (denied) {
|
|
34845
|
+
log.warn(
|
|
34846
|
+
"acpRunner",
|
|
34847
|
+
"internal-path guard \u2014 denying tool call referencing a CodeAgent platform internal"
|
|
34848
|
+
);
|
|
34849
|
+
return denied;
|
|
34850
|
+
}
|
|
34851
|
+
}
|
|
34802
34852
|
if (opts.autoApprovePermissions) {
|
|
34803
34853
|
const allow = pickAllowOption(request.options);
|
|
34804
34854
|
if (allow) {
|
|
@@ -36077,8 +36127,8 @@ function fetchQuotaUsage(runtime, historySvc) {
|
|
|
36077
36127
|
|
|
36078
36128
|
// src/beads/workflow-hint.ts
|
|
36079
36129
|
var fs66 = __toESM(require("fs"));
|
|
36080
|
-
var
|
|
36081
|
-
var
|
|
36130
|
+
var path72 = __toESM(require("path"));
|
|
36131
|
+
var os55 = __toESM(require("os"));
|
|
36082
36132
|
var BEADS_HINT_MARKER = "<!-- codeam:beads-workflow -->";
|
|
36083
36133
|
var BEADS_HINT = `${BEADS_HINT_MARKER}
|
|
36084
36134
|
# Beads (bd) \u2014 task tracking + persistent memory (ALWAYS use it)
|
|
@@ -36092,16 +36142,16 @@ This environment uses **bd (beads)** for issue/task tracking and persistent memo
|
|
|
36092
36142
|
- \`bd ready\` (available work) \xB7 \`bd show <id>\` \xB7 \`bd update <id> --claim\` \xB7 \`bd close <id>\`.
|
|
36093
36143
|
- Use \`bd remember "..."\` for persistent knowledge \u2014 do NOT use MEMORY.md files.
|
|
36094
36144
|
${BEADS_HINT_MARKER}`;
|
|
36095
|
-
function ensureBeadsWorkflowHint(homeDir2 =
|
|
36145
|
+
function ensureBeadsWorkflowHint(homeDir2 = os55.homedir()) {
|
|
36096
36146
|
try {
|
|
36097
|
-
const file =
|
|
36147
|
+
const file = path72.join(homeDir2, ".claude", "CLAUDE.md");
|
|
36098
36148
|
let existing = "";
|
|
36099
36149
|
try {
|
|
36100
36150
|
existing = fs66.readFileSync(file, "utf8");
|
|
36101
36151
|
} catch {
|
|
36102
36152
|
}
|
|
36103
36153
|
if (existing.includes(BEADS_HINT_MARKER)) return;
|
|
36104
|
-
fs66.mkdirSync(
|
|
36154
|
+
fs66.mkdirSync(path72.dirname(file), { recursive: true });
|
|
36105
36155
|
const next = existing.trim() ? `${existing.trimEnd()}
|
|
36106
36156
|
|
|
36107
36157
|
${BEADS_HINT}
|
|
@@ -36369,10 +36419,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
|
|
|
36369
36419
|
this.lastOutput = this.now();
|
|
36370
36420
|
}
|
|
36371
36421
|
whenSafeToYield() {
|
|
36372
|
-
return new Promise((
|
|
36422
|
+
return new Promise((resolve9) => {
|
|
36373
36423
|
const tick = () => {
|
|
36374
36424
|
const quietFor = this.now() - this.lastOutput;
|
|
36375
|
-
if (quietFor >= this.idleMs)
|
|
36425
|
+
if (quietFor >= this.idleMs) resolve9();
|
|
36376
36426
|
else setTimeout(tick, this.idleMs - quietFor);
|
|
36377
36427
|
};
|
|
36378
36428
|
tick();
|
|
@@ -36507,11 +36557,11 @@ var AcpDriver = class {
|
|
|
36507
36557
|
this.turnActive = false;
|
|
36508
36558
|
const waiters = this.waiters;
|
|
36509
36559
|
this.waiters = [];
|
|
36510
|
-
waiters.forEach((
|
|
36560
|
+
waiters.forEach((resolve9) => resolve9());
|
|
36511
36561
|
}
|
|
36512
36562
|
whenSafeToYield() {
|
|
36513
36563
|
if (!this.turnActive) return Promise.resolve();
|
|
36514
|
-
return new Promise((
|
|
36564
|
+
return new Promise((resolve9) => this.waiters.push(resolve9));
|
|
36515
36565
|
}
|
|
36516
36566
|
};
|
|
36517
36567
|
|
|
@@ -36846,12 +36896,12 @@ function toEpochMs(ts) {
|
|
|
36846
36896
|
|
|
36847
36897
|
// src/agents/claude/onboarding.ts
|
|
36848
36898
|
var fs68 = __toESM(require("fs"));
|
|
36849
|
-
var
|
|
36850
|
-
var
|
|
36899
|
+
var os57 = __toESM(require("os"));
|
|
36900
|
+
var path73 = __toESM(require("path"));
|
|
36851
36901
|
var ONBOARDING_VERSION_SENTINEL = "9999.0.0";
|
|
36852
36902
|
function ensureClaudeOnboarded(cwd) {
|
|
36853
36903
|
try {
|
|
36854
|
-
const file =
|
|
36904
|
+
const file = path73.join(os57.homedir(), ".claude.json");
|
|
36855
36905
|
let config = {};
|
|
36856
36906
|
try {
|
|
36857
36907
|
config = JSON.parse(fs68.readFileSync(file, "utf8"));
|
|
@@ -36879,7 +36929,7 @@ function ensureClaudeOnboarded(cwd) {
|
|
|
36879
36929
|
}
|
|
36880
36930
|
}
|
|
36881
36931
|
if (!changed) return;
|
|
36882
|
-
fs68.mkdirSync(
|
|
36932
|
+
fs68.mkdirSync(path73.dirname(file), { recursive: true });
|
|
36883
36933
|
fs68.writeFileSync(file, JSON.stringify(config, null, 2));
|
|
36884
36934
|
log.info(
|
|
36885
36935
|
"claude",
|
|
@@ -37006,8 +37056,8 @@ async function start(requestedAgent, presetSession) {
|
|
|
37006
37056
|
let gateTimer;
|
|
37007
37057
|
await Promise.race([
|
|
37008
37058
|
Promise.all([depsReady, agentBinaryReady]),
|
|
37009
|
-
new Promise((
|
|
37010
|
-
gateTimer = setTimeout(
|
|
37059
|
+
new Promise((resolve9) => {
|
|
37060
|
+
gateTimer = setTimeout(resolve9, GATE_TIMEOUT_MS);
|
|
37011
37061
|
})
|
|
37012
37062
|
]);
|
|
37013
37063
|
if (gateTimer) clearTimeout(gateTimer);
|
|
@@ -37362,7 +37412,7 @@ async function pair(args2 = []) {
|
|
|
37362
37412
|
waitSpin.message(waitMessage());
|
|
37363
37413
|
}, 1e3);
|
|
37364
37414
|
countdownInterval.unref?.();
|
|
37365
|
-
await new Promise((
|
|
37415
|
+
await new Promise((resolve9) => {
|
|
37366
37416
|
let stopPolling = null;
|
|
37367
37417
|
function sigintHandler() {
|
|
37368
37418
|
clearInterval(countdownInterval);
|
|
@@ -37413,7 +37463,7 @@ async function pair(args2 = []) {
|
|
|
37413
37463
|
pluginAuthToken: info.pluginAuthToken
|
|
37414
37464
|
});
|
|
37415
37465
|
}
|
|
37416
|
-
|
|
37466
|
+
resolve9();
|
|
37417
37467
|
},
|
|
37418
37468
|
() => {
|
|
37419
37469
|
clearInterval(countdownInterval);
|
|
@@ -37598,7 +37648,7 @@ var import_picocolors11 = __toESM(require("picocolors"));
|
|
|
37598
37648
|
var import_child_process29 = require("child_process");
|
|
37599
37649
|
var import_util4 = require("util");
|
|
37600
37650
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
37601
|
-
var
|
|
37651
|
+
var path74 = __toESM(require("path"));
|
|
37602
37652
|
var execFileP6 = (0, import_util4.promisify)(import_child_process29.execFile);
|
|
37603
37653
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
37604
37654
|
function resetStdinForChild() {
|
|
@@ -37642,12 +37692,12 @@ var GitHubCodespacesProvider = class {
|
|
|
37642
37692
|
}
|
|
37643
37693
|
if (!isAuthed) {
|
|
37644
37694
|
resetStdinForChild();
|
|
37645
|
-
await new Promise((
|
|
37695
|
+
await new Promise((resolve9, reject) => {
|
|
37646
37696
|
const proc = (0, import_child_process29.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
|
|
37647
37697
|
stdio: "inherit"
|
|
37648
37698
|
});
|
|
37649
37699
|
proc.on("exit", (code) => {
|
|
37650
|
-
if (code === 0)
|
|
37700
|
+
if (code === 0) resolve9();
|
|
37651
37701
|
else reject(new Error("gh auth login failed."));
|
|
37652
37702
|
});
|
|
37653
37703
|
proc.on("error", reject);
|
|
@@ -37676,13 +37726,13 @@ var GitHubCodespacesProvider = class {
|
|
|
37676
37726
|
}
|
|
37677
37727
|
wt(noteLines.join("\n"), "One more permission needed");
|
|
37678
37728
|
resetStdinForChild();
|
|
37679
|
-
const refreshCode = await new Promise((
|
|
37729
|
+
const refreshCode = await new Promise((resolve9, reject) => {
|
|
37680
37730
|
const proc = (0, import_child_process29.spawn)(
|
|
37681
37731
|
"gh",
|
|
37682
37732
|
["auth", "refresh", "-h", "github.com", "-s", "codespace"],
|
|
37683
37733
|
{ stdio: "inherit" }
|
|
37684
37734
|
);
|
|
37685
|
-
proc.on("exit", (code) =>
|
|
37735
|
+
proc.on("exit", (code) => resolve9(code ?? 1));
|
|
37686
37736
|
proc.on("error", reject);
|
|
37687
37737
|
});
|
|
37688
37738
|
if (refreshCode !== 0) {
|
|
@@ -37826,10 +37876,10 @@ var GitHubCodespacesProvider = class {
|
|
|
37826
37876
|
if (q(proceed) || !proceed) return;
|
|
37827
37877
|
O2.step(`Installing gh via ${installCmd.describe}\u2026`);
|
|
37828
37878
|
resetStdinForChild();
|
|
37829
|
-
const ok = await new Promise((
|
|
37879
|
+
const ok = await new Promise((resolve9) => {
|
|
37830
37880
|
const proc = (0, import_child_process29.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
|
|
37831
|
-
proc.on("exit", (code) =>
|
|
37832
|
-
proc.on("error", () =>
|
|
37881
|
+
proc.on("exit", (code) => resolve9(code === 0));
|
|
37882
|
+
proc.on("error", () => resolve9(false));
|
|
37833
37883
|
});
|
|
37834
37884
|
if (ok) O2.success("gh installed");
|
|
37835
37885
|
else O2.error("gh install failed");
|
|
@@ -37853,14 +37903,14 @@ var GitHubCodespacesProvider = class {
|
|
|
37853
37903
|
"Expanding GitHub scopes"
|
|
37854
37904
|
);
|
|
37855
37905
|
resetStdinForChild();
|
|
37856
|
-
await new Promise((
|
|
37906
|
+
await new Promise((resolve9, reject) => {
|
|
37857
37907
|
const proc = (0, import_child_process29.spawn)(
|
|
37858
37908
|
"gh",
|
|
37859
37909
|
["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
|
|
37860
37910
|
{ stdio: "inherit" }
|
|
37861
37911
|
);
|
|
37862
37912
|
proc.on("exit", (code) => {
|
|
37863
|
-
if (code === 0)
|
|
37913
|
+
if (code === 0) resolve9();
|
|
37864
37914
|
else reject(new Error(
|
|
37865
37915
|
"gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
|
|
37866
37916
|
));
|
|
@@ -38031,13 +38081,13 @@ var GitHubCodespacesProvider = class {
|
|
|
38031
38081
|
}
|
|
38032
38082
|
async streamCommand(workspaceId, command2) {
|
|
38033
38083
|
resetStdinForChild();
|
|
38034
|
-
return new Promise((
|
|
38084
|
+
return new Promise((resolve9, reject) => {
|
|
38035
38085
|
const proc = (0, import_child_process29.spawn)(
|
|
38036
38086
|
"gh",
|
|
38037
38087
|
["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
|
|
38038
38088
|
{ stdio: "inherit" }
|
|
38039
38089
|
);
|
|
38040
|
-
proc.on("exit", (code) =>
|
|
38090
|
+
proc.on("exit", (code) => resolve9({ code: code ?? 0 }));
|
|
38041
38091
|
proc.on("error", reject);
|
|
38042
38092
|
});
|
|
38043
38093
|
}
|
|
@@ -38058,7 +38108,7 @@ var GitHubCodespacesProvider = class {
|
|
|
38058
38108
|
"--",
|
|
38059
38109
|
`mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
|
|
38060
38110
|
];
|
|
38061
|
-
await new Promise((
|
|
38111
|
+
await new Promise((resolve9, reject) => {
|
|
38062
38112
|
const tar = (0, import_child_process29.spawn)("tar", tarArgs, {
|
|
38063
38113
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38064
38114
|
env: tarEnv
|
|
@@ -38078,7 +38128,7 @@ var GitHubCodespacesProvider = class {
|
|
|
38078
38128
|
ssh.on("error", reject);
|
|
38079
38129
|
ssh.on("exit", (code) => {
|
|
38080
38130
|
if (code === 0) {
|
|
38081
|
-
|
|
38131
|
+
resolve9();
|
|
38082
38132
|
} else {
|
|
38083
38133
|
const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
|
|
38084
38134
|
reject(new Error(`Remote tar failed: ${reason}`));
|
|
@@ -38087,7 +38137,7 @@ var GitHubCodespacesProvider = class {
|
|
|
38087
38137
|
});
|
|
38088
38138
|
}
|
|
38089
38139
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
38090
|
-
const remoteDir =
|
|
38140
|
+
const remoteDir = path74.posix.dirname(remotePath);
|
|
38091
38141
|
const parts = [
|
|
38092
38142
|
`mkdir -p ${shellQuote(remoteDir)}`,
|
|
38093
38143
|
`cat > ${shellQuote(remotePath)}`
|
|
@@ -38096,7 +38146,7 @@ var GitHubCodespacesProvider = class {
|
|
|
38096
38146
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
|
|
38097
38147
|
}
|
|
38098
38148
|
const cmd = parts.join(" && ");
|
|
38099
|
-
await new Promise((
|
|
38149
|
+
await new Promise((resolve9, reject) => {
|
|
38100
38150
|
const proc = (0, import_child_process29.spawn)(
|
|
38101
38151
|
"gh",
|
|
38102
38152
|
["codespace", "ssh", "-c", workspaceId, "--", cmd],
|
|
@@ -38108,7 +38158,7 @@ var GitHubCodespacesProvider = class {
|
|
|
38108
38158
|
});
|
|
38109
38159
|
proc.on("error", reject);
|
|
38110
38160
|
proc.on("exit", (code) => {
|
|
38111
|
-
if (code === 0)
|
|
38161
|
+
if (code === 0) resolve9();
|
|
38112
38162
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
38113
38163
|
});
|
|
38114
38164
|
proc.stdin?.write(contents);
|
|
@@ -38157,7 +38207,7 @@ function shellQuote(s) {
|
|
|
38157
38207
|
// src/services/providers/gitpod.ts
|
|
38158
38208
|
var import_child_process30 = require("child_process");
|
|
38159
38209
|
var import_util5 = require("util");
|
|
38160
|
-
var
|
|
38210
|
+
var path75 = __toESM(require("path"));
|
|
38161
38211
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
38162
38212
|
var execFileP7 = (0, import_util5.promisify)(import_child_process30.execFile);
|
|
38163
38213
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
@@ -38198,10 +38248,10 @@ var GitpodProvider = class {
|
|
|
38198
38248
|
"Authenticating Gitpod"
|
|
38199
38249
|
);
|
|
38200
38250
|
resetStdinForChild2();
|
|
38201
|
-
await new Promise((
|
|
38251
|
+
await new Promise((resolve9, reject) => {
|
|
38202
38252
|
const proc = (0, import_child_process30.spawn)("gitpod", ["login"], { stdio: "inherit" });
|
|
38203
38253
|
proc.on("exit", (code) => {
|
|
38204
|
-
if (code === 0)
|
|
38254
|
+
if (code === 0) resolve9();
|
|
38205
38255
|
else reject(new Error("gitpod login failed."));
|
|
38206
38256
|
});
|
|
38207
38257
|
proc.on("error", reject);
|
|
@@ -38350,13 +38400,13 @@ var GitpodProvider = class {
|
|
|
38350
38400
|
}
|
|
38351
38401
|
async streamCommand(workspaceId, command2) {
|
|
38352
38402
|
resetStdinForChild2();
|
|
38353
|
-
return new Promise((
|
|
38403
|
+
return new Promise((resolve9, reject) => {
|
|
38354
38404
|
const proc = (0, import_child_process30.spawn)(
|
|
38355
38405
|
"gitpod",
|
|
38356
38406
|
["workspace", "ssh", workspaceId, "--", "-tt", command2],
|
|
38357
38407
|
{ stdio: "inherit" }
|
|
38358
38408
|
);
|
|
38359
|
-
proc.on("exit", (code) =>
|
|
38409
|
+
proc.on("exit", (code) => resolve9({ code: code ?? 0 }));
|
|
38360
38410
|
proc.on("error", reject);
|
|
38361
38411
|
});
|
|
38362
38412
|
}
|
|
@@ -38370,7 +38420,7 @@ var GitpodProvider = class {
|
|
|
38370
38420
|
tarArgs.push(".");
|
|
38371
38421
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
38372
38422
|
const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
|
|
38373
|
-
await new Promise((
|
|
38423
|
+
await new Promise((resolve9, reject) => {
|
|
38374
38424
|
const tar = (0, import_child_process30.spawn)("tar", tarArgs, {
|
|
38375
38425
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38376
38426
|
env: tarEnv
|
|
@@ -38391,13 +38441,13 @@ var GitpodProvider = class {
|
|
|
38391
38441
|
tar.on("error", reject);
|
|
38392
38442
|
ssh.on("error", reject);
|
|
38393
38443
|
ssh.on("exit", (code) => {
|
|
38394
|
-
if (code === 0)
|
|
38444
|
+
if (code === 0) resolve9();
|
|
38395
38445
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
38396
38446
|
});
|
|
38397
38447
|
});
|
|
38398
38448
|
}
|
|
38399
38449
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
38400
|
-
const remoteDir =
|
|
38450
|
+
const remoteDir = path75.posix.dirname(remotePath);
|
|
38401
38451
|
const parts = [
|
|
38402
38452
|
`mkdir -p ${shellQuote2(remoteDir)}`,
|
|
38403
38453
|
`cat > ${shellQuote2(remotePath)}`
|
|
@@ -38406,7 +38456,7 @@ var GitpodProvider = class {
|
|
|
38406
38456
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
|
|
38407
38457
|
}
|
|
38408
38458
|
const cmd = parts.join(" && ");
|
|
38409
|
-
await new Promise((
|
|
38459
|
+
await new Promise((resolve9, reject) => {
|
|
38410
38460
|
const proc = (0, import_child_process30.spawn)(
|
|
38411
38461
|
"gitpod",
|
|
38412
38462
|
["workspace", "ssh", workspaceId, "--", cmd],
|
|
@@ -38418,7 +38468,7 @@ var GitpodProvider = class {
|
|
|
38418
38468
|
});
|
|
38419
38469
|
proc.on("error", reject);
|
|
38420
38470
|
proc.on("exit", (code) => {
|
|
38421
|
-
if (code === 0)
|
|
38471
|
+
if (code === 0) resolve9();
|
|
38422
38472
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
38423
38473
|
});
|
|
38424
38474
|
proc.stdin?.write(contents);
|
|
@@ -38433,7 +38483,7 @@ function shellQuote2(s) {
|
|
|
38433
38483
|
// src/services/providers/gitlab-workspaces.ts
|
|
38434
38484
|
var import_child_process31 = require("child_process");
|
|
38435
38485
|
var import_util6 = require("util");
|
|
38436
|
-
var
|
|
38486
|
+
var path76 = __toESM(require("path"));
|
|
38437
38487
|
var execFileP8 = (0, import_util6.promisify)(import_child_process31.execFile);
|
|
38438
38488
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
38439
38489
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
@@ -38475,14 +38525,14 @@ var GitLabWorkspacesProvider = class {
|
|
|
38475
38525
|
"Authenticating GitLab"
|
|
38476
38526
|
);
|
|
38477
38527
|
resetStdinForChild3();
|
|
38478
|
-
await new Promise((
|
|
38528
|
+
await new Promise((resolve9, reject) => {
|
|
38479
38529
|
const proc = (0, import_child_process31.spawn)(
|
|
38480
38530
|
"glab",
|
|
38481
38531
|
["auth", "login", "--scopes", "api,read_user,read_repository"],
|
|
38482
38532
|
{ stdio: "inherit" }
|
|
38483
38533
|
);
|
|
38484
38534
|
proc.on("exit", (code) => {
|
|
38485
|
-
if (code === 0)
|
|
38535
|
+
if (code === 0) resolve9();
|
|
38486
38536
|
else reject(new Error("glab auth login failed."));
|
|
38487
38537
|
});
|
|
38488
38538
|
proc.on("error", reject);
|
|
@@ -38647,13 +38697,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
38647
38697
|
async streamCommand(workspaceId, command2) {
|
|
38648
38698
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
38649
38699
|
resetStdinForChild3();
|
|
38650
|
-
return new Promise((
|
|
38700
|
+
return new Promise((resolve9, reject) => {
|
|
38651
38701
|
const proc = (0, import_child_process31.spawn)(
|
|
38652
38702
|
"ssh",
|
|
38653
38703
|
["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
|
|
38654
38704
|
{ stdio: "inherit" }
|
|
38655
38705
|
);
|
|
38656
|
-
proc.on("exit", (code) =>
|
|
38706
|
+
proc.on("exit", (code) => resolve9({ code: code ?? 0 }));
|
|
38657
38707
|
proc.on("error", reject);
|
|
38658
38708
|
});
|
|
38659
38709
|
}
|
|
@@ -38668,7 +38718,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
38668
38718
|
tarArgs.push(".");
|
|
38669
38719
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
38670
38720
|
const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
|
|
38671
|
-
await new Promise((
|
|
38721
|
+
await new Promise((resolve9, reject) => {
|
|
38672
38722
|
const tar = (0, import_child_process31.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
38673
38723
|
const ssh = (0, import_child_process31.spawn)(
|
|
38674
38724
|
"ssh",
|
|
@@ -38686,20 +38736,20 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
38686
38736
|
tar.on("error", reject);
|
|
38687
38737
|
ssh.on("error", reject);
|
|
38688
38738
|
ssh.on("exit", (code) => {
|
|
38689
|
-
if (code === 0)
|
|
38739
|
+
if (code === 0) resolve9();
|
|
38690
38740
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
38691
38741
|
});
|
|
38692
38742
|
});
|
|
38693
38743
|
}
|
|
38694
38744
|
async uploadFile(workspaceId, remotePath, contents, options = {}) {
|
|
38695
38745
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
38696
|
-
const remoteDir =
|
|
38746
|
+
const remoteDir = path76.posix.dirname(remotePath);
|
|
38697
38747
|
const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
|
|
38698
38748
|
if (options.mode != null) {
|
|
38699
38749
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
38700
38750
|
}
|
|
38701
38751
|
const cmd = parts.join(" && ");
|
|
38702
|
-
await new Promise((
|
|
38752
|
+
await new Promise((resolve9, reject) => {
|
|
38703
38753
|
const proc = (0, import_child_process31.spawn)(
|
|
38704
38754
|
"ssh",
|
|
38705
38755
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
|
|
@@ -38711,7 +38761,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
38711
38761
|
});
|
|
38712
38762
|
proc.on("error", reject);
|
|
38713
38763
|
proc.on("exit", (code) => {
|
|
38714
|
-
if (code === 0)
|
|
38764
|
+
if (code === 0) resolve9();
|
|
38715
38765
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
38716
38766
|
});
|
|
38717
38767
|
proc.stdin?.write(contents);
|
|
@@ -38761,7 +38811,7 @@ function shellQuote3(s) {
|
|
|
38761
38811
|
// src/services/providers/railway.ts
|
|
38762
38812
|
var import_child_process32 = require("child_process");
|
|
38763
38813
|
var import_util7 = require("util");
|
|
38764
|
-
var
|
|
38814
|
+
var path77 = __toESM(require("path"));
|
|
38765
38815
|
var execFileP9 = (0, import_util7.promisify)(import_child_process32.execFile);
|
|
38766
38816
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
38767
38817
|
function resetStdinForChild4() {
|
|
@@ -38802,10 +38852,10 @@ var RailwayProvider = class {
|
|
|
38802
38852
|
"Authenticating Railway"
|
|
38803
38853
|
);
|
|
38804
38854
|
resetStdinForChild4();
|
|
38805
|
-
await new Promise((
|
|
38855
|
+
await new Promise((resolve9, reject) => {
|
|
38806
38856
|
const proc = (0, import_child_process32.spawn)("railway", ["login"], { stdio: "inherit" });
|
|
38807
38857
|
proc.on("exit", (code) => {
|
|
38808
|
-
if (code === 0)
|
|
38858
|
+
if (code === 0) resolve9();
|
|
38809
38859
|
else reject(new Error("railway login failed."));
|
|
38810
38860
|
});
|
|
38811
38861
|
proc.on("error", reject);
|
|
@@ -38945,13 +38995,13 @@ var RailwayProvider = class {
|
|
|
38945
38995
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
38946
38996
|
}
|
|
38947
38997
|
resetStdinForChild4();
|
|
38948
|
-
return new Promise((
|
|
38998
|
+
return new Promise((resolve9, reject) => {
|
|
38949
38999
|
const proc = (0, import_child_process32.spawn)(
|
|
38950
39000
|
"railway",
|
|
38951
39001
|
["shell", "--project", projectId, "--service", serviceId, "--command", command2],
|
|
38952
39002
|
{ stdio: "inherit" }
|
|
38953
39003
|
);
|
|
38954
|
-
proc.on("exit", (code) =>
|
|
39004
|
+
proc.on("exit", (code) => resolve9({ code: code ?? 0 }));
|
|
38955
39005
|
proc.on("error", reject);
|
|
38956
39006
|
});
|
|
38957
39007
|
}
|
|
@@ -38969,7 +39019,7 @@ var RailwayProvider = class {
|
|
|
38969
39019
|
tarArgs.push(".");
|
|
38970
39020
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
38971
39021
|
const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
|
|
38972
|
-
await new Promise((
|
|
39022
|
+
await new Promise((resolve9, reject) => {
|
|
38973
39023
|
const tar = (0, import_child_process32.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
38974
39024
|
const sh = (0, import_child_process32.spawn)(
|
|
38975
39025
|
"railway",
|
|
@@ -38987,7 +39037,7 @@ var RailwayProvider = class {
|
|
|
38987
39037
|
tar.on("error", reject);
|
|
38988
39038
|
sh.on("error", reject);
|
|
38989
39039
|
sh.on("exit", (code) => {
|
|
38990
|
-
if (code === 0)
|
|
39040
|
+
if (code === 0) resolve9();
|
|
38991
39041
|
else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
38992
39042
|
});
|
|
38993
39043
|
});
|
|
@@ -38997,13 +39047,13 @@ var RailwayProvider = class {
|
|
|
38997
39047
|
if (!projectId || !serviceId) {
|
|
38998
39048
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
38999
39049
|
}
|
|
39000
|
-
const remoteDir =
|
|
39050
|
+
const remoteDir = path77.posix.dirname(remotePath);
|
|
39001
39051
|
const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
|
|
39002
39052
|
if (options.mode != null) {
|
|
39003
39053
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
39004
39054
|
}
|
|
39005
39055
|
const cmd = parts.join(" && ");
|
|
39006
|
-
await new Promise((
|
|
39056
|
+
await new Promise((resolve9, reject) => {
|
|
39007
39057
|
const proc = (0, import_child_process32.spawn)(
|
|
39008
39058
|
"railway",
|
|
39009
39059
|
["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
|
|
@@ -39015,7 +39065,7 @@ var RailwayProvider = class {
|
|
|
39015
39065
|
});
|
|
39016
39066
|
proc.on("error", reject);
|
|
39017
39067
|
proc.on("exit", (code) => {
|
|
39018
|
-
if (code === 0)
|
|
39068
|
+
if (code === 0) resolve9();
|
|
39019
39069
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
39020
39070
|
});
|
|
39021
39071
|
proc.stdin?.write(contents);
|
|
@@ -39644,7 +39694,7 @@ var import_node_dns = require("dns");
|
|
|
39644
39694
|
var import_node_util5 = require("util");
|
|
39645
39695
|
var import_node_crypto13 = require("crypto");
|
|
39646
39696
|
var fs69 = __toESM(require("fs"));
|
|
39647
|
-
var
|
|
39697
|
+
var path78 = __toESM(require("path"));
|
|
39648
39698
|
var import_picocolors14 = __toESM(require("picocolors"));
|
|
39649
39699
|
var dnsResolveP = (0, import_node_util5.promisify)(import_node_dns.resolve);
|
|
39650
39700
|
async function checkDns(apiBase2) {
|
|
@@ -39700,10 +39750,10 @@ async function checkHealth(apiBase2) {
|
|
|
39700
39750
|
}
|
|
39701
39751
|
}
|
|
39702
39752
|
function checkConfigDir() {
|
|
39703
|
-
const dir =
|
|
39753
|
+
const dir = path78.join(require("os").homedir(), ".codeam");
|
|
39704
39754
|
try {
|
|
39705
39755
|
fs69.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
39706
|
-
const probe =
|
|
39756
|
+
const probe = path78.join(dir, ".doctor-probe");
|
|
39707
39757
|
fs69.writeFileSync(probe, "ok", { mode: 384 });
|
|
39708
39758
|
const read2 = fs69.readFileSync(probe, "utf8");
|
|
39709
39759
|
fs69.unlinkSync(probe);
|
|
@@ -39746,9 +39796,9 @@ function checkSessions() {
|
|
|
39746
39796
|
}
|
|
39747
39797
|
}
|
|
39748
39798
|
function checkAgentBinaries() {
|
|
39749
|
-
const
|
|
39799
|
+
const os60 = createOsStrategy();
|
|
39750
39800
|
return getEnabledAgents().map((meta) => {
|
|
39751
|
-
const found =
|
|
39801
|
+
const found = os60.findInPath(meta.binaryName);
|
|
39752
39802
|
return {
|
|
39753
39803
|
id: `agent-${meta.id}`,
|
|
39754
39804
|
label: `Agent binary: ${meta.displayName} (${meta.binaryName})`,
|
|
@@ -39770,7 +39820,7 @@ function checkNodePty() {
|
|
|
39770
39820
|
detail: "not required on this platform"
|
|
39771
39821
|
};
|
|
39772
39822
|
}
|
|
39773
|
-
const vendoredPath =
|
|
39823
|
+
const vendoredPath = path78.join(__dirname, "vendor", "node-pty");
|
|
39774
39824
|
for (const target of [vendoredPath, "node-pty"]) {
|
|
39775
39825
|
try {
|
|
39776
39826
|
require(target);
|
|
@@ -39812,7 +39862,7 @@ function checkChokidar() {
|
|
|
39812
39862
|
}
|
|
39813
39863
|
async function doctor(args2 = []) {
|
|
39814
39864
|
const json = args2.includes("--json");
|
|
39815
|
-
const cliVersion = true ? "2.61.
|
|
39865
|
+
const cliVersion = true ? "2.61.69" : "0.0.0-dev";
|
|
39816
39866
|
const apiBase2 = resolveApiBaseUrl();
|
|
39817
39867
|
const diagnosticId = (0, import_node_crypto13.randomUUID)();
|
|
39818
39868
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -40091,11 +40141,11 @@ var RestartableStdioProxy = class {
|
|
|
40091
40141
|
rl.on("close", () => this.child?.stdin?.end());
|
|
40092
40142
|
const timer = setInterval(() => this.checkRestart(stdout), RESTART_CHECK_INTERVAL_MS);
|
|
40093
40143
|
timer.unref();
|
|
40094
|
-
return new Promise((
|
|
40144
|
+
return new Promise((resolve9) => {
|
|
40095
40145
|
this.ended = (code) => {
|
|
40096
40146
|
clearInterval(timer);
|
|
40097
40147
|
process.exitCode = code;
|
|
40098
|
-
|
|
40148
|
+
resolve9();
|
|
40099
40149
|
};
|
|
40100
40150
|
});
|
|
40101
40151
|
}
|
|
@@ -40334,7 +40384,7 @@ async function mcpRun(args2) {
|
|
|
40334
40384
|
// src/commands/version.ts
|
|
40335
40385
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
40336
40386
|
function version2() {
|
|
40337
|
-
const v = true ? "2.61.
|
|
40387
|
+
const v = true ? "2.61.69" : "unknown";
|
|
40338
40388
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
40339
40389
|
}
|
|
40340
40390
|
|
|
@@ -40483,10 +40533,10 @@ var EXIT_CODE_NAMES = {
|
|
|
40483
40533
|
};
|
|
40484
40534
|
|
|
40485
40535
|
// src/index.ts
|
|
40486
|
-
var
|
|
40536
|
+
var os59 = __toESM(require("os"));
|
|
40487
40537
|
if (!process.env.HOME) {
|
|
40488
40538
|
try {
|
|
40489
|
-
const home =
|
|
40539
|
+
const home = os59.homedir();
|
|
40490
40540
|
if (home) process.env.HOME = home;
|
|
40491
40541
|
} catch {
|
|
40492
40542
|
}
|