codeam-cli 2.61.0 → 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 +16 -0
- package/dist/index.js +354 -303
- 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
|
);
|
|
@@ -8672,7 +8677,7 @@ var fs55 = __toESM(require("fs"));
|
|
|
8672
8677
|
var os44 = __toESM(require("os"));
|
|
8673
8678
|
var path59 = __toESM(require("path"));
|
|
8674
8679
|
var import_crypto3 = require("crypto");
|
|
8675
|
-
var
|
|
8680
|
+
var import_child_process24 = require("child_process");
|
|
8676
8681
|
|
|
8677
8682
|
// src/lib/payload.ts
|
|
8678
8683
|
var import_zod = require("zod");
|
|
@@ -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(
|
|
@@ -19184,6 +19227,7 @@ function makeRealApplyBudgetDeps() {
|
|
|
19184
19227
|
var fs44 = __toESM(require("fs"));
|
|
19185
19228
|
var os38 = __toESM(require("os"));
|
|
19186
19229
|
var path47 = __toESM(require("path"));
|
|
19230
|
+
var import_child_process14 = require("child_process");
|
|
19187
19231
|
function registryPath() {
|
|
19188
19232
|
return path47.join(os38.homedir(), ".codeam", "preview-ports.json");
|
|
19189
19233
|
}
|
|
@@ -19220,15 +19264,34 @@ function forgetPreviewPort(port) {
|
|
|
19220
19264
|
writeRegistry(reg);
|
|
19221
19265
|
}
|
|
19222
19266
|
function groupAlive(pgid) {
|
|
19267
|
+
const probe = process.platform === "win32" ? pgid : -pgid;
|
|
19223
19268
|
try {
|
|
19224
|
-
process.kill(
|
|
19269
|
+
process.kill(probe, 0);
|
|
19225
19270
|
return true;
|
|
19226
19271
|
} catch (err) {
|
|
19227
19272
|
return err.code === "EPERM";
|
|
19228
19273
|
}
|
|
19229
19274
|
}
|
|
19275
|
+
function killGroup(pgid) {
|
|
19276
|
+
if (process.platform === "win32") {
|
|
19277
|
+
(0, import_child_process14.spawnSync)("taskkill", ["/F", "/T", "/PID", String(pgid)], { stdio: "ignore" });
|
|
19278
|
+
return;
|
|
19279
|
+
}
|
|
19280
|
+
try {
|
|
19281
|
+
process.kill(-pgid, "SIGTERM");
|
|
19282
|
+
} catch {
|
|
19283
|
+
}
|
|
19284
|
+
try {
|
|
19285
|
+
setTimeout(() => {
|
|
19286
|
+
try {
|
|
19287
|
+
process.kill(-pgid, "SIGKILL");
|
|
19288
|
+
} catch {
|
|
19289
|
+
}
|
|
19290
|
+
}, 300).unref?.();
|
|
19291
|
+
} catch {
|
|
19292
|
+
}
|
|
19293
|
+
}
|
|
19230
19294
|
function reclaimOwnOrphanPort(port) {
|
|
19231
|
-
if (process.platform === "win32") return false;
|
|
19232
19295
|
const reg = readRegistry();
|
|
19233
19296
|
const owner = reg[String(port)];
|
|
19234
19297
|
if (!owner) return false;
|
|
@@ -19241,26 +19304,14 @@ function reclaimOwnOrphanPort(port) {
|
|
|
19241
19304
|
"preview",
|
|
19242
19305
|
`reclaiming OWN orphaned preview on port ${port} (pgid=${owner.pgid}, session=${owner.sessionId}) after a CLI restart`
|
|
19243
19306
|
);
|
|
19244
|
-
|
|
19245
|
-
process.kill(-owner.pgid, "SIGTERM");
|
|
19246
|
-
} catch {
|
|
19247
|
-
}
|
|
19248
|
-
try {
|
|
19249
|
-
setTimeout(() => {
|
|
19250
|
-
try {
|
|
19251
|
-
process.kill(-owner.pgid, "SIGKILL");
|
|
19252
|
-
} catch {
|
|
19253
|
-
}
|
|
19254
|
-
}, 300).unref?.();
|
|
19255
|
-
} catch {
|
|
19256
|
-
}
|
|
19307
|
+
killGroup(owner.pgid);
|
|
19257
19308
|
delete reg[String(port)];
|
|
19258
19309
|
writeRegistry(reg);
|
|
19259
19310
|
return true;
|
|
19260
19311
|
}
|
|
19261
19312
|
|
|
19262
19313
|
// src/services/preview/cloudflared.ts
|
|
19263
|
-
var
|
|
19314
|
+
var import_child_process15 = require("child_process");
|
|
19264
19315
|
var import_fs = require("fs");
|
|
19265
19316
|
var import_promises = __toESM(require("fs/promises"));
|
|
19266
19317
|
var import_os8 = __toESM(require("os"));
|
|
@@ -19336,12 +19387,12 @@ async function isExecutableBinary(p2) {
|
|
|
19336
19387
|
}
|
|
19337
19388
|
}
|
|
19338
19389
|
function extractTgz(tgzPath, destDir) {
|
|
19339
|
-
return new Promise((
|
|
19340
|
-
const child = (0,
|
|
19390
|
+
return new Promise((resolve8, reject) => {
|
|
19391
|
+
const child = (0, import_child_process15.spawn)("tar", ["-xzf", tgzPath, "-C", destDir], { stdio: "ignore" });
|
|
19341
19392
|
child.on("error", (err) => reject(err));
|
|
19342
19393
|
child.on(
|
|
19343
19394
|
"exit",
|
|
19344
|
-
(code) => code === 0 ?
|
|
19395
|
+
(code) => code === 0 ? resolve8() : reject(new Error(`tar exited with code ${code} while extracting cloudflared`))
|
|
19345
19396
|
);
|
|
19346
19397
|
});
|
|
19347
19398
|
}
|
|
@@ -19371,7 +19422,7 @@ async function spawnNamedTunnel(bin, token, port) {
|
|
|
19371
19422
|
await import_promises.default.mkdir(credDir, { recursive: true });
|
|
19372
19423
|
const credFile = import_path4.default.join(credDir, `tunnel-${creds.TunnelID}.json`);
|
|
19373
19424
|
await import_promises.default.writeFile(credFile, JSON.stringify(creds), { mode: 384 });
|
|
19374
|
-
return (0,
|
|
19425
|
+
return (0, import_child_process15.spawn)(
|
|
19375
19426
|
bin,
|
|
19376
19427
|
[
|
|
19377
19428
|
"tunnel",
|
|
@@ -19387,9 +19438,9 @@ async function spawnNamedTunnel(bin, token, port) {
|
|
|
19387
19438
|
}
|
|
19388
19439
|
|
|
19389
19440
|
// src/services/preview/codespace.ts
|
|
19390
|
-
var
|
|
19441
|
+
var import_child_process16 = require("child_process");
|
|
19391
19442
|
var import_util3 = require("util");
|
|
19392
|
-
var execFileP5 = (0, import_util3.promisify)(
|
|
19443
|
+
var execFileP5 = (0, import_util3.promisify)(import_child_process16.execFile);
|
|
19393
19444
|
|
|
19394
19445
|
// src/services/preview/config-file.ts
|
|
19395
19446
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
@@ -19555,12 +19606,12 @@ function parseExpoUrl(stdout) {
|
|
|
19555
19606
|
// src/services/preview/port-ready.ts
|
|
19556
19607
|
var net = __toESM(require("net"));
|
|
19557
19608
|
function isPortListening(port, host2 = "127.0.0.1") {
|
|
19558
|
-
return new Promise((
|
|
19609
|
+
return new Promise((resolve8) => {
|
|
19559
19610
|
const socket = new net.Socket();
|
|
19560
19611
|
const done = (result) => {
|
|
19561
19612
|
socket.removeAllListeners();
|
|
19562
19613
|
socket.destroy();
|
|
19563
|
-
|
|
19614
|
+
resolve8(result);
|
|
19564
19615
|
};
|
|
19565
19616
|
socket.setTimeout(1e3);
|
|
19566
19617
|
socket.once("connect", () => done(true));
|
|
@@ -19584,10 +19635,10 @@ var import_fs2 = require("fs");
|
|
|
19584
19635
|
var import_path6 = __toESM(require("path"));
|
|
19585
19636
|
|
|
19586
19637
|
// src/services/preview/run-setup.ts
|
|
19587
|
-
var
|
|
19638
|
+
var import_child_process17 = require("child_process");
|
|
19588
19639
|
function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
19589
|
-
return new Promise((
|
|
19590
|
-
const child = (0,
|
|
19640
|
+
return new Promise((resolve8) => {
|
|
19641
|
+
const child = (0, import_child_process17.spawn)(cmd, args2, {
|
|
19591
19642
|
cwd,
|
|
19592
19643
|
env: { ...process.env, ...env ?? {} },
|
|
19593
19644
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -19606,20 +19657,20 @@ function runSetupCommand(cmd, args2, cwd, env, opts) {
|
|
|
19606
19657
|
settled = true;
|
|
19607
19658
|
log.info("preview", `${tag}: timed out after ${opts.timeoutMs}ms \u2014 killing`);
|
|
19608
19659
|
killQuiet(child);
|
|
19609
|
-
|
|
19660
|
+
resolve8({ status: "timeout", code: null });
|
|
19610
19661
|
}, opts.timeoutMs);
|
|
19611
19662
|
child.once("exit", (code) => {
|
|
19612
19663
|
if (settled) return;
|
|
19613
19664
|
settled = true;
|
|
19614
19665
|
clearTimeout(timer);
|
|
19615
|
-
if (code === 0)
|
|
19616
|
-
else
|
|
19666
|
+
if (code === 0) resolve8({ status: "ok", code: 0 });
|
|
19667
|
+
else resolve8({ status: "failed", code });
|
|
19617
19668
|
});
|
|
19618
19669
|
child.once("error", () => {
|
|
19619
19670
|
if (settled) return;
|
|
19620
19671
|
settled = true;
|
|
19621
19672
|
clearTimeout(timer);
|
|
19622
|
-
|
|
19673
|
+
resolve8({ status: "failed", code: null });
|
|
19623
19674
|
});
|
|
19624
19675
|
});
|
|
19625
19676
|
}
|
|
@@ -19861,23 +19912,23 @@ async function awaitTunnelRegistered(candidate, hostname4, deadlineMs) {
|
|
|
19861
19912
|
ac.signal.addEventListener("abort", detach, { once: true });
|
|
19862
19913
|
};
|
|
19863
19914
|
try {
|
|
19864
|
-
return await new Promise((
|
|
19915
|
+
return await new Promise((resolve8) => {
|
|
19865
19916
|
const onChunk = (chunk) => {
|
|
19866
19917
|
const s = chunk.toString();
|
|
19867
19918
|
if (!url) url = parseCloudflaredUrl(s);
|
|
19868
19919
|
if (TUNNEL_REGISTERED_RE.test(s)) registered = true;
|
|
19869
19920
|
const trimmed = s.replace(/\n+$/g, "");
|
|
19870
19921
|
if (trimmed.length > 0) log.info("preview", `cloudflared: ${trimmed}`);
|
|
19871
|
-
if (url && registered)
|
|
19922
|
+
if (url && registered) resolve8({ kind: "registered", url });
|
|
19872
19923
|
};
|
|
19873
19924
|
const onExit = (code) => {
|
|
19874
|
-
|
|
19925
|
+
resolve8({ kind: "exited", sawUrl: url != null, code });
|
|
19875
19926
|
};
|
|
19876
19927
|
const { stdout, stderr } = candidate;
|
|
19877
19928
|
if (stdout) scoped(() => stdout.on("data", onChunk), () => stdout.off("data", onChunk));
|
|
19878
19929
|
if (stderr) scoped(() => stderr.on("data", onChunk), () => stderr.off("data", onChunk));
|
|
19879
19930
|
scoped(() => candidate.on("exit", onExit), () => candidate.off("exit", onExit));
|
|
19880
|
-
timer = setTimeout(() =>
|
|
19931
|
+
timer = setTimeout(() => resolve8({ kind: "timeout", sawUrl: url != null }), deadlineMs);
|
|
19881
19932
|
});
|
|
19882
19933
|
} finally {
|
|
19883
19934
|
ac.abort();
|
|
@@ -19930,7 +19981,7 @@ function activePreviewSessionIds() {
|
|
|
19930
19981
|
}
|
|
19931
19982
|
|
|
19932
19983
|
// src/services/preview/start-orchestrator.ts
|
|
19933
|
-
var
|
|
19984
|
+
var import_child_process18 = require("child_process");
|
|
19934
19985
|
var fs49 = __toESM(require("fs"));
|
|
19935
19986
|
var path52 = __toESM(require("path"));
|
|
19936
19987
|
var import_which2 = __toESM(require("which"));
|
|
@@ -20207,7 +20258,7 @@ async function startDevServer(ctx) {
|
|
|
20207
20258
|
}
|
|
20208
20259
|
const spawnable = normalizeDetectionForSpawn(detection, cwd);
|
|
20209
20260
|
emitProgress("BOOT_SEQUENCE", `${spawnable.command} ${spawnable.args.join(" ")}`);
|
|
20210
|
-
const devServer = (0,
|
|
20261
|
+
const devServer = (0, import_child_process18.spawn)(spawnable.command, spawnable.args, {
|
|
20211
20262
|
cwd,
|
|
20212
20263
|
env: { ...process.env, ...spawnable.env ?? {} },
|
|
20213
20264
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -20332,7 +20383,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
20332
20383
|
`cloudflared quick tunnel (retry ${attempt}/${MAX_TUNNEL_ATTEMPTS})`
|
|
20333
20384
|
);
|
|
20334
20385
|
}
|
|
20335
|
-
const candidate = (0,
|
|
20386
|
+
const candidate = (0, import_child_process18.spawn)(
|
|
20336
20387
|
bin,
|
|
20337
20388
|
["tunnel", "--url", `http://localhost:${detection.port}`],
|
|
20338
20389
|
{ stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -20363,7 +20414,7 @@ async function establishTunnel(ctx, dev) {
|
|
|
20363
20414
|
}
|
|
20364
20415
|
|
|
20365
20416
|
// src/beads/bd-adapter.ts
|
|
20366
|
-
var
|
|
20417
|
+
var import_child_process19 = require("child_process");
|
|
20367
20418
|
var fs50 = __toESM(require("fs"));
|
|
20368
20419
|
var os40 = __toESM(require("os"));
|
|
20369
20420
|
var path53 = __toESM(require("path"));
|
|
@@ -20414,12 +20465,12 @@ var _spawnSeam = {
|
|
|
20414
20465
|
run: _defaultSpawn
|
|
20415
20466
|
};
|
|
20416
20467
|
function _defaultSpawn(binaryPath, args2, opts) {
|
|
20417
|
-
return new Promise((
|
|
20468
|
+
return new Promise((resolve8) => {
|
|
20418
20469
|
let proc;
|
|
20419
20470
|
try {
|
|
20420
|
-
proc = (0,
|
|
20471
|
+
proc = (0, import_child_process19.spawn)(binaryPath, args2, { cwd: opts.cwd, env: opts.env });
|
|
20421
20472
|
} catch (err) {
|
|
20422
|
-
|
|
20473
|
+
resolve8({ code: -1, stdout: "", stderr: err.message });
|
|
20423
20474
|
return;
|
|
20424
20475
|
}
|
|
20425
20476
|
let stdout = "";
|
|
@@ -20430,8 +20481,8 @@ function _defaultSpawn(binaryPath, args2, opts) {
|
|
|
20430
20481
|
proc.stderr?.on("data", (c2) => {
|
|
20431
20482
|
stderr += c2.toString();
|
|
20432
20483
|
});
|
|
20433
|
-
proc.on("error", (err) =>
|
|
20434
|
-
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 }));
|
|
20435
20486
|
});
|
|
20436
20487
|
}
|
|
20437
20488
|
var _adapterSeam = {
|
|
@@ -20574,13 +20625,13 @@ function coerceIssue(row, projectKey) {
|
|
|
20574
20625
|
}
|
|
20575
20626
|
|
|
20576
20627
|
// src/beads/provisioner.ts
|
|
20577
|
-
var
|
|
20628
|
+
var import_child_process23 = require("child_process");
|
|
20578
20629
|
var fs53 = __toESM(require("fs"));
|
|
20579
20630
|
var os42 = __toESM(require("os"));
|
|
20580
20631
|
var path56 = __toESM(require("path"));
|
|
20581
20632
|
|
|
20582
20633
|
// src/beads/install-bd.ts
|
|
20583
|
-
var
|
|
20634
|
+
var import_child_process20 = require("child_process");
|
|
20584
20635
|
var INSTALL_SH_URL = "https://raw.githubusercontent.com/gastownhall/beads/main/scripts/install.sh";
|
|
20585
20636
|
var INSTALL_PS1_URL = "https://raw.githubusercontent.com/gastownhall/beads/main/install.ps1";
|
|
20586
20637
|
function resolveInstallStrategy(platform3) {
|
|
@@ -20608,22 +20659,22 @@ var _installSpawnSeam = {
|
|
|
20608
20659
|
run: _defaultInstallSpawn
|
|
20609
20660
|
};
|
|
20610
20661
|
function _defaultInstallSpawn(strategy) {
|
|
20611
|
-
return new Promise((
|
|
20662
|
+
return new Promise((resolve8) => {
|
|
20612
20663
|
let proc;
|
|
20613
20664
|
try {
|
|
20614
|
-
proc = (0,
|
|
20665
|
+
proc = (0, import_child_process20.spawn)(strategy.command, strategy.args, { env: process.env });
|
|
20615
20666
|
} catch (err) {
|
|
20616
|
-
|
|
20667
|
+
resolve8({ ok: false, code: -1, stderr: err.message });
|
|
20617
20668
|
return;
|
|
20618
20669
|
}
|
|
20619
20670
|
let stderr = "";
|
|
20620
20671
|
proc.stderr?.on("data", (c2) => {
|
|
20621
20672
|
stderr += c2.toString();
|
|
20622
20673
|
});
|
|
20623
|
-
proc.on("error", (err) =>
|
|
20674
|
+
proc.on("error", (err) => resolve8({ ok: false, code: -1, stderr: err.message }));
|
|
20624
20675
|
proc.on(
|
|
20625
20676
|
"close",
|
|
20626
|
-
(code) =>
|
|
20677
|
+
(code) => resolve8({ ok: code === 0, code: code ?? -1, stderr })
|
|
20627
20678
|
);
|
|
20628
20679
|
});
|
|
20629
20680
|
}
|
|
@@ -20641,7 +20692,7 @@ async function installBd(platform3 = process.platform) {
|
|
|
20641
20692
|
}
|
|
20642
20693
|
|
|
20643
20694
|
// src/beads/install-dolt.ts
|
|
20644
|
-
var
|
|
20695
|
+
var import_child_process21 = require("child_process");
|
|
20645
20696
|
var fs51 = __toESM(require("fs"));
|
|
20646
20697
|
var os41 = __toESM(require("os"));
|
|
20647
20698
|
var path54 = __toESM(require("path"));
|
|
@@ -20792,18 +20843,18 @@ var _doltInstallSpawnSeam = {
|
|
|
20792
20843
|
};
|
|
20793
20844
|
var DOLT_INSTALL_TIMEOUT_MS = 12e4;
|
|
20794
20845
|
function _defaultDoltInstallSpawn(strategy) {
|
|
20795
|
-
return new Promise((
|
|
20846
|
+
return new Promise((resolve8) => {
|
|
20796
20847
|
let settled = false;
|
|
20797
20848
|
let timer;
|
|
20798
20849
|
const finish = (r) => {
|
|
20799
20850
|
if (settled) return;
|
|
20800
20851
|
settled = true;
|
|
20801
20852
|
if (timer) clearTimeout(timer);
|
|
20802
|
-
|
|
20853
|
+
resolve8(r);
|
|
20803
20854
|
};
|
|
20804
20855
|
let proc;
|
|
20805
20856
|
try {
|
|
20806
|
-
proc = (0,
|
|
20857
|
+
proc = (0, import_child_process21.spawn)(strategy.command, strategy.args, {
|
|
20807
20858
|
env: process.env,
|
|
20808
20859
|
stdio: ["ignore", "pipe", "pipe"]
|
|
20809
20860
|
});
|
|
@@ -20901,7 +20952,7 @@ async function ensureSharedServer(adapter, options = {}) {
|
|
|
20901
20952
|
}
|
|
20902
20953
|
|
|
20903
20954
|
// src/beads/project-key.ts
|
|
20904
|
-
var
|
|
20955
|
+
var import_child_process22 = require("child_process");
|
|
20905
20956
|
var crypto2 = __toESM(require("crypto"));
|
|
20906
20957
|
var fs52 = __toESM(require("fs"));
|
|
20907
20958
|
var path55 = __toESM(require("path"));
|
|
@@ -20948,7 +20999,7 @@ function findRepoRoot(cwd) {
|
|
|
20948
20999
|
}
|
|
20949
21000
|
var _execSeam2 = {
|
|
20950
21001
|
exec: (file, args2, opts) => {
|
|
20951
|
-
const out2 = (0,
|
|
21002
|
+
const out2 = (0, import_child_process22.execFileSync)(file, args2, opts);
|
|
20952
21003
|
return typeof out2 === "string" ? out2 : out2.toString("utf8");
|
|
20953
21004
|
},
|
|
20954
21005
|
realpath: (p2) => fs52.realpathSync(p2)
|
|
@@ -21111,7 +21162,7 @@ function linkBdOntoPath(binaryPath) {
|
|
|
21111
21162
|
log.info("beads", `linked bd onto PATH: ${linkPath} -> ${binaryPath}`);
|
|
21112
21163
|
}
|
|
21113
21164
|
function setGitBeadsRole() {
|
|
21114
|
-
(0,
|
|
21165
|
+
(0, import_child_process23.execFileSync)("git", ["config", "--global", "beads.role", "contributor"], {
|
|
21115
21166
|
stdio: "ignore"
|
|
21116
21167
|
});
|
|
21117
21168
|
}
|
|
@@ -21878,7 +21929,7 @@ var sessionTerminated = async (ctx, cmd) => {
|
|
|
21878
21929
|
}
|
|
21879
21930
|
quiet(() => ctx.agent.kill());
|
|
21880
21931
|
try {
|
|
21881
|
-
const proc = (0,
|
|
21932
|
+
const proc = (0, import_child_process24.spawn)("bash", ["-lc", "pm2 delete codeam-pair >/dev/null 2>&1 || true"], {
|
|
21882
21933
|
detached: true,
|
|
21883
21934
|
stdio: "ignore"
|
|
21884
21935
|
});
|
|
@@ -21897,7 +21948,7 @@ var shutdownSession = async (ctx, cmd) => {
|
|
|
21897
21948
|
quiet(() => ctx.agent.kill());
|
|
21898
21949
|
if (ctx.keepAliveCtx.inCodespace && ctx.keepAliveCtx.codespaceName) {
|
|
21899
21950
|
try {
|
|
21900
|
-
const stopProc = (0,
|
|
21951
|
+
const stopProc = (0, import_child_process24.spawn)(
|
|
21901
21952
|
"bash",
|
|
21902
21953
|
["-lc", `sleep 1; gh codespace stop -c ${JSON.stringify(ctx.keepAliveCtx.codespaceName)} >/dev/null 2>&1 || true`],
|
|
21903
21954
|
{ detached: true, stdio: "ignore" }
|
|
@@ -21907,7 +21958,7 @@ var shutdownSession = async (ctx, cmd) => {
|
|
|
21907
21958
|
}
|
|
21908
21959
|
}
|
|
21909
21960
|
try {
|
|
21910
|
-
const proc = (0,
|
|
21961
|
+
const proc = (0, import_child_process24.spawn)("bash", ["-lc", "pm2 delete codeam-pair >/dev/null 2>&1 || true"], {
|
|
21911
21962
|
detached: true,
|
|
21912
21963
|
stdio: "ignore"
|
|
21913
21964
|
});
|
|
@@ -22430,7 +22481,7 @@ var defaultCliUpdateDeps = {
|
|
|
22430
22481
|
// Only a truly local `codeam start` (neither marker) re-execs in place below.
|
|
22431
22482
|
isSupervised: () => process.env["CODEAM_AUTO_APPROVE"] === "1" || process.env["CODESPACES"] === "true",
|
|
22432
22483
|
relaunch: (args2) => {
|
|
22433
|
-
const child = (0,
|
|
22484
|
+
const child = (0, import_child_process24.spawnSync)("codeam", args2, { stdio: "inherit", env: process.env });
|
|
22434
22485
|
process.exit(child.status ?? 0);
|
|
22435
22486
|
}
|
|
22436
22487
|
};
|
|
@@ -22458,16 +22509,16 @@ async function runNpmInstallLatest() {
|
|
|
22458
22509
|
const useShell = process.platform === "win32";
|
|
22459
22510
|
const command2 = useShell && invocation.command.includes(" ") ? `"${invocation.command}"` : invocation.command;
|
|
22460
22511
|
for (let attempt = 1; attempt <= CLI_UPDATE_MAX_ATTEMPTS; attempt++) {
|
|
22461
|
-
const result = await new Promise((
|
|
22462
|
-
(0,
|
|
22512
|
+
const result = await new Promise((resolve8) => {
|
|
22513
|
+
(0, import_child_process24.execFile)(
|
|
22463
22514
|
command2,
|
|
22464
22515
|
invocation.args,
|
|
22465
22516
|
{ timeout: CLI_UPDATE_INSTALL_TIMEOUT_MS, shell: useShell },
|
|
22466
22517
|
(err, _stdout, stderr) => {
|
|
22467
22518
|
if (!err) {
|
|
22468
|
-
|
|
22519
|
+
resolve8({ ok: true });
|
|
22469
22520
|
} else {
|
|
22470
|
-
|
|
22521
|
+
resolve8({ ok: false, error: (stderr || err.message).slice(0, 300) });
|
|
22471
22522
|
}
|
|
22472
22523
|
}
|
|
22473
22524
|
);
|
|
@@ -23051,13 +23102,13 @@ async function dispatchCommand(ctx, cmd) {
|
|
|
23051
23102
|
}
|
|
23052
23103
|
|
|
23053
23104
|
// src/commands/start/keep-alive.ts
|
|
23054
|
-
var
|
|
23105
|
+
var import_child_process25 = require("child_process");
|
|
23055
23106
|
function buildKeepAlive(ctx) {
|
|
23056
23107
|
let timer = null;
|
|
23057
23108
|
async function setIdleTimeout(minutes) {
|
|
23058
23109
|
if (!ctx.inCodespace || !ctx.codespaceName) return;
|
|
23059
|
-
await new Promise((
|
|
23060
|
-
const proc = (0,
|
|
23110
|
+
await new Promise((resolve8) => {
|
|
23111
|
+
const proc = (0, import_child_process25.spawn)(
|
|
23061
23112
|
"gh",
|
|
23062
23113
|
[
|
|
23063
23114
|
"api",
|
|
@@ -23070,8 +23121,8 @@ function buildKeepAlive(ctx) {
|
|
|
23070
23121
|
{ stdio: "ignore", detached: true }
|
|
23071
23122
|
);
|
|
23072
23123
|
proc.unref();
|
|
23073
|
-
proc.on("exit", () =>
|
|
23074
|
-
proc.on("error", () =>
|
|
23124
|
+
proc.on("exit", () => resolve8());
|
|
23125
|
+
proc.on("error", () => resolve8());
|
|
23075
23126
|
});
|
|
23076
23127
|
}
|
|
23077
23128
|
return {
|
|
@@ -23572,10 +23623,10 @@ function wrapWithHeadroom(launch, opts) {
|
|
|
23572
23623
|
var _present;
|
|
23573
23624
|
function headroomPresent() {
|
|
23574
23625
|
if (_present !== void 0) return Promise.resolve(_present);
|
|
23575
|
-
return new Promise((
|
|
23626
|
+
return new Promise((resolve8) => {
|
|
23576
23627
|
(0, import_node_child_process24.execFile)("headroom", ["--version"], (err) => {
|
|
23577
23628
|
_present = !err;
|
|
23578
|
-
|
|
23629
|
+
resolve8(_present);
|
|
23579
23630
|
});
|
|
23580
23631
|
});
|
|
23581
23632
|
}
|
|
@@ -23929,7 +23980,7 @@ var path62 = __toESM(require("path"));
|
|
|
23929
23980
|
var import_fs4 = __toESM(require("fs"));
|
|
23930
23981
|
var import_os10 = __toESM(require("os"));
|
|
23931
23982
|
var import_path8 = __toESM(require("path"));
|
|
23932
|
-
var
|
|
23983
|
+
var import_child_process26 = require("child_process");
|
|
23933
23984
|
function currentPlatformKey() {
|
|
23934
23985
|
return `${process.platform}-${process.arch}`;
|
|
23935
23986
|
}
|
|
@@ -23965,7 +24016,7 @@ function resolveClaudeNativeBinary(deps = {}) {
|
|
|
23965
24016
|
const candidate = import_path8.default.join(scopeDir, `claude-agent-sdk-${platformKey}`, binName);
|
|
23966
24017
|
return existsSync27(candidate) ? candidate : null;
|
|
23967
24018
|
}
|
|
23968
|
-
var realSleep = (ms) => new Promise((
|
|
24019
|
+
var realSleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
23969
24020
|
async function waitForClaudeNativeBinary(opts = {}) {
|
|
23970
24021
|
const timeoutMs = opts.timeoutMs ?? 18e4;
|
|
23971
24022
|
const pollMs = opts.pollMs ?? 500;
|
|
@@ -23992,7 +24043,7 @@ function isCommandOnPath(cmd, probe = defaultWhich) {
|
|
|
23992
24043
|
function defaultWhich(cmd) {
|
|
23993
24044
|
const finder = process.platform === "win32" ? "where" : "which";
|
|
23994
24045
|
try {
|
|
23995
|
-
const res = (0,
|
|
24046
|
+
const res = (0, import_child_process26.spawnSync)(finder, [cmd], { stdio: "ignore" });
|
|
23996
24047
|
return res.status === 0;
|
|
23997
24048
|
} catch {
|
|
23998
24049
|
return false;
|
|
@@ -24045,8 +24096,8 @@ var ADAPTER_MODULE_LOAD_ERROR_RE = /ERR_MODULE_NOT_FOUND|Cannot find module|ERR_
|
|
|
24045
24096
|
var PERMANENT_ADAPTER_STARTUP_RE = /IneligibleTierError|UNSUPPORTED_CLIENT|no longer supported for Gemini Code Assist|not eligible for Gemini Code Assist|Error authenticating|ProjectIdRequiredError/i;
|
|
24046
24097
|
function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
24047
24098
|
const livenessMs = opts.livenessMs ?? 400;
|
|
24048
|
-
const spawnFn = opts.spawnFn ??
|
|
24049
|
-
return new Promise((
|
|
24099
|
+
const spawnFn = opts.spawnFn ?? import_child_process26.spawn;
|
|
24100
|
+
return new Promise((resolve8) => {
|
|
24050
24101
|
let settled = false;
|
|
24051
24102
|
let stderr = "";
|
|
24052
24103
|
let timer;
|
|
@@ -24059,12 +24110,12 @@ function probeAdapterModuleGraph(command2, args2, opts = {}) {
|
|
|
24059
24110
|
child?.kill("SIGKILL");
|
|
24060
24111
|
} catch {
|
|
24061
24112
|
}
|
|
24062
|
-
|
|
24113
|
+
resolve8(r);
|
|
24063
24114
|
};
|
|
24064
24115
|
try {
|
|
24065
24116
|
child = spawnFn(command2, [...args2], { stdio: ["pipe", "ignore", "pipe"] });
|
|
24066
24117
|
} catch {
|
|
24067
|
-
|
|
24118
|
+
resolve8("ok");
|
|
24068
24119
|
return;
|
|
24069
24120
|
}
|
|
24070
24121
|
child.stderr?.on("data", (d3) => {
|
|
@@ -24115,10 +24166,10 @@ function augmentPath2() {
|
|
|
24115
24166
|
if (!parts.includes(dir)) process.env.PATH = `${dir}:${process.env.PATH ?? ""}`;
|
|
24116
24167
|
}
|
|
24117
24168
|
async function runInstaller2() {
|
|
24118
|
-
return new Promise((
|
|
24169
|
+
return new Promise((resolve8) => {
|
|
24119
24170
|
const proc = (0, import_node_child_process25.spawn)("sh", ["-c", `curl -fsSL ${INSTALL_URL2} | bash`], { stdio: "inherit" });
|
|
24120
|
-
proc.on("close", (code) =>
|
|
24121
|
-
proc.on("error", () =>
|
|
24171
|
+
proc.on("close", (code) => resolve8(code === 0));
|
|
24172
|
+
proc.on("error", () => resolve8(false));
|
|
24122
24173
|
});
|
|
24123
24174
|
}
|
|
24124
24175
|
async function ensureKimiInstalled() {
|
|
@@ -24342,7 +24393,7 @@ function parseJsonl(filePath) {
|
|
|
24342
24393
|
return messages;
|
|
24343
24394
|
}
|
|
24344
24395
|
function post(endpoint, body, pluginAuthToken) {
|
|
24345
|
-
return new Promise((
|
|
24396
|
+
return new Promise((resolve8) => {
|
|
24346
24397
|
const payload = JSON.stringify(body);
|
|
24347
24398
|
const u2 = new URL(`${API_BASE8}${endpoint}`);
|
|
24348
24399
|
const transport = u2.protocol === "https:" ? https7 : http6;
|
|
@@ -24367,17 +24418,17 @@ function post(endpoint, body, pluginAuthToken) {
|
|
|
24367
24418
|
res.resume();
|
|
24368
24419
|
const ok = res.statusCode !== void 0 && res.statusCode >= 200 && res.statusCode < 300;
|
|
24369
24420
|
if (!ok) log.warn("history:post", `${endpoint} \u2192 HTTP ${res.statusCode}`);
|
|
24370
|
-
|
|
24421
|
+
resolve8(ok);
|
|
24371
24422
|
}
|
|
24372
24423
|
);
|
|
24373
24424
|
req.on("error", (err) => {
|
|
24374
24425
|
log.warn("history:post", `${endpoint} network error`, err);
|
|
24375
|
-
|
|
24426
|
+
resolve8(false);
|
|
24376
24427
|
});
|
|
24377
24428
|
req.on("timeout", () => {
|
|
24378
24429
|
log.warn("history:post", `${endpoint} timeout after 15s`);
|
|
24379
24430
|
req.destroy();
|
|
24380
|
-
|
|
24431
|
+
resolve8(false);
|
|
24381
24432
|
});
|
|
24382
24433
|
req.write(payload);
|
|
24383
24434
|
req.end();
|
|
@@ -27027,8 +27078,8 @@ var Connection = class {
|
|
|
27027
27078
|
this.requestHandler = requestHandler;
|
|
27028
27079
|
this.notificationHandler = notificationHandler;
|
|
27029
27080
|
this.stream = stream;
|
|
27030
|
-
this.closedPromise = new Promise((
|
|
27031
|
-
this.abortController.signal.addEventListener("abort", () =>
|
|
27081
|
+
this.closedPromise = new Promise((resolve8) => {
|
|
27082
|
+
this.abortController.signal.addEventListener("abort", () => resolve8());
|
|
27032
27083
|
});
|
|
27033
27084
|
void this.receive();
|
|
27034
27085
|
}
|
|
@@ -27198,11 +27249,11 @@ var Connection = class {
|
|
|
27198
27249
|
return rejectedPromise(this.closedReason());
|
|
27199
27250
|
}
|
|
27200
27251
|
const id = this.nextRequestId++;
|
|
27201
|
-
const responsePromise = new Promise((
|
|
27252
|
+
const responsePromise = new Promise((resolve8, reject) => {
|
|
27202
27253
|
this.pendingResponses.set(id, {
|
|
27203
27254
|
resolve: (response) => {
|
|
27204
27255
|
try {
|
|
27205
|
-
|
|
27256
|
+
resolve8(mapResponse ? mapResponse(response) : response);
|
|
27206
27257
|
} catch (error) {
|
|
27207
27258
|
reject(error);
|
|
27208
27259
|
}
|
|
@@ -27869,14 +27920,14 @@ var AcpClient = class {
|
|
|
27869
27920
|
this.sessionId = null;
|
|
27870
27921
|
try {
|
|
27871
27922
|
child.kill("SIGTERM");
|
|
27872
|
-
const grace = new Promise((
|
|
27923
|
+
const grace = new Promise((resolve8) => {
|
|
27873
27924
|
const t2 = setTimeout(() => {
|
|
27874
27925
|
killQuiet(child, "SIGKILL");
|
|
27875
|
-
|
|
27926
|
+
resolve8();
|
|
27876
27927
|
}, 2e3);
|
|
27877
27928
|
child.once("exit", () => {
|
|
27878
27929
|
clearTimeout(t2);
|
|
27879
|
-
|
|
27930
|
+
resolve8();
|
|
27880
27931
|
});
|
|
27881
27932
|
});
|
|
27882
27933
|
await grace;
|
|
@@ -28094,7 +28145,7 @@ var _transport4 = {
|
|
|
28094
28145
|
get: _get
|
|
28095
28146
|
};
|
|
28096
28147
|
function _post3(url, headers, payload) {
|
|
28097
|
-
return new Promise((
|
|
28148
|
+
return new Promise((resolve8, reject) => {
|
|
28098
28149
|
let settled = false;
|
|
28099
28150
|
const u2 = new URL(url);
|
|
28100
28151
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -28119,7 +28170,7 @@ function _post3(url, headers, payload) {
|
|
|
28119
28170
|
res.on("end", () => {
|
|
28120
28171
|
if (settled) return;
|
|
28121
28172
|
settled = true;
|
|
28122
|
-
|
|
28173
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
28123
28174
|
});
|
|
28124
28175
|
}
|
|
28125
28176
|
);
|
|
@@ -28136,7 +28187,7 @@ function _post3(url, headers, payload) {
|
|
|
28136
28187
|
});
|
|
28137
28188
|
}
|
|
28138
28189
|
function _get(url, headers) {
|
|
28139
|
-
return new Promise((
|
|
28190
|
+
return new Promise((resolve8, reject) => {
|
|
28140
28191
|
let settled = false;
|
|
28141
28192
|
const u2 = new URL(url);
|
|
28142
28193
|
const lib = u2.protocol === "https:" ? https8 : http7;
|
|
@@ -28160,7 +28211,7 @@ function _get(url, headers) {
|
|
|
28160
28211
|
res.on("end", () => {
|
|
28161
28212
|
if (settled) return;
|
|
28162
28213
|
settled = true;
|
|
28163
|
-
|
|
28214
|
+
resolve8({ statusCode: res.statusCode ?? 0, body });
|
|
28164
28215
|
});
|
|
28165
28216
|
}
|
|
28166
28217
|
);
|
|
@@ -28532,7 +28583,7 @@ function commonPrefixLength(a, b) {
|
|
|
28532
28583
|
}
|
|
28533
28584
|
|
|
28534
28585
|
// src/agents/acp/onboarding.ts
|
|
28535
|
-
var
|
|
28586
|
+
var import_child_process27 = require("child_process");
|
|
28536
28587
|
var fs60 = __toESM(require("fs"));
|
|
28537
28588
|
var os49 = __toESM(require("os"));
|
|
28538
28589
|
var path65 = __toESM(require("path"));
|
|
@@ -28553,7 +28604,7 @@ var _onboardingSeam = {
|
|
|
28553
28604
|
*/
|
|
28554
28605
|
gitRemoteUrl: (cwd) => {
|
|
28555
28606
|
try {
|
|
28556
|
-
return (0,
|
|
28607
|
+
return (0, import_child_process27.execFileSync)("git", ["-C", cwd, "remote", "get-url", "origin"], {
|
|
28557
28608
|
encoding: "utf8",
|
|
28558
28609
|
stdio: ["ignore", "pipe", "ignore"],
|
|
28559
28610
|
timeout: 2e3
|
|
@@ -28829,7 +28880,7 @@ function extractSelectPrompt(text) {
|
|
|
28829
28880
|
var import_crypto5 = require("crypto");
|
|
28830
28881
|
|
|
28831
28882
|
// src/services/turn-files/git-changeset.ts
|
|
28832
|
-
var
|
|
28883
|
+
var import_child_process28 = require("child_process");
|
|
28833
28884
|
var fs61 = __toESM(require("fs/promises"));
|
|
28834
28885
|
var path66 = __toESM(require("path"));
|
|
28835
28886
|
async function collectRepoChangeset(opts) {
|
|
@@ -28941,12 +28992,12 @@ function runGit3(cwd, args2) {
|
|
|
28941
28992
|
return _runGitImpl2.run(cwd, args2);
|
|
28942
28993
|
}
|
|
28943
28994
|
function defaultRunGit(cwd, args2) {
|
|
28944
|
-
return new Promise((
|
|
28995
|
+
return new Promise((resolve8) => {
|
|
28945
28996
|
let proc;
|
|
28946
28997
|
try {
|
|
28947
|
-
proc = (0,
|
|
28998
|
+
proc = (0, import_child_process28.spawn)("git", args2, { cwd, env: process.env });
|
|
28948
28999
|
} catch {
|
|
28949
|
-
|
|
29000
|
+
resolve8(null);
|
|
28950
29001
|
return;
|
|
28951
29002
|
}
|
|
28952
29003
|
let stdout = "";
|
|
@@ -28957,16 +29008,16 @@ function defaultRunGit(cwd, args2) {
|
|
|
28957
29008
|
proc.stderr?.on("data", (c2) => {
|
|
28958
29009
|
stderr += c2.toString();
|
|
28959
29010
|
});
|
|
28960
|
-
proc.on("error", () =>
|
|
29011
|
+
proc.on("error", () => resolve8(null));
|
|
28961
29012
|
proc.on("close", (code) => {
|
|
28962
29013
|
if (code === 0) {
|
|
28963
|
-
|
|
29014
|
+
resolve8(stdout);
|
|
28964
29015
|
} else {
|
|
28965
29016
|
log.trace(
|
|
28966
29017
|
"turnFiles",
|
|
28967
29018
|
`git ${args2.join(" ")} exited ${code} stderr=${stderr.slice(0, 200)}`
|
|
28968
29019
|
);
|
|
28969
|
-
|
|
29020
|
+
resolve8(null);
|
|
28970
29021
|
}
|
|
28971
29022
|
});
|
|
28972
29023
|
});
|
|
@@ -29354,25 +29405,25 @@ function baselineKey(entry) {
|
|
|
29354
29405
|
|
|
29355
29406
|
// src/agents/acp/withTimeout.ts
|
|
29356
29407
|
function withTimeout(p2, ms) {
|
|
29357
|
-
return new Promise((
|
|
29408
|
+
return new Promise((resolve8) => {
|
|
29358
29409
|
let settled = false;
|
|
29359
29410
|
const timer = setTimeout(() => {
|
|
29360
29411
|
if (settled) return;
|
|
29361
29412
|
settled = true;
|
|
29362
|
-
|
|
29413
|
+
resolve8(void 0);
|
|
29363
29414
|
}, ms);
|
|
29364
29415
|
p2.then(
|
|
29365
29416
|
(v) => {
|
|
29366
29417
|
if (settled) return;
|
|
29367
29418
|
settled = true;
|
|
29368
29419
|
clearTimeout(timer);
|
|
29369
|
-
|
|
29420
|
+
resolve8(v);
|
|
29370
29421
|
},
|
|
29371
29422
|
() => {
|
|
29372
29423
|
if (settled) return;
|
|
29373
29424
|
settled = true;
|
|
29374
29425
|
clearTimeout(timer);
|
|
29375
|
-
|
|
29426
|
+
resolve8(void 0);
|
|
29376
29427
|
}
|
|
29377
29428
|
);
|
|
29378
29429
|
});
|
|
@@ -30243,7 +30294,7 @@ var StreamingState = class {
|
|
|
30243
30294
|
* default-reject. Caller is the SDK's `onRequestPermission`.
|
|
30244
30295
|
*/
|
|
30245
30296
|
registerPermission(args2) {
|
|
30246
|
-
return new Promise((
|
|
30297
|
+
return new Promise((resolve8) => {
|
|
30247
30298
|
const timeoutTimer = setTimeout(() => {
|
|
30248
30299
|
if (this.pending?.kind === "permission" && this.pending.questionId === args2.questionId) {
|
|
30249
30300
|
log.warn(
|
|
@@ -30251,7 +30302,7 @@ var StreamingState = class {
|
|
|
30251
30302
|
`permission ${args2.questionId.slice(0, 8)} TTL expired \u2014 auto-cancel`
|
|
30252
30303
|
);
|
|
30253
30304
|
this.pending = null;
|
|
30254
|
-
|
|
30305
|
+
resolve8({ outcome: { outcome: "cancelled" } });
|
|
30255
30306
|
}
|
|
30256
30307
|
}, PERMISSION_TIMEOUT_MS);
|
|
30257
30308
|
this.pending = {
|
|
@@ -30259,7 +30310,7 @@ var StreamingState = class {
|
|
|
30259
30310
|
questionId: args2.questionId,
|
|
30260
30311
|
labels: args2.labels,
|
|
30261
30312
|
optionIdByLabel: args2.optionIdByLabel,
|
|
30262
|
-
resolve:
|
|
30313
|
+
resolve: resolve8,
|
|
30263
30314
|
timeoutTimer
|
|
30264
30315
|
};
|
|
30265
30316
|
});
|
|
@@ -30291,14 +30342,14 @@ var StreamingState = class {
|
|
|
30291
30342
|
const label = this.pending.labels[index];
|
|
30292
30343
|
const optionId = label ? this.pending.optionIdByLabel[label] : void 0;
|
|
30293
30344
|
clearTimeout(this.pending.timeoutTimer);
|
|
30294
|
-
const
|
|
30345
|
+
const resolve8 = this.pending.resolve;
|
|
30295
30346
|
this.pending = null;
|
|
30296
30347
|
if (!optionId) {
|
|
30297
30348
|
log.warn("acpRunner", `select_option index=${index} out of bounds \u2014 cancel`);
|
|
30298
|
-
|
|
30349
|
+
resolve8({ outcome: { outcome: "cancelled" } });
|
|
30299
30350
|
return { kind: "resolved" };
|
|
30300
30351
|
}
|
|
30301
|
-
|
|
30352
|
+
resolve8({ outcome: { outcome: "selected", optionId } });
|
|
30302
30353
|
return { kind: "resolved" };
|
|
30303
30354
|
}
|
|
30304
30355
|
const text = this.pending.options[index];
|
|
@@ -32170,10 +32221,10 @@ var NativeTuiDriver = class _NativeTuiDriver {
|
|
|
32170
32221
|
this.lastOutput = this.now();
|
|
32171
32222
|
}
|
|
32172
32223
|
whenSafeToYield() {
|
|
32173
|
-
return new Promise((
|
|
32224
|
+
return new Promise((resolve8) => {
|
|
32174
32225
|
const tick = () => {
|
|
32175
32226
|
const quietFor = this.now() - this.lastOutput;
|
|
32176
|
-
if (quietFor >= this.idleMs)
|
|
32227
|
+
if (quietFor >= this.idleMs) resolve8();
|
|
32177
32228
|
else setTimeout(tick, this.idleMs - quietFor);
|
|
32178
32229
|
};
|
|
32179
32230
|
tick();
|
|
@@ -32310,11 +32361,11 @@ var AcpDriver = class {
|
|
|
32310
32361
|
this.turnActive = false;
|
|
32311
32362
|
const waiters = this.waiters;
|
|
32312
32363
|
this.waiters = [];
|
|
32313
|
-
waiters.forEach((
|
|
32364
|
+
waiters.forEach((resolve8) => resolve8());
|
|
32314
32365
|
}
|
|
32315
32366
|
whenSafeToYield() {
|
|
32316
32367
|
if (!this.turnActive) return Promise.resolve();
|
|
32317
|
-
return new Promise((
|
|
32368
|
+
return new Promise((resolve8) => this.waiters.push(resolve8));
|
|
32318
32369
|
}
|
|
32319
32370
|
};
|
|
32320
32371
|
|
|
@@ -32805,8 +32856,8 @@ async function start(requestedAgent) {
|
|
|
32805
32856
|
let gateTimer;
|
|
32806
32857
|
await Promise.race([
|
|
32807
32858
|
Promise.all([beadsReady.catch(() => null), depsReady, agentBinaryReady]),
|
|
32808
|
-
new Promise((
|
|
32809
|
-
gateTimer = setTimeout(
|
|
32859
|
+
new Promise((resolve8) => {
|
|
32860
|
+
gateTimer = setTimeout(resolve8, GATE_TIMEOUT_MS);
|
|
32810
32861
|
})
|
|
32811
32862
|
]);
|
|
32812
32863
|
if (gateTimer) clearTimeout(gateTimer);
|
|
@@ -33131,7 +33182,7 @@ async function pair(args2 = []) {
|
|
|
33131
33182
|
waitSpin.message(waitMessage());
|
|
33132
33183
|
}, 1e3);
|
|
33133
33184
|
countdownInterval.unref?.();
|
|
33134
|
-
await new Promise((
|
|
33185
|
+
await new Promise((resolve8) => {
|
|
33135
33186
|
let stopPolling = null;
|
|
33136
33187
|
function sigintHandler() {
|
|
33137
33188
|
clearInterval(countdownInterval);
|
|
@@ -33182,7 +33233,7 @@ async function pair(args2 = []) {
|
|
|
33182
33233
|
pluginAuthToken: info.pluginAuthToken
|
|
33183
33234
|
});
|
|
33184
33235
|
}
|
|
33185
|
-
|
|
33236
|
+
resolve8();
|
|
33186
33237
|
},
|
|
33187
33238
|
() => {
|
|
33188
33239
|
clearInterval(countdownInterval);
|
|
@@ -33364,11 +33415,11 @@ async function logout() {
|
|
|
33364
33415
|
var import_picocolors11 = __toESM(require("picocolors"));
|
|
33365
33416
|
|
|
33366
33417
|
// src/services/providers/github-codespaces.ts
|
|
33367
|
-
var
|
|
33418
|
+
var import_child_process29 = require("child_process");
|
|
33368
33419
|
var import_util4 = require("util");
|
|
33369
33420
|
var import_picocolors9 = __toESM(require("picocolors"));
|
|
33370
33421
|
var path69 = __toESM(require("path"));
|
|
33371
|
-
var execFileP6 = (0, import_util4.promisify)(
|
|
33422
|
+
var execFileP6 = (0, import_util4.promisify)(import_child_process29.execFile);
|
|
33372
33423
|
var MAX_BUFFER = 8 * 1024 * 1024;
|
|
33373
33424
|
function resetStdinForChild() {
|
|
33374
33425
|
if (process.stdin.isTTY) {
|
|
@@ -33411,12 +33462,12 @@ var GitHubCodespacesProvider = class {
|
|
|
33411
33462
|
}
|
|
33412
33463
|
if (!isAuthed) {
|
|
33413
33464
|
resetStdinForChild();
|
|
33414
|
-
await new Promise((
|
|
33415
|
-
const proc = (0,
|
|
33465
|
+
await new Promise((resolve8, reject) => {
|
|
33466
|
+
const proc = (0, import_child_process29.spawn)("gh", ["auth", "login", "-s", "codespace,repo,read:user"], {
|
|
33416
33467
|
stdio: "inherit"
|
|
33417
33468
|
});
|
|
33418
33469
|
proc.on("exit", (code) => {
|
|
33419
|
-
if (code === 0)
|
|
33470
|
+
if (code === 0) resolve8();
|
|
33420
33471
|
else reject(new Error("gh auth login failed."));
|
|
33421
33472
|
});
|
|
33422
33473
|
proc.on("error", reject);
|
|
@@ -33445,13 +33496,13 @@ var GitHubCodespacesProvider = class {
|
|
|
33445
33496
|
}
|
|
33446
33497
|
wt(noteLines.join("\n"), "One more permission needed");
|
|
33447
33498
|
resetStdinForChild();
|
|
33448
|
-
const refreshCode = await new Promise((
|
|
33449
|
-
const proc = (0,
|
|
33499
|
+
const refreshCode = await new Promise((resolve8, reject) => {
|
|
33500
|
+
const proc = (0, import_child_process29.spawn)(
|
|
33450
33501
|
"gh",
|
|
33451
33502
|
["auth", "refresh", "-h", "github.com", "-s", "codespace"],
|
|
33452
33503
|
{ stdio: "inherit" }
|
|
33453
33504
|
);
|
|
33454
|
-
proc.on("exit", (code) =>
|
|
33505
|
+
proc.on("exit", (code) => resolve8(code ?? 1));
|
|
33455
33506
|
proc.on("error", reject);
|
|
33456
33507
|
});
|
|
33457
33508
|
if (refreshCode !== 0) {
|
|
@@ -33595,10 +33646,10 @@ var GitHubCodespacesProvider = class {
|
|
|
33595
33646
|
if (q(proceed) || !proceed) return;
|
|
33596
33647
|
O2.step(`Installing gh via ${installCmd.describe}\u2026`);
|
|
33597
33648
|
resetStdinForChild();
|
|
33598
|
-
const ok = await new Promise((
|
|
33599
|
-
const proc = (0,
|
|
33600
|
-
proc.on("exit", (code) =>
|
|
33601
|
-
proc.on("error", () =>
|
|
33649
|
+
const ok = await new Promise((resolve8) => {
|
|
33650
|
+
const proc = (0, import_child_process29.spawn)(installCmd.exe, installCmd.args, { stdio: "inherit" });
|
|
33651
|
+
proc.on("exit", (code) => resolve8(code === 0));
|
|
33652
|
+
proc.on("error", () => resolve8(false));
|
|
33602
33653
|
});
|
|
33603
33654
|
if (ok) O2.success("gh installed");
|
|
33604
33655
|
else O2.error("gh install failed");
|
|
@@ -33622,14 +33673,14 @@ var GitHubCodespacesProvider = class {
|
|
|
33622
33673
|
"Expanding GitHub scopes"
|
|
33623
33674
|
);
|
|
33624
33675
|
resetStdinForChild();
|
|
33625
|
-
await new Promise((
|
|
33626
|
-
const proc = (0,
|
|
33676
|
+
await new Promise((resolve8, reject) => {
|
|
33677
|
+
const proc = (0, import_child_process29.spawn)(
|
|
33627
33678
|
"gh",
|
|
33628
33679
|
["auth", "refresh", "-h", "github.com", "-s", "repo,read:org"],
|
|
33629
33680
|
{ stdio: "inherit" }
|
|
33630
33681
|
);
|
|
33631
33682
|
proc.on("exit", (code) => {
|
|
33632
|
-
if (code === 0)
|
|
33683
|
+
if (code === 0) resolve8();
|
|
33633
33684
|
else reject(new Error(
|
|
33634
33685
|
"gh auth refresh failed. Re-run `gh auth refresh -h github.com -s repo,read:org` manually."
|
|
33635
33686
|
));
|
|
@@ -33800,13 +33851,13 @@ var GitHubCodespacesProvider = class {
|
|
|
33800
33851
|
}
|
|
33801
33852
|
async streamCommand(workspaceId, command2) {
|
|
33802
33853
|
resetStdinForChild();
|
|
33803
|
-
return new Promise((
|
|
33804
|
-
const proc = (0,
|
|
33854
|
+
return new Promise((resolve8, reject) => {
|
|
33855
|
+
const proc = (0, import_child_process29.spawn)(
|
|
33805
33856
|
"gh",
|
|
33806
33857
|
["codespace", "ssh", "-c", workspaceId, "--", "-tt", command2],
|
|
33807
33858
|
{ stdio: "inherit" }
|
|
33808
33859
|
);
|
|
33809
|
-
proc.on("exit", (code) =>
|
|
33860
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
33810
33861
|
proc.on("error", reject);
|
|
33811
33862
|
});
|
|
33812
33863
|
}
|
|
@@ -33827,12 +33878,12 @@ var GitHubCodespacesProvider = class {
|
|
|
33827
33878
|
"--",
|
|
33828
33879
|
`mkdir -p ${shellQuote(remoteDir)} && tar -xzf - -C ${shellQuote(remoteDir)}`
|
|
33829
33880
|
];
|
|
33830
|
-
await new Promise((
|
|
33831
|
-
const tar = (0,
|
|
33881
|
+
await new Promise((resolve8, reject) => {
|
|
33882
|
+
const tar = (0, import_child_process29.spawn)("tar", tarArgs, {
|
|
33832
33883
|
stdio: ["ignore", "pipe", "pipe"],
|
|
33833
33884
|
env: tarEnv
|
|
33834
33885
|
});
|
|
33835
|
-
const ssh = (0,
|
|
33886
|
+
const ssh = (0, import_child_process29.spawn)("gh", sshArgs, {
|
|
33836
33887
|
stdio: [tar.stdout, "pipe", "pipe"]
|
|
33837
33888
|
});
|
|
33838
33889
|
let tarErr = "";
|
|
@@ -33847,7 +33898,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33847
33898
|
ssh.on("error", reject);
|
|
33848
33899
|
ssh.on("exit", (code) => {
|
|
33849
33900
|
if (code === 0) {
|
|
33850
|
-
|
|
33901
|
+
resolve8();
|
|
33851
33902
|
} else {
|
|
33852
33903
|
const reason = (sshErr || tarErr || `exit ${code}`).trim().slice(0, 500);
|
|
33853
33904
|
reject(new Error(`Remote tar failed: ${reason}`));
|
|
@@ -33865,8 +33916,8 @@ var GitHubCodespacesProvider = class {
|
|
|
33865
33916
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote(remotePath)}`);
|
|
33866
33917
|
}
|
|
33867
33918
|
const cmd = parts.join(" && ");
|
|
33868
|
-
await new Promise((
|
|
33869
|
-
const proc = (0,
|
|
33919
|
+
await new Promise((resolve8, reject) => {
|
|
33920
|
+
const proc = (0, import_child_process29.spawn)(
|
|
33870
33921
|
"gh",
|
|
33871
33922
|
["codespace", "ssh", "-c", workspaceId, "--", cmd],
|
|
33872
33923
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -33877,7 +33928,7 @@ var GitHubCodespacesProvider = class {
|
|
|
33877
33928
|
});
|
|
33878
33929
|
proc.on("error", reject);
|
|
33879
33930
|
proc.on("exit", (code) => {
|
|
33880
|
-
if (code === 0)
|
|
33931
|
+
if (code === 0) resolve8();
|
|
33881
33932
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
33882
33933
|
});
|
|
33883
33934
|
proc.stdin?.write(contents);
|
|
@@ -33924,11 +33975,11 @@ function shellQuote(s) {
|
|
|
33924
33975
|
}
|
|
33925
33976
|
|
|
33926
33977
|
// src/services/providers/gitpod.ts
|
|
33927
|
-
var
|
|
33978
|
+
var import_child_process30 = require("child_process");
|
|
33928
33979
|
var import_util5 = require("util");
|
|
33929
33980
|
var path70 = __toESM(require("path"));
|
|
33930
33981
|
var import_picocolors10 = __toESM(require("picocolors"));
|
|
33931
|
-
var execFileP7 = (0, import_util5.promisify)(
|
|
33982
|
+
var execFileP7 = (0, import_util5.promisify)(import_child_process30.execFile);
|
|
33932
33983
|
var MAX_BUFFER2 = 8 * 1024 * 1024;
|
|
33933
33984
|
function resetStdinForChild2() {
|
|
33934
33985
|
if (process.stdin.isTTY) {
|
|
@@ -33967,10 +34018,10 @@ var GitpodProvider = class {
|
|
|
33967
34018
|
"Authenticating Gitpod"
|
|
33968
34019
|
);
|
|
33969
34020
|
resetStdinForChild2();
|
|
33970
|
-
await new Promise((
|
|
33971
|
-
const proc = (0,
|
|
34021
|
+
await new Promise((resolve8, reject) => {
|
|
34022
|
+
const proc = (0, import_child_process30.spawn)("gitpod", ["login"], { stdio: "inherit" });
|
|
33972
34023
|
proc.on("exit", (code) => {
|
|
33973
|
-
if (code === 0)
|
|
34024
|
+
if (code === 0) resolve8();
|
|
33974
34025
|
else reject(new Error("gitpod login failed."));
|
|
33975
34026
|
});
|
|
33976
34027
|
proc.on("error", reject);
|
|
@@ -34119,13 +34170,13 @@ var GitpodProvider = class {
|
|
|
34119
34170
|
}
|
|
34120
34171
|
async streamCommand(workspaceId, command2) {
|
|
34121
34172
|
resetStdinForChild2();
|
|
34122
|
-
return new Promise((
|
|
34123
|
-
const proc = (0,
|
|
34173
|
+
return new Promise((resolve8, reject) => {
|
|
34174
|
+
const proc = (0, import_child_process30.spawn)(
|
|
34124
34175
|
"gitpod",
|
|
34125
34176
|
["workspace", "ssh", workspaceId, "--", "-tt", command2],
|
|
34126
34177
|
{ stdio: "inherit" }
|
|
34127
34178
|
);
|
|
34128
|
-
proc.on("exit", (code) =>
|
|
34179
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34129
34180
|
proc.on("error", reject);
|
|
34130
34181
|
});
|
|
34131
34182
|
}
|
|
@@ -34139,12 +34190,12 @@ var GitpodProvider = class {
|
|
|
34139
34190
|
tarArgs.push(".");
|
|
34140
34191
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34141
34192
|
const remoteCmd = `mkdir -p ${shellQuote2(remoteDir)} && tar -xzf - -C ${shellQuote2(remoteDir)}`;
|
|
34142
|
-
await new Promise((
|
|
34143
|
-
const tar = (0,
|
|
34193
|
+
await new Promise((resolve8, reject) => {
|
|
34194
|
+
const tar = (0, import_child_process30.spawn)("tar", tarArgs, {
|
|
34144
34195
|
stdio: ["ignore", "pipe", "pipe"],
|
|
34145
34196
|
env: tarEnv
|
|
34146
34197
|
});
|
|
34147
|
-
const ssh = (0,
|
|
34198
|
+
const ssh = (0, import_child_process30.spawn)(
|
|
34148
34199
|
"gitpod",
|
|
34149
34200
|
["workspace", "ssh", workspaceId, "--", remoteCmd],
|
|
34150
34201
|
{ stdio: [tar.stdout, "pipe", "pipe"] }
|
|
@@ -34160,7 +34211,7 @@ var GitpodProvider = class {
|
|
|
34160
34211
|
tar.on("error", reject);
|
|
34161
34212
|
ssh.on("error", reject);
|
|
34162
34213
|
ssh.on("exit", (code) => {
|
|
34163
|
-
if (code === 0)
|
|
34214
|
+
if (code === 0) resolve8();
|
|
34164
34215
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34165
34216
|
});
|
|
34166
34217
|
});
|
|
@@ -34175,8 +34226,8 @@ var GitpodProvider = class {
|
|
|
34175
34226
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote2(remotePath)}`);
|
|
34176
34227
|
}
|
|
34177
34228
|
const cmd = parts.join(" && ");
|
|
34178
|
-
await new Promise((
|
|
34179
|
-
const proc = (0,
|
|
34229
|
+
await new Promise((resolve8, reject) => {
|
|
34230
|
+
const proc = (0, import_child_process30.spawn)(
|
|
34180
34231
|
"gitpod",
|
|
34181
34232
|
["workspace", "ssh", workspaceId, "--", cmd],
|
|
34182
34233
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -34187,7 +34238,7 @@ var GitpodProvider = class {
|
|
|
34187
34238
|
});
|
|
34188
34239
|
proc.on("error", reject);
|
|
34189
34240
|
proc.on("exit", (code) => {
|
|
34190
|
-
if (code === 0)
|
|
34241
|
+
if (code === 0) resolve8();
|
|
34191
34242
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34192
34243
|
});
|
|
34193
34244
|
proc.stdin?.write(contents);
|
|
@@ -34200,10 +34251,10 @@ function shellQuote2(s) {
|
|
|
34200
34251
|
}
|
|
34201
34252
|
|
|
34202
34253
|
// src/services/providers/gitlab-workspaces.ts
|
|
34203
|
-
var
|
|
34254
|
+
var import_child_process31 = require("child_process");
|
|
34204
34255
|
var import_util6 = require("util");
|
|
34205
34256
|
var path71 = __toESM(require("path"));
|
|
34206
|
-
var execFileP8 = (0, import_util6.promisify)(
|
|
34257
|
+
var execFileP8 = (0, import_util6.promisify)(import_child_process31.execFile);
|
|
34207
34258
|
var MAX_BUFFER3 = 8 * 1024 * 1024;
|
|
34208
34259
|
var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
|
|
34209
34260
|
function resetStdinForChild3() {
|
|
@@ -34244,14 +34295,14 @@ var GitLabWorkspacesProvider = class {
|
|
|
34244
34295
|
"Authenticating GitLab"
|
|
34245
34296
|
);
|
|
34246
34297
|
resetStdinForChild3();
|
|
34247
|
-
await new Promise((
|
|
34248
|
-
const proc = (0,
|
|
34298
|
+
await new Promise((resolve8, reject) => {
|
|
34299
|
+
const proc = (0, import_child_process31.spawn)(
|
|
34249
34300
|
"glab",
|
|
34250
34301
|
["auth", "login", "--scopes", "api,read_user,read_repository"],
|
|
34251
34302
|
{ stdio: "inherit" }
|
|
34252
34303
|
);
|
|
34253
34304
|
proc.on("exit", (code) => {
|
|
34254
|
-
if (code === 0)
|
|
34305
|
+
if (code === 0) resolve8();
|
|
34255
34306
|
else reject(new Error("glab auth login failed."));
|
|
34256
34307
|
});
|
|
34257
34308
|
proc.on("error", reject);
|
|
@@ -34416,13 +34467,13 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34416
34467
|
async streamCommand(workspaceId, command2) {
|
|
34417
34468
|
const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
|
|
34418
34469
|
resetStdinForChild3();
|
|
34419
|
-
return new Promise((
|
|
34420
|
-
const proc = (0,
|
|
34470
|
+
return new Promise((resolve8, reject) => {
|
|
34471
|
+
const proc = (0, import_child_process31.spawn)(
|
|
34421
34472
|
"ssh",
|
|
34422
34473
|
["-tt", "-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, command2],
|
|
34423
34474
|
{ stdio: "inherit" }
|
|
34424
34475
|
);
|
|
34425
|
-
proc.on("exit", (code) =>
|
|
34476
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34426
34477
|
proc.on("error", reject);
|
|
34427
34478
|
});
|
|
34428
34479
|
}
|
|
@@ -34437,9 +34488,9 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34437
34488
|
tarArgs.push(".");
|
|
34438
34489
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34439
34490
|
const remoteCmd = `mkdir -p ${shellQuote3(remoteDir)} && tar -xzf - -C ${shellQuote3(remoteDir)}`;
|
|
34440
|
-
await new Promise((
|
|
34441
|
-
const tar = (0,
|
|
34442
|
-
const ssh = (0,
|
|
34491
|
+
await new Promise((resolve8, reject) => {
|
|
34492
|
+
const tar = (0, import_child_process31.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
34493
|
+
const ssh = (0, import_child_process31.spawn)(
|
|
34443
34494
|
"ssh",
|
|
34444
34495
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, remoteCmd],
|
|
34445
34496
|
{ stdio: [tar.stdout, "pipe", "pipe"] }
|
|
@@ -34455,7 +34506,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34455
34506
|
tar.on("error", reject);
|
|
34456
34507
|
ssh.on("error", reject);
|
|
34457
34508
|
ssh.on("exit", (code) => {
|
|
34458
|
-
if (code === 0)
|
|
34509
|
+
if (code === 0) resolve8();
|
|
34459
34510
|
else reject(new Error(`Remote tar failed: ${(sshErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34460
34511
|
});
|
|
34461
34512
|
});
|
|
@@ -34468,8 +34519,8 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34468
34519
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
|
|
34469
34520
|
}
|
|
34470
34521
|
const cmd = parts.join(" && ");
|
|
34471
|
-
await new Promise((
|
|
34472
|
-
const proc = (0,
|
|
34522
|
+
await new Promise((resolve8, reject) => {
|
|
34523
|
+
const proc = (0, import_child_process31.spawn)(
|
|
34473
34524
|
"ssh",
|
|
34474
34525
|
["-o", "StrictHostKeyChecking=accept-new", `${workspaceId}@${sshHost}`, cmd],
|
|
34475
34526
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -34480,7 +34531,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
|
|
|
34480
34531
|
});
|
|
34481
34532
|
proc.on("error", reject);
|
|
34482
34533
|
proc.on("exit", (code) => {
|
|
34483
|
-
if (code === 0)
|
|
34534
|
+
if (code === 0) resolve8();
|
|
34484
34535
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34485
34536
|
});
|
|
34486
34537
|
proc.stdin?.write(contents);
|
|
@@ -34528,10 +34579,10 @@ function shellQuote3(s) {
|
|
|
34528
34579
|
}
|
|
34529
34580
|
|
|
34530
34581
|
// src/services/providers/railway.ts
|
|
34531
|
-
var
|
|
34582
|
+
var import_child_process32 = require("child_process");
|
|
34532
34583
|
var import_util7 = require("util");
|
|
34533
34584
|
var path72 = __toESM(require("path"));
|
|
34534
|
-
var execFileP9 = (0, import_util7.promisify)(
|
|
34585
|
+
var execFileP9 = (0, import_util7.promisify)(import_child_process32.execFile);
|
|
34535
34586
|
var MAX_BUFFER4 = 8 * 1024 * 1024;
|
|
34536
34587
|
function resetStdinForChild4() {
|
|
34537
34588
|
if (process.stdin.isTTY) {
|
|
@@ -34571,10 +34622,10 @@ var RailwayProvider = class {
|
|
|
34571
34622
|
"Authenticating Railway"
|
|
34572
34623
|
);
|
|
34573
34624
|
resetStdinForChild4();
|
|
34574
|
-
await new Promise((
|
|
34575
|
-
const proc = (0,
|
|
34625
|
+
await new Promise((resolve8, reject) => {
|
|
34626
|
+
const proc = (0, import_child_process32.spawn)("railway", ["login"], { stdio: "inherit" });
|
|
34576
34627
|
proc.on("exit", (code) => {
|
|
34577
|
-
if (code === 0)
|
|
34628
|
+
if (code === 0) resolve8();
|
|
34578
34629
|
else reject(new Error("railway login failed."));
|
|
34579
34630
|
});
|
|
34580
34631
|
proc.on("error", reject);
|
|
@@ -34714,13 +34765,13 @@ var RailwayProvider = class {
|
|
|
34714
34765
|
throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
|
|
34715
34766
|
}
|
|
34716
34767
|
resetStdinForChild4();
|
|
34717
|
-
return new Promise((
|
|
34718
|
-
const proc = (0,
|
|
34768
|
+
return new Promise((resolve8, reject) => {
|
|
34769
|
+
const proc = (0, import_child_process32.spawn)(
|
|
34719
34770
|
"railway",
|
|
34720
34771
|
["shell", "--project", projectId, "--service", serviceId, "--command", command2],
|
|
34721
34772
|
{ stdio: "inherit" }
|
|
34722
34773
|
);
|
|
34723
|
-
proc.on("exit", (code) =>
|
|
34774
|
+
proc.on("exit", (code) => resolve8({ code: code ?? 0 }));
|
|
34724
34775
|
proc.on("error", reject);
|
|
34725
34776
|
});
|
|
34726
34777
|
}
|
|
@@ -34738,9 +34789,9 @@ var RailwayProvider = class {
|
|
|
34738
34789
|
tarArgs.push(".");
|
|
34739
34790
|
const tarEnv = { ...process.env, COPYFILE_DISABLE: "1" };
|
|
34740
34791
|
const remoteCmd = `mkdir -p ${shellQuote4(remoteDir)} && tar -xzf - -C ${shellQuote4(remoteDir)}`;
|
|
34741
|
-
await new Promise((
|
|
34742
|
-
const tar = (0,
|
|
34743
|
-
const sh = (0,
|
|
34792
|
+
await new Promise((resolve8, reject) => {
|
|
34793
|
+
const tar = (0, import_child_process32.spawn)("tar", tarArgs, { stdio: ["ignore", "pipe", "pipe"], env: tarEnv });
|
|
34794
|
+
const sh = (0, import_child_process32.spawn)(
|
|
34744
34795
|
"railway",
|
|
34745
34796
|
["shell", "--project", projectId, "--service", serviceId, "--command", remoteCmd],
|
|
34746
34797
|
{ stdio: [tar.stdout, "pipe", "pipe"] }
|
|
@@ -34756,7 +34807,7 @@ var RailwayProvider = class {
|
|
|
34756
34807
|
tar.on("error", reject);
|
|
34757
34808
|
sh.on("error", reject);
|
|
34758
34809
|
sh.on("exit", (code) => {
|
|
34759
|
-
if (code === 0)
|
|
34810
|
+
if (code === 0) resolve8();
|
|
34760
34811
|
else reject(new Error(`Remote tar failed: ${(shErr || tarErr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34761
34812
|
});
|
|
34762
34813
|
});
|
|
@@ -34772,8 +34823,8 @@ var RailwayProvider = class {
|
|
|
34772
34823
|
parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
|
|
34773
34824
|
}
|
|
34774
34825
|
const cmd = parts.join(" && ");
|
|
34775
|
-
await new Promise((
|
|
34776
|
-
const proc = (0,
|
|
34826
|
+
await new Promise((resolve8, reject) => {
|
|
34827
|
+
const proc = (0, import_child_process32.spawn)(
|
|
34777
34828
|
"railway",
|
|
34778
34829
|
["shell", "--project", projectId, "--service", serviceId, "--command", cmd],
|
|
34779
34830
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
@@ -34784,7 +34835,7 @@ var RailwayProvider = class {
|
|
|
34784
34835
|
});
|
|
34785
34836
|
proc.on("error", reject);
|
|
34786
34837
|
proc.on("exit", (code) => {
|
|
34787
|
-
if (code === 0)
|
|
34838
|
+
if (code === 0) resolve8();
|
|
34788
34839
|
else reject(new Error(`Remote write failed: ${(stderr || `exit ${code}`).trim().slice(0, 500)}`));
|
|
34789
34840
|
});
|
|
34790
34841
|
proc.stdin?.write(contents);
|
|
@@ -35581,7 +35632,7 @@ function checkChokidar() {
|
|
|
35581
35632
|
}
|
|
35582
35633
|
async function doctor(args2 = []) {
|
|
35583
35634
|
const json = args2.includes("--json");
|
|
35584
|
-
const cliVersion = true ? "2.61.
|
|
35635
|
+
const cliVersion = true ? "2.61.2" : "0.0.0-dev";
|
|
35585
35636
|
const apiBase2 = resolveApiBaseUrl();
|
|
35586
35637
|
const diagnosticId = (0, import_node_crypto12.randomUUID)();
|
|
35587
35638
|
log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
|
|
@@ -35860,11 +35911,11 @@ var RestartableStdioProxy = class {
|
|
|
35860
35911
|
rl.on("close", () => this.child?.stdin?.end());
|
|
35861
35912
|
const timer = setInterval(() => this.checkRestart(stdout), RESTART_CHECK_INTERVAL_MS);
|
|
35862
35913
|
timer.unref();
|
|
35863
|
-
return new Promise((
|
|
35914
|
+
return new Promise((resolve8) => {
|
|
35864
35915
|
this.ended = (code) => {
|
|
35865
35916
|
clearInterval(timer);
|
|
35866
35917
|
process.exitCode = code;
|
|
35867
|
-
|
|
35918
|
+
resolve8();
|
|
35868
35919
|
};
|
|
35869
35920
|
});
|
|
35870
35921
|
}
|
|
@@ -36092,7 +36143,7 @@ async function mcpRun(args2) {
|
|
|
36092
36143
|
// src/commands/version.ts
|
|
36093
36144
|
var import_picocolors15 = __toESM(require("picocolors"));
|
|
36094
36145
|
function version2() {
|
|
36095
|
-
const v = true ? "2.61.
|
|
36146
|
+
const v = true ? "2.61.2" : "unknown";
|
|
36096
36147
|
console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
|
|
36097
36148
|
}
|
|
36098
36149
|
|