codeam-cli 2.73.0 → 2.73.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/index.js +268 -257
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -128,11 +128,11 @@ var init_stdio_proxy = __esm({
|
|
|
128
128
|
rl.on("close", () => this.child?.stdin?.end());
|
|
129
129
|
const timer = setInterval(() => this.checkRestart(stdout), RESTART_CHECK_INTERVAL_MS);
|
|
130
130
|
timer.unref();
|
|
131
|
-
return new Promise((
|
|
131
|
+
return new Promise((resolve11) => {
|
|
132
132
|
this.ended = (code) => {
|
|
133
133
|
clearInterval(timer);
|
|
134
134
|
process.exitCode = code;
|
|
135
|
-
|
|
135
|
+
resolve11();
|
|
136
136
|
};
|
|
137
137
|
});
|
|
138
138
|
}
|
|
@@ -542,7 +542,7 @@ async function runHttpRelay(delivery, client3, id) {
|
|
|
542
542
|
requestInit: { headers: buildHttpHeaders(delivery.httpHeaders, token) }
|
|
543
543
|
});
|
|
544
544
|
const stdioTransport = new StdioServerTransport();
|
|
545
|
-
await new Promise((
|
|
545
|
+
await new Promise((resolve11, reject) => {
|
|
546
546
|
let done = false;
|
|
547
547
|
const watchdog = createToolCallWatchdog({
|
|
548
548
|
timeoutMs: TOOL_CALL_TIMEOUT_MS,
|
|
@@ -556,7 +556,7 @@ async function runHttpRelay(delivery, client3, id) {
|
|
|
556
556
|
void httpTransport.close().catch(() => void 0);
|
|
557
557
|
void stdioTransport.close().catch(() => void 0);
|
|
558
558
|
if (err) reject(err);
|
|
559
|
-
else
|
|
559
|
+
else resolve11();
|
|
560
560
|
};
|
|
561
561
|
stdioTransport.onmessage = (msg) => {
|
|
562
562
|
watchdog.onClientMessage(msg);
|
|
@@ -5865,14 +5865,14 @@ async function addSourceContext(frames) {
|
|
|
5865
5865
|
return frames;
|
|
5866
5866
|
}
|
|
5867
5867
|
function getContextLinesFromFile(path95, ranges, output) {
|
|
5868
|
-
return new Promise((
|
|
5868
|
+
return new Promise((resolve11) => {
|
|
5869
5869
|
const stream = (0, import_node_fs.createReadStream)(path95);
|
|
5870
5870
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
5871
5871
|
input: stream
|
|
5872
5872
|
});
|
|
5873
5873
|
function destroyStreamAndResolve() {
|
|
5874
5874
|
stream.destroy();
|
|
5875
|
-
|
|
5875
|
+
resolve11();
|
|
5876
5876
|
}
|
|
5877
5877
|
let lineNumber = 0;
|
|
5878
5878
|
let currentRangeIndex = 0;
|
|
@@ -7159,9 +7159,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
7159
7159
|
if (!waitUntil) return;
|
|
7160
7160
|
if (this.disabled || this.optedOut) return;
|
|
7161
7161
|
if (!this._waitUntilCycle) {
|
|
7162
|
-
let
|
|
7162
|
+
let resolve11;
|
|
7163
7163
|
const promise = new Promise((r) => {
|
|
7164
|
-
|
|
7164
|
+
resolve11 = r;
|
|
7165
7165
|
});
|
|
7166
7166
|
try {
|
|
7167
7167
|
waitUntil(promise);
|
|
@@ -7169,7 +7169,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
7169
7169
|
return;
|
|
7170
7170
|
}
|
|
7171
7171
|
this._waitUntilCycle = {
|
|
7172
|
-
resolve:
|
|
7172
|
+
resolve: resolve11,
|
|
7173
7173
|
startedAt: Date.now(),
|
|
7174
7174
|
timer: void 0
|
|
7175
7175
|
};
|
|
@@ -7193,12 +7193,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
7193
7193
|
return cycle?.resolve;
|
|
7194
7194
|
}
|
|
7195
7195
|
async resolveWaitUntilFlush() {
|
|
7196
|
-
const
|
|
7196
|
+
const resolve11 = this._consumeWaitUntilCycle();
|
|
7197
7197
|
try {
|
|
7198
7198
|
await super.flush();
|
|
7199
7199
|
} catch {
|
|
7200
7200
|
} finally {
|
|
7201
|
-
|
|
7201
|
+
resolve11?.();
|
|
7202
7202
|
}
|
|
7203
7203
|
}
|
|
7204
7204
|
getPersistedProperty(key) {
|
|
@@ -7290,15 +7290,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
7290
7290
|
async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
|
|
7291
7291
|
if (this.isLocalEvaluationReady()) return true;
|
|
7292
7292
|
if (void 0 === this.featureFlagsPoller) return false;
|
|
7293
|
-
return new Promise((
|
|
7293
|
+
return new Promise((resolve11) => {
|
|
7294
7294
|
const timeout = setTimeout(() => {
|
|
7295
7295
|
cleanup();
|
|
7296
|
-
|
|
7296
|
+
resolve11(false);
|
|
7297
7297
|
}, timeoutMs);
|
|
7298
7298
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
7299
7299
|
clearTimeout(timeout);
|
|
7300
7300
|
cleanup();
|
|
7301
|
-
|
|
7301
|
+
resolve11(count > 0);
|
|
7302
7302
|
});
|
|
7303
7303
|
});
|
|
7304
7304
|
}
|
|
@@ -7735,13 +7735,13 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
7735
7735
|
this.context?.enter(data, options);
|
|
7736
7736
|
}
|
|
7737
7737
|
async _shutdown(shutdownTimeoutMs) {
|
|
7738
|
-
const
|
|
7738
|
+
const resolve11 = this._consumeWaitUntilCycle();
|
|
7739
7739
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
7740
7740
|
this.errorTracking.shutdown();
|
|
7741
7741
|
try {
|
|
7742
7742
|
return await super._shutdown(shutdownTimeoutMs);
|
|
7743
7743
|
} finally {
|
|
7744
|
-
|
|
7744
|
+
resolve11?.();
|
|
7745
7745
|
}
|
|
7746
7746
|
}
|
|
7747
7747
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -8097,7 +8097,7 @@ function readAnonId() {
|
|
|
8097
8097
|
}
|
|
8098
8098
|
function superProperties() {
|
|
8099
8099
|
return {
|
|
8100
|
-
cliVersion: true ? "2.73.
|
|
8100
|
+
cliVersion: true ? "2.73.1" : "0.0.0-dev",
|
|
8101
8101
|
nodeVersion: process.version,
|
|
8102
8102
|
platform: process.platform,
|
|
8103
8103
|
arch: process.arch,
|
|
@@ -8244,10 +8244,10 @@ var _execSeam = {
|
|
|
8244
8244
|
}
|
|
8245
8245
|
};
|
|
8246
8246
|
var _execSeamAsync = {
|
|
8247
|
-
exec: (file, args2, opts) => new Promise((
|
|
8247
|
+
exec: (file, args2, opts) => new Promise((resolve11, reject) => {
|
|
8248
8248
|
(0, import_child_process.execFile)(file, args2, opts, (err, stdout) => {
|
|
8249
8249
|
if (err) reject(err);
|
|
8250
|
-
else
|
|
8250
|
+
else resolve11(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
|
|
8251
8251
|
});
|
|
8252
8252
|
})
|
|
8253
8253
|
};
|
|
@@ -8339,7 +8339,7 @@ var http = __toESM(require("http"));
|
|
|
8339
8339
|
// package.json
|
|
8340
8340
|
var package_default = {
|
|
8341
8341
|
name: "codeam-cli",
|
|
8342
|
-
version: "2.73.
|
|
8342
|
+
version: "2.73.1",
|
|
8343
8343
|
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.",
|
|
8344
8344
|
type: "commonjs",
|
|
8345
8345
|
main: "dist/index.js",
|
|
@@ -8471,8 +8471,8 @@ async function requestCode(pluginId, pluginSecretHash) {
|
|
|
8471
8471
|
});
|
|
8472
8472
|
let timer;
|
|
8473
8473
|
const timeoutSentinel = /* @__PURE__ */ Symbol("request-code-timeout");
|
|
8474
|
-
const timeoutPromise = new Promise((
|
|
8475
|
-
timer = setTimeout(() =>
|
|
8474
|
+
const timeoutPromise = new Promise((resolve11) => {
|
|
8475
|
+
timer = setTimeout(() => resolve11(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
|
|
8476
8476
|
});
|
|
8477
8477
|
const result = await Promise.race([post2, timeoutPromise]);
|
|
8478
8478
|
clearTimeout(timer);
|
|
@@ -8943,7 +8943,7 @@ async function postBeadsProvisioning(input) {
|
|
|
8943
8943
|
}
|
|
8944
8944
|
}
|
|
8945
8945
|
async function _postJsonAuthed(url2, body, pluginAuthToken) {
|
|
8946
|
-
return new Promise((
|
|
8946
|
+
return new Promise((resolve11, reject) => {
|
|
8947
8947
|
const data = JSON.stringify(body);
|
|
8948
8948
|
const u2 = new URL(url2);
|
|
8949
8949
|
const transport = u2.protocol === "https:" ? https : http;
|
|
@@ -8973,9 +8973,9 @@ async function _postJsonAuthed(url2, body, pluginAuthToken) {
|
|
|
8973
8973
|
return;
|
|
8974
8974
|
}
|
|
8975
8975
|
try {
|
|
8976
|
-
|
|
8976
|
+
resolve11(JSON.parse(responseBody));
|
|
8977
8977
|
} catch {
|
|
8978
|
-
|
|
8978
|
+
resolve11(null);
|
|
8979
8979
|
}
|
|
8980
8980
|
});
|
|
8981
8981
|
}
|
|
@@ -9001,7 +9001,7 @@ function makeHttpError(statusCode, retryAfterHeader, responseBody) {
|
|
|
9001
9001
|
return err;
|
|
9002
9002
|
}
|
|
9003
9003
|
async function _postJson(url2, body, extraHeaders) {
|
|
9004
|
-
return new Promise((
|
|
9004
|
+
return new Promise((resolve11, reject) => {
|
|
9005
9005
|
const data = JSON.stringify(body);
|
|
9006
9006
|
const u2 = new URL(url2);
|
|
9007
9007
|
const transport = u2.protocol === "https:" ? https : http;
|
|
@@ -9031,9 +9031,9 @@ async function _postJson(url2, body, extraHeaders) {
|
|
|
9031
9031
|
return;
|
|
9032
9032
|
}
|
|
9033
9033
|
try {
|
|
9034
|
-
|
|
9034
|
+
resolve11(JSON.parse(body2));
|
|
9035
9035
|
} catch {
|
|
9036
|
-
|
|
9036
|
+
resolve11(null);
|
|
9037
9037
|
}
|
|
9038
9038
|
});
|
|
9039
9039
|
}
|
|
@@ -9048,7 +9048,7 @@ async function _postJson(url2, body, extraHeaders) {
|
|
|
9048
9048
|
});
|
|
9049
9049
|
}
|
|
9050
9050
|
async function _getJson(url2, extraHeaders) {
|
|
9051
|
-
return new Promise((
|
|
9051
|
+
return new Promise((resolve11, reject) => {
|
|
9052
9052
|
const u2 = new URL(url2);
|
|
9053
9053
|
const transport = u2.protocol === "https:" ? https : http;
|
|
9054
9054
|
const req = transport.request(
|
|
@@ -9072,9 +9072,9 @@ async function _getJson(url2, extraHeaders) {
|
|
|
9072
9072
|
return;
|
|
9073
9073
|
}
|
|
9074
9074
|
try {
|
|
9075
|
-
|
|
9075
|
+
resolve11(JSON.parse(body));
|
|
9076
9076
|
} catch {
|
|
9077
|
-
|
|
9077
|
+
resolve11(null);
|
|
9078
9078
|
}
|
|
9079
9079
|
});
|
|
9080
9080
|
}
|
|
@@ -9415,12 +9415,12 @@ async function probeProxyAliveReal() {
|
|
|
9415
9415
|
}
|
|
9416
9416
|
}
|
|
9417
9417
|
async function probeProxyPortOpenReal() {
|
|
9418
|
-
return new Promise((
|
|
9418
|
+
return new Promise((resolve11) => {
|
|
9419
9419
|
const socket = net.connect({ host: "127.0.0.1", port: 8787 });
|
|
9420
9420
|
const done = (ok) => {
|
|
9421
9421
|
socket.removeAllListeners();
|
|
9422
9422
|
socket.destroy();
|
|
9423
|
-
|
|
9423
|
+
resolve11(ok);
|
|
9424
9424
|
};
|
|
9425
9425
|
socket.setTimeout(2e3);
|
|
9426
9426
|
socket.once("connect", () => done(true));
|
|
@@ -9932,7 +9932,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
9932
9932
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
9933
9933
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
9934
9934
|
// pair/reconnect). Older backends ignore the extra field.
|
|
9935
|
-
..."2.73.
|
|
9935
|
+
..."2.73.1" ? { ideVersion: "2.73.1" } : {}
|
|
9936
9936
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
9937
9937
|
}
|
|
9938
9938
|
/**
|
|
@@ -10019,8 +10019,8 @@ async function stopRelayWithGoodbye(relay, timeoutMs = RELAY_GOODBYE_TIMEOUT_MS)
|
|
|
10019
10019
|
try {
|
|
10020
10020
|
await Promise.race([
|
|
10021
10021
|
relay.stopAndFlush(),
|
|
10022
|
-
new Promise((
|
|
10023
|
-
timer = setTimeout(
|
|
10022
|
+
new Promise((resolve11) => {
|
|
10023
|
+
timer = setTimeout(resolve11, timeoutMs);
|
|
10024
10024
|
})
|
|
10025
10025
|
]);
|
|
10026
10026
|
} catch {
|
|
@@ -10129,7 +10129,7 @@ var _transport2 = {
|
|
|
10129
10129
|
post: _post
|
|
10130
10130
|
};
|
|
10131
10131
|
function _post(url2, headers, payload) {
|
|
10132
|
-
return new Promise((
|
|
10132
|
+
return new Promise((resolve11, reject) => {
|
|
10133
10133
|
let settled = false;
|
|
10134
10134
|
const u2 = new URL(url2);
|
|
10135
10135
|
const lib = u2.protocol === "https:" ? https3 : http3;
|
|
@@ -10154,7 +10154,7 @@ function _post(url2, headers, payload) {
|
|
|
10154
10154
|
res.on("end", () => {
|
|
10155
10155
|
if (settled) return;
|
|
10156
10156
|
settled = true;
|
|
10157
|
-
|
|
10157
|
+
resolve11({ statusCode: res.statusCode ?? 0, body });
|
|
10158
10158
|
});
|
|
10159
10159
|
}
|
|
10160
10160
|
);
|
|
@@ -10842,12 +10842,12 @@ var _gitSeam = {
|
|
|
10842
10842
|
run: _runGitImpl
|
|
10843
10843
|
};
|
|
10844
10844
|
async function _runGitImpl(cwd, args2, opts = {}) {
|
|
10845
|
-
return new Promise((
|
|
10845
|
+
return new Promise((resolve11) => {
|
|
10846
10846
|
let proc;
|
|
10847
10847
|
try {
|
|
10848
10848
|
proc = (0, import_child_process4.spawn)("git", args2, { cwd, env: process.env });
|
|
10849
10849
|
} catch {
|
|
10850
|
-
|
|
10850
|
+
resolve11(null);
|
|
10851
10851
|
return;
|
|
10852
10852
|
}
|
|
10853
10853
|
let stdout = "";
|
|
@@ -10858,13 +10858,13 @@ async function _runGitImpl(cwd, args2, opts = {}) {
|
|
|
10858
10858
|
proc.stderr?.on("data", (c2) => {
|
|
10859
10859
|
stderr += c2.toString();
|
|
10860
10860
|
});
|
|
10861
|
-
proc.on("error", () =>
|
|
10861
|
+
proc.on("error", () => resolve11(null));
|
|
10862
10862
|
proc.on("close", (code) => {
|
|
10863
10863
|
if (code === 0 || opts.allowNonZeroExit) {
|
|
10864
|
-
|
|
10864
|
+
resolve11(stdout);
|
|
10865
10865
|
} else {
|
|
10866
10866
|
log.trace("fileWatcher", `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`);
|
|
10867
|
-
|
|
10867
|
+
resolve11(null);
|
|
10868
10868
|
}
|
|
10869
10869
|
});
|
|
10870
10870
|
});
|
|
@@ -10950,7 +10950,7 @@ var ChunkEmitter = class {
|
|
|
10950
10950
|
if (this.pairingInvalid) {
|
|
10951
10951
|
return Promise.resolve({ dead: true });
|
|
10952
10952
|
}
|
|
10953
|
-
return new Promise((
|
|
10953
|
+
return new Promise((resolve11) => {
|
|
10954
10954
|
let refreshedOnce = false;
|
|
10955
10955
|
const attempt = (attemptsLeft) => {
|
|
10956
10956
|
_transport3.post(this.url, this.headers, payload).then(({ statusCode, body: resBody }) => {
|
|
@@ -10958,13 +10958,13 @@ var ChunkEmitter = class {
|
|
|
10958
10958
|
if (statusCode === 410 || statusCode === 404 && /SESSION_NOT_FOUND|SESSION_GONE/.test(resBody)) {
|
|
10959
10959
|
process.stderr.write("[codeam] session was deleted/disconnected \u2014 stopping output stream.\n");
|
|
10960
10960
|
log.info("chunkEmitter", `dead status=${statusCode} took=${tookMs}ms`);
|
|
10961
|
-
|
|
10961
|
+
resolve11({ dead: true });
|
|
10962
10962
|
return;
|
|
10963
10963
|
}
|
|
10964
10964
|
if (statusCode === 401 || statusCode === 403) {
|
|
10965
10965
|
if (refreshedOnce) {
|
|
10966
10966
|
this.markPairingInvalid(statusCode, tookMs);
|
|
10967
|
-
|
|
10967
|
+
resolve11({ dead: true });
|
|
10968
10968
|
return;
|
|
10969
10969
|
}
|
|
10970
10970
|
log.warn("chunkEmitter", `auth ${statusCode} took=${tookMs}ms \u2014 attempting silent refresh`);
|
|
@@ -10980,10 +10980,10 @@ var ChunkEmitter = class {
|
|
|
10980
10980
|
}
|
|
10981
10981
|
if (refresh.kind === "gone") {
|
|
10982
10982
|
this.markPairingInvalid(statusCode, tookMs);
|
|
10983
|
-
|
|
10983
|
+
resolve11({ dead: true });
|
|
10984
10984
|
return;
|
|
10985
10985
|
}
|
|
10986
|
-
|
|
10986
|
+
resolve11({ dead: false });
|
|
10987
10987
|
})();
|
|
10988
10988
|
return;
|
|
10989
10989
|
}
|
|
@@ -10994,7 +10994,7 @@ var ChunkEmitter = class {
|
|
|
10994
10994
|
} else {
|
|
10995
10995
|
log.info("chunkEmitter", `ok status=${statusCode} took=${tookMs}ms`);
|
|
10996
10996
|
}
|
|
10997
|
-
|
|
10997
|
+
resolve11({ dead: false });
|
|
10998
10998
|
}).catch((err) => {
|
|
10999
10999
|
log.warn(
|
|
11000
11000
|
"chunkEmitter",
|
|
@@ -11005,7 +11005,7 @@ var ChunkEmitter = class {
|
|
|
11005
11005
|
const delay = 200 * (maxRetries - attemptsLeft + 1);
|
|
11006
11006
|
setTimeout(() => attempt(attemptsLeft - 1), delay);
|
|
11007
11007
|
} else {
|
|
11008
|
-
|
|
11008
|
+
resolve11({ dead: false });
|
|
11009
11009
|
}
|
|
11010
11010
|
});
|
|
11011
11011
|
};
|
|
@@ -11028,7 +11028,7 @@ var _transport3 = {
|
|
|
11028
11028
|
post: _post2
|
|
11029
11029
|
};
|
|
11030
11030
|
function _post2(url2, headers, payload) {
|
|
11031
|
-
return new Promise((
|
|
11031
|
+
return new Promise((resolve11, reject) => {
|
|
11032
11032
|
let settled = false;
|
|
11033
11033
|
const u2 = new URL(url2);
|
|
11034
11034
|
const transport = u2.protocol === "https:" ? https4 : http4;
|
|
@@ -11052,7 +11052,7 @@ function _post2(url2, headers, payload) {
|
|
|
11052
11052
|
res.on("end", () => {
|
|
11053
11053
|
if (settled) return;
|
|
11054
11054
|
settled = true;
|
|
11055
|
-
|
|
11055
|
+
resolve11({ statusCode: res.statusCode ?? 0, body: resData });
|
|
11056
11056
|
});
|
|
11057
11057
|
}
|
|
11058
11058
|
);
|
|
@@ -12134,12 +12134,12 @@ async function applyFileReview(workingDir, filePath, action) {
|
|
|
12134
12134
|
return { ok: true, action, filePath, repoRoot };
|
|
12135
12135
|
}
|
|
12136
12136
|
function runGit2(cwd, args2) {
|
|
12137
|
-
return new Promise((
|
|
12137
|
+
return new Promise((resolve11) => {
|
|
12138
12138
|
let proc;
|
|
12139
12139
|
try {
|
|
12140
12140
|
proc = (0, import_child_process7.spawn)("git", args2, { cwd, env: process.env });
|
|
12141
12141
|
} catch (err) {
|
|
12142
|
-
|
|
12142
|
+
resolve11({ ok: false, code: -1, stdout: "", stderr: err.message });
|
|
12143
12143
|
return;
|
|
12144
12144
|
}
|
|
12145
12145
|
let stdout = "";
|
|
@@ -12152,11 +12152,11 @@ function runGit2(cwd, args2) {
|
|
|
12152
12152
|
});
|
|
12153
12153
|
proc.on(
|
|
12154
12154
|
"error",
|
|
12155
|
-
(err) =>
|
|
12155
|
+
(err) => resolve11({ ok: false, code: -1, stdout, stderr: stderr + err.message })
|
|
12156
12156
|
);
|
|
12157
12157
|
proc.on(
|
|
12158
12158
|
"close",
|
|
12159
|
-
(code) =>
|
|
12159
|
+
(code) => resolve11({ ok: code === 0, code: code ?? -1, stdout, stderr })
|
|
12160
12160
|
);
|
|
12161
12161
|
});
|
|
12162
12162
|
}
|
|
@@ -14905,15 +14905,15 @@ function runInstaller() {
|
|
|
14905
14905
|
"-Command",
|
|
14906
14906
|
"irm https://claude.ai/install.ps1 | iex"
|
|
14907
14907
|
] : ["-c", "curl -fsSL https://claude.ai/install.sh | bash"];
|
|
14908
|
-
return new Promise((
|
|
14908
|
+
return new Promise((resolve11) => {
|
|
14909
14909
|
const proc = (0, import_child_process10.spawn)(cmd, args2, { stdio: "inherit" });
|
|
14910
14910
|
proc.on("error", (err) => {
|
|
14911
14911
|
console.error(`
|
|
14912
14912
|
\u2717 Installer failed to launch: ${err.message}`);
|
|
14913
|
-
|
|
14913
|
+
resolve11(false);
|
|
14914
14914
|
});
|
|
14915
14915
|
proc.on("exit", (code) => {
|
|
14916
|
-
|
|
14916
|
+
resolve11(code === 0);
|
|
14917
14917
|
});
|
|
14918
14918
|
});
|
|
14919
14919
|
}
|
|
@@ -15048,7 +15048,7 @@ function extractSetupTokenFromOutput(output) {
|
|
|
15048
15048
|
return m ? m[0] : null;
|
|
15049
15049
|
}
|
|
15050
15050
|
function captureClaudeSetupToken() {
|
|
15051
|
-
return new Promise((
|
|
15051
|
+
return new Promise((resolve11, reject) => {
|
|
15052
15052
|
const child = (0, import_node_child_process3.spawn)("claude", ["setup-token"], {
|
|
15053
15053
|
stdio: ["inherit", "pipe", "inherit"]
|
|
15054
15054
|
});
|
|
@@ -15062,7 +15062,7 @@ function captureClaudeSetupToken() {
|
|
|
15062
15062
|
child.on("exit", (code) => {
|
|
15063
15063
|
const token = extractSetupTokenFromOutput(out2);
|
|
15064
15064
|
if (token) {
|
|
15065
|
-
|
|
15065
|
+
resolve11({ method: "setup_token", credential: token, source: "setup-token" });
|
|
15066
15066
|
return;
|
|
15067
15067
|
}
|
|
15068
15068
|
reject(
|
|
@@ -15148,17 +15148,17 @@ function parseUsageOutput(raw) {
|
|
|
15148
15148
|
return { percent, resetAt };
|
|
15149
15149
|
}
|
|
15150
15150
|
async function fetchClaudeQuota() {
|
|
15151
|
-
return new Promise((
|
|
15151
|
+
return new Promise((resolve11) => {
|
|
15152
15152
|
const claudeCmd = findInPath("claude") ? "claude" : "claude-code";
|
|
15153
15153
|
if (!claudeCmd) {
|
|
15154
|
-
|
|
15154
|
+
resolve11(null);
|
|
15155
15155
|
return;
|
|
15156
15156
|
}
|
|
15157
15157
|
const helperPath = path20.join(os14.tmpdir(), "codeam-quota-helper.py");
|
|
15158
15158
|
fs16.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
|
|
15159
15159
|
const python = findInPath("python3") ?? findInPath("python");
|
|
15160
15160
|
if (!python) {
|
|
15161
|
-
|
|
15161
|
+
resolve11(null);
|
|
15162
15162
|
return;
|
|
15163
15163
|
}
|
|
15164
15164
|
const proc = (0, import_child_process11.spawn)(python, [helperPath, claudeCmd, "--tools", ""], {
|
|
@@ -15185,13 +15185,13 @@ async function fetchClaudeQuota() {
|
|
|
15185
15185
|
fs16.unlinkSync(helperPath);
|
|
15186
15186
|
} catch {
|
|
15187
15187
|
}
|
|
15188
|
-
|
|
15188
|
+
resolve11(result);
|
|
15189
15189
|
}, 5e3);
|
|
15190
15190
|
}, 8e3);
|
|
15191
15191
|
setTimeout(() => {
|
|
15192
15192
|
if (!resolved) {
|
|
15193
15193
|
resolved = true;
|
|
15194
|
-
|
|
15194
|
+
resolve11(null);
|
|
15195
15195
|
}
|
|
15196
15196
|
try {
|
|
15197
15197
|
proc.kill();
|
|
@@ -15216,12 +15216,12 @@ function killActiveSpawnAndCaptureChildren() {
|
|
|
15216
15216
|
}
|
|
15217
15217
|
async function spawnAndCapture(cmd, args2, opts = {}) {
|
|
15218
15218
|
const timeoutMs = opts.timeoutMs ?? 6e4;
|
|
15219
|
-
return new Promise((
|
|
15219
|
+
return new Promise((resolve11) => {
|
|
15220
15220
|
let settled = false;
|
|
15221
15221
|
const settle = (value) => {
|
|
15222
15222
|
if (settled) return;
|
|
15223
15223
|
settled = true;
|
|
15224
|
-
|
|
15224
|
+
resolve11(value);
|
|
15225
15225
|
};
|
|
15226
15226
|
let child;
|
|
15227
15227
|
try {
|
|
@@ -16610,7 +16610,7 @@ function newestRolloutIdSince(sessionsRoot, resolvedCwd, floorMs) {
|
|
|
16610
16610
|
return bestId;
|
|
16611
16611
|
}
|
|
16612
16612
|
function sleep2(ms) {
|
|
16613
|
-
return new Promise((
|
|
16613
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
16614
16614
|
}
|
|
16615
16615
|
function getCurrentUsage2(historyDir) {
|
|
16616
16616
|
if (!import_node_fs3.default.existsSync(historyDir)) return null;
|
|
@@ -16850,12 +16850,12 @@ function resolveNpm(os68) {
|
|
|
16850
16850
|
return os68.id === "win32" ? "npm.cmd" : "npm";
|
|
16851
16851
|
}
|
|
16852
16852
|
async function installCodexViaNpm(os68) {
|
|
16853
|
-
return new Promise((
|
|
16853
|
+
return new Promise((resolve11, reject) => {
|
|
16854
16854
|
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os68), ["install", "-g", "@openai/codex"], {
|
|
16855
16855
|
stdio: "inherit"
|
|
16856
16856
|
});
|
|
16857
16857
|
proc.on("close", (code) => {
|
|
16858
|
-
if (code === 0)
|
|
16858
|
+
if (code === 0) resolve11();
|
|
16859
16859
|
else reject(new Error(`npm install -g @openai/codex exited ${code}`));
|
|
16860
16860
|
});
|
|
16861
16861
|
proc.on("error", (err) => {
|
|
@@ -16976,7 +16976,7 @@ var defaultHeadroomRunner = {
|
|
|
16976
16976
|
}
|
|
16977
16977
|
},
|
|
16978
16978
|
run(cmd, args2, opts = {}) {
|
|
16979
|
-
return new Promise((
|
|
16979
|
+
return new Promise((resolve11) => {
|
|
16980
16980
|
const spawnEnv = opts.env ?? process.env;
|
|
16981
16981
|
const child = (0, import_node_child_process6.spawn)(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], env: spawnEnv });
|
|
16982
16982
|
let stderrBuf = "";
|
|
@@ -16985,7 +16985,7 @@ var defaultHeadroomRunner = {
|
|
|
16985
16985
|
const done = (code) => {
|
|
16986
16986
|
if (settled) return;
|
|
16987
16987
|
settled = true;
|
|
16988
|
-
|
|
16988
|
+
resolve11({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
16989
16989
|
};
|
|
16990
16990
|
child.stdout?.on("data", (b) => {
|
|
16991
16991
|
const chunk = b.toString();
|
|
@@ -17364,7 +17364,7 @@ async function ensureInstallPrerequisites(os68, deps = {}) {
|
|
|
17364
17364
|
};
|
|
17365
17365
|
}
|
|
17366
17366
|
function defaultRunInstallScript(env) {
|
|
17367
|
-
return new Promise((
|
|
17367
|
+
return new Promise((resolve11) => {
|
|
17368
17368
|
const proc = (0, import_node_child_process7.spawn)(
|
|
17369
17369
|
"sh",
|
|
17370
17370
|
["-c", `curl -fsSL --connect-timeout 15 --max-time 120 ${INSTALL_URL} | sh`],
|
|
@@ -17376,7 +17376,7 @@ function defaultRunInstallScript(env) {
|
|
|
17376
17376
|
if (settled) return;
|
|
17377
17377
|
settled = true;
|
|
17378
17378
|
clearTimeout(timer);
|
|
17379
|
-
|
|
17379
|
+
resolve11({ code, output });
|
|
17380
17380
|
};
|
|
17381
17381
|
const onData = (b) => {
|
|
17382
17382
|
const chunk = b.toString();
|
|
@@ -17750,7 +17750,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
17750
17750
|
}
|
|
17751
17751
|
async runOneShot(input) {
|
|
17752
17752
|
const launch = await this.prepareInvocation(input);
|
|
17753
|
-
return new Promise((
|
|
17753
|
+
return new Promise((resolve11, reject) => {
|
|
17754
17754
|
const stdoutBuf = [];
|
|
17755
17755
|
const stderrBuf = [];
|
|
17756
17756
|
const proc = (0, import_node_child_process9.spawn)(launch.cmd, launch.args, {
|
|
@@ -17762,7 +17762,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
17762
17762
|
if (settled) return;
|
|
17763
17763
|
settled = true;
|
|
17764
17764
|
clearTimeout(timer);
|
|
17765
|
-
|
|
17765
|
+
resolve11(out2);
|
|
17766
17766
|
};
|
|
17767
17767
|
const timer = setTimeout(() => {
|
|
17768
17768
|
if (settled) return;
|
|
@@ -18380,7 +18380,7 @@ function resolveClaudeNativeBinary(deps = {}) {
|
|
|
18380
18380
|
const candidate = import_path4.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
18381
18381
|
return existsSync30(candidate) ? candidate : null;
|
|
18382
18382
|
}
|
|
18383
|
-
var realSleep = (ms) => new Promise((
|
|
18383
|
+
var realSleep = (ms) => new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
18384
18384
|
async function waitForClaudeNativeBinary(opts = {}) {
|
|
18385
18385
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
18386
18386
|
const pollMs = opts.pollMs ?? 500;
|
|
@@ -18492,7 +18492,7 @@ var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no lo
|
|
|
18492
18492
|
function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
18493
18493
|
const livenessMs = opts.livenessMs ?? 400;
|
|
18494
18494
|
const spawnFn = opts.spawnFn ?? import_child_process14.spawn;
|
|
18495
|
-
return new Promise((
|
|
18495
|
+
return new Promise((resolve11) => {
|
|
18496
18496
|
let settled = false;
|
|
18497
18497
|
let stderr = "";
|
|
18498
18498
|
let timer;
|
|
@@ -18505,12 +18505,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
|
18505
18505
|
child?.kill("SIGKILL");
|
|
18506
18506
|
} catch {
|
|
18507
18507
|
}
|
|
18508
|
-
|
|
18508
|
+
resolve11(r);
|
|
18509
18509
|
};
|
|
18510
18510
|
try {
|
|
18511
18511
|
child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
|
|
18512
18512
|
} catch {
|
|
18513
|
-
|
|
18513
|
+
resolve11("ok");
|
|
18514
18514
|
return;
|
|
18515
18515
|
}
|
|
18516
18516
|
child.stderr?.on("data", (d3) => {
|
|
@@ -19097,7 +19097,7 @@ function newestSessionSince(bucket2, floorMs) {
|
|
|
19097
19097
|
return bestId;
|
|
19098
19098
|
}
|
|
19099
19099
|
function sleep3(ms) {
|
|
19100
|
-
return new Promise((
|
|
19100
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
19101
19101
|
}
|
|
19102
19102
|
function joinTextParts(parts) {
|
|
19103
19103
|
if (!Array.isArray(parts)) return "";
|
|
@@ -19544,7 +19544,7 @@ async function link(args2 = []) {
|
|
|
19544
19544
|
waitSpin.start(waitMsg());
|
|
19545
19545
|
const countdown = setInterval(() => waitSpin.message(waitMsg()), 1e3);
|
|
19546
19546
|
countdown.unref?.();
|
|
19547
|
-
const paired = await new Promise((
|
|
19547
|
+
const paired = await new Promise((resolve11, reject) => {
|
|
19548
19548
|
let stopPoll = null;
|
|
19549
19549
|
const sigint = () => {
|
|
19550
19550
|
clearInterval(countdown);
|
|
@@ -19557,7 +19557,7 @@ async function link(args2 = []) {
|
|
|
19557
19557
|
process.removeListener("SIGINT", sigint);
|
|
19558
19558
|
clearInterval(countdown);
|
|
19559
19559
|
waitSpin.stop("Paired");
|
|
19560
|
-
|
|
19560
|
+
resolve11(info);
|
|
19561
19561
|
},
|
|
19562
19562
|
() => {
|
|
19563
19563
|
clearInterval(countdown);
|
|
@@ -19715,14 +19715,14 @@ async function captureFreshCredentials(ctx) {
|
|
|
19715
19715
|
}
|
|
19716
19716
|
};
|
|
19717
19717
|
try {
|
|
19718
|
-
const token = await new Promise((
|
|
19718
|
+
const token = await new Promise((resolve11, reject) => {
|
|
19719
19719
|
let settled = false;
|
|
19720
19720
|
const tryExtract = async () => {
|
|
19721
19721
|
if (settled) return;
|
|
19722
19722
|
const t2 = await ctx.locator.extract();
|
|
19723
19723
|
if (t2 && !settled) {
|
|
19724
19724
|
settled = true;
|
|
19725
|
-
|
|
19725
|
+
resolve11(t2);
|
|
19726
19726
|
}
|
|
19727
19727
|
};
|
|
19728
19728
|
watcher.on("add", () => void tryExtract());
|
|
@@ -19962,7 +19962,7 @@ function deliverPendingCoderabbitCallback(callbackUrl) {
|
|
|
19962
19962
|
function runCoderabbitOAuthLogin(deps) {
|
|
19963
19963
|
const timeoutMs = deps.timeoutMs ?? 18e4;
|
|
19964
19964
|
const spawnProc = deps.spawn ?? spawnCoderabbitLoginProc;
|
|
19965
|
-
return new Promise((
|
|
19965
|
+
return new Promise((resolve11) => {
|
|
19966
19966
|
let settled = false;
|
|
19967
19967
|
let stdout = "";
|
|
19968
19968
|
let last = null;
|
|
@@ -19975,13 +19975,13 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
19975
19975
|
child.kill("SIGKILL");
|
|
19976
19976
|
} catch {
|
|
19977
19977
|
}
|
|
19978
|
-
|
|
19978
|
+
resolve11(r);
|
|
19979
19979
|
};
|
|
19980
19980
|
let child;
|
|
19981
19981
|
try {
|
|
19982
19982
|
child = spawnProc("coderabbit", ["auth", "login", "--agent"]);
|
|
19983
19983
|
} catch (err) {
|
|
19984
|
-
|
|
19984
|
+
resolve11({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
|
|
19985
19985
|
return;
|
|
19986
19986
|
}
|
|
19987
19987
|
const timer = setTimeout(
|
|
@@ -20454,23 +20454,23 @@ async function reviewPullRequest(params, deps) {
|
|
|
20454
20454
|
return report;
|
|
20455
20455
|
}
|
|
20456
20456
|
function defaultRunGh(args2) {
|
|
20457
|
-
return new Promise((
|
|
20457
|
+
return new Promise((resolve11) => {
|
|
20458
20458
|
const stdout = [];
|
|
20459
20459
|
const stderr = [];
|
|
20460
20460
|
let proc;
|
|
20461
20461
|
try {
|
|
20462
20462
|
proc = (0, import_node_child_process18.spawn)("gh", args2, { stdio: ["ignore", "pipe", "pipe"] });
|
|
20463
20463
|
} catch (err) {
|
|
20464
|
-
|
|
20464
|
+
resolve11({ code: -1, stdout: "", stderr: err instanceof Error ? err.message : String(err) });
|
|
20465
20465
|
return;
|
|
20466
20466
|
}
|
|
20467
20467
|
proc.stdout?.on("data", (b) => stdout.push(b));
|
|
20468
20468
|
proc.stderr?.on("data", (b) => stderr.push(b));
|
|
20469
20469
|
proc.on("error", (err) => {
|
|
20470
|
-
|
|
20470
|
+
resolve11({ code: -1, stdout: "", stderr: err.message });
|
|
20471
20471
|
});
|
|
20472
20472
|
proc.on("close", (code) => {
|
|
20473
|
-
|
|
20473
|
+
resolve11({
|
|
20474
20474
|
code: code ?? 0,
|
|
20475
20475
|
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
20476
20476
|
stderr: Buffer.concat(stderr).toString("utf8")
|
|
@@ -20611,7 +20611,7 @@ var os34 = __toESM(require("os"));
|
|
|
20611
20611
|
function runAgentInstallScript(script, opts = {}) {
|
|
20612
20612
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
20613
20613
|
const scope = opts.logScope ?? "agent-install";
|
|
20614
|
-
return new Promise((
|
|
20614
|
+
return new Promise((resolve11) => {
|
|
20615
20615
|
const home = process.env.HOME || os34.homedir();
|
|
20616
20616
|
const child = (0, import_child_process15.spawn)("sh", ["-c", script], {
|
|
20617
20617
|
env: { ...process.env, HOME: home },
|
|
@@ -20627,7 +20627,7 @@ function runAgentInstallScript(script, opts = {}) {
|
|
|
20627
20627
|
const done = (result) => {
|
|
20628
20628
|
if (settled) return;
|
|
20629
20629
|
settled = true;
|
|
20630
|
-
|
|
20630
|
+
resolve11(result);
|
|
20631
20631
|
};
|
|
20632
20632
|
const timer = setTimeout(() => {
|
|
20633
20633
|
log.warn(scope, `agent install timed out (${Math.round(timeoutMs / 1e3)}s)`);
|
|
@@ -20984,6 +20984,16 @@ function isAbsolutePathTarget(target) {
|
|
|
20984
20984
|
function selfHostedWorkspaceRoot() {
|
|
20985
20985
|
return path45.join(os36.homedir(), ".codeam", "self-hosted");
|
|
20986
20986
|
}
|
|
20987
|
+
function deployIdFromWorkspace(cwd) {
|
|
20988
|
+
if (!cwd) return null;
|
|
20989
|
+
const root = selfHostedWorkspaceRoot();
|
|
20990
|
+
const resolved = path45.resolve(cwd);
|
|
20991
|
+
const rel = path45.relative(root, resolved);
|
|
20992
|
+
if (!rel || rel.startsWith("..") || path45.isAbsolute(rel)) return null;
|
|
20993
|
+
const parts = rel.split(path45.sep).filter(Boolean);
|
|
20994
|
+
if (parts.length !== 1) return null;
|
|
20995
|
+
return parts[0];
|
|
20996
|
+
}
|
|
20987
20997
|
function nonInteractiveGitEnv() {
|
|
20988
20998
|
return {
|
|
20989
20999
|
...process.env,
|
|
@@ -21523,7 +21533,7 @@ var defaultGitToolingRunner = {
|
|
|
21523
21533
|
}
|
|
21524
21534
|
},
|
|
21525
21535
|
run(cmd, args2, opts = {}) {
|
|
21526
|
-
return new Promise((
|
|
21536
|
+
return new Promise((resolve11) => {
|
|
21527
21537
|
const child = (0, import_node_child_process21.spawn)(cmd, args2, {
|
|
21528
21538
|
stdio: [opts.input !== void 0 ? "pipe" : "ignore", "ignore", "pipe"]
|
|
21529
21539
|
});
|
|
@@ -21532,7 +21542,7 @@ var defaultGitToolingRunner = {
|
|
|
21532
21542
|
const done = (code) => {
|
|
21533
21543
|
if (settled) return;
|
|
21534
21544
|
settled = true;
|
|
21535
|
-
|
|
21545
|
+
resolve11({ code, stderr });
|
|
21536
21546
|
};
|
|
21537
21547
|
child.stderr?.on("data", (b) => {
|
|
21538
21548
|
stderr += b.toString();
|
|
@@ -22089,14 +22099,14 @@ function compareSemver(a, b) {
|
|
|
22089
22099
|
return 0;
|
|
22090
22100
|
}
|
|
22091
22101
|
function fetchLatest() {
|
|
22092
|
-
return new Promise((
|
|
22102
|
+
return new Promise((resolve11) => {
|
|
22093
22103
|
const req = https6.get(
|
|
22094
22104
|
REGISTRY_URL,
|
|
22095
22105
|
{ headers: { Accept: "application/json" }, timeout: REQUEST_TIMEOUT_MS },
|
|
22096
22106
|
(res) => {
|
|
22097
22107
|
if (res.statusCode !== 200) {
|
|
22098
22108
|
res.resume();
|
|
22099
|
-
|
|
22109
|
+
resolve11(null);
|
|
22100
22110
|
return;
|
|
22101
22111
|
}
|
|
22102
22112
|
let buf = "";
|
|
@@ -22108,21 +22118,21 @@ function fetchLatest() {
|
|
|
22108
22118
|
try {
|
|
22109
22119
|
const json = JSON.parse(buf);
|
|
22110
22120
|
if (typeof json.version === "string") {
|
|
22111
|
-
|
|
22121
|
+
resolve11(json.version);
|
|
22112
22122
|
} else {
|
|
22113
|
-
|
|
22123
|
+
resolve11(null);
|
|
22114
22124
|
}
|
|
22115
22125
|
} catch {
|
|
22116
|
-
|
|
22126
|
+
resolve11(null);
|
|
22117
22127
|
}
|
|
22118
22128
|
});
|
|
22119
22129
|
}
|
|
22120
22130
|
);
|
|
22121
22131
|
req.on("timeout", () => {
|
|
22122
22132
|
req.destroy();
|
|
22123
|
-
|
|
22133
|
+
resolve11(null);
|
|
22124
22134
|
});
|
|
22125
|
-
req.on("error", () =>
|
|
22135
|
+
req.on("error", () => resolve11(null));
|
|
22126
22136
|
});
|
|
22127
22137
|
}
|
|
22128
22138
|
function notifyIfStale(currentVersion, latest) {
|
|
@@ -22198,7 +22208,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
22198
22208
|
if (process.env.NODE_ENV === "test") return;
|
|
22199
22209
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
22200
22210
|
if (process.env.CI) return;
|
|
22201
|
-
const current2 = true ? "2.73.
|
|
22211
|
+
const current2 = true ? "2.73.1" : null;
|
|
22202
22212
|
if (!current2) return;
|
|
22203
22213
|
const cache = readCache();
|
|
22204
22214
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -22215,7 +22225,7 @@ function checkForUpdates() {
|
|
|
22215
22225
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
22216
22226
|
if (process.env.CI) return;
|
|
22217
22227
|
if (!process.stdout.isTTY) return;
|
|
22218
|
-
const current2 = true ? "2.73.
|
|
22228
|
+
const current2 = true ? "2.73.1" : null;
|
|
22219
22229
|
if (!current2) return;
|
|
22220
22230
|
const cache = readCache();
|
|
22221
22231
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -22238,7 +22248,7 @@ var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
|
22238
22248
|
var SELF_UPDATE_LS_TIMEOUT_MS = 15e3;
|
|
22239
22249
|
var SUDO_PREFLIGHT_TIMEOUT_MS = 5e3;
|
|
22240
22250
|
function currentCliVersion() {
|
|
22241
|
-
return true ? "2.73.
|
|
22251
|
+
return true ? "2.73.1" : null;
|
|
22242
22252
|
}
|
|
22243
22253
|
async function installedVersion(deps) {
|
|
22244
22254
|
const ls = await deps.run(
|
|
@@ -22254,10 +22264,10 @@ async function installedVersion(deps) {
|
|
|
22254
22264
|
}
|
|
22255
22265
|
}
|
|
22256
22266
|
function runCmd(cmd, args2, timeoutMs) {
|
|
22257
|
-
return new Promise((
|
|
22267
|
+
return new Promise((resolve11) => {
|
|
22258
22268
|
(0, import_node_child_process23.execFile)(cmd, args2, { timeout: timeoutMs }, (err, stdout, stderr) => {
|
|
22259
22269
|
const code = err && typeof err.code === "number" ? err.code : err ? null : 0;
|
|
22260
|
-
|
|
22270
|
+
resolve11({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
|
|
22261
22271
|
});
|
|
22262
22272
|
});
|
|
22263
22273
|
}
|
|
@@ -22628,7 +22638,7 @@ var DOCKER_RUN_TIMEOUT_MS = 12e4;
|
|
|
22628
22638
|
var DOCKER_RUN_WITH_PULL_TIMEOUT_MS = 6e5;
|
|
22629
22639
|
var defaultDockerRunner = {
|
|
22630
22640
|
run(args2, opts = {}) {
|
|
22631
|
-
return new Promise((
|
|
22641
|
+
return new Promise((resolve11) => {
|
|
22632
22642
|
const child = (0, import_node_child_process25.spawn)("docker", args2, {
|
|
22633
22643
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22634
22644
|
env: { ...process.env, ...opts.env }
|
|
@@ -22647,7 +22657,7 @@ var defaultDockerRunner = {
|
|
|
22647
22657
|
if (settled) return;
|
|
22648
22658
|
settled = true;
|
|
22649
22659
|
clearTimeout(timer);
|
|
22650
|
-
|
|
22660
|
+
resolve11({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
22651
22661
|
};
|
|
22652
22662
|
child.stdout?.on("data", (b) => {
|
|
22653
22663
|
stdoutBuf += b.toString();
|
|
@@ -23663,13 +23673,14 @@ var HostAgentSupervisor = class {
|
|
|
23663
23673
|
{ ...readHeadroomChildEnv(), ...readHouseProxyChildEnv() },
|
|
23664
23674
|
cwd
|
|
23665
23675
|
);
|
|
23676
|
+
const deployId = deployIdFromWorkspace(session.cwd) ?? session.id;
|
|
23666
23677
|
const child = {
|
|
23667
|
-
deployId
|
|
23678
|
+
deployId,
|
|
23668
23679
|
proc,
|
|
23669
23680
|
agent: session.agent,
|
|
23670
23681
|
startedAt: Date.now()
|
|
23671
23682
|
};
|
|
23672
|
-
this.children.set(
|
|
23683
|
+
this.children.set(deployId, child);
|
|
23673
23684
|
let tail = "";
|
|
23674
23685
|
const appendTail = (buf) => {
|
|
23675
23686
|
tail = (tail + buf.toString("utf8")).slice(-2e3);
|
|
@@ -23677,7 +23688,7 @@ var HostAgentSupervisor = class {
|
|
|
23677
23688
|
proc.stdout?.on("data", appendTail);
|
|
23678
23689
|
proc.stderr?.on("data", appendTail);
|
|
23679
23690
|
proc.once("exit", (code) => {
|
|
23680
|
-
if (this.children.get(
|
|
23691
|
+
if (this.children.get(deployId)?.proc === proc) this.children.delete(deployId);
|
|
23681
23692
|
if (typeof code === "number" && code !== 0) {
|
|
23682
23693
|
this.onResumeChildExit(session, code, tail.trim().slice(-300));
|
|
23683
23694
|
}
|
|
@@ -24745,12 +24756,12 @@ async function isExecutableBinary(p2) {
|
|
|
24745
24756
|
}
|
|
24746
24757
|
}
|
|
24747
24758
|
function extractTgz(tgzPath, destDir) {
|
|
24748
|
-
return new Promise((
|
|
24759
|
+
return new Promise((resolve11, reject) => {
|
|
24749
24760
|
const child = (0, import_child_process18.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
|
|
24750
24761
|
child.on("error", (err) => reject(err));
|
|
24751
24762
|
child.on(
|
|
24752
24763
|
"exit",
|
|
24753
|
-
(code) => code === 0 ?
|
|
24764
|
+
(code) => code === 0 ? resolve11() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
|
|
24754
24765
|
);
|
|
24755
24766
|
});
|
|
24756
24767
|
}
|
|
@@ -24999,12 +25010,12 @@ function describeDetectionFailure(raw) {
|
|
|
24999
25010
|
// src/services/preview/port-ready.ts
|
|
25000
25011
|
var net2 = __toESM(require("net"));
|
|
25001
25012
|
function isPortListening(port, host2 = "127.0.0.1") {
|
|
25002
|
-
return new Promise((
|
|
25013
|
+
return new Promise((resolve11) => {
|
|
25003
25014
|
const socket = new net2.Socket();
|
|
25004
25015
|
const done = (result) => {
|
|
25005
25016
|
socket.removeAllListeners();
|
|
25006
25017
|
socket.destroy();
|
|
25007
|
-
|
|
25018
|
+
resolve11(result);
|
|
25008
25019
|
};
|
|
25009
25020
|
socket.setTimeout(1e3);
|
|
25010
25021
|
socket.once("connect", () => done(true));
|
|
@@ -25042,14 +25053,14 @@ const { PGLiteSocketServer } = require('@electric-sql/pglite-socket');
|
|
|
25042
25053
|
})().catch((e) => { console.error(String(e && e.message)); process.exit(1); });
|
|
25043
25054
|
`;
|
|
25044
25055
|
function isListening(port) {
|
|
25045
|
-
return new Promise((
|
|
25056
|
+
return new Promise((resolve11) => {
|
|
25046
25057
|
const s = net3.connect({ host: "127.0.0.1", port }, () => {
|
|
25047
25058
|
s.destroy();
|
|
25048
|
-
|
|
25049
|
-
}).on("error", () =>
|
|
25059
|
+
resolve11(true);
|
|
25060
|
+
}).on("error", () => resolve11(false));
|
|
25050
25061
|
s.setTimeout(1e3, () => {
|
|
25051
25062
|
s.destroy();
|
|
25052
|
-
|
|
25063
|
+
resolve11(false);
|
|
25053
25064
|
});
|
|
25054
25065
|
});
|
|
25055
25066
|
}
|
|
@@ -25097,7 +25108,7 @@ function stopChild(child) {
|
|
|
25097
25108
|
// src/services/preview/run-setup.ts
|
|
25098
25109
|
var import_child_process21 = require("child_process");
|
|
25099
25110
|
function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
25100
|
-
return new Promise((
|
|
25111
|
+
return new Promise((resolve11) => {
|
|
25101
25112
|
const child = (0, import_child_process21.spawn)(cmd, args2, {
|
|
25102
25113
|
cwd,
|
|
25103
25114
|
env: { ...process.env, ...env ?? {} },
|
|
@@ -25117,20 +25128,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
|
25117
25128
|
settled = true;
|
|
25118
25129
|
log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
|
|
25119
25130
|
killQuiet(child);
|
|
25120
|
-
|
|
25131
|
+
resolve11({ status: "timeout", code: null });
|
|
25121
25132
|
}, opts.timeoutMs);
|
|
25122
25133
|
child.once("exit", (code) => {
|
|
25123
25134
|
if (settled) return;
|
|
25124
25135
|
settled = true;
|
|
25125
25136
|
clearTimeout(timer);
|
|
25126
|
-
if (code === 0)
|
|
25127
|
-
else
|
|
25137
|
+
if (code === 0) resolve11({ status: "ok", code: 0 });
|
|
25138
|
+
else resolve11({ status: "failed", code });
|
|
25128
25139
|
});
|
|
25129
25140
|
child.once("error", () => {
|
|
25130
25141
|
if (settled) return;
|
|
25131
25142
|
settled = true;
|
|
25132
25143
|
clearTimeout(timer);
|
|
25133
|
-
|
|
25144
|
+
resolve11({ status: "failed", code: null });
|
|
25134
25145
|
});
|
|
25135
25146
|
});
|
|
25136
25147
|
}
|
|
@@ -25468,23 +25479,23 @@ async function awaitTunnelRegistered(candidate, hostname3, deadlineMs) {
|
|
|
25468
25479
|
ac.signal.addEventListener("abort", detach, { once: true });
|
|
25469
25480
|
};
|
|
25470
25481
|
try {
|
|
25471
|
-
return await new Promise((
|
|
25482
|
+
return await new Promise((resolve11) => {
|
|
25472
25483
|
const onChunk = (chunk) => {
|
|
25473
25484
|
const s = chunk.toString();
|
|
25474
25485
|
if (!url2) url2 = parseCloudflaredUrl(s);
|
|
25475
25486
|
if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
|
|
25476
25487
|
const trimmed = s.replace(/\n+$/g, "");
|
|
25477
25488
|
if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
|
|
25478
|
-
if (url2 && registered)
|
|
25489
|
+
if (url2 && registered) resolve11({ kind: "registered", url: url2 });
|
|
25479
25490
|
};
|
|
25480
25491
|
const onExit = (code) => {
|
|
25481
|
-
|
|
25492
|
+
resolve11({ kind: "exited", sawUrl: url2 != null, code });
|
|
25482
25493
|
};
|
|
25483
25494
|
const { stdout, stderr } = candidate;
|
|
25484
25495
|
if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
|
|
25485
25496
|
if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
|
|
25486
25497
|
scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
|
|
25487
|
-
timer = setTimeout(() =>
|
|
25498
|
+
timer = setTimeout(() => resolve11({ kind: "timeout", sawUrl: url2 != null }), deadlineMs);
|
|
25488
25499
|
});
|
|
25489
25500
|
} finally {
|
|
25490
25501
|
ac.abort();
|
|
@@ -25507,7 +25518,7 @@ function verdictFor(res) {
|
|
|
25507
25518
|
}
|
|
25508
25519
|
return { adopt: true };
|
|
25509
25520
|
}
|
|
25510
|
-
var probePort = (port) => new Promise((
|
|
25521
|
+
var probePort = (port) => new Promise((resolve11) => {
|
|
25511
25522
|
const req = http6.get(
|
|
25512
25523
|
{ host: "127.0.0.1", port, path: "/", timeout: PROBE_TIMEOUT_MS },
|
|
25513
25524
|
(res) => {
|
|
@@ -25518,16 +25529,16 @@ var probePort = (port) => new Promise((resolve10) => {
|
|
|
25518
25529
|
});
|
|
25519
25530
|
res.on(
|
|
25520
25531
|
"end",
|
|
25521
|
-
() =>
|
|
25532
|
+
() => resolve11({ contentType: res.headers["content-type"], bodyStart: body })
|
|
25522
25533
|
);
|
|
25523
|
-
res.on("error", () =>
|
|
25534
|
+
res.on("error", () => resolve11(null));
|
|
25524
25535
|
}
|
|
25525
25536
|
);
|
|
25526
25537
|
req.on("timeout", () => {
|
|
25527
25538
|
req.destroy();
|
|
25528
|
-
|
|
25539
|
+
resolve11(null);
|
|
25529
25540
|
});
|
|
25530
|
-
req.on("error", () =>
|
|
25541
|
+
req.on("error", () => resolve11(null));
|
|
25531
25542
|
});
|
|
25532
25543
|
async function canAdoptPort(port, probe = probePort) {
|
|
25533
25544
|
try {
|
|
@@ -25861,18 +25872,18 @@ async function startInspectorProxy(opts) {
|
|
|
25861
25872
|
clientSocket.on("error", drop);
|
|
25862
25873
|
clientSocket.on("close", drop);
|
|
25863
25874
|
});
|
|
25864
|
-
await new Promise((
|
|
25875
|
+
await new Promise((resolve11, reject) => {
|
|
25865
25876
|
server.once("error", reject);
|
|
25866
|
-
server.listen(0, "127.0.0.1", () =>
|
|
25877
|
+
server.listen(0, "127.0.0.1", () => resolve11());
|
|
25867
25878
|
});
|
|
25868
25879
|
const port = server.address().port;
|
|
25869
25880
|
return {
|
|
25870
25881
|
port,
|
|
25871
|
-
close: () => new Promise((
|
|
25882
|
+
close: () => new Promise((resolve11) => {
|
|
25872
25883
|
for (const socket of upgraded) socket.destroy();
|
|
25873
25884
|
upgraded.clear();
|
|
25874
25885
|
server.closeAllConnections?.();
|
|
25875
|
-
server.close(() =>
|
|
25886
|
+
server.close(() => resolve11());
|
|
25876
25887
|
})
|
|
25877
25888
|
};
|
|
25878
25889
|
}
|
|
@@ -26751,12 +26762,12 @@ var _spawnSeam = {
|
|
|
26751
26762
|
run: _defaultSpawn
|
|
26752
26763
|
};
|
|
26753
26764
|
function _defaultSpawn(binaryPath, args2, opts) {
|
|
26754
|
-
return new Promise((
|
|
26765
|
+
return new Promise((resolve11) => {
|
|
26755
26766
|
let proc;
|
|
26756
26767
|
try {
|
|
26757
26768
|
proc = (0, import_child_process24.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
|
|
26758
26769
|
} catch (err) {
|
|
26759
|
-
|
|
26770
|
+
resolve11({ code: -1, stdout: "", stderr: err.message });
|
|
26760
26771
|
return;
|
|
26761
26772
|
}
|
|
26762
26773
|
let stdout = "";
|
|
@@ -26767,8 +26778,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
|
|
|
26767
26778
|
proc.stderr?.on("data", (c2) => {
|
|
26768
26779
|
stderr += c2.toString();
|
|
26769
26780
|
});
|
|
26770
|
-
proc.on("error", (err) =>
|
|
26771
|
-
proc.on("close", (code) =>
|
|
26781
|
+
proc.on("error", (err) => resolve11({ code: -1, stdout, stderr: err.message }));
|
|
26782
|
+
proc.on("close", (code) => resolve11({ code: code ?? -1, stdout, stderr }));
|
|
26772
26783
|
});
|
|
26773
26784
|
}
|
|
26774
26785
|
var _adapterSeam = {
|
|
@@ -26945,22 +26956,22 @@ var _installSpawnSeam = {
|
|
|
26945
26956
|
run: _defaultInstallSpawn
|
|
26946
26957
|
};
|
|
26947
26958
|
function _defaultInstallSpawn(strategy) {
|
|
26948
|
-
return new Promise((
|
|
26959
|
+
return new Promise((resolve11) => {
|
|
26949
26960
|
let proc;
|
|
26950
26961
|
try {
|
|
26951
26962
|
proc = (0, import_child_process25.spawn)(strategy.command, strategy.args, { env: process.env });
|
|
26952
26963
|
} catch (err) {
|
|
26953
|
-
|
|
26964
|
+
resolve11({ ok: false, code: -1, stderr: err.message });
|
|
26954
26965
|
return;
|
|
26955
26966
|
}
|
|
26956
26967
|
let stderr = "";
|
|
26957
26968
|
proc.stderr?.on("data", (c2) => {
|
|
26958
26969
|
stderr += c2.toString();
|
|
26959
26970
|
});
|
|
26960
|
-
proc.on("error", (err) =>
|
|
26971
|
+
proc.on("error", (err) => resolve11({ ok: false, code: -1, stderr: err.message }));
|
|
26961
26972
|
proc.on(
|
|
26962
26973
|
"close",
|
|
26963
|
-
(code) =>
|
|
26974
|
+
(code) => resolve11({ ok: code === 0, code: code ?? -1, stderr })
|
|
26964
26975
|
);
|
|
26965
26976
|
});
|
|
26966
26977
|
}
|
|
@@ -27129,14 +27140,14 @@ var _doltInstallSpawnSeam = {
|
|
|
27129
27140
|
};
|
|
27130
27141
|
var DOLT_INSTALL_TIMEOUT_MS = 12e4;
|
|
27131
27142
|
function _defaultDoltInstallSpawn(strategy) {
|
|
27132
|
-
return new Promise((
|
|
27143
|
+
return new Promise((resolve11) => {
|
|
27133
27144
|
let settled = false;
|
|
27134
27145
|
let timer;
|
|
27135
27146
|
const finish = (r) => {
|
|
27136
27147
|
if (settled) return;
|
|
27137
27148
|
settled = true;
|
|
27138
27149
|
if (timer) clearTimeout(timer);
|
|
27139
|
-
|
|
27150
|
+
resolve11(r);
|
|
27140
27151
|
};
|
|
27141
27152
|
let proc;
|
|
27142
27153
|
try {
|
|
@@ -28991,16 +29002,16 @@ async function runNpmInstallLatest() {
|
|
|
28991
29002
|
const invocation = buildNpmInstallInvocation({ sudo: useSudo });
|
|
28992
29003
|
const useShell = process.platform === "win32";
|
|
28993
29004
|
const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
|
|
28994
|
-
const result = await new Promise((
|
|
29005
|
+
const result = await new Promise((resolve11) => {
|
|
28995
29006
|
(0, import_child_process28.execFile)(
|
|
28996
29007
|
command2,
|
|
28997
29008
|
invocation.args,
|
|
28998
29009
|
{ timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
|
|
28999
29010
|
(err, _stdout, stderr) => {
|
|
29000
29011
|
if (!err) {
|
|
29001
|
-
|
|
29012
|
+
resolve11({ ok: true });
|
|
29002
29013
|
} else {
|
|
29003
|
-
|
|
29014
|
+
resolve11({ ok: false, error: (stderr || err.message).slice(0, 300) });
|
|
29004
29015
|
}
|
|
29005
29016
|
}
|
|
29006
29017
|
);
|
|
@@ -29690,7 +29701,7 @@ function buildKeepAlive(ctx) {
|
|
|
29690
29701
|
let timer = null;
|
|
29691
29702
|
async function setIdleTimeout(minutes) {
|
|
29692
29703
|
if (!ctx.inCodespace || !ctx.codespaceName) return;
|
|
29693
|
-
await new Promise((
|
|
29704
|
+
await new Promise((resolve11) => {
|
|
29694
29705
|
const proc = (0, import_child_process29.spawn)(
|
|
29695
29706
|
"gh",
|
|
29696
29707
|
[
|
|
@@ -29704,8 +29715,8 @@ function buildKeepAlive(ctx) {
|
|
|
29704
29715
|
{ stdio: "ignore", detached: true }
|
|
29705
29716
|
);
|
|
29706
29717
|
proc.unref();
|
|
29707
|
-
proc.on("exit", () =>
|
|
29708
|
-
proc.on("error", () =>
|
|
29718
|
+
proc.on("exit", () => resolve11());
|
|
29719
|
+
proc.on("error", () => resolve11());
|
|
29709
29720
|
});
|
|
29710
29721
|
}
|
|
29711
29722
|
return {
|
|
@@ -30197,10 +30208,10 @@ function wrapWithHeadroom(launch, opts) {
|
|
|
30197
30208
|
var _present;
|
|
30198
30209
|
function headroomPresent() {
|
|
30199
30210
|
if (_present !== void 0) return Promise.resolve(_present);
|
|
30200
|
-
return new Promise((
|
|
30211
|
+
return new Promise((resolve11) => {
|
|
30201
30212
|
(0, import_node_child_process26.execFile)("headroom", ["--version"], (err) => {
|
|
30202
30213
|
_present = !err;
|
|
30203
|
-
|
|
30214
|
+
resolve11(_present);
|
|
30204
30215
|
});
|
|
30205
30216
|
});
|
|
30206
30217
|
}
|
|
@@ -30569,10 +30580,10 @@ function augmentKimiPath() {
|
|
|
30569
30580
|
}
|
|
30570
30581
|
var augmentPath2 = augmentKimiPath;
|
|
30571
30582
|
async function runInstaller2() {
|
|
30572
|
-
return new Promise((
|
|
30583
|
+
return new Promise((resolve11) => {
|
|
30573
30584
|
const proc = (0, import_node_child_process27.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL2} | bash`], { stdio: "inherit" });
|
|
30574
|
-
proc.on("close", (code) =>
|
|
30575
|
-
proc.on("error", () =>
|
|
30585
|
+
proc.on("close", (code) => resolve11(code === 0));
|
|
30586
|
+
proc.on("error", () => resolve11(false));
|
|
30576
30587
|
});
|
|
30577
30588
|
}
|
|
30578
30589
|
async function ensureKimiInstalled() {
|
|
@@ -30622,10 +30633,10 @@ function augmentOpencodePath() {
|
|
|
30622
30633
|
}
|
|
30623
30634
|
var augmentPath3 = augmentOpencodePath;
|
|
30624
30635
|
async function runInstaller3() {
|
|
30625
|
-
return new Promise((
|
|
30636
|
+
return new Promise((resolve11) => {
|
|
30626
30637
|
const proc = (0, import_node_child_process28.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL3} | bash`], { stdio: "inherit" });
|
|
30627
|
-
proc.on("close", (code) =>
|
|
30628
|
-
proc.on("error", () =>
|
|
30638
|
+
proc.on("close", (code) => resolve11(code === 0));
|
|
30639
|
+
proc.on("error", () => resolve11(false));
|
|
30629
30640
|
});
|
|
30630
30641
|
}
|
|
30631
30642
|
async function ensureOpencodeInstalled() {
|
|
@@ -30833,11 +30844,11 @@ async function resolveAcpAdapterWithRetry(agent, opts = {}) {
|
|
|
30833
30844
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_ADAPTER_RETRY_TIMEOUT_MS;
|
|
30834
30845
|
const pollMs = opts.pollMs ?? DEFAULT_ADAPTER_RETRY_POLL_MS;
|
|
30835
30846
|
const now = opts.now ?? Date.now;
|
|
30836
|
-
const sleep5 = opts.sleep ?? ((ms) => new Promise((
|
|
30837
|
-
const
|
|
30847
|
+
const sleep5 = opts.sleep ?? ((ms) => new Promise((resolve12) => setTimeout(resolve12, ms)));
|
|
30848
|
+
const resolve11 = opts.resolve ?? getAcpAdapter;
|
|
30838
30849
|
const attempt = () => {
|
|
30839
30850
|
try {
|
|
30840
|
-
return
|
|
30851
|
+
return resolve11(agent);
|
|
30841
30852
|
} catch {
|
|
30842
30853
|
return null;
|
|
30843
30854
|
}
|
|
@@ -30944,7 +30955,7 @@ function parseJsonl(filePath) {
|
|
|
30944
30955
|
return messages;
|
|
30945
30956
|
}
|
|
30946
30957
|
function post(endpoint, body, pluginAuthToken) {
|
|
30947
|
-
return new Promise((
|
|
30958
|
+
return new Promise((resolve11) => {
|
|
30948
30959
|
const payload = JSON.stringify(body);
|
|
30949
30960
|
const u2 = new URL(`${API_BASE8}${endpoint}`);
|
|
30950
30961
|
const transport = u2.protocol === "https:" ? https7 : http8;
|
|
@@ -30969,17 +30980,17 @@ function post(endpoint, body, pluginAuthToken) {
|
|
|
30969
30980
|
res.resume();
|
|
30970
30981
|
const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
|
|
30971
30982
|
if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
|
|
30972
|
-
|
|
30983
|
+
resolve11(ok);
|
|
30973
30984
|
}
|
|
30974
30985
|
);
|
|
30975
30986
|
req.on("error", (err) => {
|
|
30976
30987
|
log.warn("history:post", `${endpoint} network error`, err);
|
|
30977
|
-
|
|
30988
|
+
resolve11(false);
|
|
30978
30989
|
});
|
|
30979
30990
|
req.on("timeout", () => {
|
|
30980
30991
|
log.warn("history:post", `${endpoint} timeout after 15s`);
|
|
30981
30992
|
req.destroy();
|
|
30982
|
-
|
|
30993
|
+
resolve11(false);
|
|
30983
30994
|
});
|
|
30984
30995
|
req.write(payload);
|
|
30985
30996
|
req.end();
|
|
@@ -33529,12 +33540,12 @@ var Connection = class {
|
|
|
33529
33540
|
const id = this.nextRequestId++;
|
|
33530
33541
|
let cancel = () => {
|
|
33531
33542
|
};
|
|
33532
|
-
const responsePromise = new Promise((
|
|
33543
|
+
const responsePromise = new Promise((resolve11, reject) => {
|
|
33533
33544
|
const pendingResponse = {
|
|
33534
33545
|
resolve: (response) => {
|
|
33535
33546
|
try {
|
|
33536
33547
|
const value = mapResponse ? mapResponse(response) : response;
|
|
33537
|
-
|
|
33548
|
+
resolve11(value);
|
|
33538
33549
|
} catch (error) {
|
|
33539
33550
|
reject(error);
|
|
33540
33551
|
}
|
|
@@ -33612,8 +33623,8 @@ var Connection = class {
|
|
|
33612
33623
|
initialize(stream, handlers2) {
|
|
33613
33624
|
this.stream = stream;
|
|
33614
33625
|
this.staticHandlers = handlers2;
|
|
33615
|
-
this.closedPromise = new Promise((
|
|
33616
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
33626
|
+
this.closedPromise = new Promise((resolve11) => {
|
|
33627
|
+
this.abortController.signal.addEventListener("abort", () => resolve11());
|
|
33617
33628
|
});
|
|
33618
33629
|
void this.receive();
|
|
33619
33630
|
}
|
|
@@ -34401,8 +34412,8 @@ var AsyncQueue = class {
|
|
|
34401
34412
|
if (this.failed) {
|
|
34402
34413
|
return Promise.reject(this.failure);
|
|
34403
34414
|
}
|
|
34404
|
-
return new Promise((
|
|
34405
|
-
this.waiters.push({ resolve:
|
|
34415
|
+
return new Promise((resolve11, reject) => {
|
|
34416
|
+
this.waiters.push({ resolve: resolve11, reject });
|
|
34406
34417
|
});
|
|
34407
34418
|
}
|
|
34408
34419
|
};
|
|
@@ -36036,7 +36047,7 @@ var AcpClient = class {
|
|
|
36036
36047
|
this.pendingToolCalls.clear();
|
|
36037
36048
|
try {
|
|
36038
36049
|
const result = await Promise.race([send, idle.promise]);
|
|
36039
|
-
await new Promise((
|
|
36050
|
+
await new Promise((resolve11) => setImmediate(resolve11));
|
|
36040
36051
|
log.info(
|
|
36041
36052
|
"acpClient",
|
|
36042
36053
|
`prompt \u2190 ok stopReason=${result.stopReason ?? "?"} elapsedMs=${Date.now() - t0}`
|
|
@@ -36435,14 +36446,14 @@ var AcpClient = class {
|
|
|
36435
36446
|
this.sessionId = null;
|
|
36436
36447
|
try {
|
|
36437
36448
|
child.kill("SIGTERM");
|
|
36438
|
-
const grace = new Promise((
|
|
36449
|
+
const grace = new Promise((resolve11) => {
|
|
36439
36450
|
const t2 = setTimeout(() => {
|
|
36440
36451
|
killQuiet(child, "SIGKILL");
|
|
36441
|
-
|
|
36452
|
+
resolve11();
|
|
36442
36453
|
}, 2e3);
|
|
36443
36454
|
child.once("exit", () => {
|
|
36444
36455
|
clearTimeout(t2);
|
|
36445
|
-
|
|
36456
|
+
resolve11();
|
|
36446
36457
|
});
|
|
36447
36458
|
});
|
|
36448
36459
|
await grace;
|
|
@@ -36905,7 +36916,7 @@ var _transport4 = {
|
|
|
36905
36916
|
get: _get
|
|
36906
36917
|
};
|
|
36907
36918
|
function _post3(url2, headers, payload) {
|
|
36908
|
-
return new Promise((
|
|
36919
|
+
return new Promise((resolve11, reject) => {
|
|
36909
36920
|
let settled = false;
|
|
36910
36921
|
const u2 = new URL(url2);
|
|
36911
36922
|
const lib = u2.protocol === "https:" ? https8 : http9;
|
|
@@ -36930,7 +36941,7 @@ function _post3(url2, headers, payload) {
|
|
|
36930
36941
|
res.on("end", () => {
|
|
36931
36942
|
if (settled) return;
|
|
36932
36943
|
settled = true;
|
|
36933
|
-
|
|
36944
|
+
resolve11({ statusCode: res.statusCode ?? 0, body });
|
|
36934
36945
|
});
|
|
36935
36946
|
}
|
|
36936
36947
|
);
|
|
@@ -36947,7 +36958,7 @@ function _post3(url2, headers, payload) {
|
|
|
36947
36958
|
});
|
|
36948
36959
|
}
|
|
36949
36960
|
function _get(url2, headers) {
|
|
36950
|
-
return new Promise((
|
|
36961
|
+
return new Promise((resolve11, reject) => {
|
|
36951
36962
|
let settled = false;
|
|
36952
36963
|
const u2 = new URL(url2);
|
|
36953
36964
|
const lib = u2.protocol === "https:" ? https8 : http9;
|
|
@@ -36971,7 +36982,7 @@ function _get(url2, headers) {
|
|
|
36971
36982
|
res.on("end", () => {
|
|
36972
36983
|
if (settled) return;
|
|
36973
36984
|
settled = true;
|
|
36974
|
-
|
|
36985
|
+
resolve11({ statusCode: res.statusCode ?? 0, body });
|
|
36975
36986
|
});
|
|
36976
36987
|
}
|
|
36977
36988
|
);
|
|
@@ -38144,12 +38155,12 @@ function runGit3(cwd, args2) {
|
|
|
38144
38155
|
return _runGitImpl2.run(cwd, args2);
|
|
38145
38156
|
}
|
|
38146
38157
|
function defaultRunGit(cwd, args2) {
|
|
38147
|
-
return new Promise((
|
|
38158
|
+
return new Promise((resolve11) => {
|
|
38148
38159
|
let proc;
|
|
38149
38160
|
try {
|
|
38150
38161
|
proc = (0, import_child_process31.spawn)("git", args2, { cwd, env: process.env });
|
|
38151
38162
|
} catch {
|
|
38152
|
-
|
|
38163
|
+
resolve11(null);
|
|
38153
38164
|
return;
|
|
38154
38165
|
}
|
|
38155
38166
|
let stdout = "";
|
|
@@ -38160,16 +38171,16 @@ function defaultRunGit(cwd, args2) {
|
|
|
38160
38171
|
proc.stderr?.on("data", (c2) => {
|
|
38161
38172
|
stderr += c2.toString();
|
|
38162
38173
|
});
|
|
38163
|
-
proc.on("error", () =>
|
|
38174
|
+
proc.on("error", () => resolve11(null));
|
|
38164
38175
|
proc.on("close", (code) => {
|
|
38165
38176
|
if (code === 0) {
|
|
38166
|
-
|
|
38177
|
+
resolve11(stdout);
|
|
38167
38178
|
} else {
|
|
38168
38179
|
log.trace(
|
|
38169
38180
|
"turnFiles",
|
|
38170
38181
|
`git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
|
|
38171
38182
|
);
|
|
38172
|
-
|
|
38183
|
+
resolve11(null);
|
|
38173
38184
|
}
|
|
38174
38185
|
});
|
|
38175
38186
|
});
|
|
@@ -38578,25 +38589,25 @@ function baselineKey(entry) {
|
|
|
38578
38589
|
|
|
38579
38590
|
// src/agents/acp/withTimeout.ts
|
|
38580
38591
|
function withTimeout(p2, ms) {
|
|
38581
|
-
return new Promise((
|
|
38592
|
+
return new Promise((resolve11) => {
|
|
38582
38593
|
let settled = false;
|
|
38583
38594
|
const timer = setTimeout(() => {
|
|
38584
38595
|
if (settled) return;
|
|
38585
38596
|
settled = true;
|
|
38586
|
-
|
|
38597
|
+
resolve11(void 0);
|
|
38587
38598
|
}, ms);
|
|
38588
38599
|
p2.then(
|
|
38589
38600
|
(v) => {
|
|
38590
38601
|
if (settled) return;
|
|
38591
38602
|
settled = true;
|
|
38592
38603
|
clearTimeout(timer);
|
|
38593
|
-
|
|
38604
|
+
resolve11(v);
|
|
38594
38605
|
},
|
|
38595
38606
|
() => {
|
|
38596
38607
|
if (settled) return;
|
|
38597
38608
|
settled = true;
|
|
38598
38609
|
clearTimeout(timer);
|
|
38599
|
-
|
|
38610
|
+
resolve11(void 0);
|
|
38600
38611
|
}
|
|
38601
38612
|
);
|
|
38602
38613
|
});
|
|
@@ -38891,7 +38902,7 @@ async function postBudgetReached(opts, fetchImpl = fetch) {
|
|
|
38891
38902
|
var import_node_child_process30 = require("child_process");
|
|
38892
38903
|
var fs73 = __toESM(require("fs"));
|
|
38893
38904
|
var path81 = __toESM(require("path"));
|
|
38894
|
-
var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((
|
|
38905
|
+
var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve11) => {
|
|
38895
38906
|
(0, import_node_child_process30.execFile)(
|
|
38896
38907
|
file,
|
|
38897
38908
|
args2,
|
|
@@ -38902,7 +38913,7 @@ var defaultCommandRunner = (file, args2, cwd, timeoutMs) => new Promise((resolve
|
|
|
38902
38913
|
const rawCode = err.code;
|
|
38903
38914
|
code = typeof rawCode === "number" ? rawCode : 1;
|
|
38904
38915
|
}
|
|
38905
|
-
|
|
38916
|
+
resolve11({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
|
|
38906
38917
|
}
|
|
38907
38918
|
);
|
|
38908
38919
|
});
|
|
@@ -40712,15 +40723,15 @@ async function prewarmNewMcpEntries(manifest, previousIds) {
|
|
|
40712
40723
|
);
|
|
40713
40724
|
await Promise.all(
|
|
40714
40725
|
fresh.map(
|
|
40715
|
-
(e) => new Promise((
|
|
40726
|
+
(e) => new Promise((resolve11) => {
|
|
40716
40727
|
const mcp = e.delivery.mcp;
|
|
40717
40728
|
const child = (0, import_node_child_process31.execFile)(
|
|
40718
40729
|
mcp.command,
|
|
40719
40730
|
[...mcp.args, "--help"],
|
|
40720
40731
|
{ timeout: 9e4 },
|
|
40721
|
-
() =>
|
|
40732
|
+
() => resolve11()
|
|
40722
40733
|
);
|
|
40723
|
-
child.on("error", () =>
|
|
40734
|
+
child.on("error", () => resolve11());
|
|
40724
40735
|
})
|
|
40725
40736
|
)
|
|
40726
40737
|
);
|
|
@@ -40945,7 +40956,7 @@ var StreamingState = class {
|
|
|
40945
40956
|
* default-reject. Caller is the SDK's `onRequestPermission`.
|
|
40946
40957
|
*/
|
|
40947
40958
|
registerPermission(args2) {
|
|
40948
|
-
return new Promise((
|
|
40959
|
+
return new Promise((resolve11) => {
|
|
40949
40960
|
const timeoutTimer = setTimeout(() => {
|
|
40950
40961
|
if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
|
|
40951
40962
|
log.warn(
|
|
@@ -40953,7 +40964,7 @@ var StreamingState = class {
|
|
|
40953
40964
|
`permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
|
|
40954
40965
|
);
|
|
40955
40966
|
this.pending = null;
|
|
40956
|
-
|
|
40967
|
+
resolve11({ outcome: { outcome: "cancelled" } });
|
|
40957
40968
|
}
|
|
40958
40969
|
}, PERMISSION_TIMEOUT_MS);
|
|
40959
40970
|
this.pending = {
|
|
@@ -40961,7 +40972,7 @@ var StreamingState = class {
|
|
|
40961
40972
|
questionId: args2.questionId,
|
|
40962
40973
|
labels: args2.labels,
|
|
40963
40974
|
optionIdByLabel: args2.optionIdByLabel,
|
|
40964
|
-
resolve:
|
|
40975
|
+
resolve: resolve11,
|
|
40965
40976
|
timeoutTimer
|
|
40966
40977
|
};
|
|
40967
40978
|
});
|
|
@@ -40993,14 +41004,14 @@ var StreamingState = class {
|
|
|
40993
41004
|
const label = this.pending.labels[index];
|
|
40994
41005
|
const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
|
|
40995
41006
|
clearTimeout(this.pending.timeoutTimer);
|
|
40996
|
-
const
|
|
41007
|
+
const resolve11 = this.pending.resolve;
|
|
40997
41008
|
this.pending = null;
|
|
40998
41009
|
if (!optionId) {
|
|
40999
41010
|
log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
|
|
41000
|
-
|
|
41011
|
+
resolve11({ outcome: { outcome: "cancelled" } });
|
|
41001
41012
|
return { kind: "resolved" };
|
|
41002
41013
|
}
|
|
41003
|
-
|
|
41014
|
+
resolve11({ outcome: { outcome: "selected", optionId } });
|
|
41004
41015
|
return { kind: "resolved" };
|
|
41005
41016
|
}
|
|
41006
41017
|
const text = this.pending.options[index];
|
|
@@ -43444,10 +43455,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
|
|
|
43444
43455
|
this.lastOutput = this.now();
|
|
43445
43456
|
}
|
|
43446
43457
|
whenSafeToYield() {
|
|
43447
|
-
return new Promise((
|
|
43458
|
+
return new Promise((resolve11) => {
|
|
43448
43459
|
const tick = () => {
|
|
43449
43460
|
const quietFor = this.now() - this.lastOutput;
|
|
43450
|
-
if (quietFor >= this.idleMs)
|
|
43461
|
+
if (quietFor >= this.idleMs) resolve11();
|
|
43451
43462
|
else setTimeout(tick, this.idleMs - quietFor);
|
|
43452
43463
|
};
|
|
43453
43464
|
tick();
|
|
@@ -43513,10 +43524,10 @@ var AcpDriver = class {
|
|
|
43513
43524
|
* one ever is, assume resumable so behaviour is unchanged.
|
|
43514
43525
|
*/
|
|
43515
43526
|
hasTranscript(conversationId) {
|
|
43516
|
-
const
|
|
43517
|
-
if (typeof
|
|
43527
|
+
const resolve11 = this.deps.runtime.resolveHistoryFile;
|
|
43528
|
+
if (typeof resolve11 !== "function") return true;
|
|
43518
43529
|
try {
|
|
43519
|
-
return
|
|
43530
|
+
return resolve11.call(this.deps.runtime, this.deps.opts.cwd, conversationId) !== null;
|
|
43520
43531
|
} catch {
|
|
43521
43532
|
return true;
|
|
43522
43533
|
}
|
|
@@ -43606,11 +43617,11 @@ var AcpDriver = class {
|
|
|
43606
43617
|
this.turnActive = false;
|
|
43607
43618
|
const waiters = this.waiters;
|
|
43608
43619
|
this.waiters = [];
|
|
43609
|
-
waiters.forEach((
|
|
43620
|
+
waiters.forEach((resolve11) => resolve11());
|
|
43610
43621
|
}
|
|
43611
43622
|
whenSafeToYield() {
|
|
43612
43623
|
if (!this.turnActive) return Promise.resolve();
|
|
43613
|
-
return new Promise((
|
|
43624
|
+
return new Promise((resolve11) => this.waiters.push(resolve11));
|
|
43614
43625
|
}
|
|
43615
43626
|
};
|
|
43616
43627
|
|
|
@@ -44188,8 +44199,8 @@ async function start(requestedAgent, presetSession) {
|
|
|
44188
44199
|
let gateTimer;
|
|
44189
44200
|
await Promise.race([
|
|
44190
44201
|
Promise.all([depsReady, agentBinaryReady]),
|
|
44191
|
-
new Promise((
|
|
44192
|
-
gateTimer = setTimeout(
|
|
44202
|
+
new Promise((resolve11) => {
|
|
44203
|
+
gateTimer = setTimeout(resolve11, GATE_TIMEOUT_MS);
|
|
44193
44204
|
})
|
|
44194
44205
|
]);
|
|
44195
44206
|
if (gateTimer) clearTimeout(gateTimer);
|
|
@@ -44563,7 +44574,7 @@ async function pair(args2 = []) {
|
|
|
44563
44574
|
waitSpin.message(waitMessage());
|
|
44564
44575
|
}, 1e3);
|
|
44565
44576
|
countdownInterval.unref?.();
|
|
44566
|
-
await new Promise((
|
|
44577
|
+
await new Promise((resolve11) => {
|
|
44567
44578
|
let stopPolling = null;
|
|
44568
44579
|
function sigintHandler() {
|
|
44569
44580
|
clearInterval(countdownInterval);
|
|
@@ -44614,7 +44625,7 @@ async function pair(args2 = []) {
|
|
|
44614
44625
|
pluginAuthToken: info.pluginAuthToken
|
|
44615
44626
|
});
|
|
44616
44627
|
}
|
|
44617
|
-
|
|
44628
|
+
resolve11();
|
|
44618
44629
|
},
|
|
44619
44630
|
() => {
|
|
44620
44631
|
clearInterval(countdownInterval);
|
|
@@ -44843,12 +44854,12 @@ var GitHubCodespacesProvider = class {
|
|
|
44843
44854
|
}
|
|
44844
44855
|
if (!isAuthed) {
|
|
44845
44856
|
resetStdinForChild();
|
|
44846
|
-
await new Promise((
|
|
44857
|
+
await new Promise((resolve11, reject) => {
|
|
44847
44858
|
const proc = (0, import_child_process32.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
|
|
44848
44859
|
stdio: "inherit"
|
|
44849
44860
|
});
|
|
44850
44861
|
proc.on("exit", (code) => {
|
|
44851
|
-
if (code === 0)
|
|
44862
|
+
if (code === 0) resolve11();
|
|
44852
44863
|
else reject(new Error("gh auth login failed."));
|
|
44853
44864
|
});
|
|
44854
44865
|
proc.on("error", reject);
|
|
@@ -44877,13 +44888,13 @@ var GitHubCodespacesProvider = class {
|
|
|
44877
44888
|
}
|
|
44878
44889
|
wt(noteLines.join("\n"), "One more permission needed");
|
|
44879
44890
|
resetStdinForChild();
|
|
44880
|
-
const refreshCode = await new Promise((
|
|
44891
|
+
const refreshCode = await new Promise((resolve11, reject) => {
|
|
44881
44892
|
const proc = (0, import_child_process32.spawn)(
|
|
44882
44893
|
"gh",
|
|
44883
44894
|
["auth", "refresh", "-h", "github.com", "-s", "codespace"],
|
|
44884
44895
|
{ stdio: "inherit" }
|
|
44885
44896
|
);
|
|
44886
|
-
proc.on("exit", (code) =>
|
|
44897
|
+
proc.on("exit", (code) => resolve11(code ?? 1));
|
|
44887
44898
|
proc.on("error", reject);
|
|
44888
44899
|
});
|
|
44889
44900
|
if (refreshCode !== 0) {
|
|
@@ -45027,10 +45038,10 @@ var GitHubCodespacesProvider = class {
|
|
|
45027
45038
|
if (q(proceed) || !proceed) return;
|
|
45028
45039
|
O2.step(`Installing gh via ${installCmd.describe}\u2026`);
|
|
45029
45040
|
resetStdinForChild();
|
|
45030
|
-
const ok = await new Promise((
|
|
45041
|
+
const ok = await new Promise((resolve11) => {
|
|
45031
45042
|
const proc = (0, import_child_process32.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
|
|
45032
|
-
proc.on("exit", (code) =>
|
|
45033
|
-
proc.on("error", () =>
|
|
45043
|
+
proc.on("exit", (code) => resolve11(code === 0));
|
|
45044
|
+
proc.on("error", () => resolve11(false));
|
|
45034
45045
|
});
|
|
45035
45046
|
if (ok) O2.success("gh installed");
|
|
45036
45047
|
else O2.error("gh install failed");
|
|
@@ -45054,14 +45065,14 @@ var GitHubCodespacesProvider = class {
|
|
|
45054
45065
|
"Expanding GitHub scopes"
|
|
45055
45066
|
);
|
|
45056
45067
|
resetStdinForChild();
|
|
45057
|
-
await new Promise((
|
|
45068
|
+
await new Promise((resolve11, reject) => {
|
|
45058
45069
|
const proc = (0, import_child_process32.spawn)(
|
|
45059
45070
|
"gh",
|
|
45060
45071
|
["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
|
|
45061
45072
|
{ stdio: "inherit" }
|
|
45062
45073
|
);
|
|
45063
45074
|
proc.on("exit", (code) => {
|
|
45064
|
-
if (code === 0)
|
|
45075
|
+
if (code === 0) resolve11();
|
|
45065
45076
|
else reject(new Error(
|
|
45066
45077
|
"gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
|
|
45067
45078
|
));
|
|
@@ -45232,13 +45243,13 @@ var GitHubCodespacesProvider = class {
|
|
|
45232
45243
|
}
|
|
45233
45244
|
async streamCommand(workspaceId, command2) {
|
|
45234
45245
|
resetStdinForChild();
|
|
45235
|
-
return new Promise((
|
|
45246
|
+
return new Promise((resolve11, reject) => {
|
|
45236
45247
|
const proc = (0, import_child_process32.spawn)(
|
|
45237
45248
|
"gh",
|
|
45238
45249
|
["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
|
|
45239
45250
|
{ stdio: "inherit" }
|
|
45240
45251
|
);
|
|
45241
|
-
proc.on("exit", (code) =>
|
|
45252
|
+
proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
|
|
45242
45253
|
proc.on("error", reject);
|
|
45243
45254
|
});
|
|
45244
45255
|
}
|
|
@@ -45259,7 +45270,7 @@ var GitHubCodespacesProvider = class {
|
|
|
45259
45270
|
"--",
|
|
45260
45271
|
`mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
|
|
45261
45272
|
];
|
|
45262
|
-
await new Promise((
|
|
45273
|
+
await new Promise((resolve11, reject) => {
|
|
45263
45274
|
const tar = (0, import_child_process32.spawn)("tar", tarArgs, {
|
|
45264
45275
|
stdio: ["ignore", "pipe", "pipe"],
|
|
45265
45276
|
env: tarEnv
|
|
@@ -45279,7 +45290,7 @@ var GitHubCodespacesProvider = class {
|
|
|
45279
45290
|
ssh.on("error", reject);
|
|
45280
45291
|
ssh.on("exit", (code) => {
|
|
45281
45292
|
if (code === 0) {
|
|
45282
|
-
|
|
45293
|
+
resolve11();
|
|
45283
45294
|
} else {
|
|
45284
45295
|
const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
|
|
45285
45296
|
reject(new Error(`Remote tar failed: ${reason}`));
|
|
@@ -45297,7 +45308,7 @@ var GitHubCodespacesProvider = class {
|
|
|
45297
45308
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
|
|
45298
45309
|
}
|
|
45299
45310
|
const cmd = parts.join(" && ");
|
|
45300
|
-
await new Promise((
|
|
45311
|
+
await new Promise((resolve11, reject) => {
|
|
45301
45312
|
const proc = (0, import_child_process32.spawn)(
|
|
45302
45313
|
"gh",
|
|
45303
45314
|
["codespace", "ssh", "-c", workspaceId, "--", cmd],
|
|
@@ -45309,7 +45320,7 @@ var GitHubCodespacesProvider = class {
|
|
|
45309
45320
|
});
|
|
45310
45321
|
proc.on("error", reject);
|
|
45311
45322
|
proc.on("exit", (code) => {
|
|
45312
|
-
if (code === 0)
|
|
45323
|
+
if (code === 0) resolve11();
|
|
45313
45324
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
45314
45325
|
});
|
|
45315
45326
|
proc.stdin?.write(contents);
|
|
@@ -45399,10 +45410,10 @@ var GitpodProvider = class {
|
|
|
45399
45410
|
"Authenticating Gitpod"
|
|
45400
45411
|
);
|
|
45401
45412
|
resetStdinForChild2();
|
|
45402
|
-
await new Promise((
|
|
45413
|
+
await new Promise((resolve11, reject) => {
|
|
45403
45414
|
const proc = (0, import_child_process33.spawn)("gitpod", ["login"], { stdio: "inherit" });
|
|
45404
45415
|
proc.on("exit", (code) => {
|
|
45405
|
-
if (code === 0)
|
|
45416
|
+
if (code === 0) resolve11();
|
|
45406
45417
|
else reject(new Error("gitpod login failed."));
|
|
45407
45418
|
});
|
|
45408
45419
|
proc.on("error", reject);
|
|
@@ -45551,13 +45562,13 @@ var GitpodProvider = class {
|
|
|
45551
45562
|
}
|
|
45552
45563
|
async streamCommand(workspaceId, command2) {
|
|
45553
45564
|
resetStdinForChild2();
|
|
45554
|
-
return new Promise((
|
|
45565
|
+
return new Promise((resolve11, reject) => {
|
|
45555
45566
|
const proc = (0, import_child_process33.spawn)(
|
|
45556
45567
|
"gitpod",
|
|
45557
45568
|
["workspace", "ssh", workspaceId, "--", "-tt", command2],
|
|
45558
45569
|
{ stdio: "inherit" }
|
|
45559
45570
|
);
|
|
45560
|
-
proc.on("exit", (code) =>
|
|
45571
|
+
proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
|
|
45561
45572
|
proc.on("error", reject);
|
|
45562
45573
|
});
|
|
45563
45574
|
}
|
|
@@ -45571,7 +45582,7 @@ var GitpodProvider = class {
|
|
|
45571
45582
|
tarArgs.push(".");
|
|
45572
45583
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
45573
45584
|
const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
|
|
45574
|
-
await new Promise((
|
|
45585
|
+
await new Promise((resolve11, reject) => {
|
|
45575
45586
|
const tar = (0, import_child_process33.spawn)("tar", tarArgs, {
|
|
45576
45587
|
stdio: ["ignore", "pipe", "pipe"],
|
|
45577
45588
|
env: tarEnv
|
|
@@ -45592,7 +45603,7 @@ var GitpodProvider = class {
|
|
|
45592
45603
|
tar.on("error", reject);
|
|
45593
45604
|
ssh.on("error", reject);
|
|
45594
45605
|
ssh.on("exit", (code) => {
|
|
45595
|
-
if (code === 0)
|
|
45606
|
+
if (code === 0) resolve11();
|
|
45596
45607
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
45597
45608
|
});
|
|
45598
45609
|
});
|
|
@@ -45607,7 +45618,7 @@ var GitpodProvider = class {
|
|
|
45607
45618
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
|
|
45608
45619
|
}
|
|
45609
45620
|
const cmd = parts.join(" && ");
|
|
45610
|
-
await new Promise((
|
|
45621
|
+
await new Promise((resolve11, reject) => {
|
|
45611
45622
|
const proc = (0, import_child_process33.spawn)(
|
|
45612
45623
|
"gitpod",
|
|
45613
45624
|
["workspace", "ssh", workspaceId, "--", cmd],
|
|
@@ -45619,7 +45630,7 @@ var GitpodProvider = class {
|
|
|
45619
45630
|
});
|
|
45620
45631
|
proc.on("error", reject);
|
|
45621
45632
|
proc.on("exit", (code) => {
|
|
45622
|
-
if (code === 0)
|
|
45633
|
+
if (code === 0) resolve11();
|
|
45623
45634
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
45624
45635
|
});
|
|
45625
45636
|
proc.stdin?.write(contents);
|
|
@@ -45676,14 +45687,14 @@ var GitLabWorkspacesProvider = class {
|
|
|
45676
45687
|
"Authenticating GitLab"
|
|
45677
45688
|
);
|
|
45678
45689
|
resetStdinForChild3();
|
|
45679
|
-
await new Promise((
|
|
45690
|
+
await new Promise((resolve11, reject) => {
|
|
45680
45691
|
const proc = (0, import_child_process34.spawn)(
|
|
45681
45692
|
"glab",
|
|
45682
45693
|
["auth", "login", "--scopes", "api,read_user,read_repository"],
|
|
45683
45694
|
{ stdio: "inherit" }
|
|
45684
45695
|
);
|
|
45685
45696
|
proc.on("exit", (code) => {
|
|
45686
|
-
if (code === 0)
|
|
45697
|
+
if (code === 0) resolve11();
|
|
45687
45698
|
else reject(new Error("glab auth login failed."));
|
|
45688
45699
|
});
|
|
45689
45700
|
proc.on("error", reject);
|
|
@@ -45848,13 +45859,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
45848
45859
|
async streamCommand(workspaceId, command2) {
|
|
45849
45860
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
45850
45861
|
resetStdinForChild3();
|
|
45851
|
-
return new Promise((
|
|
45862
|
+
return new Promise((resolve11, reject) => {
|
|
45852
45863
|
const proc = (0, import_child_process34.spawn)(
|
|
45853
45864
|
"ssh",
|
|
45854
45865
|
["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
|
|
45855
45866
|
{ stdio: "inherit" }
|
|
45856
45867
|
);
|
|
45857
|
-
proc.on("exit", (code) =>
|
|
45868
|
+
proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
|
|
45858
45869
|
proc.on("error", reject);
|
|
45859
45870
|
});
|
|
45860
45871
|
}
|
|
@@ -45869,7 +45880,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
45869
45880
|
tarArgs.push(".");
|
|
45870
45881
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
45871
45882
|
const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
|
|
45872
|
-
await new Promise((
|
|
45883
|
+
await new Promise((resolve11, reject) => {
|
|
45873
45884
|
const tar = (0, import_child_process34.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
45874
45885
|
const ssh = (0, import_child_process34.spawn)(
|
|
45875
45886
|
"ssh",
|
|
@@ -45887,7 +45898,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
45887
45898
|
tar.on("error", reject);
|
|
45888
45899
|
ssh.on("error", reject);
|
|
45889
45900
|
ssh.on("exit", (code) => {
|
|
45890
|
-
if (code === 0)
|
|
45901
|
+
if (code === 0) resolve11();
|
|
45891
45902
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
45892
45903
|
});
|
|
45893
45904
|
});
|
|
@@ -45900,7 +45911,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
45900
45911
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
45901
45912
|
}
|
|
45902
45913
|
const cmd = parts.join(" && ");
|
|
45903
|
-
await new Promise((
|
|
45914
|
+
await new Promise((resolve11, reject) => {
|
|
45904
45915
|
const proc = (0, import_child_process34.spawn)(
|
|
45905
45916
|
"ssh",
|
|
45906
45917
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
|
|
@@ -45912,7 +45923,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
45912
45923
|
});
|
|
45913
45924
|
proc.on("error", reject);
|
|
45914
45925
|
proc.on("exit", (code) => {
|
|
45915
|
-
if (code === 0)
|
|
45926
|
+
if (code === 0) resolve11();
|
|
45916
45927
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
45917
45928
|
});
|
|
45918
45929
|
proc.stdin?.write(contents);
|
|
@@ -46003,10 +46014,10 @@ var RailwayProvider = class {
|
|
|
46003
46014
|
"Authenticating Railway"
|
|
46004
46015
|
);
|
|
46005
46016
|
resetStdinForChild4();
|
|
46006
|
-
await new Promise((
|
|
46017
|
+
await new Promise((resolve11, reject) => {
|
|
46007
46018
|
const proc = (0, import_child_process35.spawn)("railway", ["login"], { stdio: "inherit" });
|
|
46008
46019
|
proc.on("exit", (code) => {
|
|
46009
|
-
if (code === 0)
|
|
46020
|
+
if (code === 0) resolve11();
|
|
46010
46021
|
else reject(new Error("railway login failed."));
|
|
46011
46022
|
});
|
|
46012
46023
|
proc.on("error", reject);
|
|
@@ -46146,13 +46157,13 @@ var RailwayProvider = class {
|
|
|
46146
46157
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
46147
46158
|
}
|
|
46148
46159
|
resetStdinForChild4();
|
|
46149
|
-
return new Promise((
|
|
46160
|
+
return new Promise((resolve11, reject) => {
|
|
46150
46161
|
const proc = (0, import_child_process35.spawn)(
|
|
46151
46162
|
"railway",
|
|
46152
46163
|
["shell", "--project", projectId, "--service", serviceId, "--command", command2],
|
|
46153
46164
|
{ stdio: "inherit" }
|
|
46154
46165
|
);
|
|
46155
|
-
proc.on("exit", (code) =>
|
|
46166
|
+
proc.on("exit", (code) => resolve11({ code: code ?? 0 }));
|
|
46156
46167
|
proc.on("error", reject);
|
|
46157
46168
|
});
|
|
46158
46169
|
}
|
|
@@ -46170,7 +46181,7 @@ var RailwayProvider = class {
|
|
|
46170
46181
|
tarArgs.push(".");
|
|
46171
46182
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
46172
46183
|
const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
|
|
46173
|
-
await new Promise((
|
|
46184
|
+
await new Promise((resolve11, reject) => {
|
|
46174
46185
|
const tar = (0, import_child_process35.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
46175
46186
|
const sh = (0, import_child_process35.spawn)(
|
|
46176
46187
|
"railway",
|
|
@@ -46188,7 +46199,7 @@ var RailwayProvider = class {
|
|
|
46188
46199
|
tar.on("error", reject);
|
|
46189
46200
|
sh.on("error", reject);
|
|
46190
46201
|
sh.on("exit", (code) => {
|
|
46191
|
-
if (code === 0)
|
|
46202
|
+
if (code === 0) resolve11();
|
|
46192
46203
|
else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
46193
46204
|
});
|
|
46194
46205
|
});
|
|
@@ -46204,7 +46215,7 @@ var RailwayProvider = class {
|
|
|
46204
46215
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
46205
46216
|
}
|
|
46206
46217
|
const cmd = parts.join(" && ");
|
|
46207
|
-
await new Promise((
|
|
46218
|
+
await new Promise((resolve11, reject) => {
|
|
46208
46219
|
const proc = (0, import_child_process35.spawn)(
|
|
46209
46220
|
"railway",
|
|
46210
46221
|
["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
|
|
@@ -46216,7 +46227,7 @@ var RailwayProvider = class {
|
|
|
46216
46227
|
});
|
|
46217
46228
|
proc.on("error", reject);
|
|
46218
46229
|
proc.on("exit", (code) => {
|
|
46219
|
-
if (code === 0)
|
|
46230
|
+
if (code === 0) resolve11();
|
|
46220
46231
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
46221
46232
|
});
|
|
46222
46233
|
proc.stdin?.write(contents);
|
|
@@ -47013,7 +47024,7 @@ function checkChokidar() {
|
|
|
47013
47024
|
}
|
|
47014
47025
|
async function doctor(args2 = []) {
|
|
47015
47026
|
const json = args2.includes("--json");
|
|
47016
|
-
const cliVersion = true ? "2.73.
|
|
47027
|
+
const cliVersion = true ? "2.73.1" : "0.0.0-dev";
|
|
47017
47028
|
const apiBase2 = resolveApiBaseUrl();
|
|
47018
47029
|
const diagnosticId = (0, import_node_crypto13.randomUUID)();
|
|
47019
47030
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -47404,7 +47415,7 @@ async function mcpRun(args2) {
|
|
|
47404
47415
|
// src/commands/version.ts
|
|
47405
47416
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
47406
47417
|
function version2() {
|
|
47407
|
-
const v = true ? "2.73.
|
|
47418
|
+
const v = true ? "2.73.1" : "unknown";
|
|
47408
47419
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
47409
47420
|
}
|
|
47410
47421
|
|