adhdev 0.9.71 → 0.9.73
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/dist/cli/index.js +373 -299
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +282 -208
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +1 -1
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -2656,8 +2656,8 @@ async function detectIDEs(providerLoader) {
|
|
|
2656
2656
|
if ((0, import_fs4.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
2657
2657
|
}
|
|
2658
2658
|
if (!resolvedCli && appPath && os29 === "win32") {
|
|
2659
|
-
const { dirname:
|
|
2660
|
-
const appDir =
|
|
2659
|
+
const { dirname: dirname11 } = await import("path");
|
|
2660
|
+
const appDir = dirname11(appPath);
|
|
2661
2661
|
const candidates = [
|
|
2662
2662
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
2663
2663
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -2729,19 +2729,19 @@ function resolveCommandPath(command) {
|
|
|
2729
2729
|
return null;
|
|
2730
2730
|
}
|
|
2731
2731
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
2732
|
-
return new Promise((
|
|
2732
|
+
return new Promise((resolve20) => {
|
|
2733
2733
|
const child = (0, import_child_process2.exec)(cmd, {
|
|
2734
2734
|
encoding: "utf-8",
|
|
2735
2735
|
timeout: timeoutMs,
|
|
2736
2736
|
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
2737
2737
|
}, (err, stdout) => {
|
|
2738
2738
|
if (err || !stdout?.trim()) {
|
|
2739
|
-
|
|
2739
|
+
resolve20(null);
|
|
2740
2740
|
} else {
|
|
2741
|
-
|
|
2741
|
+
resolve20(stdout.trim());
|
|
2742
2742
|
}
|
|
2743
2743
|
});
|
|
2744
|
-
child.on("error", () =>
|
|
2744
|
+
child.on("error", () => resolve20(null));
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
async function detectCLIs(providerLoader, options) {
|
|
@@ -3353,7 +3353,7 @@ var init_manager = __esm({
|
|
|
3353
3353
|
* Returns multiple entries if multiple IDE windows are open on same port
|
|
3354
3354
|
*/
|
|
3355
3355
|
static listAllTargets(port) {
|
|
3356
|
-
return new Promise((
|
|
3356
|
+
return new Promise((resolve20) => {
|
|
3357
3357
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
3358
3358
|
let data = "";
|
|
3359
3359
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -3369,16 +3369,16 @@ var init_manager = __esm({
|
|
|
3369
3369
|
(t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
|
|
3370
3370
|
);
|
|
3371
3371
|
const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
|
|
3372
|
-
|
|
3372
|
+
resolve20(mainPages.length > 0 ? mainPages : fallbackPages);
|
|
3373
3373
|
} catch {
|
|
3374
|
-
|
|
3374
|
+
resolve20([]);
|
|
3375
3375
|
}
|
|
3376
3376
|
});
|
|
3377
3377
|
});
|
|
3378
|
-
req.on("error", () =>
|
|
3378
|
+
req.on("error", () => resolve20([]));
|
|
3379
3379
|
req.setTimeout(2e3, () => {
|
|
3380
3380
|
req.destroy();
|
|
3381
|
-
|
|
3381
|
+
resolve20([]);
|
|
3382
3382
|
});
|
|
3383
3383
|
});
|
|
3384
3384
|
}
|
|
@@ -3418,7 +3418,7 @@ var init_manager = __esm({
|
|
|
3418
3418
|
}
|
|
3419
3419
|
}
|
|
3420
3420
|
findTargetOnPort(port) {
|
|
3421
|
-
return new Promise((
|
|
3421
|
+
return new Promise((resolve20) => {
|
|
3422
3422
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
3423
3423
|
let data = "";
|
|
3424
3424
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -3429,7 +3429,7 @@ var init_manager = __esm({
|
|
|
3429
3429
|
(t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
|
|
3430
3430
|
);
|
|
3431
3431
|
if (pages.length === 0) {
|
|
3432
|
-
|
|
3432
|
+
resolve20(targets.find((t) => t.webSocketDebuggerUrl) || null);
|
|
3433
3433
|
return;
|
|
3434
3434
|
}
|
|
3435
3435
|
const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
|
|
@@ -3448,25 +3448,25 @@ var init_manager = __esm({
|
|
|
3448
3448
|
this._targetId = selected.target.id;
|
|
3449
3449
|
}
|
|
3450
3450
|
this._pageTitle = selected.target.title || "";
|
|
3451
|
-
|
|
3451
|
+
resolve20(selected.target);
|
|
3452
3452
|
return;
|
|
3453
3453
|
}
|
|
3454
3454
|
if (previousTargetId) {
|
|
3455
3455
|
this.log(`[CDP] Target ${previousTargetId} not found in page list`);
|
|
3456
|
-
|
|
3456
|
+
resolve20(null);
|
|
3457
3457
|
return;
|
|
3458
3458
|
}
|
|
3459
3459
|
this._pageTitle = list[0]?.title || "";
|
|
3460
|
-
|
|
3460
|
+
resolve20(list[0]);
|
|
3461
3461
|
} catch {
|
|
3462
|
-
|
|
3462
|
+
resolve20(null);
|
|
3463
3463
|
}
|
|
3464
3464
|
});
|
|
3465
3465
|
});
|
|
3466
|
-
req.on("error", () =>
|
|
3466
|
+
req.on("error", () => resolve20(null));
|
|
3467
3467
|
req.setTimeout(2e3, () => {
|
|
3468
3468
|
req.destroy();
|
|
3469
|
-
|
|
3469
|
+
resolve20(null);
|
|
3470
3470
|
});
|
|
3471
3471
|
});
|
|
3472
3472
|
}
|
|
@@ -3477,7 +3477,7 @@ var init_manager = __esm({
|
|
|
3477
3477
|
this.extensionProviders = providers;
|
|
3478
3478
|
}
|
|
3479
3479
|
connectToTarget(wsUrl) {
|
|
3480
|
-
return new Promise((
|
|
3480
|
+
return new Promise((resolve20) => {
|
|
3481
3481
|
this.ws = new import_ws.default(wsUrl);
|
|
3482
3482
|
this.ws.on("open", async () => {
|
|
3483
3483
|
this._connected = true;
|
|
@@ -3487,17 +3487,17 @@ var init_manager = __esm({
|
|
|
3487
3487
|
}
|
|
3488
3488
|
this.connectBrowserWs().catch(() => {
|
|
3489
3489
|
});
|
|
3490
|
-
|
|
3490
|
+
resolve20(true);
|
|
3491
3491
|
});
|
|
3492
3492
|
this.ws.on("message", (data) => {
|
|
3493
3493
|
try {
|
|
3494
3494
|
const msg = JSON.parse(data.toString());
|
|
3495
3495
|
if (msg.id && this.pending.has(msg.id)) {
|
|
3496
|
-
const { resolve:
|
|
3496
|
+
const { resolve: resolve21, reject } = this.pending.get(msg.id);
|
|
3497
3497
|
this.pending.delete(msg.id);
|
|
3498
3498
|
this.failureCount = 0;
|
|
3499
3499
|
if (msg.error) reject(new Error(msg.error.message));
|
|
3500
|
-
else
|
|
3500
|
+
else resolve21(msg.result);
|
|
3501
3501
|
} else if (msg.method === "Runtime.executionContextCreated") {
|
|
3502
3502
|
this.contexts.add(msg.params.context.id);
|
|
3503
3503
|
} else if (msg.method === "Runtime.executionContextDestroyed") {
|
|
@@ -3520,7 +3520,7 @@ var init_manager = __esm({
|
|
|
3520
3520
|
this.ws.on("error", (err) => {
|
|
3521
3521
|
this.log(`[CDP] WebSocket error: ${err.message}`);
|
|
3522
3522
|
this._connected = false;
|
|
3523
|
-
|
|
3523
|
+
resolve20(false);
|
|
3524
3524
|
});
|
|
3525
3525
|
});
|
|
3526
3526
|
}
|
|
@@ -3534,7 +3534,7 @@ var init_manager = __esm({
|
|
|
3534
3534
|
return;
|
|
3535
3535
|
}
|
|
3536
3536
|
this.log(`[CDP] Connecting browser WS for target discovery...`);
|
|
3537
|
-
await new Promise((
|
|
3537
|
+
await new Promise((resolve20, reject) => {
|
|
3538
3538
|
this.browserWs = new import_ws.default(browserWsUrl);
|
|
3539
3539
|
this.browserWs.on("open", async () => {
|
|
3540
3540
|
this._browserConnected = true;
|
|
@@ -3544,16 +3544,16 @@ var init_manager = __esm({
|
|
|
3544
3544
|
} catch (e) {
|
|
3545
3545
|
this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
|
|
3546
3546
|
}
|
|
3547
|
-
|
|
3547
|
+
resolve20();
|
|
3548
3548
|
});
|
|
3549
3549
|
this.browserWs.on("message", (data) => {
|
|
3550
3550
|
try {
|
|
3551
3551
|
const msg = JSON.parse(data.toString());
|
|
3552
3552
|
if (msg.id && this.browserPending.has(msg.id)) {
|
|
3553
|
-
const { resolve:
|
|
3553
|
+
const { resolve: resolve21, reject: reject2 } = this.browserPending.get(msg.id);
|
|
3554
3554
|
this.browserPending.delete(msg.id);
|
|
3555
3555
|
if (msg.error) reject2(new Error(msg.error.message));
|
|
3556
|
-
else
|
|
3556
|
+
else resolve21(msg.result);
|
|
3557
3557
|
}
|
|
3558
3558
|
} catch {
|
|
3559
3559
|
}
|
|
@@ -3573,31 +3573,31 @@ var init_manager = __esm({
|
|
|
3573
3573
|
}
|
|
3574
3574
|
}
|
|
3575
3575
|
getBrowserWsUrl() {
|
|
3576
|
-
return new Promise((
|
|
3576
|
+
return new Promise((resolve20) => {
|
|
3577
3577
|
const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
|
|
3578
3578
|
let data = "";
|
|
3579
3579
|
res.on("data", (chunk) => data += chunk.toString());
|
|
3580
3580
|
res.on("end", () => {
|
|
3581
3581
|
try {
|
|
3582
3582
|
const info = JSON.parse(data);
|
|
3583
|
-
|
|
3583
|
+
resolve20(info.webSocketDebuggerUrl || null);
|
|
3584
3584
|
} catch {
|
|
3585
|
-
|
|
3585
|
+
resolve20(null);
|
|
3586
3586
|
}
|
|
3587
3587
|
});
|
|
3588
3588
|
});
|
|
3589
|
-
req.on("error", () =>
|
|
3589
|
+
req.on("error", () => resolve20(null));
|
|
3590
3590
|
req.setTimeout(3e3, () => {
|
|
3591
3591
|
req.destroy();
|
|
3592
|
-
|
|
3592
|
+
resolve20(null);
|
|
3593
3593
|
});
|
|
3594
3594
|
});
|
|
3595
3595
|
}
|
|
3596
3596
|
sendBrowser(method, params = {}, timeoutMs = 15e3) {
|
|
3597
|
-
return new Promise((
|
|
3597
|
+
return new Promise((resolve20, reject) => {
|
|
3598
3598
|
if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
|
|
3599
3599
|
const id = this.browserMsgId++;
|
|
3600
|
-
this.browserPending.set(id, { resolve:
|
|
3600
|
+
this.browserPending.set(id, { resolve: resolve20, reject });
|
|
3601
3601
|
this.browserWs.send(JSON.stringify({ id, method, params }));
|
|
3602
3602
|
setTimeout(() => {
|
|
3603
3603
|
if (this.browserPending.has(id)) {
|
|
@@ -3637,11 +3637,11 @@ var init_manager = __esm({
|
|
|
3637
3637
|
}
|
|
3638
3638
|
// ─── CDP Protocol ────────────────────────────────────────
|
|
3639
3639
|
sendInternal(method, params = {}, timeoutMs = 15e3) {
|
|
3640
|
-
return new Promise((
|
|
3640
|
+
return new Promise((resolve20, reject) => {
|
|
3641
3641
|
if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
|
|
3642
3642
|
if (this.ws.readyState !== import_ws.default.OPEN) return reject(new Error("WebSocket not open"));
|
|
3643
3643
|
const id = this.msgId++;
|
|
3644
|
-
this.pending.set(id, { resolve:
|
|
3644
|
+
this.pending.set(id, { resolve: resolve20, reject });
|
|
3645
3645
|
this.ws.send(JSON.stringify({ id, method, params }));
|
|
3646
3646
|
setTimeout(() => {
|
|
3647
3647
|
if (this.pending.has(id)) {
|
|
@@ -3890,7 +3890,7 @@ var init_manager = __esm({
|
|
|
3890
3890
|
const browserWs = this.browserWs;
|
|
3891
3891
|
let msgId = this.browserMsgId;
|
|
3892
3892
|
const sendWs = (method, params = {}, sessionId) => {
|
|
3893
|
-
return new Promise((
|
|
3893
|
+
return new Promise((resolve20, reject) => {
|
|
3894
3894
|
const mid = msgId++;
|
|
3895
3895
|
this.browserMsgId = msgId;
|
|
3896
3896
|
const handler = (raw) => {
|
|
@@ -3899,7 +3899,7 @@ var init_manager = __esm({
|
|
|
3899
3899
|
if (msg.id === mid) {
|
|
3900
3900
|
browserWs.removeListener("message", handler);
|
|
3901
3901
|
if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
|
|
3902
|
-
else
|
|
3902
|
+
else resolve20(msg.result);
|
|
3903
3903
|
}
|
|
3904
3904
|
} catch {
|
|
3905
3905
|
}
|
|
@@ -4100,14 +4100,14 @@ var init_manager = __esm({
|
|
|
4100
4100
|
if (!ws || ws.readyState !== import_ws.default.OPEN) {
|
|
4101
4101
|
throw new Error("CDP not connected");
|
|
4102
4102
|
}
|
|
4103
|
-
return new Promise((
|
|
4103
|
+
return new Promise((resolve20, reject) => {
|
|
4104
4104
|
const id = getNextId();
|
|
4105
4105
|
pendingMap.set(id, {
|
|
4106
4106
|
resolve: (result) => {
|
|
4107
4107
|
if (result?.result?.subtype === "error") {
|
|
4108
4108
|
reject(new Error(result.result.description));
|
|
4109
4109
|
} else {
|
|
4110
|
-
|
|
4110
|
+
resolve20(result?.result?.value);
|
|
4111
4111
|
}
|
|
4112
4112
|
},
|
|
4113
4113
|
reject
|
|
@@ -4139,10 +4139,10 @@ var init_manager = __esm({
|
|
|
4139
4139
|
throw new Error("CDP not connected");
|
|
4140
4140
|
}
|
|
4141
4141
|
const sendViaSession = (method, params = {}) => {
|
|
4142
|
-
return new Promise((
|
|
4142
|
+
return new Promise((resolve20, reject) => {
|
|
4143
4143
|
const pendingMap = this._browserConnected ? this.browserPending : this.pending;
|
|
4144
4144
|
const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
|
|
4145
|
-
pendingMap.set(id, { resolve:
|
|
4145
|
+
pendingMap.set(id, { resolve: resolve20, reject });
|
|
4146
4146
|
ws.send(JSON.stringify({ id, sessionId, method, params }));
|
|
4147
4147
|
setTimeout(() => {
|
|
4148
4148
|
if (pendingMap.has(id)) {
|
|
@@ -9527,7 +9527,7 @@ function getCliVisibleTranscriptCount(adapter) {
|
|
|
9527
9527
|
async function getStableExtensionBaseline(h) {
|
|
9528
9528
|
const first = await readExtensionChatState(h);
|
|
9529
9529
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
9530
|
-
await new Promise((
|
|
9530
|
+
await new Promise((resolve20) => setTimeout(resolve20, 150));
|
|
9531
9531
|
const second = await readExtensionChatState(h);
|
|
9532
9532
|
return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
|
|
9533
9533
|
}
|
|
@@ -9535,7 +9535,7 @@ async function verifyExtensionSendObserved(h, before) {
|
|
|
9535
9535
|
const beforeCount = getStateMessageCount(before);
|
|
9536
9536
|
const beforeSignature = getStateLastSignature(before);
|
|
9537
9537
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
9538
|
-
await new Promise((
|
|
9538
|
+
await new Promise((resolve20) => setTimeout(resolve20, 250));
|
|
9539
9539
|
const state = await readExtensionChatState(h);
|
|
9540
9540
|
if (state?.status === "waiting_approval") return true;
|
|
9541
9541
|
const afterCount = getStateMessageCount(state);
|
|
@@ -11207,7 +11207,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
11207
11207
|
const enterCount = cliCommand.enterCount || 1;
|
|
11208
11208
|
await adapter.writeRaw(cliCommand.text + "\r");
|
|
11209
11209
|
for (let i = 1; i < enterCount; i += 1) {
|
|
11210
|
-
await new Promise((
|
|
11210
|
+
await new Promise((resolve20) => setTimeout(resolve20, 50));
|
|
11211
11211
|
await adapter.writeRaw("\r");
|
|
11212
11212
|
}
|
|
11213
11213
|
}
|
|
@@ -11923,7 +11923,7 @@ var init_handler = __esm({
|
|
|
11923
11923
|
try {
|
|
11924
11924
|
const http3 = await import("http");
|
|
11925
11925
|
const postData = JSON.stringify(body);
|
|
11926
|
-
const result = await new Promise((
|
|
11926
|
+
const result = await new Promise((resolve20, reject) => {
|
|
11927
11927
|
const req = http3.request({
|
|
11928
11928
|
hostname: "127.0.0.1",
|
|
11929
11929
|
port: 19280,
|
|
@@ -11935,9 +11935,9 @@ var init_handler = __esm({
|
|
|
11935
11935
|
res.on("data", (chunk) => data += chunk);
|
|
11936
11936
|
res.on("end", () => {
|
|
11937
11937
|
try {
|
|
11938
|
-
|
|
11938
|
+
resolve20(JSON.parse(data));
|
|
11939
11939
|
} catch {
|
|
11940
|
-
|
|
11940
|
+
resolve20({ raw: data });
|
|
11941
11941
|
}
|
|
11942
11942
|
});
|
|
11943
11943
|
});
|
|
@@ -11955,15 +11955,15 @@ var init_handler = __esm({
|
|
|
11955
11955
|
if (!providerType) return { success: false, error: "providerType required" };
|
|
11956
11956
|
try {
|
|
11957
11957
|
const http3 = await import("http");
|
|
11958
|
-
const result = await new Promise((
|
|
11958
|
+
const result = await new Promise((resolve20, reject) => {
|
|
11959
11959
|
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
11960
11960
|
let data = "";
|
|
11961
11961
|
res.on("data", (chunk) => data += chunk);
|
|
11962
11962
|
res.on("end", () => {
|
|
11963
11963
|
try {
|
|
11964
|
-
|
|
11964
|
+
resolve20(JSON.parse(data));
|
|
11965
11965
|
} catch {
|
|
11966
|
-
|
|
11966
|
+
resolve20({ raw: data });
|
|
11967
11967
|
}
|
|
11968
11968
|
});
|
|
11969
11969
|
}).on("error", reject);
|
|
@@ -11977,7 +11977,7 @@ var init_handler = __esm({
|
|
|
11977
11977
|
try {
|
|
11978
11978
|
const http3 = await import("http");
|
|
11979
11979
|
const postData = JSON.stringify(args || {});
|
|
11980
|
-
const result = await new Promise((
|
|
11980
|
+
const result = await new Promise((resolve20, reject) => {
|
|
11981
11981
|
const req = http3.request({
|
|
11982
11982
|
hostname: "127.0.0.1",
|
|
11983
11983
|
port: 19280,
|
|
@@ -11989,9 +11989,9 @@ var init_handler = __esm({
|
|
|
11989
11989
|
res.on("data", (chunk) => data += chunk);
|
|
11990
11990
|
res.on("end", () => {
|
|
11991
11991
|
try {
|
|
11992
|
-
|
|
11992
|
+
resolve20(JSON.parse(data));
|
|
11993
11993
|
} catch {
|
|
11994
|
-
|
|
11994
|
+
resolve20({ raw: data });
|
|
11995
11995
|
}
|
|
11996
11996
|
});
|
|
11997
11997
|
});
|
|
@@ -14138,7 +14138,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
14138
14138
|
`[${this.cliType}] Waiting for interactive prompt: status=${status} stableMs=${stableMs} recentOutputMs=${recentlyOutput} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
|
|
14139
14139
|
);
|
|
14140
14140
|
}
|
|
14141
|
-
await new Promise((
|
|
14141
|
+
await new Promise((resolve20) => setTimeout(resolve20, 50));
|
|
14142
14142
|
}
|
|
14143
14143
|
const finalScreenText = this.terminalScreen.getText() || "";
|
|
14144
14144
|
LOG.warn(
|
|
@@ -15048,7 +15048,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
15048
15048
|
const deadline = Date.now() + 1e4;
|
|
15049
15049
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
15050
15050
|
this.resolveStartupState("send_wait");
|
|
15051
|
-
await new Promise((
|
|
15051
|
+
await new Promise((resolve20) => setTimeout(resolve20, 50));
|
|
15052
15052
|
}
|
|
15053
15053
|
}
|
|
15054
15054
|
if (!allowInterventionPrompt) {
|
|
@@ -15124,13 +15124,13 @@ var init_provider_cli_adapter = __esm({
|
|
|
15124
15124
|
}
|
|
15125
15125
|
this.responseEpoch += 1;
|
|
15126
15126
|
this.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
|
|
15127
|
-
await new Promise((
|
|
15127
|
+
await new Promise((resolve20, reject) => {
|
|
15128
15128
|
let resolved = false;
|
|
15129
15129
|
const completion = {
|
|
15130
15130
|
resolveOnce: () => {
|
|
15131
15131
|
if (resolved) return;
|
|
15132
15132
|
resolved = true;
|
|
15133
|
-
|
|
15133
|
+
resolve20();
|
|
15134
15134
|
},
|
|
15135
15135
|
rejectOnce: (error48) => {
|
|
15136
15136
|
if (resolved) return;
|
|
@@ -15288,17 +15288,17 @@ var init_provider_cli_adapter = __esm({
|
|
|
15288
15288
|
}
|
|
15289
15289
|
}
|
|
15290
15290
|
waitForStopped(timeoutMs) {
|
|
15291
|
-
return new Promise((
|
|
15291
|
+
return new Promise((resolve20) => {
|
|
15292
15292
|
const startedAt = Date.now();
|
|
15293
15293
|
const timer = setInterval(() => {
|
|
15294
15294
|
if (!this.ptyProcess || this.currentStatus === "stopped") {
|
|
15295
15295
|
clearInterval(timer);
|
|
15296
|
-
|
|
15296
|
+
resolve20(true);
|
|
15297
15297
|
return;
|
|
15298
15298
|
}
|
|
15299
15299
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
15300
15300
|
clearInterval(timer);
|
|
15301
|
-
|
|
15301
|
+
resolve20(false);
|
|
15302
15302
|
}
|
|
15303
15303
|
}, 100);
|
|
15304
15304
|
});
|
|
@@ -15636,7 +15636,7 @@ async function waitForCliAdapterReady(adapter, options) {
|
|
|
15636
15636
|
if (status === "stopped") {
|
|
15637
15637
|
throw new Error("CLI runtime stopped before it became ready");
|
|
15638
15638
|
}
|
|
15639
|
-
await new Promise((
|
|
15639
|
+
await new Promise((resolve20) => setTimeout(resolve20, pollMs));
|
|
15640
15640
|
}
|
|
15641
15641
|
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
15642
15642
|
}
|
|
@@ -16001,7 +16001,7 @@ var init_cli_provider_instance = __esm({
|
|
|
16001
16001
|
const enterCount = cliCommand.enterCount || 1;
|
|
16002
16002
|
await this.adapter.writeRaw(cliCommand.text + "\r");
|
|
16003
16003
|
for (let i = 1; i < enterCount; i += 1) {
|
|
16004
|
-
await new Promise((
|
|
16004
|
+
await new Promise((resolve20) => setTimeout(resolve20, 50));
|
|
16005
16005
|
await this.adapter.writeRaw("\r");
|
|
16006
16006
|
}
|
|
16007
16007
|
}
|
|
@@ -32583,8 +32583,8 @@ var init_acp = __esm({
|
|
|
32583
32583
|
this.#requestHandler = requestHandler;
|
|
32584
32584
|
this.#notificationHandler = notificationHandler;
|
|
32585
32585
|
this.#stream = stream;
|
|
32586
|
-
this.#closedPromise = new Promise((
|
|
32587
|
-
this.#abortController.signal.addEventListener("abort", () =>
|
|
32586
|
+
this.#closedPromise = new Promise((resolve20) => {
|
|
32587
|
+
this.#abortController.signal.addEventListener("abort", () => resolve20());
|
|
32588
32588
|
});
|
|
32589
32589
|
this.#receive();
|
|
32590
32590
|
}
|
|
@@ -32733,8 +32733,8 @@ var init_acp = __esm({
|
|
|
32733
32733
|
}
|
|
32734
32734
|
async sendRequest(method, params) {
|
|
32735
32735
|
const id = this.#nextRequestId++;
|
|
32736
|
-
const responsePromise = new Promise((
|
|
32737
|
-
this.#pendingResponses.set(id, { resolve:
|
|
32736
|
+
const responsePromise = new Promise((resolve20, reject) => {
|
|
32737
|
+
this.#pendingResponses.set(id, { resolve: resolve20, reject });
|
|
32738
32738
|
});
|
|
32739
32739
|
await this.#sendMessage({ jsonrpc: "2.0", id, method, params });
|
|
32740
32740
|
return responsePromise;
|
|
@@ -33418,13 +33418,13 @@ var init_acp_provider_instance = __esm({
|
|
|
33418
33418
|
}
|
|
33419
33419
|
this.currentStatus = "waiting_approval";
|
|
33420
33420
|
this.detectStatusTransition();
|
|
33421
|
-
const approved = await new Promise((
|
|
33422
|
-
this.permissionResolvers.push(
|
|
33421
|
+
const approved = await new Promise((resolve20) => {
|
|
33422
|
+
this.permissionResolvers.push(resolve20);
|
|
33423
33423
|
setTimeout(() => {
|
|
33424
|
-
const idx = this.permissionResolvers.indexOf(
|
|
33424
|
+
const idx = this.permissionResolvers.indexOf(resolve20);
|
|
33425
33425
|
if (idx >= 0) {
|
|
33426
33426
|
this.permissionResolvers.splice(idx, 1);
|
|
33427
|
-
|
|
33427
|
+
resolve20(false);
|
|
33428
33428
|
}
|
|
33429
33429
|
}, 3e5);
|
|
33430
33430
|
});
|
|
@@ -35559,9 +35559,9 @@ var init_handler2 = __esm({
|
|
|
35559
35559
|
if (this.fsw.closed) {
|
|
35560
35560
|
return;
|
|
35561
35561
|
}
|
|
35562
|
-
const
|
|
35562
|
+
const dirname11 = sp.dirname(file2);
|
|
35563
35563
|
const basename9 = sp.basename(file2);
|
|
35564
|
-
const parent = this.fsw._getWatchedDir(
|
|
35564
|
+
const parent = this.fsw._getWatchedDir(dirname11);
|
|
35565
35565
|
let prevStats = stats;
|
|
35566
35566
|
if (parent.has(basename9))
|
|
35567
35567
|
return;
|
|
@@ -35588,7 +35588,7 @@ var init_handler2 = __esm({
|
|
|
35588
35588
|
prevStats = newStats2;
|
|
35589
35589
|
}
|
|
35590
35590
|
} catch (error48) {
|
|
35591
|
-
this.fsw._remove(
|
|
35591
|
+
this.fsw._remove(dirname11, basename9);
|
|
35592
35592
|
}
|
|
35593
35593
|
} else if (parent.has(basename9)) {
|
|
35594
35594
|
const at = newStats.atimeMs;
|
|
@@ -35685,7 +35685,7 @@ var init_handler2 = __esm({
|
|
|
35685
35685
|
this._addToNodeFs(path33, initialAdd, wh, depth + 1);
|
|
35686
35686
|
}
|
|
35687
35687
|
}).on(EV.ERROR, this._boundHandleError);
|
|
35688
|
-
return new Promise((
|
|
35688
|
+
return new Promise((resolve20, reject) => {
|
|
35689
35689
|
if (!stream)
|
|
35690
35690
|
return reject();
|
|
35691
35691
|
stream.once(STR_END, () => {
|
|
@@ -35694,7 +35694,7 @@ var init_handler2 = __esm({
|
|
|
35694
35694
|
return;
|
|
35695
35695
|
}
|
|
35696
35696
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
35697
|
-
|
|
35697
|
+
resolve20(void 0);
|
|
35698
35698
|
previous.getChildren().filter((item) => {
|
|
35699
35699
|
return item !== directory && !current.has(item);
|
|
35700
35700
|
}).forEach((item) => {
|
|
@@ -37794,7 +37794,7 @@ var init_provider_loader = __esm({
|
|
|
37794
37794
|
return { updated: false };
|
|
37795
37795
|
}
|
|
37796
37796
|
try {
|
|
37797
|
-
const etag = await new Promise((
|
|
37797
|
+
const etag = await new Promise((resolve20, reject) => {
|
|
37798
37798
|
const options = {
|
|
37799
37799
|
method: "HEAD",
|
|
37800
37800
|
hostname: "github.com",
|
|
@@ -37812,7 +37812,7 @@ var init_provider_loader = __esm({
|
|
|
37812
37812
|
headers: { "User-Agent": "adhdev-launcher" },
|
|
37813
37813
|
timeout: 1e4
|
|
37814
37814
|
}, (res2) => {
|
|
37815
|
-
|
|
37815
|
+
resolve20(res2.headers.etag || res2.headers["last-modified"] || "");
|
|
37816
37816
|
});
|
|
37817
37817
|
req2.on("error", reject);
|
|
37818
37818
|
req2.on("timeout", () => {
|
|
@@ -37821,7 +37821,7 @@ var init_provider_loader = __esm({
|
|
|
37821
37821
|
});
|
|
37822
37822
|
req2.end();
|
|
37823
37823
|
} else {
|
|
37824
|
-
|
|
37824
|
+
resolve20(res.headers.etag || res.headers["last-modified"] || "");
|
|
37825
37825
|
}
|
|
37826
37826
|
});
|
|
37827
37827
|
req.on("error", reject);
|
|
@@ -37885,7 +37885,7 @@ var init_provider_loader = __esm({
|
|
|
37885
37885
|
downloadFile(url2, destPath) {
|
|
37886
37886
|
const https = require("https");
|
|
37887
37887
|
const http3 = require("http");
|
|
37888
|
-
return new Promise((
|
|
37888
|
+
return new Promise((resolve20, reject) => {
|
|
37889
37889
|
const doRequest = (reqUrl, redirectCount = 0) => {
|
|
37890
37890
|
if (redirectCount > 5) {
|
|
37891
37891
|
reject(new Error("Too many redirects"));
|
|
@@ -37905,7 +37905,7 @@ var init_provider_loader = __esm({
|
|
|
37905
37905
|
res.pipe(ws);
|
|
37906
37906
|
ws.on("finish", () => {
|
|
37907
37907
|
ws.close();
|
|
37908
|
-
|
|
37908
|
+
resolve20();
|
|
37909
37909
|
});
|
|
37910
37910
|
ws.on("error", reject);
|
|
37911
37911
|
});
|
|
@@ -38490,17 +38490,17 @@ async function findFreePort(ports) {
|
|
|
38490
38490
|
throw new Error("No free port found");
|
|
38491
38491
|
}
|
|
38492
38492
|
function checkPortFree(port) {
|
|
38493
|
-
return new Promise((
|
|
38493
|
+
return new Promise((resolve20) => {
|
|
38494
38494
|
const server = net2.createServer();
|
|
38495
38495
|
server.unref();
|
|
38496
|
-
server.on("error", () =>
|
|
38496
|
+
server.on("error", () => resolve20(false));
|
|
38497
38497
|
server.listen(port, "127.0.0.1", () => {
|
|
38498
|
-
server.close(() =>
|
|
38498
|
+
server.close(() => resolve20(true));
|
|
38499
38499
|
});
|
|
38500
38500
|
});
|
|
38501
38501
|
}
|
|
38502
38502
|
async function isCdpActive(port) {
|
|
38503
|
-
return new Promise((
|
|
38503
|
+
return new Promise((resolve20) => {
|
|
38504
38504
|
const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
38505
38505
|
timeout: 2e3
|
|
38506
38506
|
}, (res) => {
|
|
@@ -38509,16 +38509,16 @@ async function isCdpActive(port) {
|
|
|
38509
38509
|
res.on("end", () => {
|
|
38510
38510
|
try {
|
|
38511
38511
|
const info = JSON.parse(data);
|
|
38512
|
-
|
|
38512
|
+
resolve20(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
38513
38513
|
} catch {
|
|
38514
|
-
|
|
38514
|
+
resolve20(false);
|
|
38515
38515
|
}
|
|
38516
38516
|
});
|
|
38517
38517
|
});
|
|
38518
|
-
req.on("error", () =>
|
|
38518
|
+
req.on("error", () => resolve20(false));
|
|
38519
38519
|
req.on("timeout", () => {
|
|
38520
38520
|
req.destroy();
|
|
38521
|
-
|
|
38521
|
+
resolve20(false);
|
|
38522
38522
|
});
|
|
38523
38523
|
});
|
|
38524
38524
|
}
|
|
@@ -39029,11 +39029,23 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
39029
39029
|
if (!path33) {
|
|
39030
39030
|
return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
|
|
39031
39031
|
}
|
|
39032
|
+
const mcpServer = resolveAdhdevMcpServerLaunch({
|
|
39033
|
+
meshId,
|
|
39034
|
+
nodeExecutable: options.nodeExecutable,
|
|
39035
|
+
adhdevMcpEntryPath: options.adhdevMcpEntryPath
|
|
39036
|
+
});
|
|
39037
|
+
if (!mcpServer) {
|
|
39038
|
+
return {
|
|
39039
|
+
kind: "unsupported",
|
|
39040
|
+
reason: "Could not resolve the ADHDev MCP server entrypoint without relying on a PATH bin shim"
|
|
39041
|
+
};
|
|
39042
|
+
}
|
|
39032
39043
|
return {
|
|
39033
39044
|
kind: "auto_import",
|
|
39034
39045
|
serverName,
|
|
39035
|
-
configPath: (0,
|
|
39036
|
-
configFormat: mcpConfig.format
|
|
39046
|
+
configPath: (0, import_node_path2.join)(workspace, path33),
|
|
39047
|
+
configFormat: mcpConfig.format,
|
|
39048
|
+
mcpServer
|
|
39037
39049
|
};
|
|
39038
39050
|
}
|
|
39039
39051
|
if (mcpConfig.mode === "manual") {
|
|
@@ -39065,11 +39077,60 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
39065
39077
|
function renderMeshCoordinatorTemplate(template, values) {
|
|
39066
39078
|
return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_2, key) => values[key] || "");
|
|
39067
39079
|
}
|
|
39068
|
-
|
|
39080
|
+
function resolveAdhdevMcpServerLaunch(options) {
|
|
39081
|
+
const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath);
|
|
39082
|
+
if (!entryPath) return null;
|
|
39083
|
+
return {
|
|
39084
|
+
command: options.nodeExecutable?.trim() || process.execPath,
|
|
39085
|
+
args: [entryPath, "--repo-mesh", options.meshId]
|
|
39086
|
+
};
|
|
39087
|
+
}
|
|
39088
|
+
function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
39089
|
+
const explicit = explicitPath?.trim();
|
|
39090
|
+
if (explicit) return normalizeExistingPath(explicit) || explicit;
|
|
39091
|
+
const envPath = process.env.ADHDEV_MCP_SERVER_PATH?.trim();
|
|
39092
|
+
if (envPath) return normalizeExistingPath(envPath) || envPath;
|
|
39093
|
+
const candidates = [];
|
|
39094
|
+
const addCandidate = (candidate) => {
|
|
39095
|
+
if (!candidates.includes(candidate)) candidates.push(candidate);
|
|
39096
|
+
};
|
|
39097
|
+
const addPackagedCandidates = (baseFile) => {
|
|
39098
|
+
if (!baseFile) return;
|
|
39099
|
+
const realBase = normalizeExistingPath(baseFile) || baseFile;
|
|
39100
|
+
const dir = (0, import_node_path2.dirname)(realBase);
|
|
39101
|
+
addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
|
|
39102
|
+
addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
|
|
39103
|
+
addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
|
|
39104
|
+
};
|
|
39105
|
+
addPackagedCandidates(process.argv[1]);
|
|
39106
|
+
for (const candidate of candidates) {
|
|
39107
|
+
const normalized = normalizeExistingPath(candidate);
|
|
39108
|
+
if (normalized) return normalized;
|
|
39109
|
+
}
|
|
39110
|
+
try {
|
|
39111
|
+
const requireBase = process.argv[1] ? normalizeExistingPath(process.argv[1]) || process.argv[1] : (0, import_node_path2.join)(process.cwd(), "adhdev-daemon.js");
|
|
39112
|
+
const req = (0, import_node_module2.createRequire)(requireBase);
|
|
39113
|
+
const resolvedModule = req.resolve("@adhdev/mcp-server");
|
|
39114
|
+
return normalizeExistingPath(resolvedModule) || resolvedModule;
|
|
39115
|
+
} catch {
|
|
39116
|
+
return null;
|
|
39117
|
+
}
|
|
39118
|
+
}
|
|
39119
|
+
function normalizeExistingPath(filePath) {
|
|
39120
|
+
try {
|
|
39121
|
+
if (!(0, import_node_fs4.existsSync)(filePath)) return null;
|
|
39122
|
+
return import_node_fs4.realpathSync.native(filePath);
|
|
39123
|
+
} catch {
|
|
39124
|
+
return null;
|
|
39125
|
+
}
|
|
39126
|
+
}
|
|
39127
|
+
var import_node_fs4, import_node_module2, import_node_path2, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
|
|
39069
39128
|
var init_mesh_coordinator = __esm({
|
|
39070
39129
|
"../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
|
|
39071
39130
|
"use strict";
|
|
39072
|
-
|
|
39131
|
+
import_node_fs4 = require("fs");
|
|
39132
|
+
import_node_module2 = require("module");
|
|
39133
|
+
import_node_path2 = require("path");
|
|
39073
39134
|
DEFAULT_SERVER_NAME = "adhdev-mesh";
|
|
39074
39135
|
DEFAULT_ADHDEV_MCP_COMMAND = "adhdev-mcp";
|
|
39075
39136
|
}
|
|
@@ -39588,7 +39649,7 @@ async function waitForPidExit(pid, timeoutMs) {
|
|
|
39588
39649
|
while (Date.now() - start < timeoutMs) {
|
|
39589
39650
|
try {
|
|
39590
39651
|
process.kill(pid, 0);
|
|
39591
|
-
await new Promise((
|
|
39652
|
+
await new Promise((resolve20) => setTimeout(resolve20, 250));
|
|
39592
39653
|
} catch {
|
|
39593
39654
|
return;
|
|
39594
39655
|
}
|
|
@@ -39699,7 +39760,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
39699
39760
|
appendUpgradeLog(installOutput.trim());
|
|
39700
39761
|
}
|
|
39701
39762
|
if (process.platform === "win32") {
|
|
39702
|
-
await new Promise((
|
|
39763
|
+
await new Promise((resolve20) => setTimeout(resolve20, 500));
|
|
39703
39764
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
39704
39765
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
39705
39766
|
}
|
|
@@ -40585,7 +40646,20 @@ var init_router = __esm({
|
|
|
40585
40646
|
}
|
|
40586
40647
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
40587
40648
|
if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
|
|
40588
|
-
const
|
|
40649
|
+
const requestedCoordinatorNodeId = typeof args?.coordinatorNodeId === "string" ? args.coordinatorNodeId.trim() : "";
|
|
40650
|
+
const preferredCoordinatorNodeId = requestedCoordinatorNodeId || (typeof mesh.coordinator?.preferredNodeId === "string" ? mesh.coordinator.preferredNodeId.trim() : "");
|
|
40651
|
+
const coordinatorNode = preferredCoordinatorNodeId ? mesh.nodes.find((node) => node?.id === preferredCoordinatorNodeId || node?.nodeId === preferredCoordinatorNodeId) : mesh.nodes[0];
|
|
40652
|
+
if (!coordinatorNode) {
|
|
40653
|
+
return {
|
|
40654
|
+
success: false,
|
|
40655
|
+
code: "mesh_coordinator_node_not_found",
|
|
40656
|
+
error: `Coordinator node ${preferredCoordinatorNodeId} was not found in mesh`,
|
|
40657
|
+
meshId,
|
|
40658
|
+
cliType
|
|
40659
|
+
};
|
|
40660
|
+
}
|
|
40661
|
+
const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
|
|
40662
|
+
if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
|
|
40589
40663
|
const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
|
|
40590
40664
|
const coordinatorSetup = resolveMeshCoordinatorSetup({
|
|
40591
40665
|
provider: providerMeta,
|
|
@@ -40623,9 +40697,9 @@ var init_router = __esm({
|
|
|
40623
40697
|
workspace
|
|
40624
40698
|
};
|
|
40625
40699
|
}
|
|
40626
|
-
const { existsSync:
|
|
40700
|
+
const { existsSync: existsSync26, readFileSync: readFileSync20, writeFileSync: writeFileSync14, copyFileSync: copyFileSync4 } = await import("fs");
|
|
40627
40701
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
40628
|
-
const hadExistingMcpConfig =
|
|
40702
|
+
const hadExistingMcpConfig = existsSync26(mcpConfigPath);
|
|
40629
40703
|
let existingMcpConfig = {};
|
|
40630
40704
|
if (hadExistingMcpConfig) {
|
|
40631
40705
|
try {
|
|
@@ -40639,8 +40713,8 @@ var init_router = __esm({
|
|
|
40639
40713
|
mcpServers: {
|
|
40640
40714
|
...existingMcpConfig.mcpServers || {},
|
|
40641
40715
|
[coordinatorSetup.serverName]: {
|
|
40642
|
-
command:
|
|
40643
|
-
args:
|
|
40716
|
+
command: coordinatorSetup.mcpServer.command,
|
|
40717
|
+
args: coordinatorSetup.mcpServer.args
|
|
40644
40718
|
}
|
|
40645
40719
|
}
|
|
40646
40720
|
};
|
|
@@ -41326,7 +41400,7 @@ var init_provider_adapter = __esm({
|
|
|
41326
41400
|
const beforeCount = this.messageCount(before);
|
|
41327
41401
|
const beforeSignature = this.lastMessageSignature(before);
|
|
41328
41402
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
41329
|
-
await new Promise((
|
|
41403
|
+
await new Promise((resolve20) => setTimeout(resolve20, 250));
|
|
41330
41404
|
let state;
|
|
41331
41405
|
try {
|
|
41332
41406
|
state = await this.readChat(evaluate);
|
|
@@ -41348,7 +41422,7 @@ var init_provider_adapter = __esm({
|
|
|
41348
41422
|
if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
|
|
41349
41423
|
return first;
|
|
41350
41424
|
}
|
|
41351
|
-
await new Promise((
|
|
41425
|
+
await new Promise((resolve20) => setTimeout(resolve20, 150));
|
|
41352
41426
|
const second = await this.readChat(evaluate);
|
|
41353
41427
|
return this.messageCount(second) >= this.messageCount(first) ? second : first;
|
|
41354
41428
|
}
|
|
@@ -41499,7 +41573,7 @@ var init_provider_adapter = __esm({
|
|
|
41499
41573
|
if (typeof data.error === "string" && data.error.trim()) return false;
|
|
41500
41574
|
}
|
|
41501
41575
|
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
41502
|
-
await new Promise((
|
|
41576
|
+
await new Promise((resolve20) => setTimeout(resolve20, 250));
|
|
41503
41577
|
const state = await this.readChat(evaluate);
|
|
41504
41578
|
const title = this.getStateTitle(state);
|
|
41505
41579
|
if (this.titlesMatch(title, sessionId)) return true;
|
|
@@ -44146,7 +44220,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
|
|
|
44146
44220
|
return { target, instance, adapter };
|
|
44147
44221
|
}
|
|
44148
44222
|
function sleep(ms) {
|
|
44149
|
-
return new Promise((
|
|
44223
|
+
return new Promise((resolve20) => setTimeout(resolve20, ms));
|
|
44150
44224
|
}
|
|
44151
44225
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
44152
44226
|
const startedAt = Date.now();
|
|
@@ -46426,15 +46500,15 @@ var init_dev_server = __esm({
|
|
|
46426
46500
|
this.json(res, 500, { error: e.message });
|
|
46427
46501
|
}
|
|
46428
46502
|
});
|
|
46429
|
-
return new Promise((
|
|
46503
|
+
return new Promise((resolve20, reject) => {
|
|
46430
46504
|
this.server.listen(port, "127.0.0.1", () => {
|
|
46431
46505
|
this.log(`Dev server listening on http://127.0.0.1:${port}`);
|
|
46432
|
-
|
|
46506
|
+
resolve20();
|
|
46433
46507
|
});
|
|
46434
46508
|
this.server.on("error", (e) => {
|
|
46435
46509
|
if (e.code === "EADDRINUSE") {
|
|
46436
46510
|
this.log(`Port ${port} in use, skipping dev server`);
|
|
46437
|
-
|
|
46511
|
+
resolve20();
|
|
46438
46512
|
} else {
|
|
46439
46513
|
reject(e);
|
|
46440
46514
|
}
|
|
@@ -46516,20 +46590,20 @@ var init_dev_server = __esm({
|
|
|
46516
46590
|
child.stderr?.on("data", (d) => {
|
|
46517
46591
|
stderr += d.toString().slice(0, 2e3);
|
|
46518
46592
|
});
|
|
46519
|
-
await new Promise((
|
|
46593
|
+
await new Promise((resolve20) => {
|
|
46520
46594
|
const timer = setTimeout(() => {
|
|
46521
46595
|
child.kill();
|
|
46522
|
-
|
|
46596
|
+
resolve20();
|
|
46523
46597
|
}, 3e3);
|
|
46524
46598
|
child.on("exit", () => {
|
|
46525
46599
|
clearTimeout(timer);
|
|
46526
|
-
|
|
46600
|
+
resolve20();
|
|
46527
46601
|
});
|
|
46528
46602
|
child.stdout?.once("data", () => {
|
|
46529
46603
|
setTimeout(() => {
|
|
46530
46604
|
child.kill();
|
|
46531
46605
|
clearTimeout(timer);
|
|
46532
|
-
|
|
46606
|
+
resolve20();
|
|
46533
46607
|
}, 500);
|
|
46534
46608
|
});
|
|
46535
46609
|
});
|
|
@@ -47032,14 +47106,14 @@ var init_dev_server = __esm({
|
|
|
47032
47106
|
child.stderr?.on("data", (d) => {
|
|
47033
47107
|
stderr += d.toString();
|
|
47034
47108
|
});
|
|
47035
|
-
await new Promise((
|
|
47109
|
+
await new Promise((resolve20) => {
|
|
47036
47110
|
const timer = setTimeout(() => {
|
|
47037
47111
|
child.kill();
|
|
47038
|
-
|
|
47112
|
+
resolve20();
|
|
47039
47113
|
}, timeout);
|
|
47040
47114
|
child.on("exit", () => {
|
|
47041
47115
|
clearTimeout(timer);
|
|
47042
|
-
|
|
47116
|
+
resolve20();
|
|
47043
47117
|
});
|
|
47044
47118
|
});
|
|
47045
47119
|
const elapsed = Date.now() - start;
|
|
@@ -47709,14 +47783,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
47709
47783
|
res.end(JSON.stringify(data, null, 2));
|
|
47710
47784
|
}
|
|
47711
47785
|
async readBody(req) {
|
|
47712
|
-
return new Promise((
|
|
47786
|
+
return new Promise((resolve20) => {
|
|
47713
47787
|
let body = "";
|
|
47714
47788
|
req.on("data", (chunk) => body += chunk);
|
|
47715
47789
|
req.on("end", () => {
|
|
47716
47790
|
try {
|
|
47717
|
-
|
|
47791
|
+
resolve20(JSON.parse(body));
|
|
47718
47792
|
} catch {
|
|
47719
|
-
|
|
47793
|
+
resolve20({});
|
|
47720
47794
|
}
|
|
47721
47795
|
});
|
|
47722
47796
|
});
|
|
@@ -48233,7 +48307,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
|
|
|
48233
48307
|
const deadline = Date.now() + timeoutMs;
|
|
48234
48308
|
while (Date.now() < deadline) {
|
|
48235
48309
|
if (await canConnect(endpoint)) return;
|
|
48236
|
-
await new Promise((
|
|
48310
|
+
await new Promise((resolve20) => setTimeout(resolve20, STARTUP_POLL_MS));
|
|
48237
48311
|
}
|
|
48238
48312
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
48239
48313
|
}
|
|
@@ -48339,10 +48413,10 @@ async function installExtension(ide, extension) {
|
|
|
48339
48413
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
48340
48414
|
const fs20 = await import("fs");
|
|
48341
48415
|
fs20.writeFileSync(vsixPath, buffer);
|
|
48342
|
-
return new Promise((
|
|
48416
|
+
return new Promise((resolve20) => {
|
|
48343
48417
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
48344
48418
|
(0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
48345
|
-
|
|
48419
|
+
resolve20({
|
|
48346
48420
|
extensionId: extension.id,
|
|
48347
48421
|
marketplaceId: extension.marketplaceId,
|
|
48348
48422
|
success: !error48,
|
|
@@ -48355,11 +48429,11 @@ async function installExtension(ide, extension) {
|
|
|
48355
48429
|
} catch (e) {
|
|
48356
48430
|
}
|
|
48357
48431
|
}
|
|
48358
|
-
return new Promise((
|
|
48432
|
+
return new Promise((resolve20) => {
|
|
48359
48433
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
48360
48434
|
(0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
|
|
48361
48435
|
if (error48) {
|
|
48362
|
-
|
|
48436
|
+
resolve20({
|
|
48363
48437
|
extensionId: extension.id,
|
|
48364
48438
|
marketplaceId: extension.marketplaceId,
|
|
48365
48439
|
success: false,
|
|
@@ -48367,7 +48441,7 @@ async function installExtension(ide, extension) {
|
|
|
48367
48441
|
error: stderr || error48.message
|
|
48368
48442
|
});
|
|
48369
48443
|
} else {
|
|
48370
|
-
|
|
48444
|
+
resolve20({
|
|
48371
48445
|
extensionId: extension.id,
|
|
48372
48446
|
marketplaceId: extension.marketplaceId,
|
|
48373
48447
|
success: true,
|
|
@@ -49222,7 +49296,7 @@ var init_server_connection = __esm({
|
|
|
49222
49296
|
* Returns the command result or throws on timeout / auth failure.
|
|
49223
49297
|
*/
|
|
49224
49298
|
sendMeshCommand(targetDaemonId, command, args = {}, timeoutMs = 3e4) {
|
|
49225
|
-
return new Promise((
|
|
49299
|
+
return new Promise((resolve20, reject) => {
|
|
49226
49300
|
const requestId = `mesh_${crypto.randomUUID()}`;
|
|
49227
49301
|
const timer = setTimeout(() => {
|
|
49228
49302
|
this.off("daemon_mesh_result", handler);
|
|
@@ -49235,7 +49309,7 @@ var init_server_connection = __esm({
|
|
|
49235
49309
|
if (msg.payload?.success === false) {
|
|
49236
49310
|
reject(new Error(msg.payload?.error ?? "Mesh command failed"));
|
|
49237
49311
|
} else {
|
|
49238
|
-
|
|
49312
|
+
resolve20(msg.payload?.result);
|
|
49239
49313
|
}
|
|
49240
49314
|
};
|
|
49241
49315
|
this.on("daemon_mesh_result", handler);
|
|
@@ -50542,19 +50616,19 @@ var init_peer_connection_manager = __esm({
|
|
|
50542
50616
|
});
|
|
50543
50617
|
|
|
50544
50618
|
// src/daemon-p2p/index.ts
|
|
50545
|
-
var fs16, path27,
|
|
50619
|
+
var fs16, path27, import_node_module3, esmRequire, DaemonP2PSender;
|
|
50546
50620
|
var init_daemon_p2p = __esm({
|
|
50547
50621
|
"src/daemon-p2p/index.ts"() {
|
|
50548
50622
|
"use strict";
|
|
50549
50623
|
fs16 = __toESM(require("fs"));
|
|
50550
50624
|
path27 = __toESM(require("path"));
|
|
50551
|
-
|
|
50625
|
+
import_node_module3 = require("module");
|
|
50552
50626
|
init_src();
|
|
50553
50627
|
init_data_channel_router();
|
|
50554
50628
|
init_screenshot_sender();
|
|
50555
50629
|
init_peer_connection_manager();
|
|
50556
50630
|
init_log();
|
|
50557
|
-
esmRequire = (0,
|
|
50631
|
+
esmRequire = (0, import_node_module3.createRequire)(__filename);
|
|
50558
50632
|
DaemonP2PSender = class {
|
|
50559
50633
|
serverConn;
|
|
50560
50634
|
peers = /* @__PURE__ */ new Map();
|
|
@@ -51031,14 +51105,14 @@ var require_filesystem = __commonJS({
|
|
|
51031
51105
|
});
|
|
51032
51106
|
return buffer.subarray(0, bytesRead);
|
|
51033
51107
|
};
|
|
51034
|
-
var readFile2 = (path33) => new Promise((
|
|
51108
|
+
var readFile2 = (path33) => new Promise((resolve20, reject) => {
|
|
51035
51109
|
fs20.open(path33, "r", (err, fd) => {
|
|
51036
51110
|
if (err) {
|
|
51037
51111
|
reject(err);
|
|
51038
51112
|
} else {
|
|
51039
51113
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
51040
51114
|
fs20.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
|
|
51041
|
-
|
|
51115
|
+
resolve20(buffer.subarray(0, bytesRead));
|
|
51042
51116
|
fs20.close(fd, () => {
|
|
51043
51117
|
});
|
|
51044
51118
|
});
|
|
@@ -51106,10 +51180,10 @@ var require_detect_libc = __commonJS({
|
|
|
51106
51180
|
var commandOut = "";
|
|
51107
51181
|
var safeCommand = () => {
|
|
51108
51182
|
if (!commandOut) {
|
|
51109
|
-
return new Promise((
|
|
51183
|
+
return new Promise((resolve20) => {
|
|
51110
51184
|
childProcess.exec(command, (err, out) => {
|
|
51111
51185
|
commandOut = err ? " " : out;
|
|
51112
|
-
|
|
51186
|
+
resolve20(commandOut);
|
|
51113
51187
|
});
|
|
51114
51188
|
});
|
|
51115
51189
|
}
|
|
@@ -53789,14 +53863,14 @@ var require_input = __commonJS({
|
|
|
53789
53863
|
return this;
|
|
53790
53864
|
} else {
|
|
53791
53865
|
if (this._isStreamInput()) {
|
|
53792
|
-
return new Promise((
|
|
53866
|
+
return new Promise((resolve20, reject) => {
|
|
53793
53867
|
const finished = () => {
|
|
53794
53868
|
this._flattenBufferIn();
|
|
53795
53869
|
sharp.metadata(this.options, (err, metadata2) => {
|
|
53796
53870
|
if (err) {
|
|
53797
53871
|
reject(is.nativeError(err, stack));
|
|
53798
53872
|
} else {
|
|
53799
|
-
|
|
53873
|
+
resolve20(metadata2);
|
|
53800
53874
|
}
|
|
53801
53875
|
});
|
|
53802
53876
|
};
|
|
@@ -53807,12 +53881,12 @@ var require_input = __commonJS({
|
|
|
53807
53881
|
}
|
|
53808
53882
|
});
|
|
53809
53883
|
} else {
|
|
53810
|
-
return new Promise((
|
|
53884
|
+
return new Promise((resolve20, reject) => {
|
|
53811
53885
|
sharp.metadata(this.options, (err, metadata2) => {
|
|
53812
53886
|
if (err) {
|
|
53813
53887
|
reject(is.nativeError(err, stack));
|
|
53814
53888
|
} else {
|
|
53815
|
-
|
|
53889
|
+
resolve20(metadata2);
|
|
53816
53890
|
}
|
|
53817
53891
|
});
|
|
53818
53892
|
});
|
|
@@ -53845,25 +53919,25 @@ var require_input = __commonJS({
|
|
|
53845
53919
|
return this;
|
|
53846
53920
|
} else {
|
|
53847
53921
|
if (this._isStreamInput()) {
|
|
53848
|
-
return new Promise((
|
|
53922
|
+
return new Promise((resolve20, reject) => {
|
|
53849
53923
|
this.on("finish", function() {
|
|
53850
53924
|
this._flattenBufferIn();
|
|
53851
53925
|
sharp.stats(this.options, (err, stats2) => {
|
|
53852
53926
|
if (err) {
|
|
53853
53927
|
reject(is.nativeError(err, stack));
|
|
53854
53928
|
} else {
|
|
53855
|
-
|
|
53929
|
+
resolve20(stats2);
|
|
53856
53930
|
}
|
|
53857
53931
|
});
|
|
53858
53932
|
});
|
|
53859
53933
|
});
|
|
53860
53934
|
} else {
|
|
53861
|
-
return new Promise((
|
|
53935
|
+
return new Promise((resolve20, reject) => {
|
|
53862
53936
|
sharp.stats(this.options, (err, stats2) => {
|
|
53863
53937
|
if (err) {
|
|
53864
53938
|
reject(is.nativeError(err, stack));
|
|
53865
53939
|
} else {
|
|
53866
|
-
|
|
53940
|
+
resolve20(stats2);
|
|
53867
53941
|
}
|
|
53868
53942
|
});
|
|
53869
53943
|
});
|
|
@@ -57285,7 +57359,7 @@ var require_output = __commonJS({
|
|
|
57285
57359
|
return this;
|
|
57286
57360
|
} else {
|
|
57287
57361
|
if (this._isStreamInput()) {
|
|
57288
|
-
return new Promise((
|
|
57362
|
+
return new Promise((resolve20, reject) => {
|
|
57289
57363
|
this.once("finish", () => {
|
|
57290
57364
|
this._flattenBufferIn();
|
|
57291
57365
|
sharp.pipeline(this.options, (err, data, info) => {
|
|
@@ -57293,24 +57367,24 @@ var require_output = __commonJS({
|
|
|
57293
57367
|
reject(is.nativeError(err, stack));
|
|
57294
57368
|
} else {
|
|
57295
57369
|
if (this.options.resolveWithObject) {
|
|
57296
|
-
|
|
57370
|
+
resolve20({ data, info });
|
|
57297
57371
|
} else {
|
|
57298
|
-
|
|
57372
|
+
resolve20(data);
|
|
57299
57373
|
}
|
|
57300
57374
|
}
|
|
57301
57375
|
});
|
|
57302
57376
|
});
|
|
57303
57377
|
});
|
|
57304
57378
|
} else {
|
|
57305
|
-
return new Promise((
|
|
57379
|
+
return new Promise((resolve20, reject) => {
|
|
57306
57380
|
sharp.pipeline(this.options, (err, data, info) => {
|
|
57307
57381
|
if (err) {
|
|
57308
57382
|
reject(is.nativeError(err, stack));
|
|
57309
57383
|
} else {
|
|
57310
57384
|
if (this.options.resolveWithObject) {
|
|
57311
|
-
|
|
57385
|
+
resolve20({ data, info });
|
|
57312
57386
|
} else {
|
|
57313
|
-
|
|
57387
|
+
resolve20(data);
|
|
57314
57388
|
}
|
|
57315
57389
|
}
|
|
57316
57390
|
});
|
|
@@ -58689,9 +58763,9 @@ function resolvePackageVersion(options) {
|
|
|
58689
58763
|
const injectedVersion = options?.injectedVersion || "unknown";
|
|
58690
58764
|
const dir = options?.dirname || __dirname;
|
|
58691
58765
|
const possiblePaths = [
|
|
58692
|
-
(0,
|
|
58693
|
-
(0,
|
|
58694
|
-
(0,
|
|
58766
|
+
(0, import_path4.join)(dir, "..", "..", "package.json"),
|
|
58767
|
+
(0, import_path4.join)(dir, "..", "package.json"),
|
|
58768
|
+
(0, import_path4.join)(dir, "package.json")
|
|
58695
58769
|
];
|
|
58696
58770
|
for (const p of possiblePaths) {
|
|
58697
58771
|
try {
|
|
@@ -58702,12 +58776,12 @@ function resolvePackageVersion(options) {
|
|
|
58702
58776
|
}
|
|
58703
58777
|
return injectedVersion;
|
|
58704
58778
|
}
|
|
58705
|
-
var import_fs7,
|
|
58779
|
+
var import_fs7, import_path4;
|
|
58706
58780
|
var init_version = __esm({
|
|
58707
58781
|
"src/version.ts"() {
|
|
58708
58782
|
"use strict";
|
|
58709
58783
|
import_fs7 = require("fs");
|
|
58710
|
-
|
|
58784
|
+
import_path4 = require("path");
|
|
58711
58785
|
}
|
|
58712
58786
|
});
|
|
58713
58787
|
|
|
@@ -59036,7 +59110,7 @@ var init_adhdev_daemon = __esm({
|
|
|
59036
59110
|
init_version();
|
|
59037
59111
|
init_src();
|
|
59038
59112
|
init_runtime_defaults();
|
|
59039
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
59113
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.73" });
|
|
59040
59114
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
59041
59115
|
localHttpServer = null;
|
|
59042
59116
|
localWss = null;
|
|
@@ -59852,7 +59926,7 @@ ${err?.stack || ""}`);
|
|
|
59852
59926
|
try {
|
|
59853
59927
|
const statusResult = await Promise.race([
|
|
59854
59928
|
this.components.router.execute("git_status", { workspace }, "mesh"),
|
|
59855
|
-
new Promise((
|
|
59929
|
+
new Promise((resolve20) => setTimeout(() => resolve20(null), 4e3))
|
|
59856
59930
|
]);
|
|
59857
59931
|
const s = statusResult?.status ?? statusResult;
|
|
59858
59932
|
if (s?.isGitRepo) {
|
|
@@ -60035,7 +60109,7 @@ ${err?.stack || ""}`);
|
|
|
60035
60109
|
this.localWss.emit("connection", ws, req);
|
|
60036
60110
|
});
|
|
60037
60111
|
});
|
|
60038
|
-
await new Promise((
|
|
60112
|
+
await new Promise((resolve20, reject) => {
|
|
60039
60113
|
const cleanup = () => {
|
|
60040
60114
|
this.localHttpServer?.off("error", onError);
|
|
60041
60115
|
this.localHttpServer?.off("listening", onListening);
|
|
@@ -60046,7 +60120,7 @@ ${err?.stack || ""}`);
|
|
|
60046
60120
|
};
|
|
60047
60121
|
const onListening = () => {
|
|
60048
60122
|
cleanup();
|
|
60049
|
-
|
|
60123
|
+
resolve20();
|
|
60050
60124
|
};
|
|
60051
60125
|
this.localHttpServer.once("error", onError);
|
|
60052
60126
|
this.localHttpServer.once("listening", onListening);
|
|
@@ -60220,12 +60294,12 @@ ${err?.stack || ""}`);
|
|
|
60220
60294
|
this.localClients.clear();
|
|
60221
60295
|
this.localWss?.close();
|
|
60222
60296
|
this.localWss = null;
|
|
60223
|
-
await new Promise((
|
|
60297
|
+
await new Promise((resolve20) => {
|
|
60224
60298
|
if (!this.localHttpServer) {
|
|
60225
|
-
|
|
60299
|
+
resolve20();
|
|
60226
60300
|
return;
|
|
60227
60301
|
}
|
|
60228
|
-
this.localHttpServer.close(() =>
|
|
60302
|
+
this.localHttpServer.close(() => resolve20());
|
|
60229
60303
|
this.localHttpServer = null;
|
|
60230
60304
|
});
|
|
60231
60305
|
} catch {
|
|
@@ -60773,14 +60847,14 @@ var require_run_async = __commonJS({
|
|
|
60773
60847
|
return function() {
|
|
60774
60848
|
var args = arguments;
|
|
60775
60849
|
var originalThis = this;
|
|
60776
|
-
var promise2 = new Promise(function(
|
|
60850
|
+
var promise2 = new Promise(function(resolve20, reject) {
|
|
60777
60851
|
var resolved = false;
|
|
60778
60852
|
const wrappedResolve = function(value) {
|
|
60779
60853
|
if (resolved) {
|
|
60780
60854
|
console.warn("Run-async promise already resolved.");
|
|
60781
60855
|
}
|
|
60782
60856
|
resolved = true;
|
|
60783
|
-
|
|
60857
|
+
resolve20(value);
|
|
60784
60858
|
};
|
|
60785
60859
|
var rejected = false;
|
|
60786
60860
|
const wrappedReject = function(value) {
|
|
@@ -61571,7 +61645,7 @@ var require_Observable = __commonJS({
|
|
|
61571
61645
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
61572
61646
|
var _this = this;
|
|
61573
61647
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
61574
|
-
return new promiseCtor(function(
|
|
61648
|
+
return new promiseCtor(function(resolve20, reject) {
|
|
61575
61649
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
61576
61650
|
next: function(value) {
|
|
61577
61651
|
try {
|
|
@@ -61582,7 +61656,7 @@ var require_Observable = __commonJS({
|
|
|
61582
61656
|
}
|
|
61583
61657
|
},
|
|
61584
61658
|
error: reject,
|
|
61585
|
-
complete:
|
|
61659
|
+
complete: resolve20
|
|
61586
61660
|
});
|
|
61587
61661
|
_this.subscribe(subscriber);
|
|
61588
61662
|
});
|
|
@@ -61604,14 +61678,14 @@ var require_Observable = __commonJS({
|
|
|
61604
61678
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
61605
61679
|
var _this = this;
|
|
61606
61680
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
61607
|
-
return new promiseCtor(function(
|
|
61681
|
+
return new promiseCtor(function(resolve20, reject) {
|
|
61608
61682
|
var value;
|
|
61609
61683
|
_this.subscribe(function(x) {
|
|
61610
61684
|
return value = x;
|
|
61611
61685
|
}, function(err) {
|
|
61612
61686
|
return reject(err);
|
|
61613
61687
|
}, function() {
|
|
61614
|
-
return
|
|
61688
|
+
return resolve20(value);
|
|
61615
61689
|
});
|
|
61616
61690
|
});
|
|
61617
61691
|
};
|
|
@@ -63707,11 +63781,11 @@ var require_innerFrom = __commonJS({
|
|
|
63707
63781
|
"use strict";
|
|
63708
63782
|
var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
63709
63783
|
function adopt(value) {
|
|
63710
|
-
return value instanceof P ? value : new P(function(
|
|
63711
|
-
|
|
63784
|
+
return value instanceof P ? value : new P(function(resolve20) {
|
|
63785
|
+
resolve20(value);
|
|
63712
63786
|
});
|
|
63713
63787
|
}
|
|
63714
|
-
return new (P || (P = Promise))(function(
|
|
63788
|
+
return new (P || (P = Promise))(function(resolve20, reject) {
|
|
63715
63789
|
function fulfilled(value) {
|
|
63716
63790
|
try {
|
|
63717
63791
|
step(generator.next(value));
|
|
@@ -63727,7 +63801,7 @@ var require_innerFrom = __commonJS({
|
|
|
63727
63801
|
}
|
|
63728
63802
|
}
|
|
63729
63803
|
function step(result) {
|
|
63730
|
-
result.done ?
|
|
63804
|
+
result.done ? resolve20(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
63731
63805
|
}
|
|
63732
63806
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
63733
63807
|
});
|
|
@@ -63809,14 +63883,14 @@ var require_innerFrom = __commonJS({
|
|
|
63809
63883
|
}, i);
|
|
63810
63884
|
function verb(n) {
|
|
63811
63885
|
i[n] = o[n] && function(v) {
|
|
63812
|
-
return new Promise(function(
|
|
63813
|
-
v = o[n](v), settle(
|
|
63886
|
+
return new Promise(function(resolve20, reject) {
|
|
63887
|
+
v = o[n](v), settle(resolve20, reject, v.done, v.value);
|
|
63814
63888
|
});
|
|
63815
63889
|
};
|
|
63816
63890
|
}
|
|
63817
|
-
function settle(
|
|
63891
|
+
function settle(resolve20, reject, d, v) {
|
|
63818
63892
|
Promise.resolve(v).then(function(v2) {
|
|
63819
|
-
|
|
63893
|
+
resolve20({ value: v2, done: d });
|
|
63820
63894
|
}, reject);
|
|
63821
63895
|
}
|
|
63822
63896
|
};
|
|
@@ -64435,7 +64509,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
64435
64509
|
var EmptyError_1 = require_EmptyError();
|
|
64436
64510
|
function lastValueFrom(source, config2) {
|
|
64437
64511
|
var hasConfig = typeof config2 === "object";
|
|
64438
|
-
return new Promise(function(
|
|
64512
|
+
return new Promise(function(resolve20, reject) {
|
|
64439
64513
|
var _hasValue = false;
|
|
64440
64514
|
var _value;
|
|
64441
64515
|
source.subscribe({
|
|
@@ -64446,9 +64520,9 @@ var require_lastValueFrom = __commonJS({
|
|
|
64446
64520
|
error: reject,
|
|
64447
64521
|
complete: function() {
|
|
64448
64522
|
if (_hasValue) {
|
|
64449
|
-
|
|
64523
|
+
resolve20(_value);
|
|
64450
64524
|
} else if (hasConfig) {
|
|
64451
|
-
|
|
64525
|
+
resolve20(config2.defaultValue);
|
|
64452
64526
|
} else {
|
|
64453
64527
|
reject(new EmptyError_1.EmptyError());
|
|
64454
64528
|
}
|
|
@@ -64470,16 +64544,16 @@ var require_firstValueFrom = __commonJS({
|
|
|
64470
64544
|
var Subscriber_1 = require_Subscriber();
|
|
64471
64545
|
function firstValueFrom(source, config2) {
|
|
64472
64546
|
var hasConfig = typeof config2 === "object";
|
|
64473
|
-
return new Promise(function(
|
|
64547
|
+
return new Promise(function(resolve20, reject) {
|
|
64474
64548
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
64475
64549
|
next: function(value) {
|
|
64476
|
-
|
|
64550
|
+
resolve20(value);
|
|
64477
64551
|
subscriber.unsubscribe();
|
|
64478
64552
|
},
|
|
64479
64553
|
error: reject,
|
|
64480
64554
|
complete: function() {
|
|
64481
64555
|
if (hasConfig) {
|
|
64482
|
-
|
|
64556
|
+
resolve20(config2.defaultValue);
|
|
64483
64557
|
} else {
|
|
64484
64558
|
reject(new EmptyError_1.EmptyError());
|
|
64485
64559
|
}
|
|
@@ -76285,14 +76359,14 @@ var require_async_iterator = __commonJS({
|
|
|
76285
76359
|
};
|
|
76286
76360
|
}
|
|
76287
76361
|
function readAndResolve(iter) {
|
|
76288
|
-
var
|
|
76289
|
-
if (
|
|
76362
|
+
var resolve20 = iter[kLastResolve];
|
|
76363
|
+
if (resolve20 !== null) {
|
|
76290
76364
|
var data = iter[kStream].read();
|
|
76291
76365
|
if (data !== null) {
|
|
76292
76366
|
iter[kLastPromise] = null;
|
|
76293
76367
|
iter[kLastResolve] = null;
|
|
76294
76368
|
iter[kLastReject] = null;
|
|
76295
|
-
|
|
76369
|
+
resolve20(createIterResult(data, false));
|
|
76296
76370
|
}
|
|
76297
76371
|
}
|
|
76298
76372
|
}
|
|
@@ -76300,13 +76374,13 @@ var require_async_iterator = __commonJS({
|
|
|
76300
76374
|
process.nextTick(readAndResolve, iter);
|
|
76301
76375
|
}
|
|
76302
76376
|
function wrapForNext(lastPromise, iter) {
|
|
76303
|
-
return function(
|
|
76377
|
+
return function(resolve20, reject) {
|
|
76304
76378
|
lastPromise.then(function() {
|
|
76305
76379
|
if (iter[kEnded]) {
|
|
76306
|
-
|
|
76380
|
+
resolve20(createIterResult(void 0, true));
|
|
76307
76381
|
return;
|
|
76308
76382
|
}
|
|
76309
|
-
iter[kHandlePromise](
|
|
76383
|
+
iter[kHandlePromise](resolve20, reject);
|
|
76310
76384
|
}, reject);
|
|
76311
76385
|
};
|
|
76312
76386
|
}
|
|
@@ -76326,12 +76400,12 @@ var require_async_iterator = __commonJS({
|
|
|
76326
76400
|
return Promise.resolve(createIterResult(void 0, true));
|
|
76327
76401
|
}
|
|
76328
76402
|
if (this[kStream].destroyed) {
|
|
76329
|
-
return new Promise(function(
|
|
76403
|
+
return new Promise(function(resolve20, reject) {
|
|
76330
76404
|
process.nextTick(function() {
|
|
76331
76405
|
if (_this[kError]) {
|
|
76332
76406
|
reject(_this[kError]);
|
|
76333
76407
|
} else {
|
|
76334
|
-
|
|
76408
|
+
resolve20(createIterResult(void 0, true));
|
|
76335
76409
|
}
|
|
76336
76410
|
});
|
|
76337
76411
|
});
|
|
@@ -76354,13 +76428,13 @@ var require_async_iterator = __commonJS({
|
|
|
76354
76428
|
return this;
|
|
76355
76429
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
76356
76430
|
var _this2 = this;
|
|
76357
|
-
return new Promise(function(
|
|
76431
|
+
return new Promise(function(resolve20, reject) {
|
|
76358
76432
|
_this2[kStream].destroy(null, function(err) {
|
|
76359
76433
|
if (err) {
|
|
76360
76434
|
reject(err);
|
|
76361
76435
|
return;
|
|
76362
76436
|
}
|
|
76363
|
-
|
|
76437
|
+
resolve20(createIterResult(void 0, true));
|
|
76364
76438
|
});
|
|
76365
76439
|
});
|
|
76366
76440
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -76382,15 +76456,15 @@ var require_async_iterator = __commonJS({
|
|
|
76382
76456
|
value: stream._readableState.endEmitted,
|
|
76383
76457
|
writable: true
|
|
76384
76458
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
76385
|
-
value: function value(
|
|
76459
|
+
value: function value(resolve20, reject) {
|
|
76386
76460
|
var data = iterator[kStream].read();
|
|
76387
76461
|
if (data) {
|
|
76388
76462
|
iterator[kLastPromise] = null;
|
|
76389
76463
|
iterator[kLastResolve] = null;
|
|
76390
76464
|
iterator[kLastReject] = null;
|
|
76391
|
-
|
|
76465
|
+
resolve20(createIterResult(data, false));
|
|
76392
76466
|
} else {
|
|
76393
|
-
iterator[kLastResolve] =
|
|
76467
|
+
iterator[kLastResolve] = resolve20;
|
|
76394
76468
|
iterator[kLastReject] = reject;
|
|
76395
76469
|
}
|
|
76396
76470
|
},
|
|
@@ -76409,12 +76483,12 @@ var require_async_iterator = __commonJS({
|
|
|
76409
76483
|
iterator[kError] = err;
|
|
76410
76484
|
return;
|
|
76411
76485
|
}
|
|
76412
|
-
var
|
|
76413
|
-
if (
|
|
76486
|
+
var resolve20 = iterator[kLastResolve];
|
|
76487
|
+
if (resolve20 !== null) {
|
|
76414
76488
|
iterator[kLastPromise] = null;
|
|
76415
76489
|
iterator[kLastResolve] = null;
|
|
76416
76490
|
iterator[kLastReject] = null;
|
|
76417
|
-
|
|
76491
|
+
resolve20(createIterResult(void 0, true));
|
|
76418
76492
|
}
|
|
76419
76493
|
iterator[kEnded] = true;
|
|
76420
76494
|
});
|
|
@@ -76429,7 +76503,7 @@ var require_async_iterator = __commonJS({
|
|
|
76429
76503
|
var require_from2 = __commonJS({
|
|
76430
76504
|
"../../node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
|
|
76431
76505
|
"use strict";
|
|
76432
|
-
function asyncGeneratorStep(gen,
|
|
76506
|
+
function asyncGeneratorStep(gen, resolve20, reject, _next, _throw, key, arg) {
|
|
76433
76507
|
try {
|
|
76434
76508
|
var info = gen[key](arg);
|
|
76435
76509
|
var value = info.value;
|
|
@@ -76438,7 +76512,7 @@ var require_from2 = __commonJS({
|
|
|
76438
76512
|
return;
|
|
76439
76513
|
}
|
|
76440
76514
|
if (info.done) {
|
|
76441
|
-
|
|
76515
|
+
resolve20(value);
|
|
76442
76516
|
} else {
|
|
76443
76517
|
Promise.resolve(value).then(_next, _throw);
|
|
76444
76518
|
}
|
|
@@ -76446,13 +76520,13 @@ var require_from2 = __commonJS({
|
|
|
76446
76520
|
function _asyncToGenerator(fn) {
|
|
76447
76521
|
return function() {
|
|
76448
76522
|
var self2 = this, args = arguments;
|
|
76449
|
-
return new Promise(function(
|
|
76523
|
+
return new Promise(function(resolve20, reject) {
|
|
76450
76524
|
var gen = fn.apply(self2, args);
|
|
76451
76525
|
function _next(value) {
|
|
76452
|
-
asyncGeneratorStep(gen,
|
|
76526
|
+
asyncGeneratorStep(gen, resolve20, reject, _next, _throw, "next", value);
|
|
76453
76527
|
}
|
|
76454
76528
|
function _throw(err) {
|
|
76455
|
-
asyncGeneratorStep(gen,
|
|
76529
|
+
asyncGeneratorStep(gen, resolve20, reject, _next, _throw, "throw", err);
|
|
76456
76530
|
}
|
|
76457
76531
|
_next(void 0);
|
|
76458
76532
|
});
|
|
@@ -78391,9 +78465,9 @@ var init_base = __esm({
|
|
|
78391
78465
|
* @return {Promise}
|
|
78392
78466
|
*/
|
|
78393
78467
|
run() {
|
|
78394
|
-
return new Promise((
|
|
78468
|
+
return new Promise((resolve20, reject) => {
|
|
78395
78469
|
this._run(
|
|
78396
|
-
(value) =>
|
|
78470
|
+
(value) => resolve20(value),
|
|
78397
78471
|
(error48) => reject(error48)
|
|
78398
78472
|
);
|
|
78399
78473
|
});
|
|
@@ -85025,7 +85099,7 @@ var require_lib2 = __commonJS({
|
|
|
85025
85099
|
return matches;
|
|
85026
85100
|
};
|
|
85027
85101
|
exports2.analyse = analyse;
|
|
85028
|
-
var detectFile = (filepath, opts = {}) => new Promise((
|
|
85102
|
+
var detectFile = (filepath, opts = {}) => new Promise((resolve20, reject) => {
|
|
85029
85103
|
let fd;
|
|
85030
85104
|
const fs20 = (0, node_1.default)();
|
|
85031
85105
|
const handler = (err, buffer) => {
|
|
@@ -85035,7 +85109,7 @@ var require_lib2 = __commonJS({
|
|
|
85035
85109
|
if (err) {
|
|
85036
85110
|
reject(err);
|
|
85037
85111
|
} else if (buffer) {
|
|
85038
|
-
|
|
85112
|
+
resolve20((0, exports2.detect)(buffer));
|
|
85039
85113
|
} else {
|
|
85040
85114
|
reject(new Error("No error and no buffer received"));
|
|
85041
85115
|
}
|
|
@@ -88963,14 +89037,14 @@ function splitStringBySpace(str) {
|
|
|
88963
89037
|
}
|
|
88964
89038
|
return pieces;
|
|
88965
89039
|
}
|
|
88966
|
-
var import_chardet, import_child_process14, import_fs8,
|
|
89040
|
+
var import_chardet, import_child_process14, import_fs8, import_node_path3, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
|
|
88967
89041
|
var init_esm2 = __esm({
|
|
88968
89042
|
"../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
|
|
88969
89043
|
"use strict";
|
|
88970
89044
|
import_chardet = __toESM(require_lib2(), 1);
|
|
88971
89045
|
import_child_process14 = require("child_process");
|
|
88972
89046
|
import_fs8 = require("fs");
|
|
88973
|
-
|
|
89047
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
88974
89048
|
import_node_os4 = __toESM(require("os"), 1);
|
|
88975
89049
|
import_node_crypto2 = require("crypto");
|
|
88976
89050
|
import_iconv_lite = __toESM(require_lib3(), 1);
|
|
@@ -89035,8 +89109,8 @@ var init_esm2 = __esm({
|
|
|
89035
89109
|
const prefix = sanitizeAffix(this.fileOptions.prefix);
|
|
89036
89110
|
const postfix = sanitizeAffix(this.fileOptions.postfix);
|
|
89037
89111
|
const filename = `${prefix}${id}${postfix}`;
|
|
89038
|
-
const candidate =
|
|
89039
|
-
const baseResolved =
|
|
89112
|
+
const candidate = import_node_path3.default.resolve(baseDir, filename);
|
|
89113
|
+
const baseResolved = import_node_path3.default.resolve(baseDir) + import_node_path3.default.sep;
|
|
89040
89114
|
if (!candidate.startsWith(baseResolved)) {
|
|
89041
89115
|
throw new Error("Resolved temporary file escaped the base directory");
|
|
89042
89116
|
}
|