codeam-cli 2.61.1 → 2.61.3
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 +22 -0
- package/dist/index.js +301 -225
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -859,6 +859,11 @@ var USER_EVENTS = {
|
|
|
859
859
|
SELF_HOSTED_HOST_METRICS: "self_hosted_host_metrics",
|
|
860
860
|
SELF_HOSTED_HOST_SESSIONS: "self_hosted_host_sessions",
|
|
861
861
|
SELF_HOSTED_DEPLOY_PROGRESS: "self_hosted_deploy_progress",
|
|
862
|
+
/** Fleet rescue: the user's CodeAgent Box reached RUNNING (host enrolled
|
|
863
|
+
* + online). Drives the mobile "Use a free CodeAgent Box" flow to
|
|
864
|
+
* auto-deploy the user's presets instead of hanging on a paired session
|
|
865
|
+
* a box never creates. */
|
|
866
|
+
FLEET_BOX_READY: "fleet_box_ready",
|
|
862
867
|
REFERRAL_REWARD_EARNED: "referral_reward_earned",
|
|
863
868
|
HEADROOM_PROGRESS: "headroom_progress",
|
|
864
869
|
HEADROOM_STATUS: "headroom_status",
|
|
@@ -1789,12 +1794,12 @@ var PromiseQueue = class {
|
|
|
1789
1794
|
return promise;
|
|
1790
1795
|
}
|
|
1791
1796
|
async join() {
|
|
1792
|
-
let
|
|
1793
|
-
let length =
|
|
1797
|
+
let promises4 = Object.values(this.promiseByIds);
|
|
1798
|
+
let length = promises4.length;
|
|
1794
1799
|
while (length > 0) {
|
|
1795
|
-
await Promise.all(
|
|
1796
|
-
|
|
1797
|
-
length =
|
|
1800
|
+
await Promise.all(promises4);
|
|
1801
|
+
promises4 = Object.values(this.promiseByIds);
|
|
1802
|
+
length = promises4.length;
|
|
1798
1803
|
}
|
|
1799
1804
|
}
|
|
1800
1805
|
get length() {
|
|
@@ -2132,8 +2137,8 @@ function safeSetTimeout(fn, timeout) {
|
|
|
2132
2137
|
return t2;
|
|
2133
2138
|
}
|
|
2134
2139
|
var isError = (x) => x instanceof Error;
|
|
2135
|
-
function allSettled(
|
|
2136
|
-
return Promise.all(
|
|
2140
|
+
function allSettled(promises4) {
|
|
2141
|
+
return Promise.all(promises4.map((p2) => (p2 ?? Promise.resolve()).then((value) => ({
|
|
2137
2142
|
status: "fulfilled",
|
|
2138
2143
|
value
|
|
2139
2144
|
}), (reason) => ({
|
|
@@ -3738,14 +3743,14 @@ async function addSourceContext(frames) {
|
|
|
3738
3743
|
return frames;
|
|
3739
3744
|
}
|
|
3740
3745
|
function getContextLinesFromFile(path75, ranges, output) {
|
|
3741
|
-
return new Promise((
|
|
3746
|
+
return new Promise((resolve8) => {
|
|
3742
3747
|
const stream = (0, import_node_fs.createReadStream)(path75);
|
|
3743
3748
|
const lineReaded = (0, import_node_readline.createInterface)({
|
|
3744
3749
|
input: stream
|
|
3745
3750
|
});
|
|
3746
3751
|
function destroyStreamAndResolve() {
|
|
3747
3752
|
stream.destroy();
|
|
3748
|
-
|
|
3753
|
+
resolve8();
|
|
3749
3754
|
}
|
|
3750
3755
|
let lineNumber = 0;
|
|
3751
3756
|
let currentRangeIndex = 0;
|
|
@@ -5032,9 +5037,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5032
5037
|
if (!waitUntil) return;
|
|
5033
5038
|
if (this.disabled || this.optedOut) return;
|
|
5034
5039
|
if (!this._waitUntilCycle) {
|
|
5035
|
-
let
|
|
5040
|
+
let resolve8;
|
|
5036
5041
|
const promise = new Promise((r) => {
|
|
5037
|
-
|
|
5042
|
+
resolve8 = r;
|
|
5038
5043
|
});
|
|
5039
5044
|
try {
|
|
5040
5045
|
waitUntil(promise);
|
|
@@ -5042,7 +5047,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5042
5047
|
return;
|
|
5043
5048
|
}
|
|
5044
5049
|
this._waitUntilCycle = {
|
|
5045
|
-
resolve:
|
|
5050
|
+
resolve: resolve8,
|
|
5046
5051
|
startedAt: Date.now(),
|
|
5047
5052
|
timer: void 0
|
|
5048
5053
|
};
|
|
@@ -5066,12 +5071,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5066
5071
|
return cycle?.resolve;
|
|
5067
5072
|
}
|
|
5068
5073
|
async resolveWaitUntilFlush() {
|
|
5069
|
-
const
|
|
5074
|
+
const resolve8 = this._consumeWaitUntilCycle();
|
|
5070
5075
|
try {
|
|
5071
5076
|
await super.flush();
|
|
5072
5077
|
} catch {
|
|
5073
5078
|
} finally {
|
|
5074
|
-
|
|
5079
|
+
resolve8?.();
|
|
5075
5080
|
}
|
|
5076
5081
|
}
|
|
5077
5082
|
getPersistedProperty(key) {
|
|
@@ -5163,15 +5168,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5163
5168
|
async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
|
|
5164
5169
|
if (this.isLocalEvaluationReady()) return true;
|
|
5165
5170
|
if (void 0 === this.featureFlagsPoller) return false;
|
|
5166
|
-
return new Promise((
|
|
5171
|
+
return new Promise((resolve8) => {
|
|
5167
5172
|
const timeout = setTimeout(() => {
|
|
5168
5173
|
cleanup();
|
|
5169
|
-
|
|
5174
|
+
resolve8(false);
|
|
5170
5175
|
}, timeoutMs);
|
|
5171
5176
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
5172
5177
|
clearTimeout(timeout);
|
|
5173
5178
|
cleanup();
|
|
5174
|
-
|
|
5179
|
+
resolve8(count > 0);
|
|
5175
5180
|
});
|
|
5176
5181
|
});
|
|
5177
5182
|
}
|
|
@@ -5608,13 +5613,13 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5608
5613
|
this.context?.enter(data, options);
|
|
5609
5614
|
}
|
|
5610
5615
|
async _shutdown(shutdownTimeoutMs) {
|
|
5611
|
-
const
|
|
5616
|
+
const resolve8 = this._consumeWaitUntilCycle();
|
|
5612
5617
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
5613
5618
|
this.errorTracking.shutdown();
|
|
5614
5619
|
try {
|
|
5615
5620
|
return await super._shutdown(shutdownTimeoutMs);
|
|
5616
5621
|
} finally {
|
|
5617
|
-
|
|
5622
|
+
resolve8?.();
|
|
5618
5623
|
}
|
|
5619
5624
|
}
|
|
5620
5625
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -5970,7 +5975,7 @@ function readAnonId() {
|
|
|
5970
5975
|
}
|
|
5971
5976
|
function superProperties() {
|
|
5972
5977
|
return {
|
|
5973
|
-
cliVersion: true ? "2.61.
|
|
5978
|
+
cliVersion: true ? "2.61.3" : "0.0.0-dev",
|
|
5974
5979
|
nodeVersion: process.version,
|
|
5975
5980
|
platform: process.platform,
|
|
5976
5981
|
arch: process.arch,
|
|
@@ -6117,10 +6122,10 @@ var _execSeam = {
|
|
|
6117
6122
|
}
|
|
6118
6123
|
};
|
|
6119
6124
|
var _execSeamAsync = {
|
|
6120
|
-
exec: (file, args2, opts) => new Promise((
|
|
6125
|
+
exec: (file, args2, opts) => new Promise((resolve8, reject) => {
|
|
6121
6126
|
(0, import_child_process.execFile)(file, args2, opts, (err, stdout) => {
|
|
6122
6127
|
if (err) reject(err);
|
|
6123
|
-
else
|
|
6128
|
+
else resolve8(typeof stdout === "string" ? stdout : stdout.toString("utf8"));
|
|
6124
6129
|
});
|
|
6125
6130
|
})
|
|
6126
6131
|
};
|
|
@@ -6151,7 +6156,7 @@ var os4 = __toESM(require("os"));
|
|
|
6151
6156
|
// package.json
|
|
6152
6157
|
var package_default = {
|
|
6153
6158
|
name: "codeam-cli",
|
|
6154
|
-
version: "2.61.
|
|
6159
|
+
version: "2.61.3",
|
|
6155
6160
|
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.",
|
|
6156
6161
|
type: "commonjs",
|
|
6157
6162
|
main: "dist/index.js",
|
|
@@ -6275,8 +6280,8 @@ async function requestCode(pluginId, pluginSecretHash) {
|
|
|
6275
6280
|
});
|
|
6276
6281
|
let timer;
|
|
6277
6282
|
const timeoutSentinel = /* @__PURE__ */ Symbol("request-code-timeout");
|
|
6278
|
-
const timeoutPromise = new Promise((
|
|
6279
|
-
timer = setTimeout(() =>
|
|
6283
|
+
const timeoutPromise = new Promise((resolve8) => {
|
|
6284
|
+
timer = setTimeout(() => resolve8(timeoutSentinel), REQUEST_CODE_TIMEOUT_MS);
|
|
6280
6285
|
});
|
|
6281
6286
|
const result = await Promise.race([post2, timeoutPromise]);
|
|
6282
6287
|
clearTimeout(timer);
|
|
@@ -6586,7 +6591,7 @@ async function postBeadsProvisioning(input) {
|
|
|
6586
6591
|
}
|
|
6587
6592
|
}
|
|
6588
6593
|
async function _postJsonAuthed(url, body, pluginAuthToken) {
|
|
6589
|
-
return new Promise((
|
|
6594
|
+
return new Promise((resolve8, reject) => {
|
|
6590
6595
|
const data = JSON.stringify(body);
|
|
6591
6596
|
const u2 = new URL(url);
|
|
6592
6597
|
const transport = u2.protocol === "https:" ? https : http;
|
|
@@ -6618,9 +6623,9 @@ async function _postJsonAuthed(url, body, pluginAuthToken) {
|
|
|
6618
6623
|
return;
|
|
6619
6624
|
}
|
|
6620
6625
|
try {
|
|
6621
|
-
|
|
6626
|
+
resolve8(JSON.parse(responseBody));
|
|
6622
6627
|
} catch {
|
|
6623
|
-
|
|
6628
|
+
resolve8(null);
|
|
6624
6629
|
}
|
|
6625
6630
|
});
|
|
6626
6631
|
}
|
|
@@ -6645,7 +6650,7 @@ function makeHttpError(statusCode, retryAfterHeader, responseBody) {
|
|
|
6645
6650
|
return err;
|
|
6646
6651
|
}
|
|
6647
6652
|
async function _postJson(url, body, extraHeaders) {
|
|
6648
|
-
return new Promise((
|
|
6653
|
+
return new Promise((resolve8, reject) => {
|
|
6649
6654
|
const data = JSON.stringify(body);
|
|
6650
6655
|
const u2 = new URL(url);
|
|
6651
6656
|
const transport = u2.protocol === "https:" ? https : http;
|
|
@@ -6675,9 +6680,9 @@ async function _postJson(url, body, extraHeaders) {
|
|
|
6675
6680
|
return;
|
|
6676
6681
|
}
|
|
6677
6682
|
try {
|
|
6678
|
-
|
|
6683
|
+
resolve8(JSON.parse(body2));
|
|
6679
6684
|
} catch {
|
|
6680
|
-
|
|
6685
|
+
resolve8(null);
|
|
6681
6686
|
}
|
|
6682
6687
|
});
|
|
6683
6688
|
}
|
|
@@ -6692,7 +6697,7 @@ async function _postJson(url, body, extraHeaders) {
|
|
|
6692
6697
|
});
|
|
6693
6698
|
}
|
|
6694
6699
|
async function _getJson(url, extraHeaders) {
|
|
6695
|
-
return new Promise((
|
|
6700
|
+
return new Promise((resolve8, reject) => {
|
|
6696
6701
|
const u2 = new URL(url);
|
|
6697
6702
|
const transport = u2.protocol === "https:" ? https : http;
|
|
6698
6703
|
const req = transport.request(
|
|
@@ -6716,9 +6721,9 @@ async function _getJson(url, extraHeaders) {
|
|
|
6716
6721
|
return;
|
|
6717
6722
|
}
|
|
6718
6723
|
try {
|
|
6719
|
-
|
|
6724
|
+
resolve8(JSON.parse(body));
|
|
6720
6725
|
} catch {
|
|
6721
|
-
|
|
6726
|
+
resolve8(null);
|
|
6722
6727
|
}
|
|
6723
6728
|
});
|
|
6724
6729
|
}
|
|
@@ -7294,7 +7299,7 @@ var CommandRelayService = class _CommandRelayService {
|
|
|
7294
7299
|
// fresh + clear the "CLI update available" banner after a self-update
|
|
7295
7300
|
// (a codespace that reinstalls @latest reconnects via heartbeat, not
|
|
7296
7301
|
// pair/reconnect). Older backends ignore the extra field.
|
|
7297
|
-
..."2.61.
|
|
7302
|
+
..."2.61.3" ? { ideVersion: "2.61.3" } : {}
|
|
7298
7303
|
}).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
|
|
7299
7304
|
}
|
|
7300
7305
|
/**
|
|
@@ -7458,7 +7463,7 @@ var _transport2 = {
|
|
|
7458
7463
|
post: _post
|
|
7459
7464
|
};
|
|
7460
7465
|
function _post(url, headers, payload) {
|
|
7461
|
-
return new Promise((
|
|
7466
|
+
return new Promise((resolve8, reject) => {
|
|
7462
7467
|
let settled = false;
|
|
7463
7468
|
const u2 = new URL(url);
|
|
7464
7469
|
const lib = u2.protocol === "https:" ? https3 : http3;
|
|
@@ -7483,7 +7488,7 @@ function _post(url, headers, payload) {
|
|
|
7483
7488
|
res.on("end", () => {
|
|
7484
7489
|
if (settled) return;
|
|
7485
7490
|
settled = true;
|
|
7486
|
-
|
|
7491
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
7487
7492
|
});
|
|
7488
7493
|
}
|
|
7489
7494
|
);
|
|
@@ -8171,12 +8176,12 @@ var _gitSeam = {
|
|
|
8171
8176
|
run: _runGitImpl
|
|
8172
8177
|
};
|
|
8173
8178
|
async function _runGitImpl(cwd, args2, opts = {}) {
|
|
8174
|
-
return new Promise((
|
|
8179
|
+
return new Promise((resolve8) => {
|
|
8175
8180
|
let proc;
|
|
8176
8181
|
try {
|
|
8177
8182
|
proc = (0, import_child_process3.spawn)("git", args2, { cwd, env: process.env });
|
|
8178
8183
|
} catch {
|
|
8179
|
-
|
|
8184
|
+
resolve8(null);
|
|
8180
8185
|
return;
|
|
8181
8186
|
}
|
|
8182
8187
|
let stdout = "";
|
|
@@ -8187,13 +8192,13 @@ async function _runGitImpl(cwd, args2, opts = {}) {
|
|
|
8187
8192
|
proc.stderr?.on("data", (c2) => {
|
|
8188
8193
|
stderr += c2.toString();
|
|
8189
8194
|
});
|
|
8190
|
-
proc.on("error", () =>
|
|
8195
|
+
proc.on("error", () => resolve8(null));
|
|
8191
8196
|
proc.on("close", (code) => {
|
|
8192
8197
|
if (code === 0 || opts.allowNonZeroExit) {
|
|
8193
|
-
|
|
8198
|
+
resolve8(stdout);
|
|
8194
8199
|
} else {
|
|
8195
8200
|
log.trace("fileWatcher", `git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`);
|
|
8196
|
-
|
|
8201
|
+
resolve8(null);
|
|
8197
8202
|
}
|
|
8198
8203
|
});
|
|
8199
8204
|
});
|
|
@@ -8279,7 +8284,7 @@ var ChunkEmitter = class {
|
|
|
8279
8284
|
if (this.pairingInvalid) {
|
|
8280
8285
|
return Promise.resolve({ dead: true });
|
|
8281
8286
|
}
|
|
8282
|
-
return new Promise((
|
|
8287
|
+
return new Promise((resolve8) => {
|
|
8283
8288
|
let refreshedOnce = false;
|
|
8284
8289
|
const attempt = (attemptsLeft) => {
|
|
8285
8290
|
_transport3.post(this.url, this.headers, payload).then(({ statusCode, body: resBody }) => {
|
|
@@ -8287,13 +8292,13 @@ var ChunkEmitter = class {
|
|
|
8287
8292
|
if (statusCode === 410 || statusCode === 404 && /SESSION_NOT_FOUND|SESSION_GONE/.test(resBody)) {
|
|
8288
8293
|
process.stderr.write("[codeam] session was deleted/disconnected \u2014 stopping output stream.\n");
|
|
8289
8294
|
log.info("chunkEmitter", `dead status=${statusCode} took=${tookMs}ms`);
|
|
8290
|
-
|
|
8295
|
+
resolve8({ dead: true });
|
|
8291
8296
|
return;
|
|
8292
8297
|
}
|
|
8293
8298
|
if (statusCode === 401 || statusCode === 403) {
|
|
8294
8299
|
if (refreshedOnce) {
|
|
8295
8300
|
this.markPairingInvalid(statusCode, tookMs);
|
|
8296
|
-
|
|
8301
|
+
resolve8({ dead: true });
|
|
8297
8302
|
return;
|
|
8298
8303
|
}
|
|
8299
8304
|
log.warn("chunkEmitter", `auth ${statusCode} took=${tookMs}ms \u2014 attempting silent refresh`);
|
|
@@ -8309,10 +8314,10 @@ var ChunkEmitter = class {
|
|
|
8309
8314
|
}
|
|
8310
8315
|
if (refresh.kind === "gone") {
|
|
8311
8316
|
this.markPairingInvalid(statusCode, tookMs);
|
|
8312
|
-
|
|
8317
|
+
resolve8({ dead: true });
|
|
8313
8318
|
return;
|
|
8314
8319
|
}
|
|
8315
|
-
|
|
8320
|
+
resolve8({ dead: false });
|
|
8316
8321
|
})();
|
|
8317
8322
|
return;
|
|
8318
8323
|
}
|
|
@@ -8323,7 +8328,7 @@ var ChunkEmitter = class {
|
|
|
8323
8328
|
} else {
|
|
8324
8329
|
log.info("chunkEmitter", `ok status=${statusCode} took=${tookMs}ms`);
|
|
8325
8330
|
}
|
|
8326
|
-
|
|
8331
|
+
resolve8({ dead: false });
|
|
8327
8332
|
}).catch((err) => {
|
|
8328
8333
|
log.warn(
|
|
8329
8334
|
"chunkEmitter",
|
|
@@ -8334,7 +8339,7 @@ var ChunkEmitter = class {
|
|
|
8334
8339
|
const delay = 200 * (maxRetries - attemptsLeft + 1);
|
|
8335
8340
|
setTimeout(() => attempt(attemptsLeft - 1), delay);
|
|
8336
8341
|
} else {
|
|
8337
|
-
|
|
8342
|
+
resolve8({ dead: false });
|
|
8338
8343
|
}
|
|
8339
8344
|
});
|
|
8340
8345
|
};
|
|
@@ -8357,7 +8362,7 @@ var _transport3 = {
|
|
|
8357
8362
|
post: _post2
|
|
8358
8363
|
};
|
|
8359
8364
|
function _post2(url, headers, payload) {
|
|
8360
|
-
return new Promise((
|
|
8365
|
+
return new Promise((resolve8, reject) => {
|
|
8361
8366
|
let settled = false;
|
|
8362
8367
|
const u2 = new URL(url);
|
|
8363
8368
|
const transport = u2.protocol === "https:" ? https4 : http4;
|
|
@@ -8381,7 +8386,7 @@ function _post2(url, headers, payload) {
|
|
|
8381
8386
|
res.on("end", () => {
|
|
8382
8387
|
if (settled) return;
|
|
8383
8388
|
settled = true;
|
|
8384
|
-
|
|
8389
|
+
resolve8({ statusCode: res.statusCode ?? 0, body: resData });
|
|
8385
8390
|
});
|
|
8386
8391
|
}
|
|
8387
8392
|
);
|
|
@@ -9433,12 +9438,12 @@ async function applyFileReview(workingDir, filePath, action) {
|
|
|
9433
9438
|
return { ok: true, action, filePath, repoRoot };
|
|
9434
9439
|
}
|
|
9435
9440
|
function runGit2(cwd, args2) {
|
|
9436
|
-
return new Promise((
|
|
9441
|
+
return new Promise((resolve8) => {
|
|
9437
9442
|
let proc;
|
|
9438
9443
|
try {
|
|
9439
9444
|
proc = (0, import_child_process6.spawn)("git", args2, { cwd, env: process.env });
|
|
9440
9445
|
} catch (err) {
|
|
9441
|
-
|
|
9446
|
+
resolve8({ ok: false, code: -1, stdout: "", stderr: err.message });
|
|
9442
9447
|
return;
|
|
9443
9448
|
}
|
|
9444
9449
|
let stdout = "";
|
|
@@ -9451,11 +9456,11 @@ function runGit2(cwd, args2) {
|
|
|
9451
9456
|
});
|
|
9452
9457
|
proc.on(
|
|
9453
9458
|
"error",
|
|
9454
|
-
(err) =>
|
|
9459
|
+
(err) => resolve8({ ok: false, code: -1, stdout, stderr: stderr + err.message })
|
|
9455
9460
|
);
|
|
9456
9461
|
proc.on(
|
|
9457
9462
|
"close",
|
|
9458
|
-
(code) =>
|
|
9463
|
+
(code) => resolve8({ ok: code === 0, code: code ?? -1, stdout, stderr })
|
|
9459
9464
|
);
|
|
9460
9465
|
});
|
|
9461
9466
|
}
|
|
@@ -12174,15 +12179,15 @@ function runInstaller() {
|
|
|
12174
12179
|
"-Command",
|
|
12175
12180
|
"irm https://claude.ai/install.ps1 | iex"
|
|
12176
12181
|
] : ["-c", "curl -fsSL https://claude.ai/install.sh | bash"];
|
|
12177
|
-
return new Promise((
|
|
12182
|
+
return new Promise((resolve8) => {
|
|
12178
12183
|
const proc = (0, import_child_process9.spawn)(cmd, args2, { stdio: "inherit" });
|
|
12179
12184
|
proc.on("error", (err) => {
|
|
12180
12185
|
console.error(`
|
|
12181
12186
|
\u2717 Installer failed to launch: ${err.message}`);
|
|
12182
|
-
|
|
12187
|
+
resolve8(false);
|
|
12183
12188
|
});
|
|
12184
12189
|
proc.on("exit", (code) => {
|
|
12185
|
-
|
|
12190
|
+
resolve8(code === 0);
|
|
12186
12191
|
});
|
|
12187
12192
|
});
|
|
12188
12193
|
}
|
|
@@ -12315,7 +12320,7 @@ function extractSetupTokenFromOutput(output) {
|
|
|
12315
12320
|
return m ? m[0] : null;
|
|
12316
12321
|
}
|
|
12317
12322
|
function captureClaudeSetupToken() {
|
|
12318
|
-
return new Promise((
|
|
12323
|
+
return new Promise((resolve8, reject) => {
|
|
12319
12324
|
const child = (0, import_node_child_process3.spawn)("claude", ["setup-token"], {
|
|
12320
12325
|
stdio: ["inherit", "pipe", "inherit"]
|
|
12321
12326
|
});
|
|
@@ -12329,7 +12334,7 @@ function captureClaudeSetupToken() {
|
|
|
12329
12334
|
child.on("exit", (code) => {
|
|
12330
12335
|
const token = extractSetupTokenFromOutput(out2);
|
|
12331
12336
|
if (token) {
|
|
12332
|
-
|
|
12337
|
+
resolve8({ method: "setup_token", credential: token, source: "setup-token" });
|
|
12333
12338
|
return;
|
|
12334
12339
|
}
|
|
12335
12340
|
reject(
|
|
@@ -12415,17 +12420,17 @@ function parseUsageOutput(raw) {
|
|
|
12415
12420
|
return { percent, resetAt };
|
|
12416
12421
|
}
|
|
12417
12422
|
async function fetchClaudeQuota() {
|
|
12418
|
-
return new Promise((
|
|
12423
|
+
return new Promise((resolve8) => {
|
|
12419
12424
|
const claudeCmd = findInPath("claude") ? "claude" : "claude-code";
|
|
12420
12425
|
if (!claudeCmd) {
|
|
12421
|
-
|
|
12426
|
+
resolve8(null);
|
|
12422
12427
|
return;
|
|
12423
12428
|
}
|
|
12424
12429
|
const helperPath = path18.join(os13.tmpdir(), "codeam-quota-helper.py");
|
|
12425
12430
|
fs15.writeFileSync(helperPath, HELPER_SCRIPT, { mode: 420 });
|
|
12426
12431
|
const python = findInPath("python3") ?? findInPath("python");
|
|
12427
12432
|
if (!python) {
|
|
12428
|
-
|
|
12433
|
+
resolve8(null);
|
|
12429
12434
|
return;
|
|
12430
12435
|
}
|
|
12431
12436
|
const proc = (0, import_child_process10.spawn)(python, [helperPath, claudeCmd, "--tools", ""], {
|
|
@@ -12452,13 +12457,13 @@ async function fetchClaudeQuota() {
|
|
|
12452
12457
|
fs15.unlinkSync(helperPath);
|
|
12453
12458
|
} catch {
|
|
12454
12459
|
}
|
|
12455
|
-
|
|
12460
|
+
resolve8(result);
|
|
12456
12461
|
}, 5e3);
|
|
12457
12462
|
}, 8e3);
|
|
12458
12463
|
setTimeout(() => {
|
|
12459
12464
|
if (!resolved) {
|
|
12460
12465
|
resolved = true;
|
|
12461
|
-
|
|
12466
|
+
resolve8(null);
|
|
12462
12467
|
}
|
|
12463
12468
|
try {
|
|
12464
12469
|
proc.kill();
|
|
@@ -12483,12 +12488,12 @@ function killActiveSpawnAndCaptureChildren() {
|
|
|
12483
12488
|
}
|
|
12484
12489
|
async function spawnAndCapture(cmd, args2, opts = {}) {
|
|
12485
12490
|
const timeoutMs = opts.timeoutMs ?? 6e4;
|
|
12486
|
-
return new Promise((
|
|
12491
|
+
return new Promise((resolve8) => {
|
|
12487
12492
|
let settled = false;
|
|
12488
12493
|
const settle = (value) => {
|
|
12489
12494
|
if (settled) return;
|
|
12490
12495
|
settled = true;
|
|
12491
|
-
|
|
12496
|
+
resolve8(value);
|
|
12492
12497
|
};
|
|
12493
12498
|
let child;
|
|
12494
12499
|
try {
|
|
@@ -13399,7 +13404,7 @@ function newestRolloutIdSince(sessionsRoot, resolvedCwd, floorMs) {
|
|
|
13399
13404
|
return bestId;
|
|
13400
13405
|
}
|
|
13401
13406
|
function sleep2(ms) {
|
|
13402
|
-
return new Promise((
|
|
13407
|
+
return new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
13403
13408
|
}
|
|
13404
13409
|
function getCurrentUsage2(historyDir) {
|
|
13405
13410
|
if (!import_node_fs3.default.existsSync(historyDir)) return null;
|
|
@@ -13639,12 +13644,12 @@ function resolveNpm(os53) {
|
|
|
13639
13644
|
return os53.id === "win32" ? "npm.cmd" : "npm";
|
|
13640
13645
|
}
|
|
13641
13646
|
async function installCodexViaNpm(os53) {
|
|
13642
|
-
return new Promise((
|
|
13647
|
+
return new Promise((resolve8, reject) => {
|
|
13643
13648
|
const proc = (0, import_node_child_process5.spawn)(resolveNpm(os53), ["install", "-g", "@openai/codex"], {
|
|
13644
13649
|
stdio: "inherit"
|
|
13645
13650
|
});
|
|
13646
13651
|
proc.on("close", (code) => {
|
|
13647
|
-
if (code === 0)
|
|
13652
|
+
if (code === 0) resolve8();
|
|
13648
13653
|
else reject(new Error(`npm install -g @openai/codex exited ${code}`));
|
|
13649
13654
|
});
|
|
13650
13655
|
proc.on("error", (err) => {
|
|
@@ -13759,12 +13764,30 @@ async function ensureCoderabbitInstalled(os53) {
|
|
|
13759
13764
|
return false;
|
|
13760
13765
|
}
|
|
13761
13766
|
console.log("\n CodeRabbit CLI not found \u2014 installing via the official script\u2026\n");
|
|
13762
|
-
const ok = await new Promise((
|
|
13763
|
-
const
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13767
|
+
const ok = await new Promise((resolve8) => {
|
|
13768
|
+
const INSTALL_TIMEOUT_MS2 = 15e4;
|
|
13769
|
+
const proc = (0, import_node_child_process6.spawn)(
|
|
13770
|
+
"sh",
|
|
13771
|
+
["-c", `curl -fsSL --connect-timeout 15 --max-time 120 ${INSTALL_URL} | sh`],
|
|
13772
|
+
{ stdio: "inherit" }
|
|
13773
|
+
);
|
|
13774
|
+
let settled = false;
|
|
13775
|
+
const finish = (v) => {
|
|
13776
|
+
if (settled) return;
|
|
13777
|
+
settled = true;
|
|
13778
|
+
clearTimeout(timer);
|
|
13779
|
+
resolve8(v);
|
|
13780
|
+
};
|
|
13781
|
+
const timer = setTimeout(() => {
|
|
13782
|
+
console.error("\n \u2717 CodeRabbit install timed out \u2014 check network egress and retry.\n");
|
|
13783
|
+
try {
|
|
13784
|
+
proc.kill("SIGKILL");
|
|
13785
|
+
} catch {
|
|
13786
|
+
}
|
|
13787
|
+
finish(false);
|
|
13788
|
+
}, INSTALL_TIMEOUT_MS2);
|
|
13789
|
+
proc.on("close", (code) => finish(code === 0));
|
|
13790
|
+
proc.on("error", () => finish(false));
|
|
13768
13791
|
});
|
|
13769
13792
|
if (!ok) return false;
|
|
13770
13793
|
os53.augmentPath([`${os53.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
@@ -14063,7 +14086,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
14063
14086
|
}
|
|
14064
14087
|
async runOneShot(input) {
|
|
14065
14088
|
const launch = await this.prepareInvocation(input);
|
|
14066
|
-
return new Promise((
|
|
14089
|
+
return new Promise((resolve8, reject) => {
|
|
14067
14090
|
const stdoutBuf = [];
|
|
14068
14091
|
const stderrBuf = [];
|
|
14069
14092
|
const proc = (0, import_node_child_process8.spawn)(launch.cmd, launch.args, {
|
|
@@ -14075,7 +14098,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
14075
14098
|
if (settled) return;
|
|
14076
14099
|
settled = true;
|
|
14077
14100
|
clearTimeout(timer);
|
|
14078
|
-
|
|
14101
|
+
resolve8(out2);
|
|
14079
14102
|
};
|
|
14080
14103
|
const timer = setTimeout(() => {
|
|
14081
14104
|
if (settled) return;
|
|
@@ -15206,7 +15229,7 @@ function newestSessionSince(bucket, floorMs) {
|
|
|
15206
15229
|
return bestId;
|
|
15207
15230
|
}
|
|
15208
15231
|
function sleep3(ms) {
|
|
15209
|
-
return new Promise((
|
|
15232
|
+
return new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
15210
15233
|
}
|
|
15211
15234
|
function joinTextParts(parts) {
|
|
15212
15235
|
if (!Array.isArray(parts)) return "";
|
|
@@ -15538,7 +15561,7 @@ async function link(args2 = []) {
|
|
|
15538
15561
|
waitSpin.start(waitMsg());
|
|
15539
15562
|
const countdown = setInterval(() => waitSpin.message(waitMsg()), 1e3);
|
|
15540
15563
|
countdown.unref?.();
|
|
15541
|
-
const paired = await new Promise((
|
|
15564
|
+
const paired = await new Promise((resolve8, reject) => {
|
|
15542
15565
|
let stopPoll = null;
|
|
15543
15566
|
const sigint = () => {
|
|
15544
15567
|
clearInterval(countdown);
|
|
@@ -15551,7 +15574,7 @@ async function link(args2 = []) {
|
|
|
15551
15574
|
process.removeListener("SIGINT", sigint);
|
|
15552
15575
|
clearInterval(countdown);
|
|
15553
15576
|
waitSpin.stop("Paired");
|
|
15554
|
-
|
|
15577
|
+
resolve8(info);
|
|
15555
15578
|
},
|
|
15556
15579
|
() => {
|
|
15557
15580
|
clearInterval(countdown);
|
|
@@ -15709,14 +15732,14 @@ async function captureFreshCredentials(ctx) {
|
|
|
15709
15732
|
}
|
|
15710
15733
|
};
|
|
15711
15734
|
try {
|
|
15712
|
-
const token = await new Promise((
|
|
15735
|
+
const token = await new Promise((resolve8, reject) => {
|
|
15713
15736
|
let settled = false;
|
|
15714
15737
|
const tryExtract = async () => {
|
|
15715
15738
|
if (settled) return;
|
|
15716
15739
|
const t2 = await ctx.locator.extract();
|
|
15717
15740
|
if (t2 && !settled) {
|
|
15718
15741
|
settled = true;
|
|
15719
|
-
|
|
15742
|
+
resolve8(t2);
|
|
15720
15743
|
}
|
|
15721
15744
|
};
|
|
15722
15745
|
watcher.on("add", () => void tryExtract());
|
|
@@ -15925,7 +15948,7 @@ function deliverPendingCoderabbitCallback(callbackUrl) {
|
|
|
15925
15948
|
function runCoderabbitOAuthLogin(deps) {
|
|
15926
15949
|
const timeoutMs = deps.timeoutMs ?? 18e4;
|
|
15927
15950
|
const spawnProc = deps.spawn ?? spawnCoderabbitLoginProc;
|
|
15928
|
-
return new Promise((
|
|
15951
|
+
return new Promise((resolve8) => {
|
|
15929
15952
|
let settled = false;
|
|
15930
15953
|
let stdout = "";
|
|
15931
15954
|
let last = null;
|
|
@@ -15938,13 +15961,13 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
15938
15961
|
child.kill("SIGKILL");
|
|
15939
15962
|
} catch {
|
|
15940
15963
|
}
|
|
15941
|
-
|
|
15964
|
+
resolve8(r);
|
|
15942
15965
|
};
|
|
15943
15966
|
let child;
|
|
15944
15967
|
try {
|
|
15945
15968
|
child = spawnProc("coderabbit", ["auth", "login", "--agent"]);
|
|
15946
15969
|
} catch (err) {
|
|
15947
|
-
|
|
15970
|
+
resolve8({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
|
|
15948
15971
|
return;
|
|
15949
15972
|
}
|
|
15950
15973
|
const timer = setTimeout(
|
|
@@ -17041,7 +17064,7 @@ var defaultGitToolingRunner = {
|
|
|
17041
17064
|
}
|
|
17042
17065
|
},
|
|
17043
17066
|
run(cmd, args2, opts = {}) {
|
|
17044
|
-
return new Promise((
|
|
17067
|
+
return new Promise((resolve8) => {
|
|
17045
17068
|
const child = (0, import_node_child_process18.spawn)(cmd, args2, {
|
|
17046
17069
|
stdio: [opts.input !== void 0 ? "pipe" : "ignore", "ignore", "pipe"]
|
|
17047
17070
|
});
|
|
@@ -17050,7 +17073,7 @@ var defaultGitToolingRunner = {
|
|
|
17050
17073
|
const done = (code) => {
|
|
17051
17074
|
if (settled) return;
|
|
17052
17075
|
settled = true;
|
|
17053
|
-
|
|
17076
|
+
resolve8({ code, stderr });
|
|
17054
17077
|
};
|
|
17055
17078
|
child.stderr?.on("data", (b) => {
|
|
17056
17079
|
stderr += b.toString();
|
|
@@ -17208,7 +17231,7 @@ var defaultHeadroomRunner = {
|
|
|
17208
17231
|
}
|
|
17209
17232
|
},
|
|
17210
17233
|
run(cmd, args2, opts = {}) {
|
|
17211
|
-
return new Promise((
|
|
17234
|
+
return new Promise((resolve8) => {
|
|
17212
17235
|
const spawnEnv = opts.env ?? process.env;
|
|
17213
17236
|
const child = (0, import_node_child_process19.spawn)(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], env: spawnEnv });
|
|
17214
17237
|
let stderrBuf = "";
|
|
@@ -17217,7 +17240,7 @@ var defaultHeadroomRunner = {
|
|
|
17217
17240
|
const done = (code) => {
|
|
17218
17241
|
if (settled) return;
|
|
17219
17242
|
settled = true;
|
|
17220
|
-
|
|
17243
|
+
resolve8({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
17221
17244
|
};
|
|
17222
17245
|
child.stdout?.on("data", (b) => {
|
|
17223
17246
|
const chunk = b.toString();
|
|
@@ -17768,14 +17791,14 @@ function compareSemver(a, b) {
|
|
|
17768
17791
|
return 0;
|
|
17769
17792
|
}
|
|
17770
17793
|
function fetchLatest() {
|
|
17771
|
-
return new Promise((
|
|
17794
|
+
return new Promise((resolve8) => {
|
|
17772
17795
|
const req = https6.get(
|
|
17773
17796
|
REGISTRY_URL,
|
|
17774
17797
|
{ headers: { Accept: "application/json" }, timeout: REQUEST_TIMEOUT_MS },
|
|
17775
17798
|
(res) => {
|
|
17776
17799
|
if (res.statusCode !== 200) {
|
|
17777
17800
|
res.resume();
|
|
17778
|
-
|
|
17801
|
+
resolve8(null);
|
|
17779
17802
|
return;
|
|
17780
17803
|
}
|
|
17781
17804
|
let buf = "";
|
|
@@ -17787,21 +17810,21 @@ function fetchLatest() {
|
|
|
17787
17810
|
try {
|
|
17788
17811
|
const json = JSON.parse(buf);
|
|
17789
17812
|
if (typeof json.version === "string") {
|
|
17790
|
-
|
|
17813
|
+
resolve8(json.version);
|
|
17791
17814
|
} else {
|
|
17792
|
-
|
|
17815
|
+
resolve8(null);
|
|
17793
17816
|
}
|
|
17794
17817
|
} catch {
|
|
17795
|
-
|
|
17818
|
+
resolve8(null);
|
|
17796
17819
|
}
|
|
17797
17820
|
});
|
|
17798
17821
|
}
|
|
17799
17822
|
);
|
|
17800
17823
|
req.on("timeout", () => {
|
|
17801
17824
|
req.destroy();
|
|
17802
|
-
|
|
17825
|
+
resolve8(null);
|
|
17803
17826
|
});
|
|
17804
|
-
req.on("error", () =>
|
|
17827
|
+
req.on("error", () => resolve8(null));
|
|
17805
17828
|
});
|
|
17806
17829
|
}
|
|
17807
17830
|
function notifyIfStale(currentVersion, latest) {
|
|
@@ -17877,7 +17900,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
17877
17900
|
if (process.env.NODE_ENV === "test") return;
|
|
17878
17901
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17879
17902
|
if (process.env.CI) return;
|
|
17880
|
-
const current = true ? "2.61.
|
|
17903
|
+
const current = true ? "2.61.3" : null;
|
|
17881
17904
|
if (!current) return;
|
|
17882
17905
|
const cache = readCache();
|
|
17883
17906
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17894,7 +17917,7 @@ function checkForUpdates() {
|
|
|
17894
17917
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17895
17918
|
if (process.env.CI) return;
|
|
17896
17919
|
if (!process.stdout.isTTY) return;
|
|
17897
|
-
const current = true ? "2.61.
|
|
17920
|
+
const current = true ? "2.61.3" : null;
|
|
17898
17921
|
if (!current) return;
|
|
17899
17922
|
const cache = readCache();
|
|
17900
17923
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17914,13 +17937,13 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
17914
17937
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
17915
17938
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
17916
17939
|
function currentCliVersion() {
|
|
17917
|
-
return true ? "2.61.
|
|
17940
|
+
return true ? "2.61.3" : null;
|
|
17918
17941
|
}
|
|
17919
17942
|
function runCmd(cmd, args2, timeoutMs) {
|
|
17920
|
-
return new Promise((
|
|
17943
|
+
return new Promise((resolve8) => {
|
|
17921
17944
|
(0, import_node_child_process21.execFile)(cmd, args2, { timeout: timeoutMs }, (err, stdout, stderr) => {
|
|
17922
17945
|
const code = err && typeof err.code === "number" ? err.code : err ? null : 0;
|
|
17923
|
-
|
|
17946
|
+
resolve8({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
|
|
17924
17947
|
});
|
|
17925
17948
|
});
|
|
17926
17949
|
}
|
|
@@ -18178,7 +18201,7 @@ function resolveFleetBoxImage() {
|
|
|
18178
18201
|
var DOCKER_RUN_TIMEOUT_MS = 12e4;
|
|
18179
18202
|
var defaultDockerRunner = {
|
|
18180
18203
|
run(args2, opts = {}) {
|
|
18181
|
-
return new Promise((
|
|
18204
|
+
return new Promise((resolve8) => {
|
|
18182
18205
|
const child = (0, import_node_child_process23.spawn)("docker", args2, {
|
|
18183
18206
|
stdio: ["ignore", "pipe", "pipe"],
|
|
18184
18207
|
env: { ...process.env, ...opts.env }
|
|
@@ -18197,7 +18220,7 @@ var defaultDockerRunner = {
|
|
|
18197
18220
|
if (settled) return;
|
|
18198
18221
|
settled = true;
|
|
18199
18222
|
clearTimeout(timer);
|
|
18200
|
-
|
|
18223
|
+
resolve8({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
18201
18224
|
};
|
|
18202
18225
|
child.stdout?.on("data", (b) => {
|
|
18203
18226
|
stdoutBuf += b.toString();
|
|
@@ -18509,6 +18532,10 @@ var HostAgentSupervisor = class {
|
|
|
18509
18532
|
this.stopChild(cmd.payload.sessionId);
|
|
18510
18533
|
return;
|
|
18511
18534
|
}
|
|
18535
|
+
if (cmd.type === "host_list_dir") {
|
|
18536
|
+
await this.listDir(cmd);
|
|
18537
|
+
return;
|
|
18538
|
+
}
|
|
18512
18539
|
if (cmd.type === "self_hosted_refresh_credentials") {
|
|
18513
18540
|
if (!isRefreshCredentialsPayload(cmd.payload)) {
|
|
18514
18541
|
log.warn("host-agent", `ignoring malformed self_hosted_refresh_credentials id=${cmd.id}`);
|
|
@@ -18530,6 +18557,40 @@ var HostAgentSupervisor = class {
|
|
|
18530
18557
|
}
|
|
18531
18558
|
log.trace("host-agent", `ignoring unsupported command type=${cmd.type}`);
|
|
18532
18559
|
}
|
|
18560
|
+
/**
|
|
18561
|
+
* `host_list_dir` — read-only directory browse for the app's "Path on
|
|
18562
|
+
* server" picker (self-hosted deploy). Lists a directory on THIS host and
|
|
18563
|
+
* returns its subdirectories + files so the user can NAVIGATE to a project
|
|
18564
|
+
* path instead of guessing a raw one. NEVER writes, NEVER returns file
|
|
18565
|
+
* contents. It's the user's own box (auth already proved ownership at the
|
|
18566
|
+
* backend), so any absolute path is allowed; defaults to `$HOME`. Hidden
|
|
18567
|
+
* dot-entries are filtered (project paths are effectively never dotdirs).
|
|
18568
|
+
* Responds with a relay result the backend awaits.
|
|
18569
|
+
*/
|
|
18570
|
+
async listDir(cmd) {
|
|
18571
|
+
const relay = this.relay;
|
|
18572
|
+
if (!relay) return;
|
|
18573
|
+
const raw = cmd.payload?.path;
|
|
18574
|
+
const target = typeof raw === "string" && raw.trim() ? path45.resolve(raw.trim()) : os36.homedir();
|
|
18575
|
+
try {
|
|
18576
|
+
const dirents = await fs42.promises.readdir(target, { withFileTypes: true });
|
|
18577
|
+
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
18578
|
+
(a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
|
|
18579
|
+
);
|
|
18580
|
+
const parent = path45.dirname(target);
|
|
18581
|
+
await relay.sendResult(cmd.id, "completed", {
|
|
18582
|
+
path: target,
|
|
18583
|
+
// null at the filesystem root so the UI can hide the ".." affordance.
|
|
18584
|
+
parent: parent === target ? null : parent,
|
|
18585
|
+
entries
|
|
18586
|
+
});
|
|
18587
|
+
} catch (err) {
|
|
18588
|
+
await relay.sendResult(cmd.id, "failed", {
|
|
18589
|
+
path: target,
|
|
18590
|
+
error: err.code ?? err.message
|
|
18591
|
+
});
|
|
18592
|
+
}
|
|
18593
|
+
}
|
|
18533
18594
|
/**
|
|
18534
18595
|
* `fleet_create_box` — `docker run` a per-user rescue box. Builds the FULL
|
|
18535
18596
|
* argv from a fixed template (Global Constraints — nothing from the wire
|
|
@@ -18593,6 +18654,14 @@ var HostAgentSupervisor = class {
|
|
|
18593
18654
|
// not the generic "my-server" or the ugly container cuid.
|
|
18594
18655
|
"-e",
|
|
18595
18656
|
"CODEAM_HOST_LABEL=CodeAgent Box",
|
|
18657
|
+
// The enroll token above is a SINGLE-USE bootstrap, but it lives in the
|
|
18658
|
+
// container's fixed env — it can't be stripped after first boot like the
|
|
18659
|
+
// self-hosted systemd unit does. This flag tells `resolveHostIdentity`
|
|
18660
|
+
// that on a restart (docker restart / reboot / fleet_start_box wake) an
|
|
18661
|
+
// expired-token redeem is EXPECTED: resume from the sealed identity
|
|
18662
|
+
// instead of dying with "token expired". Not a secret → plain KEY=value.
|
|
18663
|
+
"-e",
|
|
18664
|
+
"CODEAM_ENROLL_EPHEMERAL=1",
|
|
18596
18665
|
resolveFleetBoxImage()
|
|
18597
18666
|
];
|
|
18598
18667
|
const res = await this.docker.run(args2, {
|
|
@@ -18874,7 +18943,7 @@ var HostAgentSupervisor = class {
|
|
|
18874
18943
|
* host-agent whose env may lack it.
|
|
18875
18944
|
*/
|
|
18876
18945
|
runAgentInstall(script) {
|
|
18877
|
-
return new Promise((
|
|
18946
|
+
return new Promise((resolve8) => {
|
|
18878
18947
|
const home = process.env.HOME || os36.homedir();
|
|
18879
18948
|
const child = (0, import_node_child_process23.spawn)("sh", ["-c", script], {
|
|
18880
18949
|
env: { ...process.env, HOME: home },
|
|
@@ -18890,7 +18959,7 @@ var HostAgentSupervisor = class {
|
|
|
18890
18959
|
const done = () => {
|
|
18891
18960
|
if (settled) return;
|
|
18892
18961
|
settled = true;
|
|
18893
|
-
|
|
18962
|
+
resolve8();
|
|
18894
18963
|
};
|
|
18895
18964
|
const timer = setTimeout(() => {
|
|
18896
18965
|
log.warn(
|
|
@@ -18980,6 +19049,13 @@ async function resolveHostIdentity(enrollToken) {
|
|
|
18980
19049
|
return identity;
|
|
18981
19050
|
} catch (err) {
|
|
18982
19051
|
if (isTerminalEnrollError(err)) {
|
|
19052
|
+
if (existing && process.env.CODEAM_ENROLL_EPHEMERAL === "1") {
|
|
19053
|
+
log.info(
|
|
19054
|
+
"host-agent",
|
|
19055
|
+
"ephemeral enroll token expired on restart; resuming from sealed identity"
|
|
19056
|
+
);
|
|
19057
|
+
return existing;
|
|
19058
|
+
}
|
|
18983
19059
|
throw new Error(
|
|
18984
19060
|
"Enrollment token expired or invalid \u2014 generate a new one in the app (Settings \u203A Servers \u203A Add server). Tokens expire after 15 minutes and are single-use.",
|
|
18985
19061
|
{ cause: err }
|
|
@@ -19344,12 +19420,12 @@ async function isExecutableBinary(p2) {
|
|
|
19344
19420
|
}
|
|
19345
19421
|
}
|
|
19346
19422
|
function extractTgz(tgzPath, destDir) {
|
|
19347
|
-
return new Promise((
|
|
19423
|
+
return new Promise((resolve8, reject) => {
|
|
19348
19424
|
const child = (0, import_child_process15.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
|
|
19349
19425
|
child.on("error", (err) => reject(err));
|
|
19350
19426
|
child.on(
|
|
19351
19427
|
"exit",
|
|
19352
|
-
(code) => code === 0 ?
|
|
19428
|
+
(code) => code === 0 ? resolve8() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
|
|
19353
19429
|
);
|
|
19354
19430
|
});
|
|
19355
19431
|
}
|
|
@@ -19563,12 +19639,12 @@ function parseExpoUrl(stdout) {
|
|
|
19563
19639
|
// src/services/preview/port-ready.ts
|
|
19564
19640
|
var net = __toESM(require("net"));
|
|
19565
19641
|
function isPortListening(port, host2 = "127.0.0.1") {
|
|
19566
|
-
return new Promise((
|
|
19642
|
+
return new Promise((resolve8) => {
|
|
19567
19643
|
const socket = new net.Socket();
|
|
19568
19644
|
const done = (result) => {
|
|
19569
19645
|
socket.removeAllListeners();
|
|
19570
19646
|
socket.destroy();
|
|
19571
|
-
|
|
19647
|
+
resolve8(result);
|
|
19572
19648
|
};
|
|
19573
19649
|
socket.setTimeout(1e3);
|
|
19574
19650
|
socket.once("connect", () => done(true));
|
|
@@ -19594,7 +19670,7 @@ var import_path6 = __toESM(require("path"));
|
|
|
19594
19670
|
// src/services/preview/run-setup.ts
|
|
19595
19671
|
var import_child_process17 = require("child_process");
|
|
19596
19672
|
function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
19597
|
-
return new Promise((
|
|
19673
|
+
return new Promise((resolve8) => {
|
|
19598
19674
|
const child = (0, import_child_process17.spawn)(cmd, args2, {
|
|
19599
19675
|
cwd,
|
|
19600
19676
|
env: { ...process.env, ...env ?? {} },
|
|
@@ -19614,20 +19690,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
|
19614
19690
|
settled = true;
|
|
19615
19691
|
log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
|
|
19616
19692
|
killQuiet(child);
|
|
19617
|
-
|
|
19693
|
+
resolve8({ status: "timeout", code: null });
|
|
19618
19694
|
}, opts.timeoutMs);
|
|
19619
19695
|
child.once("exit", (code) => {
|
|
19620
19696
|
if (settled) return;
|
|
19621
19697
|
settled = true;
|
|
19622
19698
|
clearTimeout(timer);
|
|
19623
|
-
if (code === 0)
|
|
19624
|
-
else
|
|
19699
|
+
if (code === 0) resolve8({ status: "ok", code: 0 });
|
|
19700
|
+
else resolve8({ status: "failed", code });
|
|
19625
19701
|
});
|
|
19626
19702
|
child.once("error", () => {
|
|
19627
19703
|
if (settled) return;
|
|
19628
19704
|
settled = true;
|
|
19629
19705
|
clearTimeout(timer);
|
|
19630
|
-
|
|
19706
|
+
resolve8({ status: "failed", code: null });
|
|
19631
19707
|
});
|
|
19632
19708
|
});
|
|
19633
19709
|
}
|
|
@@ -19869,23 +19945,23 @@ async function awaitTunnelRegistered(candidate, hostname4, deadlineMs) {
|
|
|
19869
19945
|
ac.signal.addEventListener("abort", detach, { once: true });
|
|
19870
19946
|
};
|
|
19871
19947
|
try {
|
|
19872
|
-
return await new Promise((
|
|
19948
|
+
return await new Promise((resolve8) => {
|
|
19873
19949
|
const onChunk = (chunk) => {
|
|
19874
19950
|
const s = chunk.toString();
|
|
19875
19951
|
if (!url) url = parseCloudflaredUrl(s);
|
|
19876
19952
|
if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
|
|
19877
19953
|
const trimmed = s.replace(/\n+$/g, "");
|
|
19878
19954
|
if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
|
|
19879
|
-
if (url && registered)
|
|
19955
|
+
if (url && registered) resolve8({ kind: "registered", url });
|
|
19880
19956
|
};
|
|
19881
19957
|
const onExit = (code) => {
|
|
19882
|
-
|
|
19958
|
+
resolve8({ kind: "exited", sawUrl: url != null, code });
|
|
19883
19959
|
};
|
|
19884
19960
|
const { stdout, stderr } = candidate;
|
|
19885
19961
|
if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
|
|
19886
19962
|
if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
|
|
19887
19963
|
scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
|
|
19888
|
-
timer = setTimeout(() =>
|
|
19964
|
+
timer = setTimeout(() => resolve8({ kind: "timeout", sawUrl: url != null }), deadlineMs);
|
|
19889
19965
|
});
|
|
19890
19966
|
} finally {
|
|
19891
19967
|
ac.abort();
|
|
@@ -20422,12 +20498,12 @@ var _spawnSeam = {
|
|
|
20422
20498
|
run: _defaultSpawn
|
|
20423
20499
|
};
|
|
20424
20500
|
function _defaultSpawn(binaryPath, args2, opts) {
|
|
20425
|
-
return new Promise((
|
|
20501
|
+
return new Promise((resolve8) => {
|
|
20426
20502
|
let proc;
|
|
20427
20503
|
try {
|
|
20428
20504
|
proc = (0, import_child_process19.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
|
|
20429
20505
|
} catch (err) {
|
|
20430
|
-
|
|
20506
|
+
resolve8({ code: -1, stdout: "", stderr: err.message });
|
|
20431
20507
|
return;
|
|
20432
20508
|
}
|
|
20433
20509
|
let stdout = "";
|
|
@@ -20438,8 +20514,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
|
|
|
20438
20514
|
proc.stderr?.on("data", (c2) => {
|
|
20439
20515
|
stderr += c2.toString();
|
|
20440
20516
|
});
|
|
20441
|
-
proc.on("error", (err) =>
|
|
20442
|
-
proc.on("close", (code) =>
|
|
20517
|
+
proc.on("error", (err) => resolve8({ code: -1, stdout, stderr: err.message }));
|
|
20518
|
+
proc.on("close", (code) => resolve8({ code: code ?? -1, stdout, stderr }));
|
|
20443
20519
|
});
|
|
20444
20520
|
}
|
|
20445
20521
|
var _adapterSeam = {
|
|
@@ -20616,22 +20692,22 @@ var _installSpawnSeam = {
|
|
|
20616
20692
|
run: _defaultInstallSpawn
|
|
20617
20693
|
};
|
|
20618
20694
|
function _defaultInstallSpawn(strategy) {
|
|
20619
|
-
return new Promise((
|
|
20695
|
+
return new Promise((resolve8) => {
|
|
20620
20696
|
let proc;
|
|
20621
20697
|
try {
|
|
20622
20698
|
proc = (0, import_child_process20.spawn)(strategy.command, strategy.args, { env: process.env });
|
|
20623
20699
|
} catch (err) {
|
|
20624
|
-
|
|
20700
|
+
resolve8({ ok: false, code: -1, stderr: err.message });
|
|
20625
20701
|
return;
|
|
20626
20702
|
}
|
|
20627
20703
|
let stderr = "";
|
|
20628
20704
|
proc.stderr?.on("data", (c2) => {
|
|
20629
20705
|
stderr += c2.toString();
|
|
20630
20706
|
});
|
|
20631
|
-
proc.on("error", (err) =>
|
|
20707
|
+
proc.on("error", (err) => resolve8({ ok: false, code: -1, stderr: err.message }));
|
|
20632
20708
|
proc.on(
|
|
20633
20709
|
"close",
|
|
20634
|
-
(code) =>
|
|
20710
|
+
(code) => resolve8({ ok: code === 0, code: code ?? -1, stderr })
|
|
20635
20711
|
);
|
|
20636
20712
|
});
|
|
20637
20713
|
}
|
|
@@ -20800,14 +20876,14 @@ var _doltInstallSpawnSeam = {
|
|
|
20800
20876
|
};
|
|
20801
20877
|
var DOLT_INSTALL_TIMEOUT_MS = 12e4;
|
|
20802
20878
|
function _defaultDoltInstallSpawn(strategy) {
|
|
20803
|
-
return new Promise((
|
|
20879
|
+
return new Promise((resolve8) => {
|
|
20804
20880
|
let settled = false;
|
|
20805
20881
|
let timer;
|
|
20806
20882
|
const finish = (r) => {
|
|
20807
20883
|
if (settled) return;
|
|
20808
20884
|
settled = true;
|
|
20809
20885
|
if (timer) clearTimeout(timer);
|
|
20810
|
-
|
|
20886
|
+
resolve8(r);
|
|
20811
20887
|
};
|
|
20812
20888
|
let proc;
|
|
20813
20889
|
try {
|
|
@@ -22466,16 +22542,16 @@ async function runNpmInstallLatest() {
|
|
|
22466
22542
|
const useShell = process.platform === "win32";
|
|
22467
22543
|
const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
|
|
22468
22544
|
for (let attempt = 1; attempt <= CLI_UPDATE_MAX_ATTEMPTS; attempt++) {
|
|
22469
|
-
const result = await new Promise((
|
|
22545
|
+
const result = await new Promise((resolve8) => {
|
|
22470
22546
|
(0, import_child_process24.execFile)(
|
|
22471
22547
|
command2,
|
|
22472
22548
|
invocation.args,
|
|
22473
22549
|
{ timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
|
|
22474
22550
|
(err, _stdout, stderr) => {
|
|
22475
22551
|
if (!err) {
|
|
22476
|
-
|
|
22552
|
+
resolve8({ ok: true });
|
|
22477
22553
|
} else {
|
|
22478
|
-
|
|
22554
|
+
resolve8({ ok: false, error: (stderr || err.message).slice(0, 300) });
|
|
22479
22555
|
}
|
|
22480
22556
|
}
|
|
22481
22557
|
);
|
|
@@ -23064,7 +23140,7 @@ function buildKeepAlive(ctx) {
|
|
|
23064
23140
|
let timer = null;
|
|
23065
23141
|
async function setIdleTimeout(minutes) {
|
|
23066
23142
|
if (!ctx.inCodespace || !ctx.codespaceName) return;
|
|
23067
|
-
await new Promise((
|
|
23143
|
+
await new Promise((resolve8) => {
|
|
23068
23144
|
const proc = (0, import_child_process25.spawn)(
|
|
23069
23145
|
"gh",
|
|
23070
23146
|
[
|
|
@@ -23078,8 +23154,8 @@ function buildKeepAlive(ctx) {
|
|
|
23078
23154
|
{ stdio: "ignore", detached: true }
|
|
23079
23155
|
);
|
|
23080
23156
|
proc.unref();
|
|
23081
|
-
proc.on("exit", () =>
|
|
23082
|
-
proc.on("error", () =>
|
|
23157
|
+
proc.on("exit", () => resolve8());
|
|
23158
|
+
proc.on("error", () => resolve8());
|
|
23083
23159
|
});
|
|
23084
23160
|
}
|
|
23085
23161
|
return {
|
|
@@ -23580,10 +23656,10 @@ function wrapWithHeadroom(launch, opts) {
|
|
|
23580
23656
|
var _present;
|
|
23581
23657
|
function headroomPresent() {
|
|
23582
23658
|
if (_present !== void 0) return Promise.resolve(_present);
|
|
23583
|
-
return new Promise((
|
|
23659
|
+
return new Promise((resolve8) => {
|
|
23584
23660
|
(0, import_node_child_process24.execFile)("headroom", ["--version"], (err) => {
|
|
23585
23661
|
_present = !err;
|
|
23586
|
-
|
|
23662
|
+
resolve8(_present);
|
|
23587
23663
|
});
|
|
23588
23664
|
});
|
|
23589
23665
|
}
|
|
@@ -23973,7 +24049,7 @@ function resolveClaudeNativeBinary(deps = {}) {
|
|
|
23973
24049
|
const candidate = import_path8.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
23974
24050
|
return existsSync27(candidate) ? candidate : null;
|
|
23975
24051
|
}
|
|
23976
|
-
var realSleep = (ms) => new Promise((
|
|
24052
|
+
var realSleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
23977
24053
|
async function waitForClaudeNativeBinary(opts = {}) {
|
|
23978
24054
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
23979
24055
|
const pollMs = opts.pollMs ?? 500;
|
|
@@ -24054,7 +24130,7 @@ var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no lo
|
|
|
24054
24130
|
function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
24055
24131
|
const livenessMs = opts.livenessMs ?? 400;
|
|
24056
24132
|
const spawnFn = opts.spawnFn ?? import_child_process26.spawn;
|
|
24057
|
-
return new Promise((
|
|
24133
|
+
return new Promise((resolve8) => {
|
|
24058
24134
|
let settled = false;
|
|
24059
24135
|
let stderr = "";
|
|
24060
24136
|
let timer;
|
|
@@ -24067,12 +24143,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
|
24067
24143
|
child?.kill("SIGKILL");
|
|
24068
24144
|
} catch {
|
|
24069
24145
|
}
|
|
24070
|
-
|
|
24146
|
+
resolve8(r);
|
|
24071
24147
|
};
|
|
24072
24148
|
try {
|
|
24073
24149
|
child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
|
|
24074
24150
|
} catch {
|
|
24075
|
-
|
|
24151
|
+
resolve8("ok");
|
|
24076
24152
|
return;
|
|
24077
24153
|
}
|
|
24078
24154
|
child.stderr?.on("data", (d3) => {
|
|
@@ -24123,10 +24199,10 @@ function augmentPath2() {
|
|
|
24123
24199
|
if (!parts.includes(dir)) process.env.PATH = `${dir}:${process.env.PATH ?? ""}`;
|
|
24124
24200
|
}
|
|
24125
24201
|
async function runInstaller2() {
|
|
24126
|
-
return new Promise((
|
|
24202
|
+
return new Promise((resolve8) => {
|
|
24127
24203
|
const proc = (0, import_node_child_process25.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL2} | bash`], { stdio: "inherit" });
|
|
24128
|
-
proc.on("close", (code) =>
|
|
24129
|
-
proc.on("error", () =>
|
|
24204
|
+
proc.on("close", (code) => resolve8(code === 0));
|
|
24205
|
+
proc.on("error", () => resolve8(false));
|
|
24130
24206
|
});
|
|
24131
24207
|
}
|
|
24132
24208
|
async function ensureKimiInstalled() {
|
|
@@ -24350,7 +24426,7 @@ function parseJsonl(filePath) {
|
|
|
24350
24426
|
return messages;
|
|
24351
24427
|
}
|
|
24352
24428
|
function post(endpoint, body, pluginAuthToken) {
|
|
24353
|
-
return new Promise((
|
|
24429
|
+
return new Promise((resolve8) => {
|
|
24354
24430
|
const payload = JSON.stringify(body);
|
|
24355
24431
|
const u2 = new URL(`${API_BASE8}${endpoint}`);
|
|
24356
24432
|
const transport = u2.protocol === "https:" ? https7 : http6;
|
|
@@ -24375,17 +24451,17 @@ function post(endpoint, body, pluginAuthToken) {
|
|
|
24375
24451
|
res.resume();
|
|
24376
24452
|
const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
|
|
24377
24453
|
if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
|
|
24378
|
-
|
|
24454
|
+
resolve8(ok);
|
|
24379
24455
|
}
|
|
24380
24456
|
);
|
|
24381
24457
|
req.on("error", (err) => {
|
|
24382
24458
|
log.warn("history:post", `${endpoint} network error`, err);
|
|
24383
|
-
|
|
24459
|
+
resolve8(false);
|
|
24384
24460
|
});
|
|
24385
24461
|
req.on("timeout", () => {
|
|
24386
24462
|
log.warn("history:post", `${endpoint} timeout after 15s`);
|
|
24387
24463
|
req.destroy();
|
|
24388
|
-
|
|
24464
|
+
resolve8(false);
|
|
24389
24465
|
});
|
|
24390
24466
|
req.write(payload);
|
|
24391
24467
|
req.end();
|
|
@@ -27035,8 +27111,8 @@ var Connection = class {
|
|
|
27035
27111
|
this.requestHandler = requestHandler;
|
|
27036
27112
|
this.notificationHandler = notificationHandler;
|
|
27037
27113
|
this.stream = stream;
|
|
27038
|
-
this.closedPromise = new Promise((
|
|
27039
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
27114
|
+
this.closedPromise = new Promise((resolve8) => {
|
|
27115
|
+
this.abortController.signal.addEventListener("abort", () => resolve8());
|
|
27040
27116
|
});
|
|
27041
27117
|
void this.receive();
|
|
27042
27118
|
}
|
|
@@ -27206,11 +27282,11 @@ var Connection = class {
|
|
|
27206
27282
|
return rejectedPromise(this.closedReason());
|
|
27207
27283
|
}
|
|
27208
27284
|
const id = this.nextRequestId++;
|
|
27209
|
-
const responsePromise = new Promise((
|
|
27285
|
+
const responsePromise = new Promise((resolve8, reject) => {
|
|
27210
27286
|
this.pendingResponses.set(id, {
|
|
27211
27287
|
resolve: (response) => {
|
|
27212
27288
|
try {
|
|
27213
|
-
|
|
27289
|
+
resolve8(mapResponse ? mapResponse(response) : response);
|
|
27214
27290
|
} catch (error) {
|
|
27215
27291
|
reject(error);
|
|
27216
27292
|
}
|
|
@@ -27877,14 +27953,14 @@ var AcpClient = class {
|
|
|
27877
27953
|
this.sessionId = null;
|
|
27878
27954
|
try {
|
|
27879
27955
|
child.kill("SIGTERM");
|
|
27880
|
-
const grace = new Promise((
|
|
27956
|
+
const grace = new Promise((resolve8) => {
|
|
27881
27957
|
const t2 = setTimeout(() => {
|
|
27882
27958
|
killQuiet(child, "SIGKILL");
|
|
27883
|
-
|
|
27959
|
+
resolve8();
|
|
27884
27960
|
}, 2e3);
|
|
27885
27961
|
child.once("exit", () => {
|
|
27886
27962
|
clearTimeout(t2);
|
|
27887
|
-
|
|
27963
|
+
resolve8();
|
|
27888
27964
|
});
|
|
27889
27965
|
});
|
|
27890
27966
|
await grace;
|
|
@@ -28102,7 +28178,7 @@ var _transport4 = {
|
|
|
28102
28178
|
get: _get
|
|
28103
28179
|
};
|
|
28104
28180
|
function _post3(url, headers, payload) {
|
|
28105
|
-
return new Promise((
|
|
28181
|
+
return new Promise((resolve8, reject) => {
|
|
28106
28182
|
let settled = false;
|
|
28107
28183
|
const u2 = new URL(url);
|
|
28108
28184
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -28127,7 +28203,7 @@ function _post3(url, headers, payload) {
|
|
|
28127
28203
|
res.on("end", () => {
|
|
28128
28204
|
if (settled) return;
|
|
28129
28205
|
settled = true;
|
|
28130
|
-
|
|
28206
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
28131
28207
|
});
|
|
28132
28208
|
}
|
|
28133
28209
|
);
|
|
@@ -28144,7 +28220,7 @@ function _post3(url, headers, payload) {
|
|
|
28144
28220
|
});
|
|
28145
28221
|
}
|
|
28146
28222
|
function _get(url, headers) {
|
|
28147
|
-
return new Promise((
|
|
28223
|
+
return new Promise((resolve8, reject) => {
|
|
28148
28224
|
let settled = false;
|
|
28149
28225
|
const u2 = new URL(url);
|
|
28150
28226
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -28168,7 +28244,7 @@ function _get(url, headers) {
|
|
|
28168
28244
|
res.on("end", () => {
|
|
28169
28245
|
if (settled) return;
|
|
28170
28246
|
settled = true;
|
|
28171
|
-
|
|
28247
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
28172
28248
|
});
|
|
28173
28249
|
}
|
|
28174
28250
|
);
|
|
@@ -28949,12 +29025,12 @@ function runGit3(cwd, args2) {
|
|
|
28949
29025
|
return _runGitImpl2.run(cwd, args2);
|
|
28950
29026
|
}
|
|
28951
29027
|
function defaultRunGit(cwd, args2) {
|
|
28952
|
-
return new Promise((
|
|
29028
|
+
return new Promise((resolve8) => {
|
|
28953
29029
|
let proc;
|
|
28954
29030
|
try {
|
|
28955
29031
|
proc = (0, import_child_process28.spawn)("git", args2, { cwd, env: process.env });
|
|
28956
29032
|
} catch {
|
|
28957
|
-
|
|
29033
|
+
resolve8(null);
|
|
28958
29034
|
return;
|
|
28959
29035
|
}
|
|
28960
29036
|
let stdout = "";
|
|
@@ -28965,16 +29041,16 @@ function defaultRunGit(cwd, args2) {
|
|
|
28965
29041
|
proc.stderr?.on("data", (c2) => {
|
|
28966
29042
|
stderr += c2.toString();
|
|
28967
29043
|
});
|
|
28968
|
-
proc.on("error", () =>
|
|
29044
|
+
proc.on("error", () => resolve8(null));
|
|
28969
29045
|
proc.on("close", (code) => {
|
|
28970
29046
|
if (code === 0) {
|
|
28971
|
-
|
|
29047
|
+
resolve8(stdout);
|
|
28972
29048
|
} else {
|
|
28973
29049
|
log.trace(
|
|
28974
29050
|
"turnFiles",
|
|
28975
29051
|
`git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
|
|
28976
29052
|
);
|
|
28977
|
-
|
|
29053
|
+
resolve8(null);
|
|
28978
29054
|
}
|
|
28979
29055
|
});
|
|
28980
29056
|
});
|
|
@@ -29362,25 +29438,25 @@ function baselineKey(entry) {
|
|
|
29362
29438
|
|
|
29363
29439
|
// src/agents/acp/withTimeout.ts
|
|
29364
29440
|
function withTimeout(p2, ms) {
|
|
29365
|
-
return new Promise((
|
|
29441
|
+
return new Promise((resolve8) => {
|
|
29366
29442
|
let settled = false;
|
|
29367
29443
|
const timer = setTimeout(() => {
|
|
29368
29444
|
if (settled) return;
|
|
29369
29445
|
settled = true;
|
|
29370
|
-
|
|
29446
|
+
resolve8(void 0);
|
|
29371
29447
|
}, ms);
|
|
29372
29448
|
p2.then(
|
|
29373
29449
|
(v) => {
|
|
29374
29450
|
if (settled) return;
|
|
29375
29451
|
settled = true;
|
|
29376
29452
|
clearTimeout(timer);
|
|
29377
|
-
|
|
29453
|
+
resolve8(v);
|
|
29378
29454
|
},
|
|
29379
29455
|
() => {
|
|
29380
29456
|
if (settled) return;
|
|
29381
29457
|
settled = true;
|
|
29382
29458
|
clearTimeout(timer);
|
|
29383
|
-
|
|
29459
|
+
resolve8(void 0);
|
|
29384
29460
|
}
|
|
29385
29461
|
);
|
|
29386
29462
|
});
|
|
@@ -30251,7 +30327,7 @@ var StreamingState = class {
|
|
|
30251
30327
|
* default-reject. Caller is the SDK's `onRequestPermission`.
|
|
30252
30328
|
*/
|
|
30253
30329
|
registerPermission(args2) {
|
|
30254
|
-
return new Promise((
|
|
30330
|
+
return new Promise((resolve8) => {
|
|
30255
30331
|
const timeoutTimer = setTimeout(() => {
|
|
30256
30332
|
if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
|
|
30257
30333
|
log.warn(
|
|
@@ -30259,7 +30335,7 @@ var StreamingState = class {
|
|
|
30259
30335
|
`permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
|
|
30260
30336
|
);
|
|
30261
30337
|
this.pending = null;
|
|
30262
|
-
|
|
30338
|
+
resolve8({ outcome: { outcome: "cancelled" } });
|
|
30263
30339
|
}
|
|
30264
30340
|
}, PERMISSION_TIMEOUT_MS);
|
|
30265
30341
|
this.pending = {
|
|
@@ -30267,7 +30343,7 @@ var StreamingState = class {
|
|
|
30267
30343
|
questionId: args2.questionId,
|
|
30268
30344
|
labels: args2.labels,
|
|
30269
30345
|
optionIdByLabel: args2.optionIdByLabel,
|
|
30270
|
-
resolve:
|
|
30346
|
+
resolve: resolve8,
|
|
30271
30347
|
timeoutTimer
|
|
30272
30348
|
};
|
|
30273
30349
|
});
|
|
@@ -30299,14 +30375,14 @@ var StreamingState = class {
|
|
|
30299
30375
|
const label = this.pending.labels[index];
|
|
30300
30376
|
const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
|
|
30301
30377
|
clearTimeout(this.pending.timeoutTimer);
|
|
30302
|
-
const
|
|
30378
|
+
const resolve8 = this.pending.resolve;
|
|
30303
30379
|
this.pending = null;
|
|
30304
30380
|
if (!optionId) {
|
|
30305
30381
|
log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
|
|
30306
|
-
|
|
30382
|
+
resolve8({ outcome: { outcome: "cancelled" } });
|
|
30307
30383
|
return { kind: "resolved" };
|
|
30308
30384
|
}
|
|
30309
|
-
|
|
30385
|
+
resolve8({ outcome: { outcome: "selected", optionId } });
|
|
30310
30386
|
return { kind: "resolved" };
|
|
30311
30387
|
}
|
|
30312
30388
|
const text = this.pending.options[index];
|
|
@@ -32178,10 +32254,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
|
|
|
32178
32254
|
this.lastOutput = this.now();
|
|
32179
32255
|
}
|
|
32180
32256
|
whenSafeToYield() {
|
|
32181
|
-
return new Promise((
|
|
32257
|
+
return new Promise((resolve8) => {
|
|
32182
32258
|
const tick = () => {
|
|
32183
32259
|
const quietFor = this.now() - this.lastOutput;
|
|
32184
|
-
if (quietFor >= this.idleMs)
|
|
32260
|
+
if (quietFor >= this.idleMs) resolve8();
|
|
32185
32261
|
else setTimeout(tick, this.idleMs - quietFor);
|
|
32186
32262
|
};
|
|
32187
32263
|
tick();
|
|
@@ -32318,11 +32394,11 @@ var AcpDriver = class {
|
|
|
32318
32394
|
this.turnActive = false;
|
|
32319
32395
|
const waiters = this.waiters;
|
|
32320
32396
|
this.waiters = [];
|
|
32321
|
-
waiters.forEach((
|
|
32397
|
+
waiters.forEach((resolve8) => resolve8());
|
|
32322
32398
|
}
|
|
32323
32399
|
whenSafeToYield() {
|
|
32324
32400
|
if (!this.turnActive) return Promise.resolve();
|
|
32325
|
-
return new Promise((
|
|
32401
|
+
return new Promise((resolve8) => this.waiters.push(resolve8));
|
|
32326
32402
|
}
|
|
32327
32403
|
};
|
|
32328
32404
|
|
|
@@ -32813,8 +32889,8 @@ async function start(requestedAgent) {
|
|
|
32813
32889
|
let gateTimer;
|
|
32814
32890
|
await Promise.race([
|
|
32815
32891
|
Promise.all([beadsReady.catch(() => null), depsReady, agentBinaryReady]),
|
|
32816
|
-
new Promise((
|
|
32817
|
-
gateTimer = setTimeout(
|
|
32892
|
+
new Promise((resolve8) => {
|
|
32893
|
+
gateTimer = setTimeout(resolve8, GATE_TIMEOUT_MS);
|
|
32818
32894
|
})
|
|
32819
32895
|
]);
|
|
32820
32896
|
if (gateTimer) clearTimeout(gateTimer);
|
|
@@ -33139,7 +33215,7 @@ async function pair(args2 = []) {
|
|
|
33139
33215
|
waitSpin.message(waitMessage());
|
|
33140
33216
|
}, 1e3);
|
|
33141
33217
|
countdownInterval.unref?.();
|
|
33142
|
-
await new Promise((
|
|
33218
|
+
await new Promise((resolve8) => {
|
|
33143
33219
|
let stopPolling = null;
|
|
33144
33220
|
function sigintHandler() {
|
|
33145
33221
|
clearInterval(countdownInterval);
|
|
@@ -33190,7 +33266,7 @@ async function pair(args2 = []) {
|
|
|
33190
33266
|
pluginAuthToken: info.pluginAuthToken
|
|
33191
33267
|
});
|
|
33192
33268
|
}
|
|
33193
|
-
|
|
33269
|
+
resolve8();
|
|
33194
33270
|
},
|
|
33195
33271
|
() => {
|
|
33196
33272
|
clearInterval(countdownInterval);
|
|
@@ -33419,12 +33495,12 @@ var GitHubCodespacesProvider = class {
|
|
|
33419
33495
|
}
|
|
33420
33496
|
if (!isAuthed) {
|
|
33421
33497
|
resetStdinForChild();
|
|
33422
|
-
await new Promise((
|
|
33498
|
+
await new Promise((resolve8, reject) => {
|
|
33423
33499
|
const proc = (0, import_child_process29.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
|
|
33424
33500
|
stdio: "inherit"
|
|
33425
33501
|
});
|
|
33426
33502
|
proc.on("exit", (code) => {
|
|
33427
|
-
if (code === 0)
|
|
33503
|
+
if (code === 0) resolve8();
|
|
33428
33504
|
else reject(new Error("gh auth login failed."));
|
|
33429
33505
|
});
|
|
33430
33506
|
proc.on("error", reject);
|
|
@@ -33453,13 +33529,13 @@ var GitHubCodespacesProvider = class {
|
|
|
33453
33529
|
}
|
|
33454
33530
|
wt(noteLines.join("\n"), "One more permission needed");
|
|
33455
33531
|
resetStdinForChild();
|
|
33456
|
-
const refreshCode = await new Promise((
|
|
33532
|
+
const refreshCode = await new Promise((resolve8, reject) => {
|
|
33457
33533
|
const proc = (0, import_child_process29.spawn)(
|
|
33458
33534
|
"gh",
|
|
33459
33535
|
["auth", "refresh", "-h", "github.com", "-s", "codespace"],
|
|
33460
33536
|
{ stdio: "inherit" }
|
|
33461
33537
|
);
|
|
33462
|
-
proc.on("exit", (code) =>
|
|
33538
|
+
proc.on("exit", (code) => resolve8(code ?? 1));
|
|
33463
33539
|
proc.on("error", reject);
|
|
33464
33540
|
});
|
|
33465
33541
|
if (refreshCode !== 0) {
|
|
@@ -33603,10 +33679,10 @@ var GitHubCodespacesProvider = class {
|
|
|
33603
33679
|
if (q(proceed) || !proceed) return;
|
|
33604
33680
|
O2.step(`Installing gh via ${installCmd.describe}\u2026`);
|
|
33605
33681
|
resetStdinForChild();
|
|
33606
|
-
const ok = await new Promise((
|
|
33682
|
+
const ok = await new Promise((resolve8) => {
|
|
33607
33683
|
const proc = (0, import_child_process29.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
|
|
33608
|
-
proc.on("exit", (code) =>
|
|
33609
|
-
proc.on("error", () =>
|
|
33684
|
+
proc.on("exit", (code) => resolve8(code === 0));
|
|
33685
|
+
proc.on("error", () => resolve8(false));
|
|
33610
33686
|
});
|
|
33611
33687
|
if (ok) O2.success("gh installed");
|
|
33612
33688
|
else O2.error("gh install failed");
|
|
@@ -33630,14 +33706,14 @@ var GitHubCodespacesProvider = class {
|
|
|
33630
33706
|
"Expanding GitHub scopes"
|
|
33631
33707
|
);
|
|
33632
33708
|
resetStdinForChild();
|
|
33633
|
-
await new Promise((
|
|
33709
|
+
await new Promise((resolve8, reject) => {
|
|
33634
33710
|
const proc = (0, import_child_process29.spawn)(
|
|
33635
33711
|
"gh",
|
|
33636
33712
|
["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
|
|
33637
33713
|
{ stdio: "inherit" }
|
|
33638
33714
|
);
|
|
33639
33715
|
proc.on("exit", (code) => {
|
|
33640
|
-
if (code === 0)
|
|
33716
|
+
if (code === 0) resolve8();
|
|
33641
33717
|
else reject(new Error(
|
|
33642
33718
|
"gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
|
|
33643
33719
|
));
|
|
@@ -33808,13 +33884,13 @@ var GitHubCodespacesProvider = class {
|
|
|
33808
33884
|
}
|
|
33809
33885
|
async streamCommand(workspaceId, command2) {
|
|
33810
33886
|
resetStdinForChild();
|
|
33811
|
-
return new Promise((
|
|
33887
|
+
return new Promise((resolve8, reject) => {
|
|
33812
33888
|
const proc = (0, import_child_process29.spawn)(
|
|
33813
33889
|
"gh",
|
|
33814
33890
|
["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
|
|
33815
33891
|
{ stdio: "inherit" }
|
|
33816
33892
|
);
|
|
33817
|
-
proc.on("exit", (code) =>
|
|
33893
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
33818
33894
|
proc.on("error", reject);
|
|
33819
33895
|
});
|
|
33820
33896
|
}
|
|
@@ -33835,7 +33911,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33835
33911
|
"--",
|
|
33836
33912
|
`mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
|
|
33837
33913
|
];
|
|
33838
|
-
await new Promise((
|
|
33914
|
+
await new Promise((resolve8, reject) => {
|
|
33839
33915
|
const tar = (0, import_child_process29.spawn)("tar", tarArgs, {
|
|
33840
33916
|
stdio: ["ignore", "pipe", "pipe"],
|
|
33841
33917
|
env: tarEnv
|
|
@@ -33855,7 +33931,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33855
33931
|
ssh.on("error", reject);
|
|
33856
33932
|
ssh.on("exit", (code) => {
|
|
33857
33933
|
if (code === 0) {
|
|
33858
|
-
|
|
33934
|
+
resolve8();
|
|
33859
33935
|
} else {
|
|
33860
33936
|
const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
|
|
33861
33937
|
reject(new Error(`Remote tar failed: ${reason}`));
|
|
@@ -33873,7 +33949,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33873
33949
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
|
|
33874
33950
|
}
|
|
33875
33951
|
const cmd = parts.join(" && ");
|
|
33876
|
-
await new Promise((
|
|
33952
|
+
await new Promise((resolve8, reject) => {
|
|
33877
33953
|
const proc = (0, import_child_process29.spawn)(
|
|
33878
33954
|
"gh",
|
|
33879
33955
|
["codespace", "ssh", "-c", workspaceId, "--", cmd],
|
|
@@ -33885,7 +33961,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33885
33961
|
});
|
|
33886
33962
|
proc.on("error", reject);
|
|
33887
33963
|
proc.on("exit", (code) => {
|
|
33888
|
-
if (code === 0)
|
|
33964
|
+
if (code === 0) resolve8();
|
|
33889
33965
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
33890
33966
|
});
|
|
33891
33967
|
proc.stdin?.write(contents);
|
|
@@ -33975,10 +34051,10 @@ var GitpodProvider = class {
|
|
|
33975
34051
|
"Authenticating Gitpod"
|
|
33976
34052
|
);
|
|
33977
34053
|
resetStdinForChild2();
|
|
33978
|
-
await new Promise((
|
|
34054
|
+
await new Promise((resolve8, reject) => {
|
|
33979
34055
|
const proc = (0, import_child_process30.spawn)("gitpod", ["login"], { stdio: "inherit" });
|
|
33980
34056
|
proc.on("exit", (code) => {
|
|
33981
|
-
if (code === 0)
|
|
34057
|
+
if (code === 0) resolve8();
|
|
33982
34058
|
else reject(new Error("gitpod login failed."));
|
|
33983
34059
|
});
|
|
33984
34060
|
proc.on("error", reject);
|
|
@@ -34127,13 +34203,13 @@ var GitpodProvider = class {
|
|
|
34127
34203
|
}
|
|
34128
34204
|
async streamCommand(workspaceId, command2) {
|
|
34129
34205
|
resetStdinForChild2();
|
|
34130
|
-
return new Promise((
|
|
34206
|
+
return new Promise((resolve8, reject) => {
|
|
34131
34207
|
const proc = (0, import_child_process30.spawn)(
|
|
34132
34208
|
"gitpod",
|
|
34133
34209
|
["workspace", "ssh", workspaceId, "--", "-tt", command2],
|
|
34134
34210
|
{ stdio: "inherit" }
|
|
34135
34211
|
);
|
|
34136
|
-
proc.on("exit", (code) =>
|
|
34212
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34137
34213
|
proc.on("error", reject);
|
|
34138
34214
|
});
|
|
34139
34215
|
}
|
|
@@ -34147,7 +34223,7 @@ var GitpodProvider = class {
|
|
|
34147
34223
|
tarArgs.push(".");
|
|
34148
34224
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34149
34225
|
const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
|
|
34150
|
-
await new Promise((
|
|
34226
|
+
await new Promise((resolve8, reject) => {
|
|
34151
34227
|
const tar = (0, import_child_process30.spawn)("tar", tarArgs, {
|
|
34152
34228
|
stdio: ["ignore", "pipe", "pipe"],
|
|
34153
34229
|
env: tarEnv
|
|
@@ -34168,7 +34244,7 @@ var GitpodProvider = class {
|
|
|
34168
34244
|
tar.on("error", reject);
|
|
34169
34245
|
ssh.on("error", reject);
|
|
34170
34246
|
ssh.on("exit", (code) => {
|
|
34171
|
-
if (code === 0)
|
|
34247
|
+
if (code === 0) resolve8();
|
|
34172
34248
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34173
34249
|
});
|
|
34174
34250
|
});
|
|
@@ -34183,7 +34259,7 @@ var GitpodProvider = class {
|
|
|
34183
34259
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
|
|
34184
34260
|
}
|
|
34185
34261
|
const cmd = parts.join(" && ");
|
|
34186
|
-
await new Promise((
|
|
34262
|
+
await new Promise((resolve8, reject) => {
|
|
34187
34263
|
const proc = (0, import_child_process30.spawn)(
|
|
34188
34264
|
"gitpod",
|
|
34189
34265
|
["workspace", "ssh", workspaceId, "--", cmd],
|
|
@@ -34195,7 +34271,7 @@ var GitpodProvider = class {
|
|
|
34195
34271
|
});
|
|
34196
34272
|
proc.on("error", reject);
|
|
34197
34273
|
proc.on("exit", (code) => {
|
|
34198
|
-
if (code === 0)
|
|
34274
|
+
if (code === 0) resolve8();
|
|
34199
34275
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34200
34276
|
});
|
|
34201
34277
|
proc.stdin?.write(contents);
|
|
@@ -34252,14 +34328,14 @@ var GitLabWorkspacesProvider = class {
|
|
|
34252
34328
|
"Authenticating GitLab"
|
|
34253
34329
|
);
|
|
34254
34330
|
resetStdinForChild3();
|
|
34255
|
-
await new Promise((
|
|
34331
|
+
await new Promise((resolve8, reject) => {
|
|
34256
34332
|
const proc = (0, import_child_process31.spawn)(
|
|
34257
34333
|
"glab",
|
|
34258
34334
|
["auth", "login", "--scopes", "api,read_user,read_repository"],
|
|
34259
34335
|
{ stdio: "inherit" }
|
|
34260
34336
|
);
|
|
34261
34337
|
proc.on("exit", (code) => {
|
|
34262
|
-
if (code === 0)
|
|
34338
|
+
if (code === 0) resolve8();
|
|
34263
34339
|
else reject(new Error("glab auth login failed."));
|
|
34264
34340
|
});
|
|
34265
34341
|
proc.on("error", reject);
|
|
@@ -34424,13 +34500,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34424
34500
|
async streamCommand(workspaceId, command2) {
|
|
34425
34501
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
34426
34502
|
resetStdinForChild3();
|
|
34427
|
-
return new Promise((
|
|
34503
|
+
return new Promise((resolve8, reject) => {
|
|
34428
34504
|
const proc = (0, import_child_process31.spawn)(
|
|
34429
34505
|
"ssh",
|
|
34430
34506
|
["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
|
|
34431
34507
|
{ stdio: "inherit" }
|
|
34432
34508
|
);
|
|
34433
|
-
proc.on("exit", (code) =>
|
|
34509
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34434
34510
|
proc.on("error", reject);
|
|
34435
34511
|
});
|
|
34436
34512
|
}
|
|
@@ -34445,7 +34521,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34445
34521
|
tarArgs.push(".");
|
|
34446
34522
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34447
34523
|
const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
|
|
34448
|
-
await new Promise((
|
|
34524
|
+
await new Promise((resolve8, reject) => {
|
|
34449
34525
|
const tar = (0, import_child_process31.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
34450
34526
|
const ssh = (0, import_child_process31.spawn)(
|
|
34451
34527
|
"ssh",
|
|
@@ -34463,7 +34539,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34463
34539
|
tar.on("error", reject);
|
|
34464
34540
|
ssh.on("error", reject);
|
|
34465
34541
|
ssh.on("exit", (code) => {
|
|
34466
|
-
if (code === 0)
|
|
34542
|
+
if (code === 0) resolve8();
|
|
34467
34543
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34468
34544
|
});
|
|
34469
34545
|
});
|
|
@@ -34476,7 +34552,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34476
34552
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
34477
34553
|
}
|
|
34478
34554
|
const cmd = parts.join(" && ");
|
|
34479
|
-
await new Promise((
|
|
34555
|
+
await new Promise((resolve8, reject) => {
|
|
34480
34556
|
const proc = (0, import_child_process31.spawn)(
|
|
34481
34557
|
"ssh",
|
|
34482
34558
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
|
|
@@ -34488,7 +34564,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34488
34564
|
});
|
|
34489
34565
|
proc.on("error", reject);
|
|
34490
34566
|
proc.on("exit", (code) => {
|
|
34491
|
-
if (code === 0)
|
|
34567
|
+
if (code === 0) resolve8();
|
|
34492
34568
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34493
34569
|
});
|
|
34494
34570
|
proc.stdin?.write(contents);
|
|
@@ -34579,10 +34655,10 @@ var RailwayProvider = class {
|
|
|
34579
34655
|
"Authenticating Railway"
|
|
34580
34656
|
);
|
|
34581
34657
|
resetStdinForChild4();
|
|
34582
|
-
await new Promise((
|
|
34658
|
+
await new Promise((resolve8, reject) => {
|
|
34583
34659
|
const proc = (0, import_child_process32.spawn)("railway", ["login"], { stdio: "inherit" });
|
|
34584
34660
|
proc.on("exit", (code) => {
|
|
34585
|
-
if (code === 0)
|
|
34661
|
+
if (code === 0) resolve8();
|
|
34586
34662
|
else reject(new Error("railway login failed."));
|
|
34587
34663
|
});
|
|
34588
34664
|
proc.on("error", reject);
|
|
@@ -34722,13 +34798,13 @@ var RailwayProvider = class {
|
|
|
34722
34798
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
34723
34799
|
}
|
|
34724
34800
|
resetStdinForChild4();
|
|
34725
|
-
return new Promise((
|
|
34801
|
+
return new Promise((resolve8, reject) => {
|
|
34726
34802
|
const proc = (0, import_child_process32.spawn)(
|
|
34727
34803
|
"railway",
|
|
34728
34804
|
["shell", "--project", projectId, "--service", serviceId, "--command", command2],
|
|
34729
34805
|
{ stdio: "inherit" }
|
|
34730
34806
|
);
|
|
34731
|
-
proc.on("exit", (code) =>
|
|
34807
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34732
34808
|
proc.on("error", reject);
|
|
34733
34809
|
});
|
|
34734
34810
|
}
|
|
@@ -34746,7 +34822,7 @@ var RailwayProvider = class {
|
|
|
34746
34822
|
tarArgs.push(".");
|
|
34747
34823
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34748
34824
|
const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
|
|
34749
|
-
await new Promise((
|
|
34825
|
+
await new Promise((resolve8, reject) => {
|
|
34750
34826
|
const tar = (0, import_child_process32.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
34751
34827
|
const sh = (0, import_child_process32.spawn)(
|
|
34752
34828
|
"railway",
|
|
@@ -34764,7 +34840,7 @@ var RailwayProvider = class {
|
|
|
34764
34840
|
tar.on("error", reject);
|
|
34765
34841
|
sh.on("error", reject);
|
|
34766
34842
|
sh.on("exit", (code) => {
|
|
34767
|
-
if (code === 0)
|
|
34843
|
+
if (code === 0) resolve8();
|
|
34768
34844
|
else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34769
34845
|
});
|
|
34770
34846
|
});
|
|
@@ -34780,7 +34856,7 @@ var RailwayProvider = class {
|
|
|
34780
34856
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
34781
34857
|
}
|
|
34782
34858
|
const cmd = parts.join(" && ");
|
|
34783
|
-
await new Promise((
|
|
34859
|
+
await new Promise((resolve8, reject) => {
|
|
34784
34860
|
const proc = (0, import_child_process32.spawn)(
|
|
34785
34861
|
"railway",
|
|
34786
34862
|
["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
|
|
@@ -34792,7 +34868,7 @@ var RailwayProvider = class {
|
|
|
34792
34868
|
});
|
|
34793
34869
|
proc.on("error", reject);
|
|
34794
34870
|
proc.on("exit", (code) => {
|
|
34795
|
-
if (code === 0)
|
|
34871
|
+
if (code === 0) resolve8();
|
|
34796
34872
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34797
34873
|
});
|
|
34798
34874
|
proc.stdin?.write(contents);
|
|
@@ -35589,7 +35665,7 @@ function checkChokidar() {
|
|
|
35589
35665
|
}
|
|
35590
35666
|
async function doctor(args2 = []) {
|
|
35591
35667
|
const json = args2.includes("--json");
|
|
35592
|
-
const cliVersion = true ? "2.61.
|
|
35668
|
+
const cliVersion = true ? "2.61.3" : "0.0.0-dev";
|
|
35593
35669
|
const apiBase2 = resolveApiBaseUrl();
|
|
35594
35670
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
35595
35671
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -35868,11 +35944,11 @@ var RestartableStdioProxy = class {
|
|
|
35868
35944
|
rl.on("close", () => this.child?.stdin?.end());
|
|
35869
35945
|
const timer = setInterval(() => this.checkRestart(stdout), RESTART_CHECK_INTERVAL_MS);
|
|
35870
35946
|
timer.unref();
|
|
35871
|
-
return new Promise((
|
|
35947
|
+
return new Promise((resolve8) => {
|
|
35872
35948
|
this.ended = (code) => {
|
|
35873
35949
|
clearInterval(timer);
|
|
35874
35950
|
process.exitCode = code;
|
|
35875
|
-
|
|
35951
|
+
resolve8();
|
|
35876
35952
|
};
|
|
35877
35953
|
});
|
|
35878
35954
|
}
|
|
@@ -36100,7 +36176,7 @@ async function mcpRun(args2) {
|
|
|
36100
36176
|
// src/commands/version.ts
|
|
36101
36177
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
36102
36178
|
function version2() {
|
|
36103
|
-
const v = true ? "2.61.
|
|
36179
|
+
const v = true ? "2.61.3" : "unknown";
|
|
36104
36180
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
36105
36181
|
}
|
|
36106
36182
|
|