codeam-cli 2.61.1 → 2.61.2
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 +10 -0
- package/dist/index.js +265 -222
- 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.2" : "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.2",
|
|
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.2" ? { ideVersion: "2.61.2" } : {}
|
|
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,12 @@ 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((
|
|
13767
|
+
const ok = await new Promise((resolve8) => {
|
|
13763
13768
|
const proc = (0, import_node_child_process6.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL} | sh`], {
|
|
13764
13769
|
stdio: "inherit"
|
|
13765
13770
|
});
|
|
13766
|
-
proc.on("close", (code) =>
|
|
13767
|
-
proc.on("error", () =>
|
|
13771
|
+
proc.on("close", (code) => resolve8(code === 0));
|
|
13772
|
+
proc.on("error", () => resolve8(false));
|
|
13768
13773
|
});
|
|
13769
13774
|
if (!ok) return false;
|
|
13770
13775
|
os53.augmentPath([`${os53.homeDir()}/.local/bin`, "/opt/homebrew/bin"]);
|
|
@@ -14063,7 +14068,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
14063
14068
|
}
|
|
14064
14069
|
async runOneShot(input) {
|
|
14065
14070
|
const launch = await this.prepareInvocation(input);
|
|
14066
|
-
return new Promise((
|
|
14071
|
+
return new Promise((resolve8, reject) => {
|
|
14067
14072
|
const stdoutBuf = [];
|
|
14068
14073
|
const stderrBuf = [];
|
|
14069
14074
|
const proc = (0, import_node_child_process8.spawn)(launch.cmd, launch.args, {
|
|
@@ -14075,7 +14080,7 @@ var CoderabbitRuntimeStrategy = class {
|
|
|
14075
14080
|
if (settled) return;
|
|
14076
14081
|
settled = true;
|
|
14077
14082
|
clearTimeout(timer);
|
|
14078
|
-
|
|
14083
|
+
resolve8(out2);
|
|
14079
14084
|
};
|
|
14080
14085
|
const timer = setTimeout(() => {
|
|
14081
14086
|
if (settled) return;
|
|
@@ -15206,7 +15211,7 @@ function newestSessionSince(bucket, floorMs) {
|
|
|
15206
15211
|
return bestId;
|
|
15207
15212
|
}
|
|
15208
15213
|
function sleep3(ms) {
|
|
15209
|
-
return new Promise((
|
|
15214
|
+
return new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
15210
15215
|
}
|
|
15211
15216
|
function joinTextParts(parts) {
|
|
15212
15217
|
if (!Array.isArray(parts)) return "";
|
|
@@ -15538,7 +15543,7 @@ async function link(args2 = []) {
|
|
|
15538
15543
|
waitSpin.start(waitMsg());
|
|
15539
15544
|
const countdown = setInterval(() => waitSpin.message(waitMsg()), 1e3);
|
|
15540
15545
|
countdown.unref?.();
|
|
15541
|
-
const paired = await new Promise((
|
|
15546
|
+
const paired = await new Promise((resolve8, reject) => {
|
|
15542
15547
|
let stopPoll = null;
|
|
15543
15548
|
const sigint = () => {
|
|
15544
15549
|
clearInterval(countdown);
|
|
@@ -15551,7 +15556,7 @@ async function link(args2 = []) {
|
|
|
15551
15556
|
process.removeListener("SIGINT", sigint);
|
|
15552
15557
|
clearInterval(countdown);
|
|
15553
15558
|
waitSpin.stop("Paired");
|
|
15554
|
-
|
|
15559
|
+
resolve8(info);
|
|
15555
15560
|
},
|
|
15556
15561
|
() => {
|
|
15557
15562
|
clearInterval(countdown);
|
|
@@ -15709,14 +15714,14 @@ async function captureFreshCredentials(ctx) {
|
|
|
15709
15714
|
}
|
|
15710
15715
|
};
|
|
15711
15716
|
try {
|
|
15712
|
-
const token = await new Promise((
|
|
15717
|
+
const token = await new Promise((resolve8, reject) => {
|
|
15713
15718
|
let settled = false;
|
|
15714
15719
|
const tryExtract = async () => {
|
|
15715
15720
|
if (settled) return;
|
|
15716
15721
|
const t2 = await ctx.locator.extract();
|
|
15717
15722
|
if (t2 && !settled) {
|
|
15718
15723
|
settled = true;
|
|
15719
|
-
|
|
15724
|
+
resolve8(t2);
|
|
15720
15725
|
}
|
|
15721
15726
|
};
|
|
15722
15727
|
watcher.on("add", () => void tryExtract());
|
|
@@ -15925,7 +15930,7 @@ function deliverPendingCoderabbitCallback(callbackUrl) {
|
|
|
15925
15930
|
function runCoderabbitOAuthLogin(deps) {
|
|
15926
15931
|
const timeoutMs = deps.timeoutMs ?? 18e4;
|
|
15927
15932
|
const spawnProc = deps.spawn ?? spawnCoderabbitLoginProc;
|
|
15928
|
-
return new Promise((
|
|
15933
|
+
return new Promise((resolve8) => {
|
|
15929
15934
|
let settled = false;
|
|
15930
15935
|
let stdout = "";
|
|
15931
15936
|
let last = null;
|
|
@@ -15938,13 +15943,13 @@ function runCoderabbitOAuthLogin(deps) {
|
|
|
15938
15943
|
child.kill("SIGKILL");
|
|
15939
15944
|
} catch {
|
|
15940
15945
|
}
|
|
15941
|
-
|
|
15946
|
+
resolve8(r);
|
|
15942
15947
|
};
|
|
15943
15948
|
let child;
|
|
15944
15949
|
try {
|
|
15945
15950
|
child = spawnProc("coderabbit", ["auth", "login", "--agent"]);
|
|
15946
15951
|
} catch (err) {
|
|
15947
|
-
|
|
15952
|
+
resolve8({ ok: false, error: err instanceof Error ? err.message : "spawn failed" });
|
|
15948
15953
|
return;
|
|
15949
15954
|
}
|
|
15950
15955
|
const timer = setTimeout(
|
|
@@ -17041,7 +17046,7 @@ var defaultGitToolingRunner = {
|
|
|
17041
17046
|
}
|
|
17042
17047
|
},
|
|
17043
17048
|
run(cmd, args2, opts = {}) {
|
|
17044
|
-
return new Promise((
|
|
17049
|
+
return new Promise((resolve8) => {
|
|
17045
17050
|
const child = (0, import_node_child_process18.spawn)(cmd, args2, {
|
|
17046
17051
|
stdio: [opts.input !== void 0 ? "pipe" : "ignore", "ignore", "pipe"]
|
|
17047
17052
|
});
|
|
@@ -17050,7 +17055,7 @@ var defaultGitToolingRunner = {
|
|
|
17050
17055
|
const done = (code) => {
|
|
17051
17056
|
if (settled) return;
|
|
17052
17057
|
settled = true;
|
|
17053
|
-
|
|
17058
|
+
resolve8({ code, stderr });
|
|
17054
17059
|
};
|
|
17055
17060
|
child.stderr?.on("data", (b) => {
|
|
17056
17061
|
stderr += b.toString();
|
|
@@ -17208,7 +17213,7 @@ var defaultHeadroomRunner = {
|
|
|
17208
17213
|
}
|
|
17209
17214
|
},
|
|
17210
17215
|
run(cmd, args2, opts = {}) {
|
|
17211
|
-
return new Promise((
|
|
17216
|
+
return new Promise((resolve8) => {
|
|
17212
17217
|
const spawnEnv = opts.env ?? process.env;
|
|
17213
17218
|
const child = (0, import_node_child_process19.spawn)(cmd, args2, { stdio: ["ignore", "pipe", "pipe"], env: spawnEnv });
|
|
17214
17219
|
let stderrBuf = "";
|
|
@@ -17217,7 +17222,7 @@ var defaultHeadroomRunner = {
|
|
|
17217
17222
|
const done = (code) => {
|
|
17218
17223
|
if (settled) return;
|
|
17219
17224
|
settled = true;
|
|
17220
|
-
|
|
17225
|
+
resolve8({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
17221
17226
|
};
|
|
17222
17227
|
child.stdout?.on("data", (b) => {
|
|
17223
17228
|
const chunk = b.toString();
|
|
@@ -17768,14 +17773,14 @@ function compareSemver(a, b) {
|
|
|
17768
17773
|
return 0;
|
|
17769
17774
|
}
|
|
17770
17775
|
function fetchLatest() {
|
|
17771
|
-
return new Promise((
|
|
17776
|
+
return new Promise((resolve8) => {
|
|
17772
17777
|
const req = https6.get(
|
|
17773
17778
|
REGISTRY_URL,
|
|
17774
17779
|
{ headers: { Accept: "application/json" }, timeout: REQUEST_TIMEOUT_MS },
|
|
17775
17780
|
(res) => {
|
|
17776
17781
|
if (res.statusCode !== 200) {
|
|
17777
17782
|
res.resume();
|
|
17778
|
-
|
|
17783
|
+
resolve8(null);
|
|
17779
17784
|
return;
|
|
17780
17785
|
}
|
|
17781
17786
|
let buf = "";
|
|
@@ -17787,21 +17792,21 @@ function fetchLatest() {
|
|
|
17787
17792
|
try {
|
|
17788
17793
|
const json = JSON.parse(buf);
|
|
17789
17794
|
if (typeof json.version === "string") {
|
|
17790
|
-
|
|
17795
|
+
resolve8(json.version);
|
|
17791
17796
|
} else {
|
|
17792
|
-
|
|
17797
|
+
resolve8(null);
|
|
17793
17798
|
}
|
|
17794
17799
|
} catch {
|
|
17795
|
-
|
|
17800
|
+
resolve8(null);
|
|
17796
17801
|
}
|
|
17797
17802
|
});
|
|
17798
17803
|
}
|
|
17799
17804
|
);
|
|
17800
17805
|
req.on("timeout", () => {
|
|
17801
17806
|
req.destroy();
|
|
17802
|
-
|
|
17807
|
+
resolve8(null);
|
|
17803
17808
|
});
|
|
17804
|
-
req.on("error", () =>
|
|
17809
|
+
req.on("error", () => resolve8(null));
|
|
17805
17810
|
});
|
|
17806
17811
|
}
|
|
17807
17812
|
function notifyIfStale(currentVersion, latest) {
|
|
@@ -17877,7 +17882,7 @@ async function autoUpgradeBeforeCriticalCommand() {
|
|
|
17877
17882
|
if (process.env.NODE_ENV === "test") return;
|
|
17878
17883
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17879
17884
|
if (process.env.CI) return;
|
|
17880
|
-
const current = true ? "2.61.
|
|
17885
|
+
const current = true ? "2.61.2" : null;
|
|
17881
17886
|
if (!current) return;
|
|
17882
17887
|
const cache = readCache();
|
|
17883
17888
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17894,7 +17899,7 @@ function checkForUpdates() {
|
|
|
17894
17899
|
if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
|
|
17895
17900
|
if (process.env.CI) return;
|
|
17896
17901
|
if (!process.stdout.isTTY) return;
|
|
17897
|
-
const current = true ? "2.61.
|
|
17902
|
+
const current = true ? "2.61.2" : null;
|
|
17898
17903
|
if (!current) return;
|
|
17899
17904
|
const cache = readCache();
|
|
17900
17905
|
const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
|
|
@@ -17914,13 +17919,13 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
|
|
|
17914
17919
|
var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
|
|
17915
17920
|
var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
|
|
17916
17921
|
function currentCliVersion() {
|
|
17917
|
-
return true ? "2.61.
|
|
17922
|
+
return true ? "2.61.2" : null;
|
|
17918
17923
|
}
|
|
17919
17924
|
function runCmd(cmd, args2, timeoutMs) {
|
|
17920
|
-
return new Promise((
|
|
17925
|
+
return new Promise((resolve8) => {
|
|
17921
17926
|
(0, import_node_child_process21.execFile)(cmd, args2, { timeout: timeoutMs }, (err, stdout, stderr) => {
|
|
17922
17927
|
const code = err && typeof err.code === "number" ? err.code : err ? null : 0;
|
|
17923
|
-
|
|
17928
|
+
resolve8({ code, stdout: stdout ?? "", stderr: stderr ?? "" });
|
|
17924
17929
|
});
|
|
17925
17930
|
});
|
|
17926
17931
|
}
|
|
@@ -18178,7 +18183,7 @@ function resolveFleetBoxImage() {
|
|
|
18178
18183
|
var DOCKER_RUN_TIMEOUT_MS = 12e4;
|
|
18179
18184
|
var defaultDockerRunner = {
|
|
18180
18185
|
run(args2, opts = {}) {
|
|
18181
|
-
return new Promise((
|
|
18186
|
+
return new Promise((resolve8) => {
|
|
18182
18187
|
const child = (0, import_node_child_process23.spawn)("docker", args2, {
|
|
18183
18188
|
stdio: ["ignore", "pipe", "pipe"],
|
|
18184
18189
|
env: { ...process.env, ...opts.env }
|
|
@@ -18197,7 +18202,7 @@ var defaultDockerRunner = {
|
|
|
18197
18202
|
if (settled) return;
|
|
18198
18203
|
settled = true;
|
|
18199
18204
|
clearTimeout(timer);
|
|
18200
|
-
|
|
18205
|
+
resolve8({ code, stderr: stderrBuf, stdout: stdoutBuf });
|
|
18201
18206
|
};
|
|
18202
18207
|
child.stdout?.on("data", (b) => {
|
|
18203
18208
|
stdoutBuf += b.toString();
|
|
@@ -18509,6 +18514,10 @@ var HostAgentSupervisor = class {
|
|
|
18509
18514
|
this.stopChild(cmd.payload.sessionId);
|
|
18510
18515
|
return;
|
|
18511
18516
|
}
|
|
18517
|
+
if (cmd.type === "host_list_dir") {
|
|
18518
|
+
await this.listDir(cmd);
|
|
18519
|
+
return;
|
|
18520
|
+
}
|
|
18512
18521
|
if (cmd.type === "self_hosted_refresh_credentials") {
|
|
18513
18522
|
if (!isRefreshCredentialsPayload(cmd.payload)) {
|
|
18514
18523
|
log.warn("host-agent", `ignoring malformed self_hosted_refresh_credentials id=${cmd.id}`);
|
|
@@ -18530,6 +18539,40 @@ var HostAgentSupervisor = class {
|
|
|
18530
18539
|
}
|
|
18531
18540
|
log.trace("host-agent", `ignoring unsupported command type=${cmd.type}`);
|
|
18532
18541
|
}
|
|
18542
|
+
/**
|
|
18543
|
+
* `host_list_dir` — read-only directory browse for the app's "Path on
|
|
18544
|
+
* server" picker (self-hosted deploy). Lists a directory on THIS host and
|
|
18545
|
+
* returns its subdirectories + files so the user can NAVIGATE to a project
|
|
18546
|
+
* path instead of guessing a raw one. NEVER writes, NEVER returns file
|
|
18547
|
+
* contents. It's the user's own box (auth already proved ownership at the
|
|
18548
|
+
* backend), so any absolute path is allowed; defaults to `$HOME`. Hidden
|
|
18549
|
+
* dot-entries are filtered (project paths are effectively never dotdirs).
|
|
18550
|
+
* Responds with a relay result the backend awaits.
|
|
18551
|
+
*/
|
|
18552
|
+
async listDir(cmd) {
|
|
18553
|
+
const relay = this.relay;
|
|
18554
|
+
if (!relay) return;
|
|
18555
|
+
const raw = cmd.payload?.path;
|
|
18556
|
+
const target = typeof raw === "string" && raw.trim() ? path45.resolve(raw.trim()) : os36.homedir();
|
|
18557
|
+
try {
|
|
18558
|
+
const dirents = await fs42.promises.readdir(target, { withFileTypes: true });
|
|
18559
|
+
const entries = dirents.filter((d3) => !d3.name.startsWith(".")).map((d3) => ({ name: d3.name, isDir: d3.isDirectory() })).sort(
|
|
18560
|
+
(a, b) => a.isDir === b.isDir ? a.name.localeCompare(b.name) : a.isDir ? -1 : 1
|
|
18561
|
+
);
|
|
18562
|
+
const parent = path45.dirname(target);
|
|
18563
|
+
await relay.sendResult(cmd.id, "completed", {
|
|
18564
|
+
path: target,
|
|
18565
|
+
// null at the filesystem root so the UI can hide the ".." affordance.
|
|
18566
|
+
parent: parent === target ? null : parent,
|
|
18567
|
+
entries
|
|
18568
|
+
});
|
|
18569
|
+
} catch (err) {
|
|
18570
|
+
await relay.sendResult(cmd.id, "failed", {
|
|
18571
|
+
path: target,
|
|
18572
|
+
error: err.code ?? err.message
|
|
18573
|
+
});
|
|
18574
|
+
}
|
|
18575
|
+
}
|
|
18533
18576
|
/**
|
|
18534
18577
|
* `fleet_create_box` — `docker run` a per-user rescue box. Builds the FULL
|
|
18535
18578
|
* argv from a fixed template (Global Constraints — nothing from the wire
|
|
@@ -18874,7 +18917,7 @@ var HostAgentSupervisor = class {
|
|
|
18874
18917
|
* host-agent whose env may lack it.
|
|
18875
18918
|
*/
|
|
18876
18919
|
runAgentInstall(script) {
|
|
18877
|
-
return new Promise((
|
|
18920
|
+
return new Promise((resolve8) => {
|
|
18878
18921
|
const home = process.env.HOME || os36.homedir();
|
|
18879
18922
|
const child = (0, import_node_child_process23.spawn)("sh", ["-c", script], {
|
|
18880
18923
|
env: { ...process.env, HOME: home },
|
|
@@ -18890,7 +18933,7 @@ var HostAgentSupervisor = class {
|
|
|
18890
18933
|
const done = () => {
|
|
18891
18934
|
if (settled) return;
|
|
18892
18935
|
settled = true;
|
|
18893
|
-
|
|
18936
|
+
resolve8();
|
|
18894
18937
|
};
|
|
18895
18938
|
const timer = setTimeout(() => {
|
|
18896
18939
|
log.warn(
|
|
@@ -19344,12 +19387,12 @@ async function isExecutableBinary(p2) {
|
|
|
19344
19387
|
}
|
|
19345
19388
|
}
|
|
19346
19389
|
function extractTgz(tgzPath, destDir) {
|
|
19347
|
-
return new Promise((
|
|
19390
|
+
return new Promise((resolve8, reject) => {
|
|
19348
19391
|
const child = (0, import_child_process15.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
|
|
19349
19392
|
child.on("error", (err) => reject(err));
|
|
19350
19393
|
child.on(
|
|
19351
19394
|
"exit",
|
|
19352
|
-
(code) => code === 0 ?
|
|
19395
|
+
(code) => code === 0 ? resolve8() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
|
|
19353
19396
|
);
|
|
19354
19397
|
});
|
|
19355
19398
|
}
|
|
@@ -19563,12 +19606,12 @@ function parseExpoUrl(stdout) {
|
|
|
19563
19606
|
// src/services/preview/port-ready.ts
|
|
19564
19607
|
var net = __toESM(require("net"));
|
|
19565
19608
|
function isPortListening(port, host2 = "127.0.0.1") {
|
|
19566
|
-
return new Promise((
|
|
19609
|
+
return new Promise((resolve8) => {
|
|
19567
19610
|
const socket = new net.Socket();
|
|
19568
19611
|
const done = (result) => {
|
|
19569
19612
|
socket.removeAllListeners();
|
|
19570
19613
|
socket.destroy();
|
|
19571
|
-
|
|
19614
|
+
resolve8(result);
|
|
19572
19615
|
};
|
|
19573
19616
|
socket.setTimeout(1e3);
|
|
19574
19617
|
socket.once("connect", () => done(true));
|
|
@@ -19594,7 +19637,7 @@ var import_path6 = __toESM(require("path"));
|
|
|
19594
19637
|
// src/services/preview/run-setup.ts
|
|
19595
19638
|
var import_child_process17 = require("child_process");
|
|
19596
19639
|
function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
19597
|
-
return new Promise((
|
|
19640
|
+
return new Promise((resolve8) => {
|
|
19598
19641
|
const child = (0, import_child_process17.spawn)(cmd, args2, {
|
|
19599
19642
|
cwd,
|
|
19600
19643
|
env: { ...process.env, ...env ?? {} },
|
|
@@ -19614,20 +19657,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
|
19614
19657
|
settled = true;
|
|
19615
19658
|
log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
|
|
19616
19659
|
killQuiet(child);
|
|
19617
|
-
|
|
19660
|
+
resolve8({ status: "timeout", code: null });
|
|
19618
19661
|
}, opts.timeoutMs);
|
|
19619
19662
|
child.once("exit", (code) => {
|
|
19620
19663
|
if (settled) return;
|
|
19621
19664
|
settled = true;
|
|
19622
19665
|
clearTimeout(timer);
|
|
19623
|
-
if (code === 0)
|
|
19624
|
-
else
|
|
19666
|
+
if (code === 0) resolve8({ status: "ok", code: 0 });
|
|
19667
|
+
else resolve8({ status: "failed", code });
|
|
19625
19668
|
});
|
|
19626
19669
|
child.once("error", () => {
|
|
19627
19670
|
if (settled) return;
|
|
19628
19671
|
settled = true;
|
|
19629
19672
|
clearTimeout(timer);
|
|
19630
|
-
|
|
19673
|
+
resolve8({ status: "failed", code: null });
|
|
19631
19674
|
});
|
|
19632
19675
|
});
|
|
19633
19676
|
}
|
|
@@ -19869,23 +19912,23 @@ async function awaitTunnelRegistered(candidate, hostname4, deadlineMs) {
|
|
|
19869
19912
|
ac.signal.addEventListener("abort", detach, { once: true });
|
|
19870
19913
|
};
|
|
19871
19914
|
try {
|
|
19872
|
-
return await new Promise((
|
|
19915
|
+
return await new Promise((resolve8) => {
|
|
19873
19916
|
const onChunk = (chunk) => {
|
|
19874
19917
|
const s = chunk.toString();
|
|
19875
19918
|
if (!url) url = parseCloudflaredUrl(s);
|
|
19876
19919
|
if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
|
|
19877
19920
|
const trimmed = s.replace(/\n+$/g, "");
|
|
19878
19921
|
if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
|
|
19879
|
-
if (url && registered)
|
|
19922
|
+
if (url && registered) resolve8({ kind: "registered", url });
|
|
19880
19923
|
};
|
|
19881
19924
|
const onExit = (code) => {
|
|
19882
|
-
|
|
19925
|
+
resolve8({ kind: "exited", sawUrl: url != null, code });
|
|
19883
19926
|
};
|
|
19884
19927
|
const { stdout, stderr } = candidate;
|
|
19885
19928
|
if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
|
|
19886
19929
|
if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
|
|
19887
19930
|
scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
|
|
19888
|
-
timer = setTimeout(() =>
|
|
19931
|
+
timer = setTimeout(() => resolve8({ kind: "timeout", sawUrl: url != null }), deadlineMs);
|
|
19889
19932
|
});
|
|
19890
19933
|
} finally {
|
|
19891
19934
|
ac.abort();
|
|
@@ -20422,12 +20465,12 @@ var _spawnSeam = {
|
|
|
20422
20465
|
run: _defaultSpawn
|
|
20423
20466
|
};
|
|
20424
20467
|
function _defaultSpawn(binaryPath, args2, opts) {
|
|
20425
|
-
return new Promise((
|
|
20468
|
+
return new Promise((resolve8) => {
|
|
20426
20469
|
let proc;
|
|
20427
20470
|
try {
|
|
20428
20471
|
proc = (0, import_child_process19.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
|
|
20429
20472
|
} catch (err) {
|
|
20430
|
-
|
|
20473
|
+
resolve8({ code: -1, stdout: "", stderr: err.message });
|
|
20431
20474
|
return;
|
|
20432
20475
|
}
|
|
20433
20476
|
let stdout = "";
|
|
@@ -20438,8 +20481,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
|
|
|
20438
20481
|
proc.stderr?.on("data", (c2) => {
|
|
20439
20482
|
stderr += c2.toString();
|
|
20440
20483
|
});
|
|
20441
|
-
proc.on("error", (err) =>
|
|
20442
|
-
proc.on("close", (code) =>
|
|
20484
|
+
proc.on("error", (err) => resolve8({ code: -1, stdout, stderr: err.message }));
|
|
20485
|
+
proc.on("close", (code) => resolve8({ code: code ?? -1, stdout, stderr }));
|
|
20443
20486
|
});
|
|
20444
20487
|
}
|
|
20445
20488
|
var _adapterSeam = {
|
|
@@ -20616,22 +20659,22 @@ var _installSpawnSeam = {
|
|
|
20616
20659
|
run: _defaultInstallSpawn
|
|
20617
20660
|
};
|
|
20618
20661
|
function _defaultInstallSpawn(strategy) {
|
|
20619
|
-
return new Promise((
|
|
20662
|
+
return new Promise((resolve8) => {
|
|
20620
20663
|
let proc;
|
|
20621
20664
|
try {
|
|
20622
20665
|
proc = (0, import_child_process20.spawn)(strategy.command, strategy.args, { env: process.env });
|
|
20623
20666
|
} catch (err) {
|
|
20624
|
-
|
|
20667
|
+
resolve8({ ok: false, code: -1, stderr: err.message });
|
|
20625
20668
|
return;
|
|
20626
20669
|
}
|
|
20627
20670
|
let stderr = "";
|
|
20628
20671
|
proc.stderr?.on("data", (c2) => {
|
|
20629
20672
|
stderr += c2.toString();
|
|
20630
20673
|
});
|
|
20631
|
-
proc.on("error", (err) =>
|
|
20674
|
+
proc.on("error", (err) => resolve8({ ok: false, code: -1, stderr: err.message }));
|
|
20632
20675
|
proc.on(
|
|
20633
20676
|
"close",
|
|
20634
|
-
(code) =>
|
|
20677
|
+
(code) => resolve8({ ok: code === 0, code: code ?? -1, stderr })
|
|
20635
20678
|
);
|
|
20636
20679
|
});
|
|
20637
20680
|
}
|
|
@@ -20800,14 +20843,14 @@ var _doltInstallSpawnSeam = {
|
|
|
20800
20843
|
};
|
|
20801
20844
|
var DOLT_INSTALL_TIMEOUT_MS = 12e4;
|
|
20802
20845
|
function _defaultDoltInstallSpawn(strategy) {
|
|
20803
|
-
return new Promise((
|
|
20846
|
+
return new Promise((resolve8) => {
|
|
20804
20847
|
let settled = false;
|
|
20805
20848
|
let timer;
|
|
20806
20849
|
const finish = (r) => {
|
|
20807
20850
|
if (settled) return;
|
|
20808
20851
|
settled = true;
|
|
20809
20852
|
if (timer) clearTimeout(timer);
|
|
20810
|
-
|
|
20853
|
+
resolve8(r);
|
|
20811
20854
|
};
|
|
20812
20855
|
let proc;
|
|
20813
20856
|
try {
|
|
@@ -22466,16 +22509,16 @@ async function runNpmInstallLatest() {
|
|
|
22466
22509
|
const useShell = process.platform === "win32";
|
|
22467
22510
|
const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
|
|
22468
22511
|
for (let attempt = 1; attempt <= CLI_UPDATE_MAX_ATTEMPTS; attempt++) {
|
|
22469
|
-
const result = await new Promise((
|
|
22512
|
+
const result = await new Promise((resolve8) => {
|
|
22470
22513
|
(0, import_child_process24.execFile)(
|
|
22471
22514
|
command2,
|
|
22472
22515
|
invocation.args,
|
|
22473
22516
|
{ timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
|
|
22474
22517
|
(err, _stdout, stderr) => {
|
|
22475
22518
|
if (!err) {
|
|
22476
|
-
|
|
22519
|
+
resolve8({ ok: true });
|
|
22477
22520
|
} else {
|
|
22478
|
-
|
|
22521
|
+
resolve8({ ok: false, error: (stderr || err.message).slice(0, 300) });
|
|
22479
22522
|
}
|
|
22480
22523
|
}
|
|
22481
22524
|
);
|
|
@@ -23064,7 +23107,7 @@ function buildKeepAlive(ctx) {
|
|
|
23064
23107
|
let timer = null;
|
|
23065
23108
|
async function setIdleTimeout(minutes) {
|
|
23066
23109
|
if (!ctx.inCodespace || !ctx.codespaceName) return;
|
|
23067
|
-
await new Promise((
|
|
23110
|
+
await new Promise((resolve8) => {
|
|
23068
23111
|
const proc = (0, import_child_process25.spawn)(
|
|
23069
23112
|
"gh",
|
|
23070
23113
|
[
|
|
@@ -23078,8 +23121,8 @@ function buildKeepAlive(ctx) {
|
|
|
23078
23121
|
{ stdio: "ignore", detached: true }
|
|
23079
23122
|
);
|
|
23080
23123
|
proc.unref();
|
|
23081
|
-
proc.on("exit", () =>
|
|
23082
|
-
proc.on("error", () =>
|
|
23124
|
+
proc.on("exit", () => resolve8());
|
|
23125
|
+
proc.on("error", () => resolve8());
|
|
23083
23126
|
});
|
|
23084
23127
|
}
|
|
23085
23128
|
return {
|
|
@@ -23580,10 +23623,10 @@ function wrapWithHeadroom(launch, opts) {
|
|
|
23580
23623
|
var _present;
|
|
23581
23624
|
function headroomPresent() {
|
|
23582
23625
|
if (_present !== void 0) return Promise.resolve(_present);
|
|
23583
|
-
return new Promise((
|
|
23626
|
+
return new Promise((resolve8) => {
|
|
23584
23627
|
(0, import_node_child_process24.execFile)("headroom", ["--version"], (err) => {
|
|
23585
23628
|
_present = !err;
|
|
23586
|
-
|
|
23629
|
+
resolve8(_present);
|
|
23587
23630
|
});
|
|
23588
23631
|
});
|
|
23589
23632
|
}
|
|
@@ -23973,7 +24016,7 @@ function resolveClaudeNativeBinary(deps = {}) {
|
|
|
23973
24016
|
const candidate = import_path8.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
23974
24017
|
return existsSync27(candidate) ? candidate : null;
|
|
23975
24018
|
}
|
|
23976
|
-
var realSleep = (ms) => new Promise((
|
|
24019
|
+
var realSleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
23977
24020
|
async function waitForClaudeNativeBinary(opts = {}) {
|
|
23978
24021
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
23979
24022
|
const pollMs = opts.pollMs ?? 500;
|
|
@@ -24054,7 +24097,7 @@ var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no lo
|
|
|
24054
24097
|
function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
24055
24098
|
const livenessMs = opts.livenessMs ?? 400;
|
|
24056
24099
|
const spawnFn = opts.spawnFn ?? import_child_process26.spawn;
|
|
24057
|
-
return new Promise((
|
|
24100
|
+
return new Promise((resolve8) => {
|
|
24058
24101
|
let settled = false;
|
|
24059
24102
|
let stderr = "";
|
|
24060
24103
|
let timer;
|
|
@@ -24067,12 +24110,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
|
24067
24110
|
child?.kill("SIGKILL");
|
|
24068
24111
|
} catch {
|
|
24069
24112
|
}
|
|
24070
|
-
|
|
24113
|
+
resolve8(r);
|
|
24071
24114
|
};
|
|
24072
24115
|
try {
|
|
24073
24116
|
child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
|
|
24074
24117
|
} catch {
|
|
24075
|
-
|
|
24118
|
+
resolve8("ok");
|
|
24076
24119
|
return;
|
|
24077
24120
|
}
|
|
24078
24121
|
child.stderr?.on("data", (d3) => {
|
|
@@ -24123,10 +24166,10 @@ function augmentPath2() {
|
|
|
24123
24166
|
if (!parts.includes(dir)) process.env.PATH = `${dir}:${process.env.PATH ?? ""}`;
|
|
24124
24167
|
}
|
|
24125
24168
|
async function runInstaller2() {
|
|
24126
|
-
return new Promise((
|
|
24169
|
+
return new Promise((resolve8) => {
|
|
24127
24170
|
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", () =>
|
|
24171
|
+
proc.on("close", (code) => resolve8(code === 0));
|
|
24172
|
+
proc.on("error", () => resolve8(false));
|
|
24130
24173
|
});
|
|
24131
24174
|
}
|
|
24132
24175
|
async function ensureKimiInstalled() {
|
|
@@ -24350,7 +24393,7 @@ function parseJsonl(filePath) {
|
|
|
24350
24393
|
return messages;
|
|
24351
24394
|
}
|
|
24352
24395
|
function post(endpoint, body, pluginAuthToken) {
|
|
24353
|
-
return new Promise((
|
|
24396
|
+
return new Promise((resolve8) => {
|
|
24354
24397
|
const payload = JSON.stringify(body);
|
|
24355
24398
|
const u2 = new URL(`${API_BASE8}${endpoint}`);
|
|
24356
24399
|
const transport = u2.protocol === "https:" ? https7 : http6;
|
|
@@ -24375,17 +24418,17 @@ function post(endpoint, body, pluginAuthToken) {
|
|
|
24375
24418
|
res.resume();
|
|
24376
24419
|
const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
|
|
24377
24420
|
if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
|
|
24378
|
-
|
|
24421
|
+
resolve8(ok);
|
|
24379
24422
|
}
|
|
24380
24423
|
);
|
|
24381
24424
|
req.on("error", (err) => {
|
|
24382
24425
|
log.warn("history:post", `${endpoint} network error`, err);
|
|
24383
|
-
|
|
24426
|
+
resolve8(false);
|
|
24384
24427
|
});
|
|
24385
24428
|
req.on("timeout", () => {
|
|
24386
24429
|
log.warn("history:post", `${endpoint} timeout after 15s`);
|
|
24387
24430
|
req.destroy();
|
|
24388
|
-
|
|
24431
|
+
resolve8(false);
|
|
24389
24432
|
});
|
|
24390
24433
|
req.write(payload);
|
|
24391
24434
|
req.end();
|
|
@@ -27035,8 +27078,8 @@ var Connection = class {
|
|
|
27035
27078
|
this.requestHandler = requestHandler;
|
|
27036
27079
|
this.notificationHandler = notificationHandler;
|
|
27037
27080
|
this.stream = stream;
|
|
27038
|
-
this.closedPromise = new Promise((
|
|
27039
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
27081
|
+
this.closedPromise = new Promise((resolve8) => {
|
|
27082
|
+
this.abortController.signal.addEventListener("abort", () => resolve8());
|
|
27040
27083
|
});
|
|
27041
27084
|
void this.receive();
|
|
27042
27085
|
}
|
|
@@ -27206,11 +27249,11 @@ var Connection = class {
|
|
|
27206
27249
|
return rejectedPromise(this.closedReason());
|
|
27207
27250
|
}
|
|
27208
27251
|
const id = this.nextRequestId++;
|
|
27209
|
-
const responsePromise = new Promise((
|
|
27252
|
+
const responsePromise = new Promise((resolve8, reject) => {
|
|
27210
27253
|
this.pendingResponses.set(id, {
|
|
27211
27254
|
resolve: (response) => {
|
|
27212
27255
|
try {
|
|
27213
|
-
|
|
27256
|
+
resolve8(mapResponse ? mapResponse(response) : response);
|
|
27214
27257
|
} catch (error) {
|
|
27215
27258
|
reject(error);
|
|
27216
27259
|
}
|
|
@@ -27877,14 +27920,14 @@ var AcpClient = class {
|
|
|
27877
27920
|
this.sessionId = null;
|
|
27878
27921
|
try {
|
|
27879
27922
|
child.kill("SIGTERM");
|
|
27880
|
-
const grace = new Promise((
|
|
27923
|
+
const grace = new Promise((resolve8) => {
|
|
27881
27924
|
const t2 = setTimeout(() => {
|
|
27882
27925
|
killQuiet(child, "SIGKILL");
|
|
27883
|
-
|
|
27926
|
+
resolve8();
|
|
27884
27927
|
}, 2e3);
|
|
27885
27928
|
child.once("exit", () => {
|
|
27886
27929
|
clearTimeout(t2);
|
|
27887
|
-
|
|
27930
|
+
resolve8();
|
|
27888
27931
|
});
|
|
27889
27932
|
});
|
|
27890
27933
|
await grace;
|
|
@@ -28102,7 +28145,7 @@ var _transport4 = {
|
|
|
28102
28145
|
get: _get
|
|
28103
28146
|
};
|
|
28104
28147
|
function _post3(url, headers, payload) {
|
|
28105
|
-
return new Promise((
|
|
28148
|
+
return new Promise((resolve8, reject) => {
|
|
28106
28149
|
let settled = false;
|
|
28107
28150
|
const u2 = new URL(url);
|
|
28108
28151
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -28127,7 +28170,7 @@ function _post3(url, headers, payload) {
|
|
|
28127
28170
|
res.on("end", () => {
|
|
28128
28171
|
if (settled) return;
|
|
28129
28172
|
settled = true;
|
|
28130
|
-
|
|
28173
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
28131
28174
|
});
|
|
28132
28175
|
}
|
|
28133
28176
|
);
|
|
@@ -28144,7 +28187,7 @@ function _post3(url, headers, payload) {
|
|
|
28144
28187
|
});
|
|
28145
28188
|
}
|
|
28146
28189
|
function _get(url, headers) {
|
|
28147
|
-
return new Promise((
|
|
28190
|
+
return new Promise((resolve8, reject) => {
|
|
28148
28191
|
let settled = false;
|
|
28149
28192
|
const u2 = new URL(url);
|
|
28150
28193
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -28168,7 +28211,7 @@ function _get(url, headers) {
|
|
|
28168
28211
|
res.on("end", () => {
|
|
28169
28212
|
if (settled) return;
|
|
28170
28213
|
settled = true;
|
|
28171
|
-
|
|
28214
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
28172
28215
|
});
|
|
28173
28216
|
}
|
|
28174
28217
|
);
|
|
@@ -28949,12 +28992,12 @@ function runGit3(cwd, args2) {
|
|
|
28949
28992
|
return _runGitImpl2.run(cwd, args2);
|
|
28950
28993
|
}
|
|
28951
28994
|
function defaultRunGit(cwd, args2) {
|
|
28952
|
-
return new Promise((
|
|
28995
|
+
return new Promise((resolve8) => {
|
|
28953
28996
|
let proc;
|
|
28954
28997
|
try {
|
|
28955
28998
|
proc = (0, import_child_process28.spawn)("git", args2, { cwd, env: process.env });
|
|
28956
28999
|
} catch {
|
|
28957
|
-
|
|
29000
|
+
resolve8(null);
|
|
28958
29001
|
return;
|
|
28959
29002
|
}
|
|
28960
29003
|
let stdout = "";
|
|
@@ -28965,16 +29008,16 @@ function defaultRunGit(cwd, args2) {
|
|
|
28965
29008
|
proc.stderr?.on("data", (c2) => {
|
|
28966
29009
|
stderr += c2.toString();
|
|
28967
29010
|
});
|
|
28968
|
-
proc.on("error", () =>
|
|
29011
|
+
proc.on("error", () => resolve8(null));
|
|
28969
29012
|
proc.on("close", (code) => {
|
|
28970
29013
|
if (code === 0) {
|
|
28971
|
-
|
|
29014
|
+
resolve8(stdout);
|
|
28972
29015
|
} else {
|
|
28973
29016
|
log.trace(
|
|
28974
29017
|
"turnFiles",
|
|
28975
29018
|
`git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
|
|
28976
29019
|
);
|
|
28977
|
-
|
|
29020
|
+
resolve8(null);
|
|
28978
29021
|
}
|
|
28979
29022
|
});
|
|
28980
29023
|
});
|
|
@@ -29362,25 +29405,25 @@ function baselineKey(entry) {
|
|
|
29362
29405
|
|
|
29363
29406
|
// src/agents/acp/withTimeout.ts
|
|
29364
29407
|
function withTimeout(p2, ms) {
|
|
29365
|
-
return new Promise((
|
|
29408
|
+
return new Promise((resolve8) => {
|
|
29366
29409
|
let settled = false;
|
|
29367
29410
|
const timer = setTimeout(() => {
|
|
29368
29411
|
if (settled) return;
|
|
29369
29412
|
settled = true;
|
|
29370
|
-
|
|
29413
|
+
resolve8(void 0);
|
|
29371
29414
|
}, ms);
|
|
29372
29415
|
p2.then(
|
|
29373
29416
|
(v) => {
|
|
29374
29417
|
if (settled) return;
|
|
29375
29418
|
settled = true;
|
|
29376
29419
|
clearTimeout(timer);
|
|
29377
|
-
|
|
29420
|
+
resolve8(v);
|
|
29378
29421
|
},
|
|
29379
29422
|
() => {
|
|
29380
29423
|
if (settled) return;
|
|
29381
29424
|
settled = true;
|
|
29382
29425
|
clearTimeout(timer);
|
|
29383
|
-
|
|
29426
|
+
resolve8(void 0);
|
|
29384
29427
|
}
|
|
29385
29428
|
);
|
|
29386
29429
|
});
|
|
@@ -30251,7 +30294,7 @@ var StreamingState = class {
|
|
|
30251
30294
|
* default-reject. Caller is the SDK's `onRequestPermission`.
|
|
30252
30295
|
*/
|
|
30253
30296
|
registerPermission(args2) {
|
|
30254
|
-
return new Promise((
|
|
30297
|
+
return new Promise((resolve8) => {
|
|
30255
30298
|
const timeoutTimer = setTimeout(() => {
|
|
30256
30299
|
if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
|
|
30257
30300
|
log.warn(
|
|
@@ -30259,7 +30302,7 @@ var StreamingState = class {
|
|
|
30259
30302
|
`permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
|
|
30260
30303
|
);
|
|
30261
30304
|
this.pending = null;
|
|
30262
|
-
|
|
30305
|
+
resolve8({ outcome: { outcome: "cancelled" } });
|
|
30263
30306
|
}
|
|
30264
30307
|
}, PERMISSION_TIMEOUT_MS);
|
|
30265
30308
|
this.pending = {
|
|
@@ -30267,7 +30310,7 @@ var StreamingState = class {
|
|
|
30267
30310
|
questionId: args2.questionId,
|
|
30268
30311
|
labels: args2.labels,
|
|
30269
30312
|
optionIdByLabel: args2.optionIdByLabel,
|
|
30270
|
-
resolve:
|
|
30313
|
+
resolve: resolve8,
|
|
30271
30314
|
timeoutTimer
|
|
30272
30315
|
};
|
|
30273
30316
|
});
|
|
@@ -30299,14 +30342,14 @@ var StreamingState = class {
|
|
|
30299
30342
|
const label = this.pending.labels[index];
|
|
30300
30343
|
const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
|
|
30301
30344
|
clearTimeout(this.pending.timeoutTimer);
|
|
30302
|
-
const
|
|
30345
|
+
const resolve8 = this.pending.resolve;
|
|
30303
30346
|
this.pending = null;
|
|
30304
30347
|
if (!optionId) {
|
|
30305
30348
|
log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
|
|
30306
|
-
|
|
30349
|
+
resolve8({ outcome: { outcome: "cancelled" } });
|
|
30307
30350
|
return { kind: "resolved" };
|
|
30308
30351
|
}
|
|
30309
|
-
|
|
30352
|
+
resolve8({ outcome: { outcome: "selected", optionId } });
|
|
30310
30353
|
return { kind: "resolved" };
|
|
30311
30354
|
}
|
|
30312
30355
|
const text = this.pending.options[index];
|
|
@@ -32178,10 +32221,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
|
|
|
32178
32221
|
this.lastOutput = this.now();
|
|
32179
32222
|
}
|
|
32180
32223
|
whenSafeToYield() {
|
|
32181
|
-
return new Promise((
|
|
32224
|
+
return new Promise((resolve8) => {
|
|
32182
32225
|
const tick = () => {
|
|
32183
32226
|
const quietFor = this.now() - this.lastOutput;
|
|
32184
|
-
if (quietFor >= this.idleMs)
|
|
32227
|
+
if (quietFor >= this.idleMs) resolve8();
|
|
32185
32228
|
else setTimeout(tick, this.idleMs - quietFor);
|
|
32186
32229
|
};
|
|
32187
32230
|
tick();
|
|
@@ -32318,11 +32361,11 @@ var AcpDriver = class {
|
|
|
32318
32361
|
this.turnActive = false;
|
|
32319
32362
|
const waiters = this.waiters;
|
|
32320
32363
|
this.waiters = [];
|
|
32321
|
-
waiters.forEach((
|
|
32364
|
+
waiters.forEach((resolve8) => resolve8());
|
|
32322
32365
|
}
|
|
32323
32366
|
whenSafeToYield() {
|
|
32324
32367
|
if (!this.turnActive) return Promise.resolve();
|
|
32325
|
-
return new Promise((
|
|
32368
|
+
return new Promise((resolve8) => this.waiters.push(resolve8));
|
|
32326
32369
|
}
|
|
32327
32370
|
};
|
|
32328
32371
|
|
|
@@ -32813,8 +32856,8 @@ async function start(requestedAgent) {
|
|
|
32813
32856
|
let gateTimer;
|
|
32814
32857
|
await Promise.race([
|
|
32815
32858
|
Promise.all([beadsReady.catch(() => null), depsReady, agentBinaryReady]),
|
|
32816
|
-
new Promise((
|
|
32817
|
-
gateTimer = setTimeout(
|
|
32859
|
+
new Promise((resolve8) => {
|
|
32860
|
+
gateTimer = setTimeout(resolve8, GATE_TIMEOUT_MS);
|
|
32818
32861
|
})
|
|
32819
32862
|
]);
|
|
32820
32863
|
if (gateTimer) clearTimeout(gateTimer);
|
|
@@ -33139,7 +33182,7 @@ async function pair(args2 = []) {
|
|
|
33139
33182
|
waitSpin.message(waitMessage());
|
|
33140
33183
|
}, 1e3);
|
|
33141
33184
|
countdownInterval.unref?.();
|
|
33142
|
-
await new Promise((
|
|
33185
|
+
await new Promise((resolve8) => {
|
|
33143
33186
|
let stopPolling = null;
|
|
33144
33187
|
function sigintHandler() {
|
|
33145
33188
|
clearInterval(countdownInterval);
|
|
@@ -33190,7 +33233,7 @@ async function pair(args2 = []) {
|
|
|
33190
33233
|
pluginAuthToken: info.pluginAuthToken
|
|
33191
33234
|
});
|
|
33192
33235
|
}
|
|
33193
|
-
|
|
33236
|
+
resolve8();
|
|
33194
33237
|
},
|
|
33195
33238
|
() => {
|
|
33196
33239
|
clearInterval(countdownInterval);
|
|
@@ -33419,12 +33462,12 @@ var GitHubCodespacesProvider = class {
|
|
|
33419
33462
|
}
|
|
33420
33463
|
if (!isAuthed) {
|
|
33421
33464
|
resetStdinForChild();
|
|
33422
|
-
await new Promise((
|
|
33465
|
+
await new Promise((resolve8, reject) => {
|
|
33423
33466
|
const proc = (0, import_child_process29.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
|
|
33424
33467
|
stdio: "inherit"
|
|
33425
33468
|
});
|
|
33426
33469
|
proc.on("exit", (code) => {
|
|
33427
|
-
if (code === 0)
|
|
33470
|
+
if (code === 0) resolve8();
|
|
33428
33471
|
else reject(new Error("gh auth login failed."));
|
|
33429
33472
|
});
|
|
33430
33473
|
proc.on("error", reject);
|
|
@@ -33453,13 +33496,13 @@ var GitHubCodespacesProvider = class {
|
|
|
33453
33496
|
}
|
|
33454
33497
|
wt(noteLines.join("\n"), "One more permission needed");
|
|
33455
33498
|
resetStdinForChild();
|
|
33456
|
-
const refreshCode = await new Promise((
|
|
33499
|
+
const refreshCode = await new Promise((resolve8, reject) => {
|
|
33457
33500
|
const proc = (0, import_child_process29.spawn)(
|
|
33458
33501
|
"gh",
|
|
33459
33502
|
["auth", "refresh", "-h", "github.com", "-s", "codespace"],
|
|
33460
33503
|
{ stdio: "inherit" }
|
|
33461
33504
|
);
|
|
33462
|
-
proc.on("exit", (code) =>
|
|
33505
|
+
proc.on("exit", (code) => resolve8(code ?? 1));
|
|
33463
33506
|
proc.on("error", reject);
|
|
33464
33507
|
});
|
|
33465
33508
|
if (refreshCode !== 0) {
|
|
@@ -33603,10 +33646,10 @@ var GitHubCodespacesProvider = class {
|
|
|
33603
33646
|
if (q(proceed) || !proceed) return;
|
|
33604
33647
|
O2.step(`Installing gh via ${installCmd.describe}\u2026`);
|
|
33605
33648
|
resetStdinForChild();
|
|
33606
|
-
const ok = await new Promise((
|
|
33649
|
+
const ok = await new Promise((resolve8) => {
|
|
33607
33650
|
const proc = (0, import_child_process29.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
|
|
33608
|
-
proc.on("exit", (code) =>
|
|
33609
|
-
proc.on("error", () =>
|
|
33651
|
+
proc.on("exit", (code) => resolve8(code === 0));
|
|
33652
|
+
proc.on("error", () => resolve8(false));
|
|
33610
33653
|
});
|
|
33611
33654
|
if (ok) O2.success("gh installed");
|
|
33612
33655
|
else O2.error("gh install failed");
|
|
@@ -33630,14 +33673,14 @@ var GitHubCodespacesProvider = class {
|
|
|
33630
33673
|
"Expanding GitHub scopes"
|
|
33631
33674
|
);
|
|
33632
33675
|
resetStdinForChild();
|
|
33633
|
-
await new Promise((
|
|
33676
|
+
await new Promise((resolve8, reject) => {
|
|
33634
33677
|
const proc = (0, import_child_process29.spawn)(
|
|
33635
33678
|
"gh",
|
|
33636
33679
|
["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
|
|
33637
33680
|
{ stdio: "inherit" }
|
|
33638
33681
|
);
|
|
33639
33682
|
proc.on("exit", (code) => {
|
|
33640
|
-
if (code === 0)
|
|
33683
|
+
if (code === 0) resolve8();
|
|
33641
33684
|
else reject(new Error(
|
|
33642
33685
|
"gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
|
|
33643
33686
|
));
|
|
@@ -33808,13 +33851,13 @@ var GitHubCodespacesProvider = class {
|
|
|
33808
33851
|
}
|
|
33809
33852
|
async streamCommand(workspaceId, command2) {
|
|
33810
33853
|
resetStdinForChild();
|
|
33811
|
-
return new Promise((
|
|
33854
|
+
return new Promise((resolve8, reject) => {
|
|
33812
33855
|
const proc = (0, import_child_process29.spawn)(
|
|
33813
33856
|
"gh",
|
|
33814
33857
|
["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
|
|
33815
33858
|
{ stdio: "inherit" }
|
|
33816
33859
|
);
|
|
33817
|
-
proc.on("exit", (code) =>
|
|
33860
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
33818
33861
|
proc.on("error", reject);
|
|
33819
33862
|
});
|
|
33820
33863
|
}
|
|
@@ -33835,7 +33878,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33835
33878
|
"--",
|
|
33836
33879
|
`mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
|
|
33837
33880
|
];
|
|
33838
|
-
await new Promise((
|
|
33881
|
+
await new Promise((resolve8, reject) => {
|
|
33839
33882
|
const tar = (0, import_child_process29.spawn)("tar", tarArgs, {
|
|
33840
33883
|
stdio: ["ignore", "pipe", "pipe"],
|
|
33841
33884
|
env: tarEnv
|
|
@@ -33855,7 +33898,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33855
33898
|
ssh.on("error", reject);
|
|
33856
33899
|
ssh.on("exit", (code) => {
|
|
33857
33900
|
if (code === 0) {
|
|
33858
|
-
|
|
33901
|
+
resolve8();
|
|
33859
33902
|
} else {
|
|
33860
33903
|
const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
|
|
33861
33904
|
reject(new Error(`Remote tar failed: ${reason}`));
|
|
@@ -33873,7 +33916,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33873
33916
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
|
|
33874
33917
|
}
|
|
33875
33918
|
const cmd = parts.join(" && ");
|
|
33876
|
-
await new Promise((
|
|
33919
|
+
await new Promise((resolve8, reject) => {
|
|
33877
33920
|
const proc = (0, import_child_process29.spawn)(
|
|
33878
33921
|
"gh",
|
|
33879
33922
|
["codespace", "ssh", "-c", workspaceId, "--", cmd],
|
|
@@ -33885,7 +33928,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33885
33928
|
});
|
|
33886
33929
|
proc.on("error", reject);
|
|
33887
33930
|
proc.on("exit", (code) => {
|
|
33888
|
-
if (code === 0)
|
|
33931
|
+
if (code === 0) resolve8();
|
|
33889
33932
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
33890
33933
|
});
|
|
33891
33934
|
proc.stdin?.write(contents);
|
|
@@ -33975,10 +34018,10 @@ var GitpodProvider = class {
|
|
|
33975
34018
|
"Authenticating Gitpod"
|
|
33976
34019
|
);
|
|
33977
34020
|
resetStdinForChild2();
|
|
33978
|
-
await new Promise((
|
|
34021
|
+
await new Promise((resolve8, reject) => {
|
|
33979
34022
|
const proc = (0, import_child_process30.spawn)("gitpod", ["login"], { stdio: "inherit" });
|
|
33980
34023
|
proc.on("exit", (code) => {
|
|
33981
|
-
if (code === 0)
|
|
34024
|
+
if (code === 0) resolve8();
|
|
33982
34025
|
else reject(new Error("gitpod login failed."));
|
|
33983
34026
|
});
|
|
33984
34027
|
proc.on("error", reject);
|
|
@@ -34127,13 +34170,13 @@ var GitpodProvider = class {
|
|
|
34127
34170
|
}
|
|
34128
34171
|
async streamCommand(workspaceId, command2) {
|
|
34129
34172
|
resetStdinForChild2();
|
|
34130
|
-
return new Promise((
|
|
34173
|
+
return new Promise((resolve8, reject) => {
|
|
34131
34174
|
const proc = (0, import_child_process30.spawn)(
|
|
34132
34175
|
"gitpod",
|
|
34133
34176
|
["workspace", "ssh", workspaceId, "--", "-tt", command2],
|
|
34134
34177
|
{ stdio: "inherit" }
|
|
34135
34178
|
);
|
|
34136
|
-
proc.on("exit", (code) =>
|
|
34179
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34137
34180
|
proc.on("error", reject);
|
|
34138
34181
|
});
|
|
34139
34182
|
}
|
|
@@ -34147,7 +34190,7 @@ var GitpodProvider = class {
|
|
|
34147
34190
|
tarArgs.push(".");
|
|
34148
34191
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34149
34192
|
const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
|
|
34150
|
-
await new Promise((
|
|
34193
|
+
await new Promise((resolve8, reject) => {
|
|
34151
34194
|
const tar = (0, import_child_process30.spawn)("tar", tarArgs, {
|
|
34152
34195
|
stdio: ["ignore", "pipe", "pipe"],
|
|
34153
34196
|
env: tarEnv
|
|
@@ -34168,7 +34211,7 @@ var GitpodProvider = class {
|
|
|
34168
34211
|
tar.on("error", reject);
|
|
34169
34212
|
ssh.on("error", reject);
|
|
34170
34213
|
ssh.on("exit", (code) => {
|
|
34171
|
-
if (code === 0)
|
|
34214
|
+
if (code === 0) resolve8();
|
|
34172
34215
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34173
34216
|
});
|
|
34174
34217
|
});
|
|
@@ -34183,7 +34226,7 @@ var GitpodProvider = class {
|
|
|
34183
34226
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
|
|
34184
34227
|
}
|
|
34185
34228
|
const cmd = parts.join(" && ");
|
|
34186
|
-
await new Promise((
|
|
34229
|
+
await new Promise((resolve8, reject) => {
|
|
34187
34230
|
const proc = (0, import_child_process30.spawn)(
|
|
34188
34231
|
"gitpod",
|
|
34189
34232
|
["workspace", "ssh", workspaceId, "--", cmd],
|
|
@@ -34195,7 +34238,7 @@ var GitpodProvider = class {
|
|
|
34195
34238
|
});
|
|
34196
34239
|
proc.on("error", reject);
|
|
34197
34240
|
proc.on("exit", (code) => {
|
|
34198
|
-
if (code === 0)
|
|
34241
|
+
if (code === 0) resolve8();
|
|
34199
34242
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34200
34243
|
});
|
|
34201
34244
|
proc.stdin?.write(contents);
|
|
@@ -34252,14 +34295,14 @@ var GitLabWorkspacesProvider = class {
|
|
|
34252
34295
|
"Authenticating GitLab"
|
|
34253
34296
|
);
|
|
34254
34297
|
resetStdinForChild3();
|
|
34255
|
-
await new Promise((
|
|
34298
|
+
await new Promise((resolve8, reject) => {
|
|
34256
34299
|
const proc = (0, import_child_process31.spawn)(
|
|
34257
34300
|
"glab",
|
|
34258
34301
|
["auth", "login", "--scopes", "api,read_user,read_repository"],
|
|
34259
34302
|
{ stdio: "inherit" }
|
|
34260
34303
|
);
|
|
34261
34304
|
proc.on("exit", (code) => {
|
|
34262
|
-
if (code === 0)
|
|
34305
|
+
if (code === 0) resolve8();
|
|
34263
34306
|
else reject(new Error("glab auth login failed."));
|
|
34264
34307
|
});
|
|
34265
34308
|
proc.on("error", reject);
|
|
@@ -34424,13 +34467,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34424
34467
|
async streamCommand(workspaceId, command2) {
|
|
34425
34468
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
34426
34469
|
resetStdinForChild3();
|
|
34427
|
-
return new Promise((
|
|
34470
|
+
return new Promise((resolve8, reject) => {
|
|
34428
34471
|
const proc = (0, import_child_process31.spawn)(
|
|
34429
34472
|
"ssh",
|
|
34430
34473
|
["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
|
|
34431
34474
|
{ stdio: "inherit" }
|
|
34432
34475
|
);
|
|
34433
|
-
proc.on("exit", (code) =>
|
|
34476
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34434
34477
|
proc.on("error", reject);
|
|
34435
34478
|
});
|
|
34436
34479
|
}
|
|
@@ -34445,7 +34488,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34445
34488
|
tarArgs.push(".");
|
|
34446
34489
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34447
34490
|
const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
|
|
34448
|
-
await new Promise((
|
|
34491
|
+
await new Promise((resolve8, reject) => {
|
|
34449
34492
|
const tar = (0, import_child_process31.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
34450
34493
|
const ssh = (0, import_child_process31.spawn)(
|
|
34451
34494
|
"ssh",
|
|
@@ -34463,7 +34506,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34463
34506
|
tar.on("error", reject);
|
|
34464
34507
|
ssh.on("error", reject);
|
|
34465
34508
|
ssh.on("exit", (code) => {
|
|
34466
|
-
if (code === 0)
|
|
34509
|
+
if (code === 0) resolve8();
|
|
34467
34510
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34468
34511
|
});
|
|
34469
34512
|
});
|
|
@@ -34476,7 +34519,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34476
34519
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
34477
34520
|
}
|
|
34478
34521
|
const cmd = parts.join(" && ");
|
|
34479
|
-
await new Promise((
|
|
34522
|
+
await new Promise((resolve8, reject) => {
|
|
34480
34523
|
const proc = (0, import_child_process31.spawn)(
|
|
34481
34524
|
"ssh",
|
|
34482
34525
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
|
|
@@ -34488,7 +34531,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34488
34531
|
});
|
|
34489
34532
|
proc.on("error", reject);
|
|
34490
34533
|
proc.on("exit", (code) => {
|
|
34491
|
-
if (code === 0)
|
|
34534
|
+
if (code === 0) resolve8();
|
|
34492
34535
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34493
34536
|
});
|
|
34494
34537
|
proc.stdin?.write(contents);
|
|
@@ -34579,10 +34622,10 @@ var RailwayProvider = class {
|
|
|
34579
34622
|
"Authenticating Railway"
|
|
34580
34623
|
);
|
|
34581
34624
|
resetStdinForChild4();
|
|
34582
|
-
await new Promise((
|
|
34625
|
+
await new Promise((resolve8, reject) => {
|
|
34583
34626
|
const proc = (0, import_child_process32.spawn)("railway", ["login"], { stdio: "inherit" });
|
|
34584
34627
|
proc.on("exit", (code) => {
|
|
34585
|
-
if (code === 0)
|
|
34628
|
+
if (code === 0) resolve8();
|
|
34586
34629
|
else reject(new Error("railway login failed."));
|
|
34587
34630
|
});
|
|
34588
34631
|
proc.on("error", reject);
|
|
@@ -34722,13 +34765,13 @@ var RailwayProvider = class {
|
|
|
34722
34765
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
34723
34766
|
}
|
|
34724
34767
|
resetStdinForChild4();
|
|
34725
|
-
return new Promise((
|
|
34768
|
+
return new Promise((resolve8, reject) => {
|
|
34726
34769
|
const proc = (0, import_child_process32.spawn)(
|
|
34727
34770
|
"railway",
|
|
34728
34771
|
["shell", "--project", projectId, "--service", serviceId, "--command", command2],
|
|
34729
34772
|
{ stdio: "inherit" }
|
|
34730
34773
|
);
|
|
34731
|
-
proc.on("exit", (code) =>
|
|
34774
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34732
34775
|
proc.on("error", reject);
|
|
34733
34776
|
});
|
|
34734
34777
|
}
|
|
@@ -34746,7 +34789,7 @@ var RailwayProvider = class {
|
|
|
34746
34789
|
tarArgs.push(".");
|
|
34747
34790
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34748
34791
|
const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
|
|
34749
|
-
await new Promise((
|
|
34792
|
+
await new Promise((resolve8, reject) => {
|
|
34750
34793
|
const tar = (0, import_child_process32.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
34751
34794
|
const sh = (0, import_child_process32.spawn)(
|
|
34752
34795
|
"railway",
|
|
@@ -34764,7 +34807,7 @@ var RailwayProvider = class {
|
|
|
34764
34807
|
tar.on("error", reject);
|
|
34765
34808
|
sh.on("error", reject);
|
|
34766
34809
|
sh.on("exit", (code) => {
|
|
34767
|
-
if (code === 0)
|
|
34810
|
+
if (code === 0) resolve8();
|
|
34768
34811
|
else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34769
34812
|
});
|
|
34770
34813
|
});
|
|
@@ -34780,7 +34823,7 @@ var RailwayProvider = class {
|
|
|
34780
34823
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
34781
34824
|
}
|
|
34782
34825
|
const cmd = parts.join(" && ");
|
|
34783
|
-
await new Promise((
|
|
34826
|
+
await new Promise((resolve8, reject) => {
|
|
34784
34827
|
const proc = (0, import_child_process32.spawn)(
|
|
34785
34828
|
"railway",
|
|
34786
34829
|
["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
|
|
@@ -34792,7 +34835,7 @@ var RailwayProvider = class {
|
|
|
34792
34835
|
});
|
|
34793
34836
|
proc.on("error", reject);
|
|
34794
34837
|
proc.on("exit", (code) => {
|
|
34795
|
-
if (code === 0)
|
|
34838
|
+
if (code === 0) resolve8();
|
|
34796
34839
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34797
34840
|
});
|
|
34798
34841
|
proc.stdin?.write(contents);
|
|
@@ -35589,7 +35632,7 @@ function checkChokidar() {
|
|
|
35589
35632
|
}
|
|
35590
35633
|
async function doctor(args2 = []) {
|
|
35591
35634
|
const json = args2.includes("--json");
|
|
35592
|
-
const cliVersion = true ? "2.61.
|
|
35635
|
+
const cliVersion = true ? "2.61.2" : "0.0.0-dev";
|
|
35593
35636
|
const apiBase2 = resolveApiBaseUrl();
|
|
35594
35637
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
35595
35638
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -35868,11 +35911,11 @@ var RestartableStdioProxy = class {
|
|
|
35868
35911
|
rl.on("close", () => this.child?.stdin?.end());
|
|
35869
35912
|
const timer = setInterval(() => this.checkRestart(stdout), RESTART_CHECK_INTERVAL_MS);
|
|
35870
35913
|
timer.unref();
|
|
35871
|
-
return new Promise((
|
|
35914
|
+
return new Promise((resolve8) => {
|
|
35872
35915
|
this.ended = (code) => {
|
|
35873
35916
|
clearInterval(timer);
|
|
35874
35917
|
process.exitCode = code;
|
|
35875
|
-
|
|
35918
|
+
resolve8();
|
|
35876
35919
|
};
|
|
35877
35920
|
});
|
|
35878
35921
|
}
|
|
@@ -36100,7 +36143,7 @@ async function mcpRun(args2) {
|
|
|
36100
36143
|
// src/commands/version.ts
|
|
36101
36144
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
36102
36145
|
function version2() {
|
|
36103
|
-
const v = true ? "2.61.
|
|
36146
|
+
const v = true ? "2.61.2" : "unknown";
|
|
36104
36147
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
36105
36148
|
}
|
|
36106
36149
|
|