adhdev 0.8.8 → 0.8.9
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 +473 -174
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1241 -434
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/session-host-daemon/index.js +55 -22
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +55 -22
- package/vendor/session-host-daemon/index.mjs.map +1 -1
package/dist/index.js
CHANGED
|
@@ -569,18 +569,18 @@ function checkPathExists(paths) {
|
|
|
569
569
|
return null;
|
|
570
570
|
}
|
|
571
571
|
async function detectIDEs() {
|
|
572
|
-
const
|
|
572
|
+
const os22 = (0, import_os2.platform)();
|
|
573
573
|
const results = [];
|
|
574
574
|
for (const def of getMergedDefinitions()) {
|
|
575
575
|
const cliPath = findCliCommand(def.cli);
|
|
576
|
-
const appPath = checkPathExists(def.paths[
|
|
576
|
+
const appPath = checkPathExists(def.paths[os22] || []);
|
|
577
577
|
const installed = !!(cliPath || appPath);
|
|
578
578
|
let resolvedCli = cliPath;
|
|
579
|
-
if (!resolvedCli && appPath &&
|
|
579
|
+
if (!resolvedCli && appPath && os22 === "darwin") {
|
|
580
580
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
581
581
|
if ((0, import_fs2.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
582
582
|
}
|
|
583
|
-
if (!resolvedCli && appPath &&
|
|
583
|
+
if (!resolvedCli && appPath && os22 === "win32") {
|
|
584
584
|
const { dirname: dirname9 } = await import("path");
|
|
585
585
|
const appDir = dirname9(appPath);
|
|
586
586
|
const candidates = [
|
|
@@ -738,9 +738,22 @@ var init_host_memory = __esm({
|
|
|
738
738
|
});
|
|
739
739
|
|
|
740
740
|
// ../../oss/packages/daemon-core/src/logging/logger.ts
|
|
741
|
+
function setLogLevel(level) {
|
|
742
|
+
currentLevel = level;
|
|
743
|
+
daemonLog("Logger", `Log level set to: ${level}`, "info");
|
|
744
|
+
}
|
|
745
|
+
function getLogLevel() {
|
|
746
|
+
return currentLevel;
|
|
747
|
+
}
|
|
741
748
|
function getDateStr() {
|
|
742
749
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
743
750
|
}
|
|
751
|
+
function getDaemonLogDir() {
|
|
752
|
+
return LOG_DIR;
|
|
753
|
+
}
|
|
754
|
+
function getCurrentDaemonLogPath(date5 = /* @__PURE__ */ new Date()) {
|
|
755
|
+
return path4.join(LOG_DIR, `daemon-${date5.toISOString().slice(0, 10)}.log`);
|
|
756
|
+
}
|
|
744
757
|
function checkDateRotation() {
|
|
745
758
|
const today = getDateStr();
|
|
746
759
|
if (today !== currentDate) {
|
|
@@ -3272,6 +3285,17 @@ async function setupIdeInstance(ctx, opts) {
|
|
|
3272
3285
|
}
|
|
3273
3286
|
return ideInstance;
|
|
3274
3287
|
}
|
|
3288
|
+
async function connectCdpManager(port, ideType, logFn, providerLoader, targetId) {
|
|
3289
|
+
const provider = providerLoader.getMeta(ideType);
|
|
3290
|
+
const manager = new DaemonCdpManager(
|
|
3291
|
+
port,
|
|
3292
|
+
logFn,
|
|
3293
|
+
targetId,
|
|
3294
|
+
provider?.targetFilter
|
|
3295
|
+
);
|
|
3296
|
+
const connected = await manager.connect();
|
|
3297
|
+
return connected ? manager : null;
|
|
3298
|
+
}
|
|
3275
3299
|
async function probeCdpPort(port, timeoutMs = 1e3) {
|
|
3276
3300
|
try {
|
|
3277
3301
|
const probe = await fetch(`http://localhost:${port}/json/version`, {
|
|
@@ -3291,12 +3315,154 @@ var init_setup = __esm({
|
|
|
3291
3315
|
});
|
|
3292
3316
|
|
|
3293
3317
|
// ../../oss/packages/daemon-core/src/cdp/scanner.ts
|
|
3318
|
+
var DaemonCdpScanner;
|
|
3294
3319
|
var init_scanner = __esm({
|
|
3295
3320
|
"../../oss/packages/daemon-core/src/cdp/scanner.ts"() {
|
|
3296
3321
|
"use strict";
|
|
3297
3322
|
init_manager();
|
|
3298
3323
|
init_setup();
|
|
3299
3324
|
init_logger();
|
|
3325
|
+
DaemonCdpScanner = class {
|
|
3326
|
+
ctx;
|
|
3327
|
+
opts;
|
|
3328
|
+
scanTimer = null;
|
|
3329
|
+
discoveryTimer = null;
|
|
3330
|
+
constructor(opts) {
|
|
3331
|
+
this.ctx = opts.ctx;
|
|
3332
|
+
this.opts = opts;
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Initial CDP discovery — connect to all available IDEs.
|
|
3336
|
+
* Supports both single-window and multi-window modes.
|
|
3337
|
+
*/
|
|
3338
|
+
async initialScan(enabledIdes) {
|
|
3339
|
+
const portMap = this.ctx.providerLoader.getCdpPortMap();
|
|
3340
|
+
const portsToTry = [];
|
|
3341
|
+
for (const [ide, ports] of Object.entries(portMap)) {
|
|
3342
|
+
portsToTry.push({ port: ports[0], ide });
|
|
3343
|
+
}
|
|
3344
|
+
const filtered = enabledIdes?.length ? portsToTry.filter((p) => enabledIdes.includes(p.ide)) : portsToTry;
|
|
3345
|
+
for (const { port, ide } of filtered) {
|
|
3346
|
+
if (this.opts.multiWindow) {
|
|
3347
|
+
await this.connectMultiWindow(port, ide);
|
|
3348
|
+
} else {
|
|
3349
|
+
await this.connectSingleWindow(port, ide);
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
/**
|
|
3354
|
+
* Start periodic scanning for newly launched IDEs.
|
|
3355
|
+
*/
|
|
3356
|
+
startPeriodicScan() {
|
|
3357
|
+
if (this.scanTimer) return;
|
|
3358
|
+
const interval = this.opts.scanIntervalMs || 3e4;
|
|
3359
|
+
this.scanTimer = setInterval(async () => {
|
|
3360
|
+
const portMap = this.ctx.providerLoader.getCdpPortMap();
|
|
3361
|
+
for (const [ide, ports] of Object.entries(portMap)) {
|
|
3362
|
+
const primaryPort = ports[0];
|
|
3363
|
+
const alreadyConnected = [...this.ctx.cdpManagers.entries()].some(
|
|
3364
|
+
([key, m]) => m.isConnected && (key === ide || key.startsWith(ide + "_"))
|
|
3365
|
+
);
|
|
3366
|
+
if (alreadyConnected) continue;
|
|
3367
|
+
if (this.opts.multiWindow) {
|
|
3368
|
+
await this.connectMultiWindow(primaryPort, ide);
|
|
3369
|
+
} else {
|
|
3370
|
+
await this.connectSingleWindow(primaryPort, ide);
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
}, interval);
|
|
3374
|
+
}
|
|
3375
|
+
/**
|
|
3376
|
+
* Start periodic agent webview discovery on all connected CDPs.
|
|
3377
|
+
*/
|
|
3378
|
+
startWebviewDiscovery(intervalMs = 3e4) {
|
|
3379
|
+
if (this.discoveryTimer) return;
|
|
3380
|
+
this.discoveryTimer = setInterval(async () => {
|
|
3381
|
+
for (const m of this.ctx.cdpManagers.values()) {
|
|
3382
|
+
if (m.isConnected) {
|
|
3383
|
+
await m.discoverAgentWebviews();
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}, intervalMs);
|
|
3387
|
+
}
|
|
3388
|
+
/**
|
|
3389
|
+
* Stop all timers.
|
|
3390
|
+
*/
|
|
3391
|
+
stop() {
|
|
3392
|
+
if (this.scanTimer) {
|
|
3393
|
+
clearInterval(this.scanTimer);
|
|
3394
|
+
this.scanTimer = null;
|
|
3395
|
+
}
|
|
3396
|
+
if (this.discoveryTimer) {
|
|
3397
|
+
clearInterval(this.discoveryTimer);
|
|
3398
|
+
this.discoveryTimer = null;
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
// ── Internal ────────────────────────────
|
|
3402
|
+
getLogFn(ideType) {
|
|
3403
|
+
if (this.opts.logFn) return this.opts.logFn(ideType);
|
|
3404
|
+
return (msg) => LOG.info(`CDP:${ideType}`, msg);
|
|
3405
|
+
}
|
|
3406
|
+
/**
|
|
3407
|
+
* Single-window connection (standalone mode).
|
|
3408
|
+
* One CDP manager per IDE, first working port wins.
|
|
3409
|
+
*/
|
|
3410
|
+
async connectSingleWindow(port, ide) {
|
|
3411
|
+
if (this.ctx.cdpManagers.has(ide)) return;
|
|
3412
|
+
const available = await probeCdpPort(port);
|
|
3413
|
+
if (!available) return;
|
|
3414
|
+
const manager = await connectCdpManager(
|
|
3415
|
+
port,
|
|
3416
|
+
ide,
|
|
3417
|
+
this.getLogFn(ide),
|
|
3418
|
+
this.ctx.providerLoader
|
|
3419
|
+
);
|
|
3420
|
+
if (!manager) return;
|
|
3421
|
+
registerExtensionProviders(this.ctx.providerLoader, manager, ide);
|
|
3422
|
+
this.ctx.cdpManagers.set(ide, manager);
|
|
3423
|
+
LOG.info("IDE", `Attached: ${ide} (port ${port})`);
|
|
3424
|
+
await setupIdeInstance(this.ctx, { ideType: ide, manager });
|
|
3425
|
+
this.opts.onConnected?.(ide, ide, manager);
|
|
3426
|
+
}
|
|
3427
|
+
/**
|
|
3428
|
+
* Multi-window connection.
|
|
3429
|
+
* Multiple CDP managers per IDE — one per workbench page.
|
|
3430
|
+
*/
|
|
3431
|
+
async connectMultiWindow(port, ide) {
|
|
3432
|
+
const allTargets = await DaemonCdpManager.listAllTargets(port);
|
|
3433
|
+
if (allTargets.length === 0) {
|
|
3434
|
+
await this.connectSingleWindow(port, ide);
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
for (let i = 0; i < allTargets.length; i++) {
|
|
3438
|
+
const target = allTargets[i];
|
|
3439
|
+
let managerKey;
|
|
3440
|
+
if (allTargets.length === 1) {
|
|
3441
|
+
managerKey = ide;
|
|
3442
|
+
} else {
|
|
3443
|
+
const workspaceName = (target.title || "").split(" \u2014 ")[0].trim() || `window_${i}`;
|
|
3444
|
+
managerKey = `${ide}_${workspaceName}`;
|
|
3445
|
+
}
|
|
3446
|
+
if (this.ctx.cdpManagers.has(managerKey)) continue;
|
|
3447
|
+
const manager = await connectCdpManager(
|
|
3448
|
+
port,
|
|
3449
|
+
ide,
|
|
3450
|
+
this.getLogFn(managerKey),
|
|
3451
|
+
this.ctx.providerLoader,
|
|
3452
|
+
target.id
|
|
3453
|
+
);
|
|
3454
|
+
if (!manager) continue;
|
|
3455
|
+
this.ctx.cdpManagers.set(managerKey, manager);
|
|
3456
|
+
LOG.info("IDE", `Attached window: ${managerKey} (port ${port}, page "${target.title}")`);
|
|
3457
|
+
await setupIdeInstance(this.ctx, {
|
|
3458
|
+
ideType: ide,
|
|
3459
|
+
manager,
|
|
3460
|
+
managerKey
|
|
3461
|
+
});
|
|
3462
|
+
this.opts.onConnected?.(ide, managerKey, manager);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
};
|
|
3300
3466
|
}
|
|
3301
3467
|
});
|
|
3302
3468
|
|
|
@@ -3540,6 +3706,12 @@ function normalizeManagedStatus(status, opts) {
|
|
|
3540
3706
|
if (normalized === "disconnected") return "disconnected";
|
|
3541
3707
|
return "idle";
|
|
3542
3708
|
}
|
|
3709
|
+
function isManagedStatusWorking(status) {
|
|
3710
|
+
return normalizeManagedStatus(status) === "generating";
|
|
3711
|
+
}
|
|
3712
|
+
function isManagedStatusWaiting(status, opts) {
|
|
3713
|
+
return normalizeManagedStatus(status, opts) === "waiting_approval";
|
|
3714
|
+
}
|
|
3543
3715
|
function normalizeActiveChatData(activeChat) {
|
|
3544
3716
|
if (!activeChat) return activeChat;
|
|
3545
3717
|
return {
|
|
@@ -3587,6 +3759,14 @@ function findCdpManager(cdpManagers, key) {
|
|
|
3587
3759
|
}
|
|
3588
3760
|
return null;
|
|
3589
3761
|
}
|
|
3762
|
+
function hasCdpManager(cdpManagers, key) {
|
|
3763
|
+
if (cdpManagers.has(key)) return true;
|
|
3764
|
+
const prefix = key + "_";
|
|
3765
|
+
for (const k of cdpManagers.keys()) {
|
|
3766
|
+
if (k.startsWith(prefix)) return true;
|
|
3767
|
+
}
|
|
3768
|
+
return false;
|
|
3769
|
+
}
|
|
3590
3770
|
function isCdpConnected(cdpManagers, key) {
|
|
3591
3771
|
const m = findCdpManager(cdpManagers, key);
|
|
3592
3772
|
return m?.isConnected ?? false;
|
|
@@ -6155,12 +6335,12 @@ function findBinary(name) {
|
|
|
6155
6335
|
function isScriptBinary(binaryPath) {
|
|
6156
6336
|
if (!path7.isAbsolute(binaryPath)) return false;
|
|
6157
6337
|
try {
|
|
6158
|
-
const
|
|
6159
|
-
const resolved =
|
|
6338
|
+
const fs18 = require("fs");
|
|
6339
|
+
const resolved = fs18.realpathSync(binaryPath);
|
|
6160
6340
|
const head = Buffer.alloc(8);
|
|
6161
|
-
const fd =
|
|
6162
|
-
|
|
6163
|
-
|
|
6341
|
+
const fd = fs18.openSync(resolved, "r");
|
|
6342
|
+
fs18.readSync(fd, head, 0, 8, 0);
|
|
6343
|
+
fs18.closeSync(fd);
|
|
6164
6344
|
let i = 0;
|
|
6165
6345
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
6166
6346
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -6171,12 +6351,12 @@ function isScriptBinary(binaryPath) {
|
|
|
6171
6351
|
function looksLikeMachOOrElf(filePath) {
|
|
6172
6352
|
if (!path7.isAbsolute(filePath)) return false;
|
|
6173
6353
|
try {
|
|
6174
|
-
const
|
|
6175
|
-
const resolved =
|
|
6354
|
+
const fs18 = require("fs");
|
|
6355
|
+
const resolved = fs18.realpathSync(filePath);
|
|
6176
6356
|
const buf = Buffer.alloc(8);
|
|
6177
|
-
const fd =
|
|
6178
|
-
|
|
6179
|
-
|
|
6357
|
+
const fd = fs18.openSync(resolved, "r");
|
|
6358
|
+
fs18.readSync(fd, buf, 0, 8, 0);
|
|
6359
|
+
fs18.closeSync(fd);
|
|
6180
6360
|
let i = 0;
|
|
6181
6361
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
6182
6362
|
const b = buf.subarray(i);
|
|
@@ -6273,14 +6453,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
6273
6453
|
pty2 = require("node-pty");
|
|
6274
6454
|
if (os8.platform() !== "win32") {
|
|
6275
6455
|
try {
|
|
6276
|
-
const
|
|
6456
|
+
const fs18 = require("fs");
|
|
6277
6457
|
const ptyDir = path7.resolve(path7.dirname(require.resolve("node-pty")), "..");
|
|
6278
6458
|
const platformArch = `${os8.platform()}-${os8.arch()}`;
|
|
6279
6459
|
const helper = path7.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
|
|
6280
|
-
if (
|
|
6281
|
-
const stat4 =
|
|
6460
|
+
if (fs18.existsSync(helper)) {
|
|
6461
|
+
const stat4 = fs18.statSync(helper);
|
|
6282
6462
|
if (!(stat4.mode & 73)) {
|
|
6283
|
-
|
|
6463
|
+
fs18.chmodSync(helper, stat4.mode | 493);
|
|
6284
6464
|
LOG.info("CLI", "[node-pty] Fixed spawn-helper permissions");
|
|
6285
6465
|
}
|
|
6286
6466
|
}
|
|
@@ -8399,10 +8579,10 @@ function mergeDefs(...defs) {
|
|
|
8399
8579
|
function cloneDef(schema) {
|
|
8400
8580
|
return mergeDefs(schema._zod.def);
|
|
8401
8581
|
}
|
|
8402
|
-
function getElementAtPath(obj,
|
|
8403
|
-
if (!
|
|
8582
|
+
function getElementAtPath(obj, path23) {
|
|
8583
|
+
if (!path23)
|
|
8404
8584
|
return obj;
|
|
8405
|
-
return
|
|
8585
|
+
return path23.reduce((acc, key) => acc?.[key], obj);
|
|
8406
8586
|
}
|
|
8407
8587
|
function promiseAllObject(promisesObj) {
|
|
8408
8588
|
const keys = Object.keys(promisesObj);
|
|
@@ -8714,11 +8894,11 @@ function aborted(x, startIndex = 0) {
|
|
|
8714
8894
|
}
|
|
8715
8895
|
return false;
|
|
8716
8896
|
}
|
|
8717
|
-
function prefixIssues(
|
|
8897
|
+
function prefixIssues(path23, issues) {
|
|
8718
8898
|
return issues.map((iss) => {
|
|
8719
8899
|
var _a2;
|
|
8720
8900
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
8721
|
-
iss.path.unshift(
|
|
8901
|
+
iss.path.unshift(path23);
|
|
8722
8902
|
return iss;
|
|
8723
8903
|
});
|
|
8724
8904
|
}
|
|
@@ -8961,7 +9141,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
8961
9141
|
}
|
|
8962
9142
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
8963
9143
|
const result = { errors: [] };
|
|
8964
|
-
const processError = (error49,
|
|
9144
|
+
const processError = (error49, path23 = []) => {
|
|
8965
9145
|
var _a2, _b;
|
|
8966
9146
|
for (const issue2 of error49.issues) {
|
|
8967
9147
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -8971,7 +9151,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
8971
9151
|
} else if (issue2.code === "invalid_element") {
|
|
8972
9152
|
processError({ issues: issue2.issues }, issue2.path);
|
|
8973
9153
|
} else {
|
|
8974
|
-
const fullpath = [...
|
|
9154
|
+
const fullpath = [...path23, ...issue2.path];
|
|
8975
9155
|
if (fullpath.length === 0) {
|
|
8976
9156
|
result.errors.push(mapper(issue2));
|
|
8977
9157
|
continue;
|
|
@@ -9003,8 +9183,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
9003
9183
|
}
|
|
9004
9184
|
function toDotPath(_path) {
|
|
9005
9185
|
const segs = [];
|
|
9006
|
-
const
|
|
9007
|
-
for (const seg of
|
|
9186
|
+
const path23 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
9187
|
+
for (const seg of path23) {
|
|
9008
9188
|
if (typeof seg === "number")
|
|
9009
9189
|
segs.push(`[${seg}]`);
|
|
9010
9190
|
else if (typeof seg === "symbol")
|
|
@@ -21768,13 +21948,13 @@ function resolveRef(ref, ctx) {
|
|
|
21768
21948
|
if (!ref.startsWith("#")) {
|
|
21769
21949
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
21770
21950
|
}
|
|
21771
|
-
const
|
|
21772
|
-
if (
|
|
21951
|
+
const path23 = ref.slice(1).split("/").filter(Boolean);
|
|
21952
|
+
if (path23.length === 0) {
|
|
21773
21953
|
return ctx.rootSchema;
|
|
21774
21954
|
}
|
|
21775
21955
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
21776
|
-
if (
|
|
21777
|
-
const key =
|
|
21956
|
+
if (path23[0] === defsKey) {
|
|
21957
|
+
const key = path23[1];
|
|
21778
21958
|
if (!key || !ctx.defs[key]) {
|
|
21779
21959
|
throw new Error(`Reference not found: ${ref}`);
|
|
21780
21960
|
}
|
|
@@ -25634,8 +25814,8 @@ var init_cli_manager = __esm({
|
|
|
25634
25814
|
const spawnCmd = provider.spawn?.command;
|
|
25635
25815
|
if (spawnCmd) {
|
|
25636
25816
|
try {
|
|
25637
|
-
const { execSync:
|
|
25638
|
-
|
|
25817
|
+
const { execSync: execSync7 } = require("child_process");
|
|
25818
|
+
execSync7(`which ${spawnCmd}`, { stdio: "ignore" });
|
|
25639
25819
|
} catch {
|
|
25640
25820
|
const installInfo = provider.install || `Install: check ${provider.displayName || provider.name} documentation`;
|
|
25641
25821
|
throw new Error(
|
|
@@ -26162,7 +26342,7 @@ var init_readdirp = __esm({
|
|
|
26162
26342
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
26163
26343
|
const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
|
|
26164
26344
|
if (wantBigintFsStats) {
|
|
26165
|
-
this._stat = (
|
|
26345
|
+
this._stat = (path23) => statMethod(path23, { bigint: true });
|
|
26166
26346
|
} else {
|
|
26167
26347
|
this._stat = statMethod;
|
|
26168
26348
|
}
|
|
@@ -26187,8 +26367,8 @@ var init_readdirp = __esm({
|
|
|
26187
26367
|
const par = this.parent;
|
|
26188
26368
|
const fil = par && par.files;
|
|
26189
26369
|
if (fil && fil.length > 0) {
|
|
26190
|
-
const { path:
|
|
26191
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent,
|
|
26370
|
+
const { path: path23, depth } = par;
|
|
26371
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path23));
|
|
26192
26372
|
const awaited = await Promise.all(slice);
|
|
26193
26373
|
for (const entry of awaited) {
|
|
26194
26374
|
if (!entry)
|
|
@@ -26228,20 +26408,20 @@ var init_readdirp = __esm({
|
|
|
26228
26408
|
this.reading = false;
|
|
26229
26409
|
}
|
|
26230
26410
|
}
|
|
26231
|
-
async _exploreDir(
|
|
26411
|
+
async _exploreDir(path23, depth) {
|
|
26232
26412
|
let files;
|
|
26233
26413
|
try {
|
|
26234
|
-
files = await (0, import_promises.readdir)(
|
|
26414
|
+
files = await (0, import_promises.readdir)(path23, this._rdOptions);
|
|
26235
26415
|
} catch (error48) {
|
|
26236
26416
|
this._onError(error48);
|
|
26237
26417
|
}
|
|
26238
|
-
return { files, depth, path:
|
|
26418
|
+
return { files, depth, path: path23 };
|
|
26239
26419
|
}
|
|
26240
|
-
async _formatEntry(dirent,
|
|
26420
|
+
async _formatEntry(dirent, path23) {
|
|
26241
26421
|
let entry;
|
|
26242
26422
|
const basename7 = this._isDirent ? dirent.name : dirent;
|
|
26243
26423
|
try {
|
|
26244
|
-
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(
|
|
26424
|
+
const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path23, basename7));
|
|
26245
26425
|
entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename7 };
|
|
26246
26426
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
26247
26427
|
} catch (err) {
|
|
@@ -26298,16 +26478,16 @@ var init_readdirp = __esm({
|
|
|
26298
26478
|
});
|
|
26299
26479
|
|
|
26300
26480
|
// ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
|
|
26301
|
-
function createFsWatchInstance(
|
|
26481
|
+
function createFsWatchInstance(path23, options, listener, errHandler, emitRaw) {
|
|
26302
26482
|
const handleEvent = (rawEvent, evPath) => {
|
|
26303
|
-
listener(
|
|
26304
|
-
emitRaw(rawEvent, evPath, { watchedPath:
|
|
26305
|
-
if (evPath &&
|
|
26306
|
-
fsWatchBroadcast(sp.resolve(
|
|
26483
|
+
listener(path23);
|
|
26484
|
+
emitRaw(rawEvent, evPath, { watchedPath: path23 });
|
|
26485
|
+
if (evPath && path23 !== evPath) {
|
|
26486
|
+
fsWatchBroadcast(sp.resolve(path23, evPath), KEY_LISTENERS, sp.join(path23, evPath));
|
|
26307
26487
|
}
|
|
26308
26488
|
};
|
|
26309
26489
|
try {
|
|
26310
|
-
return (0, import_node_fs.watch)(
|
|
26490
|
+
return (0, import_node_fs.watch)(path23, {
|
|
26311
26491
|
persistent: options.persistent
|
|
26312
26492
|
}, handleEvent);
|
|
26313
26493
|
} catch (error48) {
|
|
@@ -26656,12 +26836,12 @@ var init_handler2 = __esm({
|
|
|
26656
26836
|
listener(val1, val2, val3);
|
|
26657
26837
|
});
|
|
26658
26838
|
};
|
|
26659
|
-
setFsWatchListener = (
|
|
26839
|
+
setFsWatchListener = (path23, fullPath, options, handlers) => {
|
|
26660
26840
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
26661
26841
|
let cont = FsWatchInstances.get(fullPath);
|
|
26662
26842
|
let watcher;
|
|
26663
26843
|
if (!options.persistent) {
|
|
26664
|
-
watcher = createFsWatchInstance(
|
|
26844
|
+
watcher = createFsWatchInstance(path23, options, listener, errHandler, rawEmitter);
|
|
26665
26845
|
if (!watcher)
|
|
26666
26846
|
return;
|
|
26667
26847
|
return watcher.close.bind(watcher);
|
|
@@ -26672,7 +26852,7 @@ var init_handler2 = __esm({
|
|
|
26672
26852
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
26673
26853
|
} else {
|
|
26674
26854
|
watcher = createFsWatchInstance(
|
|
26675
|
-
|
|
26855
|
+
path23,
|
|
26676
26856
|
options,
|
|
26677
26857
|
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
|
|
26678
26858
|
errHandler,
|
|
@@ -26687,7 +26867,7 @@ var init_handler2 = __esm({
|
|
|
26687
26867
|
cont.watcherUnusable = true;
|
|
26688
26868
|
if (isWindows && error48.code === "EPERM") {
|
|
26689
26869
|
try {
|
|
26690
|
-
const fd = await (0, import_promises2.open)(
|
|
26870
|
+
const fd = await (0, import_promises2.open)(path23, "r");
|
|
26691
26871
|
await fd.close();
|
|
26692
26872
|
broadcastErr(error48);
|
|
26693
26873
|
} catch (err) {
|
|
@@ -26718,7 +26898,7 @@ var init_handler2 = __esm({
|
|
|
26718
26898
|
};
|
|
26719
26899
|
};
|
|
26720
26900
|
FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
26721
|
-
setFsWatchFileListener = (
|
|
26901
|
+
setFsWatchFileListener = (path23, fullPath, options, handlers) => {
|
|
26722
26902
|
const { listener, rawEmitter } = handlers;
|
|
26723
26903
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
26724
26904
|
const copts = cont && cont.options;
|
|
@@ -26740,7 +26920,7 @@ var init_handler2 = __esm({
|
|
|
26740
26920
|
});
|
|
26741
26921
|
const currmtime = curr.mtimeMs;
|
|
26742
26922
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
26743
|
-
foreach(cont.listeners, (listener2) => listener2(
|
|
26923
|
+
foreach(cont.listeners, (listener2) => listener2(path23, curr));
|
|
26744
26924
|
}
|
|
26745
26925
|
})
|
|
26746
26926
|
};
|
|
@@ -26770,13 +26950,13 @@ var init_handler2 = __esm({
|
|
|
26770
26950
|
* @param listener on fs change
|
|
26771
26951
|
* @returns closer for the watcher instance
|
|
26772
26952
|
*/
|
|
26773
|
-
_watchWithNodeFs(
|
|
26953
|
+
_watchWithNodeFs(path23, listener) {
|
|
26774
26954
|
const opts = this.fsw.options;
|
|
26775
|
-
const directory = sp.dirname(
|
|
26776
|
-
const basename7 = sp.basename(
|
|
26955
|
+
const directory = sp.dirname(path23);
|
|
26956
|
+
const basename7 = sp.basename(path23);
|
|
26777
26957
|
const parent = this.fsw._getWatchedDir(directory);
|
|
26778
26958
|
parent.add(basename7);
|
|
26779
|
-
const absolutePath = sp.resolve(
|
|
26959
|
+
const absolutePath = sp.resolve(path23);
|
|
26780
26960
|
const options = {
|
|
26781
26961
|
persistent: opts.persistent
|
|
26782
26962
|
};
|
|
@@ -26786,12 +26966,12 @@ var init_handler2 = __esm({
|
|
|
26786
26966
|
if (opts.usePolling) {
|
|
26787
26967
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
26788
26968
|
options.interval = enableBin && isBinaryPath(basename7) ? opts.binaryInterval : opts.interval;
|
|
26789
|
-
closer = setFsWatchFileListener(
|
|
26969
|
+
closer = setFsWatchFileListener(path23, absolutePath, options, {
|
|
26790
26970
|
listener,
|
|
26791
26971
|
rawEmitter: this.fsw._emitRaw
|
|
26792
26972
|
});
|
|
26793
26973
|
} else {
|
|
26794
|
-
closer = setFsWatchListener(
|
|
26974
|
+
closer = setFsWatchListener(path23, absolutePath, options, {
|
|
26795
26975
|
listener,
|
|
26796
26976
|
errHandler: this._boundHandleError,
|
|
26797
26977
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -26813,7 +26993,7 @@ var init_handler2 = __esm({
|
|
|
26813
26993
|
let prevStats = stats;
|
|
26814
26994
|
if (parent.has(basename7))
|
|
26815
26995
|
return;
|
|
26816
|
-
const listener = async (
|
|
26996
|
+
const listener = async (path23, newStats) => {
|
|
26817
26997
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
26818
26998
|
return;
|
|
26819
26999
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -26827,11 +27007,11 @@ var init_handler2 = __esm({
|
|
|
26827
27007
|
this.fsw._emit(EV.CHANGE, file2, newStats2);
|
|
26828
27008
|
}
|
|
26829
27009
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
26830
|
-
this.fsw._closeFile(
|
|
27010
|
+
this.fsw._closeFile(path23);
|
|
26831
27011
|
prevStats = newStats2;
|
|
26832
27012
|
const closer2 = this._watchWithNodeFs(file2, listener);
|
|
26833
27013
|
if (closer2)
|
|
26834
|
-
this.fsw._addPathCloser(
|
|
27014
|
+
this.fsw._addPathCloser(path23, closer2);
|
|
26835
27015
|
} else {
|
|
26836
27016
|
prevStats = newStats2;
|
|
26837
27017
|
}
|
|
@@ -26863,7 +27043,7 @@ var init_handler2 = __esm({
|
|
|
26863
27043
|
* @param item basename of this item
|
|
26864
27044
|
* @returns true if no more processing is needed for this entry.
|
|
26865
27045
|
*/
|
|
26866
|
-
async _handleSymlink(entry, directory,
|
|
27046
|
+
async _handleSymlink(entry, directory, path23, item) {
|
|
26867
27047
|
if (this.fsw.closed) {
|
|
26868
27048
|
return;
|
|
26869
27049
|
}
|
|
@@ -26873,7 +27053,7 @@ var init_handler2 = __esm({
|
|
|
26873
27053
|
this.fsw._incrReadyCount();
|
|
26874
27054
|
let linkPath;
|
|
26875
27055
|
try {
|
|
26876
|
-
linkPath = await (0, import_promises2.realpath)(
|
|
27056
|
+
linkPath = await (0, import_promises2.realpath)(path23);
|
|
26877
27057
|
} catch (e) {
|
|
26878
27058
|
this.fsw._emitReady();
|
|
26879
27059
|
return true;
|
|
@@ -26883,12 +27063,12 @@ var init_handler2 = __esm({
|
|
|
26883
27063
|
if (dir.has(item)) {
|
|
26884
27064
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
26885
27065
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
26886
|
-
this.fsw._emit(EV.CHANGE,
|
|
27066
|
+
this.fsw._emit(EV.CHANGE, path23, entry.stats);
|
|
26887
27067
|
}
|
|
26888
27068
|
} else {
|
|
26889
27069
|
dir.add(item);
|
|
26890
27070
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
26891
|
-
this.fsw._emit(EV.ADD,
|
|
27071
|
+
this.fsw._emit(EV.ADD, path23, entry.stats);
|
|
26892
27072
|
}
|
|
26893
27073
|
this.fsw._emitReady();
|
|
26894
27074
|
return true;
|
|
@@ -26918,9 +27098,9 @@ var init_handler2 = __esm({
|
|
|
26918
27098
|
return;
|
|
26919
27099
|
}
|
|
26920
27100
|
const item = entry.path;
|
|
26921
|
-
let
|
|
27101
|
+
let path23 = sp.join(directory, item);
|
|
26922
27102
|
current.add(item);
|
|
26923
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory,
|
|
27103
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path23, item)) {
|
|
26924
27104
|
return;
|
|
26925
27105
|
}
|
|
26926
27106
|
if (this.fsw.closed) {
|
|
@@ -26929,8 +27109,8 @@ var init_handler2 = __esm({
|
|
|
26929
27109
|
}
|
|
26930
27110
|
if (item === target || !target && !previous.has(item)) {
|
|
26931
27111
|
this.fsw._incrReadyCount();
|
|
26932
|
-
|
|
26933
|
-
this._addToNodeFs(
|
|
27112
|
+
path23 = sp.join(dir, sp.relative(dir, path23));
|
|
27113
|
+
this._addToNodeFs(path23, initialAdd, wh, depth + 1);
|
|
26934
27114
|
}
|
|
26935
27115
|
}).on(EV.ERROR, this._boundHandleError);
|
|
26936
27116
|
return new Promise((resolve13, reject) => {
|
|
@@ -26999,13 +27179,13 @@ var init_handler2 = __esm({
|
|
|
26999
27179
|
* @param depth Child path actually targeted for watch
|
|
27000
27180
|
* @param target Child path actually targeted for watch
|
|
27001
27181
|
*/
|
|
27002
|
-
async _addToNodeFs(
|
|
27182
|
+
async _addToNodeFs(path23, initialAdd, priorWh, depth, target) {
|
|
27003
27183
|
const ready = this.fsw._emitReady;
|
|
27004
|
-
if (this.fsw._isIgnored(
|
|
27184
|
+
if (this.fsw._isIgnored(path23) || this.fsw.closed) {
|
|
27005
27185
|
ready();
|
|
27006
27186
|
return false;
|
|
27007
27187
|
}
|
|
27008
|
-
const wh = this.fsw._getWatchHelpers(
|
|
27188
|
+
const wh = this.fsw._getWatchHelpers(path23);
|
|
27009
27189
|
if (priorWh) {
|
|
27010
27190
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
27011
27191
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -27021,8 +27201,8 @@ var init_handler2 = __esm({
|
|
|
27021
27201
|
const follow = this.fsw.options.followSymlinks;
|
|
27022
27202
|
let closer;
|
|
27023
27203
|
if (stats.isDirectory()) {
|
|
27024
|
-
const absPath = sp.resolve(
|
|
27025
|
-
const targetPath = follow ? await (0, import_promises2.realpath)(
|
|
27204
|
+
const absPath = sp.resolve(path23);
|
|
27205
|
+
const targetPath = follow ? await (0, import_promises2.realpath)(path23) : path23;
|
|
27026
27206
|
if (this.fsw.closed)
|
|
27027
27207
|
return;
|
|
27028
27208
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -27032,29 +27212,29 @@ var init_handler2 = __esm({
|
|
|
27032
27212
|
this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
27033
27213
|
}
|
|
27034
27214
|
} else if (stats.isSymbolicLink()) {
|
|
27035
|
-
const targetPath = follow ? await (0, import_promises2.realpath)(
|
|
27215
|
+
const targetPath = follow ? await (0, import_promises2.realpath)(path23) : path23;
|
|
27036
27216
|
if (this.fsw.closed)
|
|
27037
27217
|
return;
|
|
27038
27218
|
const parent = sp.dirname(wh.watchPath);
|
|
27039
27219
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
27040
27220
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
27041
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth,
|
|
27221
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path23, wh, targetPath);
|
|
27042
27222
|
if (this.fsw.closed)
|
|
27043
27223
|
return;
|
|
27044
27224
|
if (targetPath !== void 0) {
|
|
27045
|
-
this.fsw._symlinkPaths.set(sp.resolve(
|
|
27225
|
+
this.fsw._symlinkPaths.set(sp.resolve(path23), targetPath);
|
|
27046
27226
|
}
|
|
27047
27227
|
} else {
|
|
27048
27228
|
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
27049
27229
|
}
|
|
27050
27230
|
ready();
|
|
27051
27231
|
if (closer)
|
|
27052
|
-
this.fsw._addPathCloser(
|
|
27232
|
+
this.fsw._addPathCloser(path23, closer);
|
|
27053
27233
|
return false;
|
|
27054
27234
|
} catch (error48) {
|
|
27055
27235
|
if (this.fsw._handleError(error48)) {
|
|
27056
27236
|
ready();
|
|
27057
|
-
return
|
|
27237
|
+
return path23;
|
|
27058
27238
|
}
|
|
27059
27239
|
}
|
|
27060
27240
|
}
|
|
@@ -27089,24 +27269,24 @@ function createPattern(matcher) {
|
|
|
27089
27269
|
}
|
|
27090
27270
|
return () => false;
|
|
27091
27271
|
}
|
|
27092
|
-
function normalizePath(
|
|
27093
|
-
if (typeof
|
|
27272
|
+
function normalizePath(path23) {
|
|
27273
|
+
if (typeof path23 !== "string")
|
|
27094
27274
|
throw new Error("string expected");
|
|
27095
|
-
|
|
27096
|
-
|
|
27275
|
+
path23 = sp2.normalize(path23);
|
|
27276
|
+
path23 = path23.replace(/\\/g, "/");
|
|
27097
27277
|
let prepend = false;
|
|
27098
|
-
if (
|
|
27278
|
+
if (path23.startsWith("//"))
|
|
27099
27279
|
prepend = true;
|
|
27100
|
-
|
|
27280
|
+
path23 = path23.replace(DOUBLE_SLASH_RE, "/");
|
|
27101
27281
|
if (prepend)
|
|
27102
|
-
|
|
27103
|
-
return
|
|
27282
|
+
path23 = "/" + path23;
|
|
27283
|
+
return path23;
|
|
27104
27284
|
}
|
|
27105
27285
|
function matchPatterns(patterns, testString, stats) {
|
|
27106
|
-
const
|
|
27286
|
+
const path23 = normalizePath(testString);
|
|
27107
27287
|
for (let index = 0; index < patterns.length; index++) {
|
|
27108
27288
|
const pattern = patterns[index];
|
|
27109
|
-
if (pattern(
|
|
27289
|
+
if (pattern(path23, stats)) {
|
|
27110
27290
|
return true;
|
|
27111
27291
|
}
|
|
27112
27292
|
}
|
|
@@ -27169,19 +27349,19 @@ var init_chokidar = __esm({
|
|
|
27169
27349
|
}
|
|
27170
27350
|
return str;
|
|
27171
27351
|
};
|
|
27172
|
-
normalizePathToUnix = (
|
|
27173
|
-
normalizeIgnored = (cwd = "") => (
|
|
27174
|
-
if (typeof
|
|
27175
|
-
return normalizePathToUnix(sp2.isAbsolute(
|
|
27352
|
+
normalizePathToUnix = (path23) => toUnix(sp2.normalize(toUnix(path23)));
|
|
27353
|
+
normalizeIgnored = (cwd = "") => (path23) => {
|
|
27354
|
+
if (typeof path23 === "string") {
|
|
27355
|
+
return normalizePathToUnix(sp2.isAbsolute(path23) ? path23 : sp2.join(cwd, path23));
|
|
27176
27356
|
} else {
|
|
27177
|
-
return
|
|
27357
|
+
return path23;
|
|
27178
27358
|
}
|
|
27179
27359
|
};
|
|
27180
|
-
getAbsolutePath = (
|
|
27181
|
-
if (sp2.isAbsolute(
|
|
27182
|
-
return
|
|
27360
|
+
getAbsolutePath = (path23, cwd) => {
|
|
27361
|
+
if (sp2.isAbsolute(path23)) {
|
|
27362
|
+
return path23;
|
|
27183
27363
|
}
|
|
27184
|
-
return sp2.join(cwd,
|
|
27364
|
+
return sp2.join(cwd, path23);
|
|
27185
27365
|
};
|
|
27186
27366
|
EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
27187
27367
|
DirEntry = class {
|
|
@@ -27246,10 +27426,10 @@ var init_chokidar = __esm({
|
|
|
27246
27426
|
dirParts;
|
|
27247
27427
|
followSymlinks;
|
|
27248
27428
|
statMethod;
|
|
27249
|
-
constructor(
|
|
27429
|
+
constructor(path23, follow, fsw) {
|
|
27250
27430
|
this.fsw = fsw;
|
|
27251
|
-
const watchPath =
|
|
27252
|
-
this.path =
|
|
27431
|
+
const watchPath = path23;
|
|
27432
|
+
this.path = path23 = path23.replace(REPLACER_RE, "");
|
|
27253
27433
|
this.watchPath = watchPath;
|
|
27254
27434
|
this.fullWatchPath = sp2.resolve(watchPath);
|
|
27255
27435
|
this.dirParts = [];
|
|
@@ -27389,20 +27569,20 @@ var init_chokidar = __esm({
|
|
|
27389
27569
|
this._closePromise = void 0;
|
|
27390
27570
|
let paths = unifyPaths(paths_);
|
|
27391
27571
|
if (cwd) {
|
|
27392
|
-
paths = paths.map((
|
|
27393
|
-
const absPath = getAbsolutePath(
|
|
27572
|
+
paths = paths.map((path23) => {
|
|
27573
|
+
const absPath = getAbsolutePath(path23, cwd);
|
|
27394
27574
|
return absPath;
|
|
27395
27575
|
});
|
|
27396
27576
|
}
|
|
27397
|
-
paths.forEach((
|
|
27398
|
-
this._removeIgnoredPath(
|
|
27577
|
+
paths.forEach((path23) => {
|
|
27578
|
+
this._removeIgnoredPath(path23);
|
|
27399
27579
|
});
|
|
27400
27580
|
this._userIgnored = void 0;
|
|
27401
27581
|
if (!this._readyCount)
|
|
27402
27582
|
this._readyCount = 0;
|
|
27403
27583
|
this._readyCount += paths.length;
|
|
27404
|
-
Promise.all(paths.map(async (
|
|
27405
|
-
const res = await this._nodeFsHandler._addToNodeFs(
|
|
27584
|
+
Promise.all(paths.map(async (path23) => {
|
|
27585
|
+
const res = await this._nodeFsHandler._addToNodeFs(path23, !_internal, void 0, 0, _origAdd);
|
|
27406
27586
|
if (res)
|
|
27407
27587
|
this._emitReady();
|
|
27408
27588
|
return res;
|
|
@@ -27424,17 +27604,17 @@ var init_chokidar = __esm({
|
|
|
27424
27604
|
return this;
|
|
27425
27605
|
const paths = unifyPaths(paths_);
|
|
27426
27606
|
const { cwd } = this.options;
|
|
27427
|
-
paths.forEach((
|
|
27428
|
-
if (!sp2.isAbsolute(
|
|
27607
|
+
paths.forEach((path23) => {
|
|
27608
|
+
if (!sp2.isAbsolute(path23) && !this._closers.has(path23)) {
|
|
27429
27609
|
if (cwd)
|
|
27430
|
-
|
|
27431
|
-
|
|
27610
|
+
path23 = sp2.join(cwd, path23);
|
|
27611
|
+
path23 = sp2.resolve(path23);
|
|
27432
27612
|
}
|
|
27433
|
-
this._closePath(
|
|
27434
|
-
this._addIgnoredPath(
|
|
27435
|
-
if (this._watched.has(
|
|
27613
|
+
this._closePath(path23);
|
|
27614
|
+
this._addIgnoredPath(path23);
|
|
27615
|
+
if (this._watched.has(path23)) {
|
|
27436
27616
|
this._addIgnoredPath({
|
|
27437
|
-
path:
|
|
27617
|
+
path: path23,
|
|
27438
27618
|
recursive: true
|
|
27439
27619
|
});
|
|
27440
27620
|
}
|
|
@@ -27498,38 +27678,38 @@ var init_chokidar = __esm({
|
|
|
27498
27678
|
* @param stats arguments to be passed with event
|
|
27499
27679
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
27500
27680
|
*/
|
|
27501
|
-
async _emit(event,
|
|
27681
|
+
async _emit(event, path23, stats) {
|
|
27502
27682
|
if (this.closed)
|
|
27503
27683
|
return;
|
|
27504
27684
|
const opts = this.options;
|
|
27505
27685
|
if (isWindows)
|
|
27506
|
-
|
|
27686
|
+
path23 = sp2.normalize(path23);
|
|
27507
27687
|
if (opts.cwd)
|
|
27508
|
-
|
|
27509
|
-
const args = [
|
|
27688
|
+
path23 = sp2.relative(opts.cwd, path23);
|
|
27689
|
+
const args = [path23];
|
|
27510
27690
|
if (stats != null)
|
|
27511
27691
|
args.push(stats);
|
|
27512
27692
|
const awf = opts.awaitWriteFinish;
|
|
27513
27693
|
let pw;
|
|
27514
|
-
if (awf && (pw = this._pendingWrites.get(
|
|
27694
|
+
if (awf && (pw = this._pendingWrites.get(path23))) {
|
|
27515
27695
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
27516
27696
|
return this;
|
|
27517
27697
|
}
|
|
27518
27698
|
if (opts.atomic) {
|
|
27519
27699
|
if (event === EVENTS.UNLINK) {
|
|
27520
|
-
this._pendingUnlinks.set(
|
|
27700
|
+
this._pendingUnlinks.set(path23, [event, ...args]);
|
|
27521
27701
|
setTimeout(() => {
|
|
27522
|
-
this._pendingUnlinks.forEach((entry,
|
|
27702
|
+
this._pendingUnlinks.forEach((entry, path24) => {
|
|
27523
27703
|
this.emit(...entry);
|
|
27524
27704
|
this.emit(EVENTS.ALL, ...entry);
|
|
27525
|
-
this._pendingUnlinks.delete(
|
|
27705
|
+
this._pendingUnlinks.delete(path24);
|
|
27526
27706
|
});
|
|
27527
27707
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
27528
27708
|
return this;
|
|
27529
27709
|
}
|
|
27530
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(
|
|
27710
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path23)) {
|
|
27531
27711
|
event = EVENTS.CHANGE;
|
|
27532
|
-
this._pendingUnlinks.delete(
|
|
27712
|
+
this._pendingUnlinks.delete(path23);
|
|
27533
27713
|
}
|
|
27534
27714
|
}
|
|
27535
27715
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -27547,16 +27727,16 @@ var init_chokidar = __esm({
|
|
|
27547
27727
|
this.emitWithAll(event, args);
|
|
27548
27728
|
}
|
|
27549
27729
|
};
|
|
27550
|
-
this._awaitWriteFinish(
|
|
27730
|
+
this._awaitWriteFinish(path23, awf.stabilityThreshold, event, awfEmit);
|
|
27551
27731
|
return this;
|
|
27552
27732
|
}
|
|
27553
27733
|
if (event === EVENTS.CHANGE) {
|
|
27554
|
-
const isThrottled = !this._throttle(EVENTS.CHANGE,
|
|
27734
|
+
const isThrottled = !this._throttle(EVENTS.CHANGE, path23, 50);
|
|
27555
27735
|
if (isThrottled)
|
|
27556
27736
|
return this;
|
|
27557
27737
|
}
|
|
27558
27738
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
27559
|
-
const fullPath = opts.cwd ? sp2.join(opts.cwd,
|
|
27739
|
+
const fullPath = opts.cwd ? sp2.join(opts.cwd, path23) : path23;
|
|
27560
27740
|
let stats2;
|
|
27561
27741
|
try {
|
|
27562
27742
|
stats2 = await (0, import_promises3.stat)(fullPath);
|
|
@@ -27587,23 +27767,23 @@ var init_chokidar = __esm({
|
|
|
27587
27767
|
* @param timeout duration of time to suppress duplicate actions
|
|
27588
27768
|
* @returns tracking object or false if action should be suppressed
|
|
27589
27769
|
*/
|
|
27590
|
-
_throttle(actionType,
|
|
27770
|
+
_throttle(actionType, path23, timeout) {
|
|
27591
27771
|
if (!this._throttled.has(actionType)) {
|
|
27592
27772
|
this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
27593
27773
|
}
|
|
27594
27774
|
const action = this._throttled.get(actionType);
|
|
27595
27775
|
if (!action)
|
|
27596
27776
|
throw new Error("invalid throttle");
|
|
27597
|
-
const actionPath = action.get(
|
|
27777
|
+
const actionPath = action.get(path23);
|
|
27598
27778
|
if (actionPath) {
|
|
27599
27779
|
actionPath.count++;
|
|
27600
27780
|
return false;
|
|
27601
27781
|
}
|
|
27602
27782
|
let timeoutObject;
|
|
27603
27783
|
const clear = () => {
|
|
27604
|
-
const item = action.get(
|
|
27784
|
+
const item = action.get(path23);
|
|
27605
27785
|
const count = item ? item.count : 0;
|
|
27606
|
-
action.delete(
|
|
27786
|
+
action.delete(path23);
|
|
27607
27787
|
clearTimeout(timeoutObject);
|
|
27608
27788
|
if (item)
|
|
27609
27789
|
clearTimeout(item.timeoutObject);
|
|
@@ -27611,7 +27791,7 @@ var init_chokidar = __esm({
|
|
|
27611
27791
|
};
|
|
27612
27792
|
timeoutObject = setTimeout(clear, timeout);
|
|
27613
27793
|
const thr = { timeoutObject, clear, count: 0 };
|
|
27614
|
-
action.set(
|
|
27794
|
+
action.set(path23, thr);
|
|
27615
27795
|
return thr;
|
|
27616
27796
|
}
|
|
27617
27797
|
_incrReadyCount() {
|
|
@@ -27625,44 +27805,44 @@ var init_chokidar = __esm({
|
|
|
27625
27805
|
* @param event
|
|
27626
27806
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
27627
27807
|
*/
|
|
27628
|
-
_awaitWriteFinish(
|
|
27808
|
+
_awaitWriteFinish(path23, threshold, event, awfEmit) {
|
|
27629
27809
|
const awf = this.options.awaitWriteFinish;
|
|
27630
27810
|
if (typeof awf !== "object")
|
|
27631
27811
|
return;
|
|
27632
27812
|
const pollInterval = awf.pollInterval;
|
|
27633
27813
|
let timeoutHandler;
|
|
27634
|
-
let fullPath =
|
|
27635
|
-
if (this.options.cwd && !sp2.isAbsolute(
|
|
27636
|
-
fullPath = sp2.join(this.options.cwd,
|
|
27814
|
+
let fullPath = path23;
|
|
27815
|
+
if (this.options.cwd && !sp2.isAbsolute(path23)) {
|
|
27816
|
+
fullPath = sp2.join(this.options.cwd, path23);
|
|
27637
27817
|
}
|
|
27638
27818
|
const now = /* @__PURE__ */ new Date();
|
|
27639
27819
|
const writes = this._pendingWrites;
|
|
27640
27820
|
function awaitWriteFinishFn(prevStat) {
|
|
27641
27821
|
(0, import_node_fs2.stat)(fullPath, (err, curStat) => {
|
|
27642
|
-
if (err || !writes.has(
|
|
27822
|
+
if (err || !writes.has(path23)) {
|
|
27643
27823
|
if (err && err.code !== "ENOENT")
|
|
27644
27824
|
awfEmit(err);
|
|
27645
27825
|
return;
|
|
27646
27826
|
}
|
|
27647
27827
|
const now2 = Number(/* @__PURE__ */ new Date());
|
|
27648
27828
|
if (prevStat && curStat.size !== prevStat.size) {
|
|
27649
|
-
writes.get(
|
|
27829
|
+
writes.get(path23).lastChange = now2;
|
|
27650
27830
|
}
|
|
27651
|
-
const pw = writes.get(
|
|
27831
|
+
const pw = writes.get(path23);
|
|
27652
27832
|
const df = now2 - pw.lastChange;
|
|
27653
27833
|
if (df >= threshold) {
|
|
27654
|
-
writes.delete(
|
|
27834
|
+
writes.delete(path23);
|
|
27655
27835
|
awfEmit(void 0, curStat);
|
|
27656
27836
|
} else {
|
|
27657
27837
|
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
27658
27838
|
}
|
|
27659
27839
|
});
|
|
27660
27840
|
}
|
|
27661
|
-
if (!writes.has(
|
|
27662
|
-
writes.set(
|
|
27841
|
+
if (!writes.has(path23)) {
|
|
27842
|
+
writes.set(path23, {
|
|
27663
27843
|
lastChange: now,
|
|
27664
27844
|
cancelWait: () => {
|
|
27665
|
-
writes.delete(
|
|
27845
|
+
writes.delete(path23);
|
|
27666
27846
|
clearTimeout(timeoutHandler);
|
|
27667
27847
|
return event;
|
|
27668
27848
|
}
|
|
@@ -27673,8 +27853,8 @@ var init_chokidar = __esm({
|
|
|
27673
27853
|
/**
|
|
27674
27854
|
* Determines whether user has asked to ignore this path.
|
|
27675
27855
|
*/
|
|
27676
|
-
_isIgnored(
|
|
27677
|
-
if (this.options.atomic && DOT_RE.test(
|
|
27856
|
+
_isIgnored(path23, stats) {
|
|
27857
|
+
if (this.options.atomic && DOT_RE.test(path23))
|
|
27678
27858
|
return true;
|
|
27679
27859
|
if (!this._userIgnored) {
|
|
27680
27860
|
const { cwd } = this.options;
|
|
@@ -27684,17 +27864,17 @@ var init_chokidar = __esm({
|
|
|
27684
27864
|
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
|
27685
27865
|
this._userIgnored = anymatch(list, void 0);
|
|
27686
27866
|
}
|
|
27687
|
-
return this._userIgnored(
|
|
27867
|
+
return this._userIgnored(path23, stats);
|
|
27688
27868
|
}
|
|
27689
|
-
_isntIgnored(
|
|
27690
|
-
return !this._isIgnored(
|
|
27869
|
+
_isntIgnored(path23, stat4) {
|
|
27870
|
+
return !this._isIgnored(path23, stat4);
|
|
27691
27871
|
}
|
|
27692
27872
|
/**
|
|
27693
27873
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
27694
27874
|
* @param path file or directory pattern being watched
|
|
27695
27875
|
*/
|
|
27696
|
-
_getWatchHelpers(
|
|
27697
|
-
return new WatchHelper(
|
|
27876
|
+
_getWatchHelpers(path23) {
|
|
27877
|
+
return new WatchHelper(path23, this.options.followSymlinks, this);
|
|
27698
27878
|
}
|
|
27699
27879
|
// Directory helpers
|
|
27700
27880
|
// -----------------
|
|
@@ -27726,63 +27906,63 @@ var init_chokidar = __esm({
|
|
|
27726
27906
|
* @param item base path of item/directory
|
|
27727
27907
|
*/
|
|
27728
27908
|
_remove(directory, item, isDirectory) {
|
|
27729
|
-
const
|
|
27730
|
-
const fullPath = sp2.resolve(
|
|
27731
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(
|
|
27732
|
-
if (!this._throttle("remove",
|
|
27909
|
+
const path23 = sp2.join(directory, item);
|
|
27910
|
+
const fullPath = sp2.resolve(path23);
|
|
27911
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path23) || this._watched.has(fullPath);
|
|
27912
|
+
if (!this._throttle("remove", path23, 100))
|
|
27733
27913
|
return;
|
|
27734
27914
|
if (!isDirectory && this._watched.size === 1) {
|
|
27735
27915
|
this.add(directory, item, true);
|
|
27736
27916
|
}
|
|
27737
|
-
const wp = this._getWatchedDir(
|
|
27917
|
+
const wp = this._getWatchedDir(path23);
|
|
27738
27918
|
const nestedDirectoryChildren = wp.getChildren();
|
|
27739
|
-
nestedDirectoryChildren.forEach((nested) => this._remove(
|
|
27919
|
+
nestedDirectoryChildren.forEach((nested) => this._remove(path23, nested));
|
|
27740
27920
|
const parent = this._getWatchedDir(directory);
|
|
27741
27921
|
const wasTracked = parent.has(item);
|
|
27742
27922
|
parent.remove(item);
|
|
27743
27923
|
if (this._symlinkPaths.has(fullPath)) {
|
|
27744
27924
|
this._symlinkPaths.delete(fullPath);
|
|
27745
27925
|
}
|
|
27746
|
-
let relPath =
|
|
27926
|
+
let relPath = path23;
|
|
27747
27927
|
if (this.options.cwd)
|
|
27748
|
-
relPath = sp2.relative(this.options.cwd,
|
|
27928
|
+
relPath = sp2.relative(this.options.cwd, path23);
|
|
27749
27929
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
27750
27930
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
27751
27931
|
if (event === EVENTS.ADD)
|
|
27752
27932
|
return;
|
|
27753
27933
|
}
|
|
27754
|
-
this._watched.delete(
|
|
27934
|
+
this._watched.delete(path23);
|
|
27755
27935
|
this._watched.delete(fullPath);
|
|
27756
27936
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
27757
|
-
if (wasTracked && !this._isIgnored(
|
|
27758
|
-
this._emit(eventName,
|
|
27759
|
-
this._closePath(
|
|
27937
|
+
if (wasTracked && !this._isIgnored(path23))
|
|
27938
|
+
this._emit(eventName, path23);
|
|
27939
|
+
this._closePath(path23);
|
|
27760
27940
|
}
|
|
27761
27941
|
/**
|
|
27762
27942
|
* Closes all watchers for a path
|
|
27763
27943
|
*/
|
|
27764
|
-
_closePath(
|
|
27765
|
-
this._closeFile(
|
|
27766
|
-
const dir = sp2.dirname(
|
|
27767
|
-
this._getWatchedDir(dir).remove(sp2.basename(
|
|
27944
|
+
_closePath(path23) {
|
|
27945
|
+
this._closeFile(path23);
|
|
27946
|
+
const dir = sp2.dirname(path23);
|
|
27947
|
+
this._getWatchedDir(dir).remove(sp2.basename(path23));
|
|
27768
27948
|
}
|
|
27769
27949
|
/**
|
|
27770
27950
|
* Closes only file-specific watchers
|
|
27771
27951
|
*/
|
|
27772
|
-
_closeFile(
|
|
27773
|
-
const closers = this._closers.get(
|
|
27952
|
+
_closeFile(path23) {
|
|
27953
|
+
const closers = this._closers.get(path23);
|
|
27774
27954
|
if (!closers)
|
|
27775
27955
|
return;
|
|
27776
27956
|
closers.forEach((closer) => closer());
|
|
27777
|
-
this._closers.delete(
|
|
27957
|
+
this._closers.delete(path23);
|
|
27778
27958
|
}
|
|
27779
|
-
_addPathCloser(
|
|
27959
|
+
_addPathCloser(path23, closer) {
|
|
27780
27960
|
if (!closer)
|
|
27781
27961
|
return;
|
|
27782
|
-
let list = this._closers.get(
|
|
27962
|
+
let list = this._closers.get(path23);
|
|
27783
27963
|
if (!list) {
|
|
27784
27964
|
list = [];
|
|
27785
|
-
this._closers.set(
|
|
27965
|
+
this._closers.set(path23, list);
|
|
27786
27966
|
}
|
|
27787
27967
|
list.push(closer);
|
|
27788
27968
|
}
|
|
@@ -28374,7 +28554,7 @@ var init_provider_loader = __esm({
|
|
|
28374
28554
|
return { updated: false };
|
|
28375
28555
|
}
|
|
28376
28556
|
const https = require("https");
|
|
28377
|
-
const { execSync:
|
|
28557
|
+
const { execSync: execSync7 } = require("child_process");
|
|
28378
28558
|
const metaPath = path10.join(this.upstreamDir, _ProviderLoader.META_FILE);
|
|
28379
28559
|
let prevEtag = "";
|
|
28380
28560
|
let prevTimestamp = 0;
|
|
@@ -28439,7 +28619,7 @@ var init_provider_loader = __esm({
|
|
|
28439
28619
|
const tmpExtract = path10.join(os11.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
|
|
28440
28620
|
await this.downloadFile(_ProviderLoader.GITHUB_TARBALL_URL, tmpTar);
|
|
28441
28621
|
fs6.mkdirSync(tmpExtract, { recursive: true });
|
|
28442
|
-
|
|
28622
|
+
execSync7(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
|
|
28443
28623
|
const extracted = fs6.readdirSync(tmpExtract);
|
|
28444
28624
|
const rootDir = extracted.find(
|
|
28445
28625
|
(d) => fs6.statSync(path10.join(tmpExtract, d)).isDirectory() && d.startsWith("adhdev-providers")
|
|
@@ -29012,7 +29192,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
29012
29192
|
}
|
|
29013
29193
|
} else if (plat === "win32") {
|
|
29014
29194
|
try {
|
|
29015
|
-
const
|
|
29195
|
+
const fs18 = require("fs");
|
|
29016
29196
|
const appNameMap = getMacAppIdentifiers();
|
|
29017
29197
|
const appName = appNameMap[ideId];
|
|
29018
29198
|
if (appName) {
|
|
@@ -29021,8 +29201,8 @@ function detectCurrentWorkspace(ideId) {
|
|
|
29021
29201
|
appName,
|
|
29022
29202
|
"storage.json"
|
|
29023
29203
|
);
|
|
29024
|
-
if (
|
|
29025
|
-
const data = JSON.parse(
|
|
29204
|
+
if (fs18.existsSync(storagePath)) {
|
|
29205
|
+
const data = JSON.parse(fs18.readFileSync(storagePath, "utf-8"));
|
|
29026
29206
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
29027
29207
|
if (workspaces.length > 0) {
|
|
29028
29208
|
const recent = workspaces[0];
|
|
@@ -29180,6 +29360,9 @@ async function launchLinux(ide, port, workspace, newWindow) {
|
|
|
29180
29360
|
if (workspace) args.push(workspace);
|
|
29181
29361
|
(0, import_child_process6.spawn)(cli, args, { detached: true, stdio: "ignore" }).unref();
|
|
29182
29362
|
}
|
|
29363
|
+
function getAvailableIdeIds() {
|
|
29364
|
+
return getProviderLoader().getAvailableIdeTypes();
|
|
29365
|
+
}
|
|
29183
29366
|
var import_child_process6, net, os12, path11, _providerLoader;
|
|
29184
29367
|
var init_launch = __esm({
|
|
29185
29368
|
"../../oss/packages/daemon-core/src/launch.ts"() {
|
|
@@ -29274,6 +29457,31 @@ function logCommand(entry) {
|
|
|
29274
29457
|
} catch {
|
|
29275
29458
|
}
|
|
29276
29459
|
}
|
|
29460
|
+
function getRecentCommands(count = 50) {
|
|
29461
|
+
try {
|
|
29462
|
+
if (!fs7.existsSync(currentFile)) return [];
|
|
29463
|
+
const content = fs7.readFileSync(currentFile, "utf-8");
|
|
29464
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
29465
|
+
return lines.slice(-count).map((line) => {
|
|
29466
|
+
try {
|
|
29467
|
+
const parsed = JSON.parse(line);
|
|
29468
|
+
return {
|
|
29469
|
+
ts: parsed.ts,
|
|
29470
|
+
cmd: parsed.cmd,
|
|
29471
|
+
source: parsed.src,
|
|
29472
|
+
args: parsed.args,
|
|
29473
|
+
success: parsed.ok,
|
|
29474
|
+
error: parsed.err,
|
|
29475
|
+
durationMs: parsed.ms
|
|
29476
|
+
};
|
|
29477
|
+
} catch {
|
|
29478
|
+
return { ts: "", cmd: "parse_error", source: "unknown" };
|
|
29479
|
+
}
|
|
29480
|
+
});
|
|
29481
|
+
} catch {
|
|
29482
|
+
return [];
|
|
29483
|
+
}
|
|
29484
|
+
}
|
|
29277
29485
|
var fs7, path12, os13, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS;
|
|
29278
29486
|
var init_command_log = __esm({
|
|
29279
29487
|
"../../oss/packages/daemon-core/src/logging/command-log.ts"() {
|
|
@@ -29463,9 +29671,119 @@ var init_snapshot = __esm({
|
|
|
29463
29671
|
});
|
|
29464
29672
|
|
|
29465
29673
|
// ../../oss/packages/daemon-core/src/commands/upgrade-helper.ts
|
|
29674
|
+
function getUpgradeLogPath() {
|
|
29675
|
+
const home = os15.homedir();
|
|
29676
|
+
const dir = path13.join(home, ".adhdev");
|
|
29677
|
+
fs8.mkdirSync(dir, { recursive: true });
|
|
29678
|
+
return path13.join(dir, "daemon-upgrade.log");
|
|
29679
|
+
}
|
|
29680
|
+
function appendUpgradeLog(message) {
|
|
29681
|
+
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
|
|
29682
|
+
`;
|
|
29683
|
+
try {
|
|
29684
|
+
fs8.appendFileSync(getUpgradeLogPath(), line, "utf8");
|
|
29685
|
+
} catch {
|
|
29686
|
+
}
|
|
29687
|
+
}
|
|
29688
|
+
function getNpmExecutable() {
|
|
29689
|
+
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
29690
|
+
}
|
|
29691
|
+
function killPid(pid) {
|
|
29692
|
+
try {
|
|
29693
|
+
if (process.platform === "win32") {
|
|
29694
|
+
(0, import_child_process7.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
|
|
29695
|
+
} else {
|
|
29696
|
+
process.kill(pid, "SIGTERM");
|
|
29697
|
+
}
|
|
29698
|
+
return true;
|
|
29699
|
+
} catch {
|
|
29700
|
+
return false;
|
|
29701
|
+
}
|
|
29702
|
+
}
|
|
29703
|
+
async function waitForPidExit(pid, timeoutMs) {
|
|
29704
|
+
const start = Date.now();
|
|
29705
|
+
while (Date.now() - start < timeoutMs) {
|
|
29706
|
+
try {
|
|
29707
|
+
process.kill(pid, 0);
|
|
29708
|
+
await new Promise((resolve13) => setTimeout(resolve13, 250));
|
|
29709
|
+
} catch {
|
|
29710
|
+
return;
|
|
29711
|
+
}
|
|
29712
|
+
}
|
|
29713
|
+
}
|
|
29714
|
+
function stopSessionHostProcesses(appName) {
|
|
29715
|
+
const pidFile = path13.join(os15.homedir(), ".adhdev", `${appName}-session-host.pid`);
|
|
29716
|
+
try {
|
|
29717
|
+
if (fs8.existsSync(pidFile)) {
|
|
29718
|
+
const pid = Number.parseInt(fs8.readFileSync(pidFile, "utf8").trim(), 10);
|
|
29719
|
+
if (Number.isFinite(pid)) {
|
|
29720
|
+
killPid(pid);
|
|
29721
|
+
}
|
|
29722
|
+
}
|
|
29723
|
+
} catch {
|
|
29724
|
+
} finally {
|
|
29725
|
+
try {
|
|
29726
|
+
fs8.unlinkSync(pidFile);
|
|
29727
|
+
} catch {
|
|
29728
|
+
}
|
|
29729
|
+
}
|
|
29730
|
+
if (process.platform !== "win32") {
|
|
29731
|
+
try {
|
|
29732
|
+
const raw = (0, import_child_process7.execFileSync)("pgrep", ["-f", "session-host-daemon"], { encoding: "utf8" }).trim();
|
|
29733
|
+
for (const line of raw.split("\n")) {
|
|
29734
|
+
const pid = Number.parseInt(line.trim(), 10);
|
|
29735
|
+
if (Number.isFinite(pid)) {
|
|
29736
|
+
killPid(pid);
|
|
29737
|
+
}
|
|
29738
|
+
}
|
|
29739
|
+
} catch {
|
|
29740
|
+
}
|
|
29741
|
+
}
|
|
29742
|
+
}
|
|
29743
|
+
function removeDaemonPidFile() {
|
|
29744
|
+
const pidFile = path13.join(os15.homedir(), ".adhdev", "daemon.pid");
|
|
29745
|
+
try {
|
|
29746
|
+
fs8.unlinkSync(pidFile);
|
|
29747
|
+
} catch {
|
|
29748
|
+
}
|
|
29749
|
+
}
|
|
29750
|
+
function cleanupStaleGlobalInstallDirs(pkgName) {
|
|
29751
|
+
const npmRoot = (0, import_child_process7.execFileSync)(getNpmExecutable(), ["root", "-g"], { encoding: "utf8" }).trim();
|
|
29752
|
+
if (!npmRoot) return;
|
|
29753
|
+
const npmPrefix = (0, import_child_process7.execFileSync)(getNpmExecutable(), ["prefix", "-g"], { encoding: "utf8" }).trim();
|
|
29754
|
+
const binDir = process.platform === "win32" ? npmPrefix : path13.join(npmPrefix, "bin");
|
|
29755
|
+
const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
|
|
29756
|
+
const binNames = /* @__PURE__ */ new Set([packageBaseName]);
|
|
29757
|
+
if (pkgName === "@adhdev/daemon-standalone") {
|
|
29758
|
+
binNames.add("adhdev-standalone");
|
|
29759
|
+
}
|
|
29760
|
+
if (pkgName.startsWith("@")) {
|
|
29761
|
+
const [scope, name] = pkgName.split("/");
|
|
29762
|
+
const scopeDir = path13.join(npmRoot, scope);
|
|
29763
|
+
if (!fs8.existsSync(scopeDir)) return;
|
|
29764
|
+
for (const entry of fs8.readdirSync(scopeDir)) {
|
|
29765
|
+
if (!entry.startsWith(`.${name}-`)) continue;
|
|
29766
|
+
fs8.rmSync(path13.join(scopeDir, entry), { recursive: true, force: true });
|
|
29767
|
+
appendUpgradeLog(`Removed stale scoped staging dir: ${path13.join(scopeDir, entry)}`);
|
|
29768
|
+
}
|
|
29769
|
+
} else {
|
|
29770
|
+
for (const entry of fs8.readdirSync(npmRoot)) {
|
|
29771
|
+
if (!entry.startsWith(`.${pkgName}-`)) continue;
|
|
29772
|
+
fs8.rmSync(path13.join(npmRoot, entry), { recursive: true, force: true });
|
|
29773
|
+
appendUpgradeLog(`Removed stale staging dir: ${path13.join(npmRoot, entry)}`);
|
|
29774
|
+
}
|
|
29775
|
+
}
|
|
29776
|
+
if (fs8.existsSync(binDir)) {
|
|
29777
|
+
for (const entry of fs8.readdirSync(binDir)) {
|
|
29778
|
+
if (![...binNames].some((name) => entry.startsWith(`.${name}-`))) continue;
|
|
29779
|
+
fs8.rmSync(path13.join(binDir, entry), { recursive: true, force: true });
|
|
29780
|
+
appendUpgradeLog(`Removed stale bin staging entry: ${path13.join(binDir, entry)}`);
|
|
29781
|
+
}
|
|
29782
|
+
}
|
|
29783
|
+
}
|
|
29466
29784
|
function spawnDetachedDaemonUpgradeHelper(payload) {
|
|
29467
29785
|
const env = { ...process.env, [UPGRADE_HELPER_ENV]: JSON.stringify(payload) };
|
|
29468
|
-
const child = (0,
|
|
29786
|
+
const child = (0, import_child_process8.spawn)(process.execPath, process.argv.slice(1), {
|
|
29469
29787
|
detached: true,
|
|
29470
29788
|
stdio: "ignore",
|
|
29471
29789
|
windowsHide: true,
|
|
@@ -29474,17 +29792,75 @@ function spawnDetachedDaemonUpgradeHelper(payload) {
|
|
|
29474
29792
|
});
|
|
29475
29793
|
child.unref();
|
|
29476
29794
|
}
|
|
29477
|
-
|
|
29795
|
+
async function runDaemonUpgradeHelper(payload) {
|
|
29796
|
+
const restartArgv = Array.isArray(payload.restartArgv) ? payload.restartArgv : [];
|
|
29797
|
+
const sessionHostAppName = payload.sessionHostAppName || process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
|
|
29798
|
+
appendUpgradeLog(`Upgrade helper started for ${payload.packageName}@${payload.targetVersion}`);
|
|
29799
|
+
if (Number.isFinite(payload.parentPid) && payload.parentPid > 0) {
|
|
29800
|
+
appendUpgradeLog(`Waiting for parent pid ${payload.parentPid} to exit`);
|
|
29801
|
+
await waitForPidExit(payload.parentPid, 15e3);
|
|
29802
|
+
}
|
|
29803
|
+
stopSessionHostProcesses(sessionHostAppName);
|
|
29804
|
+
removeDaemonPidFile();
|
|
29805
|
+
cleanupStaleGlobalInstallDirs(payload.packageName);
|
|
29806
|
+
const spec = `${payload.packageName}@${payload.targetVersion || "latest"}`;
|
|
29807
|
+
appendUpgradeLog(`Installing ${spec}`);
|
|
29808
|
+
const installOutput = (0, import_child_process7.execFileSync)(
|
|
29809
|
+
getNpmExecutable(),
|
|
29810
|
+
["install", "-g", spec, "--force"],
|
|
29811
|
+
{
|
|
29812
|
+
encoding: "utf8",
|
|
29813
|
+
stdio: "pipe",
|
|
29814
|
+
maxBuffer: 20 * 1024 * 1024
|
|
29815
|
+
}
|
|
29816
|
+
);
|
|
29817
|
+
if (installOutput.trim()) {
|
|
29818
|
+
appendUpgradeLog(installOutput.trim());
|
|
29819
|
+
}
|
|
29820
|
+
if (restartArgv.length > 0) {
|
|
29821
|
+
const env = { ...process.env };
|
|
29822
|
+
delete env[UPGRADE_HELPER_ENV];
|
|
29823
|
+
appendUpgradeLog(`Restarting daemon with args: ${restartArgv.join(" ")}`);
|
|
29824
|
+
const child = (0, import_child_process8.spawn)(process.execPath, restartArgv, {
|
|
29825
|
+
detached: true,
|
|
29826
|
+
stdio: "ignore",
|
|
29827
|
+
windowsHide: true,
|
|
29828
|
+
cwd: payload.cwd || process.cwd(),
|
|
29829
|
+
env
|
|
29830
|
+
});
|
|
29831
|
+
child.unref();
|
|
29832
|
+
} else {
|
|
29833
|
+
appendUpgradeLog("No restart argv provided; upgrade completed without restart");
|
|
29834
|
+
}
|
|
29835
|
+
}
|
|
29836
|
+
async function maybeRunDaemonUpgradeHelperFromEnv() {
|
|
29837
|
+
const raw = process.env[UPGRADE_HELPER_ENV];
|
|
29838
|
+
if (!raw) return false;
|
|
29839
|
+
delete process.env[UPGRADE_HELPER_ENV];
|
|
29840
|
+
try {
|
|
29841
|
+
const payload = JSON.parse(raw);
|
|
29842
|
+
await runDaemonUpgradeHelper(payload);
|
|
29843
|
+
process.exit(0);
|
|
29844
|
+
} catch (error48) {
|
|
29845
|
+
appendUpgradeLog(`Upgrade helper failed: ${error48?.stack || error48?.message || String(error48)}`);
|
|
29846
|
+
process.exit(1);
|
|
29847
|
+
}
|
|
29848
|
+
}
|
|
29849
|
+
var import_child_process7, import_child_process8, fs8, os15, path13, UPGRADE_HELPER_ENV;
|
|
29478
29850
|
var init_upgrade_helper = __esm({
|
|
29479
29851
|
"../../oss/packages/daemon-core/src/commands/upgrade-helper.ts"() {
|
|
29480
29852
|
"use strict";
|
|
29481
29853
|
import_child_process7 = require("child_process");
|
|
29854
|
+
import_child_process8 = require("child_process");
|
|
29855
|
+
fs8 = __toESM(require("fs"));
|
|
29856
|
+
os15 = __toESM(require("os"));
|
|
29857
|
+
path13 = __toESM(require("path"));
|
|
29482
29858
|
UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
|
|
29483
29859
|
}
|
|
29484
29860
|
});
|
|
29485
29861
|
|
|
29486
29862
|
// ../../oss/packages/daemon-core/src/commands/router.ts
|
|
29487
|
-
var
|
|
29863
|
+
var fs9, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
|
|
29488
29864
|
var init_router = __esm({
|
|
29489
29865
|
"../../oss/packages/daemon-core/src/commands/router.ts"() {
|
|
29490
29866
|
"use strict";
|
|
@@ -29504,7 +29880,7 @@ var init_router = __esm({
|
|
|
29504
29880
|
init_builders();
|
|
29505
29881
|
init_snapshot();
|
|
29506
29882
|
init_upgrade_helper();
|
|
29507
|
-
|
|
29883
|
+
fs9 = __toESM(require("fs"));
|
|
29508
29884
|
CHAT_COMMANDS = [
|
|
29509
29885
|
"send_chat",
|
|
29510
29886
|
"new_chat",
|
|
@@ -29575,8 +29951,8 @@ var init_router = __esm({
|
|
|
29575
29951
|
if (logs.length > 0) {
|
|
29576
29952
|
return { success: true, logs, totalBuffered: logs.length };
|
|
29577
29953
|
}
|
|
29578
|
-
if (
|
|
29579
|
-
const content =
|
|
29954
|
+
if (fs9.existsSync(LOG_PATH)) {
|
|
29955
|
+
const content = fs9.readFileSync(LOG_PATH, "utf-8");
|
|
29580
29956
|
const allLines = content.split("\n");
|
|
29581
29957
|
const recent = allLines.slice(-count).join("\n");
|
|
29582
29958
|
return { success: true, logs: recent, totalLines: allLines.length };
|
|
@@ -29759,14 +30135,14 @@ var init_router = __esm({
|
|
|
29759
30135
|
case "daemon_upgrade": {
|
|
29760
30136
|
LOG.info("Upgrade", "Remote upgrade requested from dashboard");
|
|
29761
30137
|
try {
|
|
29762
|
-
const { execSync:
|
|
30138
|
+
const { execSync: execSync7 } = await import("child_process");
|
|
29763
30139
|
const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
|
|
29764
30140
|
const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
|
|
29765
|
-
const latest =
|
|
30141
|
+
const latest = execSync7(`npm view ${pkgName} version`, { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
29766
30142
|
LOG.info("Upgrade", `Latest ${pkgName}: v${latest}`);
|
|
29767
30143
|
let currentInstalled = null;
|
|
29768
30144
|
try {
|
|
29769
|
-
const currentJson =
|
|
30145
|
+
const currentJson = execSync7(`npm ls -g ${pkgName} --depth=0 --json`, {
|
|
29770
30146
|
encoding: "utf-8",
|
|
29771
30147
|
timeout: 1e4,
|
|
29772
30148
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -30095,11 +30471,12 @@ var init_reporter = __esm({
|
|
|
30095
30471
|
});
|
|
30096
30472
|
|
|
30097
30473
|
// ../../oss/packages/daemon-core/src/ipc-protocol.ts
|
|
30098
|
-
var DEFAULT_DAEMON_PORT;
|
|
30474
|
+
var DEFAULT_DAEMON_PORT, DAEMON_WS_PATH;
|
|
30099
30475
|
var init_ipc_protocol = __esm({
|
|
30100
30476
|
"../../oss/packages/daemon-core/src/ipc-protocol.ts"() {
|
|
30101
30477
|
"use strict";
|
|
30102
30478
|
DEFAULT_DAEMON_PORT = 19222;
|
|
30479
|
+
DAEMON_WS_PATH = "/ipc";
|
|
30103
30480
|
}
|
|
30104
30481
|
});
|
|
30105
30482
|
|
|
@@ -30968,7 +31345,7 @@ var init_provider_instance_manager = __esm({
|
|
|
30968
31345
|
// ../../oss/packages/daemon-core/src/providers/version-archive.ts
|
|
30969
31346
|
function runCommand(cmd, timeout = 1e4) {
|
|
30970
31347
|
try {
|
|
30971
|
-
return (0,
|
|
31348
|
+
return (0, import_child_process9.execSync)(cmd, {
|
|
30972
31349
|
encoding: "utf-8",
|
|
30973
31350
|
timeout,
|
|
30974
31351
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -31000,19 +31377,19 @@ function getVersion(binary, versionCommand) {
|
|
|
31000
31377
|
function checkPathExists2(paths) {
|
|
31001
31378
|
for (const p of paths) {
|
|
31002
31379
|
if (p.includes("*")) {
|
|
31003
|
-
const home =
|
|
31004
|
-
const resolved = p.replace(/\*/g, home.split(
|
|
31005
|
-
if (
|
|
31380
|
+
const home = os16.homedir();
|
|
31381
|
+
const resolved = p.replace(/\*/g, home.split(path14.sep).pop() || "");
|
|
31382
|
+
if (fs10.existsSync(resolved)) return resolved;
|
|
31006
31383
|
} else {
|
|
31007
|
-
if (
|
|
31384
|
+
if (fs10.existsSync(p)) return p;
|
|
31008
31385
|
}
|
|
31009
31386
|
}
|
|
31010
31387
|
return null;
|
|
31011
31388
|
}
|
|
31012
31389
|
function getMacAppVersion(appPath) {
|
|
31013
31390
|
if ((0, import_os3.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
|
|
31014
|
-
const plistPath =
|
|
31015
|
-
if (!
|
|
31391
|
+
const plistPath = path14.join(appPath, "Contents", "Info.plist");
|
|
31392
|
+
if (!fs10.existsSync(plistPath)) return null;
|
|
31016
31393
|
const raw = runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
|
|
31017
31394
|
return raw || null;
|
|
31018
31395
|
}
|
|
@@ -31038,8 +31415,8 @@ async function detectAllVersions(loader, archive) {
|
|
|
31038
31415
|
const cliBin = provider.cli ? findBinary2(provider.cli) : null;
|
|
31039
31416
|
let resolvedBin = cliBin;
|
|
31040
31417
|
if (!resolvedBin && appPath && currentOs === "darwin") {
|
|
31041
|
-
const bundled =
|
|
31042
|
-
if (provider.cli &&
|
|
31418
|
+
const bundled = path14.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
|
|
31419
|
+
if (provider.cli && fs10.existsSync(bundled)) resolvedBin = bundled;
|
|
31043
31420
|
}
|
|
31044
31421
|
info.installed = !!(appPath || resolvedBin);
|
|
31045
31422
|
info.path = appPath || null;
|
|
@@ -31075,16 +31452,16 @@ async function detectAllVersions(loader, archive) {
|
|
|
31075
31452
|
}
|
|
31076
31453
|
return results;
|
|
31077
31454
|
}
|
|
31078
|
-
var
|
|
31455
|
+
var fs10, path14, os16, import_child_process9, import_os3, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive;
|
|
31079
31456
|
var init_version_archive = __esm({
|
|
31080
31457
|
"../../oss/packages/daemon-core/src/providers/version-archive.ts"() {
|
|
31081
31458
|
"use strict";
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
|
|
31085
|
-
|
|
31459
|
+
fs10 = __toESM(require("fs"));
|
|
31460
|
+
path14 = __toESM(require("path"));
|
|
31461
|
+
os16 = __toESM(require("os"));
|
|
31462
|
+
import_child_process9 = require("child_process");
|
|
31086
31463
|
import_os3 = require("os");
|
|
31087
|
-
ARCHIVE_PATH =
|
|
31464
|
+
ARCHIVE_PATH = path14.join(os16.homedir(), ".adhdev", "version-history.json");
|
|
31088
31465
|
MAX_ENTRIES_PER_PROVIDER = 20;
|
|
31089
31466
|
VersionArchive = class {
|
|
31090
31467
|
history = {};
|
|
@@ -31093,8 +31470,8 @@ var init_version_archive = __esm({
|
|
|
31093
31470
|
}
|
|
31094
31471
|
load() {
|
|
31095
31472
|
try {
|
|
31096
|
-
if (
|
|
31097
|
-
this.history = JSON.parse(
|
|
31473
|
+
if (fs10.existsSync(ARCHIVE_PATH)) {
|
|
31474
|
+
this.history = JSON.parse(fs10.readFileSync(ARCHIVE_PATH, "utf-8"));
|
|
31098
31475
|
}
|
|
31099
31476
|
} catch {
|
|
31100
31477
|
this.history = {};
|
|
@@ -31131,8 +31508,8 @@ var init_version_archive = __esm({
|
|
|
31131
31508
|
}
|
|
31132
31509
|
save() {
|
|
31133
31510
|
try {
|
|
31134
|
-
|
|
31135
|
-
|
|
31511
|
+
fs10.mkdirSync(path14.dirname(ARCHIVE_PATH), { recursive: true });
|
|
31512
|
+
fs10.writeFileSync(ARCHIVE_PATH, JSON.stringify(this.history, null, 2));
|
|
31136
31513
|
} catch {
|
|
31137
31514
|
}
|
|
31138
31515
|
}
|
|
@@ -31652,18 +32029,18 @@ async function handleScriptHints(ctx, type, _req, res) {
|
|
|
31652
32029
|
return;
|
|
31653
32030
|
}
|
|
31654
32031
|
let scriptsPath = "";
|
|
31655
|
-
const directScripts =
|
|
31656
|
-
if (
|
|
32032
|
+
const directScripts = path15.join(dir, "scripts.js");
|
|
32033
|
+
if (fs11.existsSync(directScripts)) {
|
|
31657
32034
|
scriptsPath = directScripts;
|
|
31658
32035
|
} else {
|
|
31659
|
-
const scriptsDir =
|
|
31660
|
-
if (
|
|
31661
|
-
const versions =
|
|
31662
|
-
return
|
|
32036
|
+
const scriptsDir = path15.join(dir, "scripts");
|
|
32037
|
+
if (fs11.existsSync(scriptsDir)) {
|
|
32038
|
+
const versions = fs11.readdirSync(scriptsDir).filter((d) => {
|
|
32039
|
+
return fs11.statSync(path15.join(scriptsDir, d)).isDirectory();
|
|
31663
32040
|
}).sort().reverse();
|
|
31664
32041
|
for (const ver of versions) {
|
|
31665
|
-
const p =
|
|
31666
|
-
if (
|
|
32042
|
+
const p = path15.join(scriptsDir, ver, "scripts.js");
|
|
32043
|
+
if (fs11.existsSync(p)) {
|
|
31667
32044
|
scriptsPath = p;
|
|
31668
32045
|
break;
|
|
31669
32046
|
}
|
|
@@ -31675,7 +32052,7 @@ async function handleScriptHints(ctx, type, _req, res) {
|
|
|
31675
32052
|
return;
|
|
31676
32053
|
}
|
|
31677
32054
|
try {
|
|
31678
|
-
const source =
|
|
32055
|
+
const source = fs11.readFileSync(scriptsPath, "utf-8");
|
|
31679
32056
|
const hints = {};
|
|
31680
32057
|
const funcRegex = /module\.exports\.(\w+)\s*=\s*function\s+\w+\s*\(params\)/g;
|
|
31681
32058
|
let match;
|
|
@@ -32478,12 +32855,12 @@ async function handleDomContext(ctx, type, req, res) {
|
|
|
32478
32855
|
ctx.json(res, 500, { error: `DOM context collection failed: ${e.message}` });
|
|
32479
32856
|
}
|
|
32480
32857
|
}
|
|
32481
|
-
var
|
|
32858
|
+
var fs11, path15;
|
|
32482
32859
|
var init_dev_cdp_handlers = __esm({
|
|
32483
32860
|
"../../oss/packages/daemon-core/src/daemon/dev-cdp-handlers.ts"() {
|
|
32484
32861
|
"use strict";
|
|
32485
|
-
|
|
32486
|
-
|
|
32862
|
+
fs11 = __toESM(require("fs"));
|
|
32863
|
+
path15 = __toESM(require("path"));
|
|
32487
32864
|
init_logger();
|
|
32488
32865
|
}
|
|
32489
32866
|
});
|
|
@@ -32498,15 +32875,15 @@ function getCliFixtureDir(ctx, type) {
|
|
|
32498
32875
|
if (!providerDir) {
|
|
32499
32876
|
throw new Error(`Provider directory not found for '${type}'`);
|
|
32500
32877
|
}
|
|
32501
|
-
return
|
|
32878
|
+
return path16.join(providerDir, "fixtures");
|
|
32502
32879
|
}
|
|
32503
32880
|
function readCliFixture(ctx, type, name) {
|
|
32504
32881
|
const fixtureDir = getCliFixtureDir(ctx, type);
|
|
32505
|
-
const filePath =
|
|
32506
|
-
if (!
|
|
32882
|
+
const filePath = path16.join(fixtureDir, `${name}.json`);
|
|
32883
|
+
if (!fs12.existsSync(filePath)) {
|
|
32507
32884
|
throw new Error(`Fixture not found: ${filePath}`);
|
|
32508
32885
|
}
|
|
32509
|
-
return JSON.parse(
|
|
32886
|
+
return JSON.parse(fs12.readFileSync(filePath, "utf-8"));
|
|
32510
32887
|
}
|
|
32511
32888
|
function getExerciseTranscriptText(result) {
|
|
32512
32889
|
const parts = [];
|
|
@@ -33205,7 +33582,7 @@ async function handleCliFixtureCapture(ctx, req, res) {
|
|
|
33205
33582
|
return;
|
|
33206
33583
|
}
|
|
33207
33584
|
const fixtureDir = getCliFixtureDir(ctx, type);
|
|
33208
|
-
|
|
33585
|
+
fs12.mkdirSync(fixtureDir, { recursive: true });
|
|
33209
33586
|
const name = slugifyFixtureName(String(body?.name || `${type}-${Date.now()}`));
|
|
33210
33587
|
const result = await runCliExerciseInternal(ctx, { ...request, type });
|
|
33211
33588
|
const fixture = {
|
|
@@ -33232,8 +33609,8 @@ async function handleCliFixtureCapture(ctx, req, res) {
|
|
|
33232
33609
|
},
|
|
33233
33610
|
notes: typeof body?.notes === "string" ? body.notes : void 0
|
|
33234
33611
|
};
|
|
33235
|
-
const filePath =
|
|
33236
|
-
|
|
33612
|
+
const filePath = path16.join(fixtureDir, `${name}.json`);
|
|
33613
|
+
fs12.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
|
|
33237
33614
|
ctx.json(res, 200, {
|
|
33238
33615
|
saved: true,
|
|
33239
33616
|
name,
|
|
@@ -33251,14 +33628,14 @@ async function handleCliFixtureCapture(ctx, req, res) {
|
|
|
33251
33628
|
async function handleCliFixtureList(ctx, type, _req, res) {
|
|
33252
33629
|
try {
|
|
33253
33630
|
const fixtureDir = getCliFixtureDir(ctx, type);
|
|
33254
|
-
if (!
|
|
33631
|
+
if (!fs12.existsSync(fixtureDir)) {
|
|
33255
33632
|
ctx.json(res, 200, { fixtures: [], count: 0 });
|
|
33256
33633
|
return;
|
|
33257
33634
|
}
|
|
33258
|
-
const fixtures =
|
|
33259
|
-
const fullPath =
|
|
33635
|
+
const fixtures = fs12.readdirSync(fixtureDir).filter((file2) => file2.endsWith(".json")).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file2) => {
|
|
33636
|
+
const fullPath = path16.join(fixtureDir, file2);
|
|
33260
33637
|
try {
|
|
33261
|
-
const raw = JSON.parse(
|
|
33638
|
+
const raw = JSON.parse(fs12.readFileSync(fullPath, "utf-8"));
|
|
33262
33639
|
return {
|
|
33263
33640
|
name: raw.name || file2.replace(/\.json$/i, ""),
|
|
33264
33641
|
path: fullPath,
|
|
@@ -33389,12 +33766,12 @@ async function handleCliRaw(ctx, req, res) {
|
|
|
33389
33766
|
ctx.json(res, 500, { error: `Raw send failed: ${e.message}` });
|
|
33390
33767
|
}
|
|
33391
33768
|
}
|
|
33392
|
-
var
|
|
33769
|
+
var fs12, path16;
|
|
33393
33770
|
var init_dev_cli_debug = __esm({
|
|
33394
33771
|
"../../oss/packages/daemon-core/src/daemon/dev-cli-debug.ts"() {
|
|
33395
33772
|
"use strict";
|
|
33396
|
-
|
|
33397
|
-
|
|
33773
|
+
fs12 = __toESM(require("fs"));
|
|
33774
|
+
path16 = __toESM(require("path"));
|
|
33398
33775
|
}
|
|
33399
33776
|
});
|
|
33400
33777
|
|
|
@@ -33434,45 +33811,45 @@ function resolveAutoImplReference(ctx, category, requestedReference, targetType)
|
|
|
33434
33811
|
return fallback?.type || null;
|
|
33435
33812
|
}
|
|
33436
33813
|
function getLatestScriptVersionDir(scriptsDir) {
|
|
33437
|
-
if (!
|
|
33438
|
-
const versions =
|
|
33814
|
+
if (!fs13.existsSync(scriptsDir)) return null;
|
|
33815
|
+
const versions = fs13.readdirSync(scriptsDir).filter((d) => {
|
|
33439
33816
|
try {
|
|
33440
|
-
return
|
|
33817
|
+
return fs13.statSync(path17.join(scriptsDir, d)).isDirectory();
|
|
33441
33818
|
} catch {
|
|
33442
33819
|
return false;
|
|
33443
33820
|
}
|
|
33444
33821
|
}).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
|
|
33445
33822
|
if (versions.length === 0) return null;
|
|
33446
|
-
return
|
|
33823
|
+
return path17.join(scriptsDir, versions[0]);
|
|
33447
33824
|
}
|
|
33448
33825
|
function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
|
|
33449
|
-
const canonicalUserDir =
|
|
33450
|
-
const desiredDir = requestedDir ?
|
|
33451
|
-
const upstreamRoot =
|
|
33452
|
-
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${
|
|
33826
|
+
const canonicalUserDir = path17.resolve(ctx.providerLoader.getUserProviderDir(category, type));
|
|
33827
|
+
const desiredDir = requestedDir ? path17.resolve(requestedDir) : canonicalUserDir;
|
|
33828
|
+
const upstreamRoot = path17.resolve(ctx.providerLoader.getUpstreamDir());
|
|
33829
|
+
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path17.sep}`)) {
|
|
33453
33830
|
return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
|
|
33454
33831
|
}
|
|
33455
|
-
if (
|
|
33832
|
+
if (path17.basename(desiredDir) !== type) {
|
|
33456
33833
|
return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
|
|
33457
33834
|
}
|
|
33458
33835
|
const sourceDir = ctx.findProviderDir(type);
|
|
33459
33836
|
if (!sourceDir) {
|
|
33460
33837
|
return { dir: null, reason: `Provider source directory not found for '${type}'` };
|
|
33461
33838
|
}
|
|
33462
|
-
if (!
|
|
33463
|
-
|
|
33464
|
-
|
|
33839
|
+
if (!fs13.existsSync(desiredDir)) {
|
|
33840
|
+
fs13.mkdirSync(path17.dirname(desiredDir), { recursive: true });
|
|
33841
|
+
fs13.cpSync(sourceDir, desiredDir, { recursive: true });
|
|
33465
33842
|
ctx.log(`Auto-implement writable copy created: ${desiredDir}`);
|
|
33466
33843
|
}
|
|
33467
|
-
const providerJson =
|
|
33468
|
-
if (!
|
|
33844
|
+
const providerJson = path17.join(desiredDir, "provider.json");
|
|
33845
|
+
if (!fs13.existsSync(providerJson)) {
|
|
33469
33846
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
33470
33847
|
}
|
|
33471
33848
|
try {
|
|
33472
|
-
const providerData = JSON.parse(
|
|
33849
|
+
const providerData = JSON.parse(fs13.readFileSync(providerJson, "utf-8"));
|
|
33473
33850
|
if (providerData.disableUpstream !== true) {
|
|
33474
33851
|
providerData.disableUpstream = true;
|
|
33475
|
-
|
|
33852
|
+
fs13.writeFileSync(providerJson, JSON.stringify(providerData, null, 2));
|
|
33476
33853
|
}
|
|
33477
33854
|
} catch (error48) {
|
|
33478
33855
|
return {
|
|
@@ -33485,15 +33862,15 @@ function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
|
|
|
33485
33862
|
function loadAutoImplReferenceScripts(ctx, referenceType) {
|
|
33486
33863
|
if (!referenceType) return {};
|
|
33487
33864
|
const refDir = ctx.findProviderDir(referenceType);
|
|
33488
|
-
if (!refDir || !
|
|
33865
|
+
if (!refDir || !fs13.existsSync(refDir)) return {};
|
|
33489
33866
|
const referenceScripts = {};
|
|
33490
|
-
const scriptsDir =
|
|
33867
|
+
const scriptsDir = path17.join(refDir, "scripts");
|
|
33491
33868
|
const latestDir = getLatestScriptVersionDir(scriptsDir);
|
|
33492
33869
|
if (!latestDir) return referenceScripts;
|
|
33493
|
-
for (const file2 of
|
|
33870
|
+
for (const file2 of fs13.readdirSync(latestDir)) {
|
|
33494
33871
|
if (!file2.endsWith(".js")) continue;
|
|
33495
33872
|
try {
|
|
33496
|
-
referenceScripts[file2] =
|
|
33873
|
+
referenceScripts[file2] = fs13.readFileSync(path17.join(latestDir, file2), "utf-8");
|
|
33497
33874
|
} catch {
|
|
33498
33875
|
}
|
|
33499
33876
|
}
|
|
@@ -33601,16 +33978,16 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33601
33978
|
});
|
|
33602
33979
|
const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
|
|
33603
33980
|
const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
|
|
33604
|
-
const tmpDir =
|
|
33605
|
-
if (!
|
|
33606
|
-
const promptFile =
|
|
33607
|
-
|
|
33981
|
+
const tmpDir = path17.join(os17.tmpdir(), "adhdev-autoimpl");
|
|
33982
|
+
if (!fs13.existsSync(tmpDir)) fs13.mkdirSync(tmpDir, { recursive: true });
|
|
33983
|
+
const promptFile = path17.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
|
|
33984
|
+
fs13.writeFileSync(promptFile, prompt, "utf-8");
|
|
33608
33985
|
ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
|
|
33609
33986
|
const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
|
|
33610
33987
|
const spawn5 = agentProvider?.spawn;
|
|
33611
33988
|
if (!spawn5?.command) {
|
|
33612
33989
|
try {
|
|
33613
|
-
|
|
33990
|
+
fs13.unlinkSync(promptFile);
|
|
33614
33991
|
} catch {
|
|
33615
33992
|
}
|
|
33616
33993
|
ctx.json(res, 400, { error: `Agent '${agent}' has no spawn config. Select a CLI provider with a spawn configuration.` });
|
|
@@ -33712,7 +34089,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33712
34089
|
} catch {
|
|
33713
34090
|
}
|
|
33714
34091
|
try {
|
|
33715
|
-
|
|
34092
|
+
fs13.unlinkSync(promptFile);
|
|
33716
34093
|
} catch {
|
|
33717
34094
|
}
|
|
33718
34095
|
ctx.log(`Auto-implement (ACP) ${success2 ? "completed" : "failed"}: ${type} (exit: ${code})`);
|
|
@@ -33755,7 +34132,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33755
34132
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
33756
34133
|
const baseArgs = [...spawn5.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
33757
34134
|
let shellCmd;
|
|
33758
|
-
const isWin =
|
|
34135
|
+
const isWin = os17.platform() === "win32";
|
|
33759
34136
|
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
33760
34137
|
if (command === "claude") {
|
|
33761
34138
|
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
@@ -33799,7 +34176,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33799
34176
|
try {
|
|
33800
34177
|
const pty3 = require("node-pty");
|
|
33801
34178
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
33802
|
-
const isWin2 =
|
|
34179
|
+
const isWin2 = os17.platform() === "win32";
|
|
33803
34180
|
child = pty3.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
33804
34181
|
name: "xterm-256color",
|
|
33805
34182
|
cols: 120,
|
|
@@ -33947,7 +34324,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33947
34324
|
}
|
|
33948
34325
|
});
|
|
33949
34326
|
try {
|
|
33950
|
-
|
|
34327
|
+
fs13.unlinkSync(promptFile);
|
|
33951
34328
|
} catch {
|
|
33952
34329
|
}
|
|
33953
34330
|
ctx.log(`Auto-implement ${success2 ? "completed" : "failed"}: ${type} (exit: ${code})${verificationSummary ? ` verify=${verificationSummary.pass ? "pass" : "fail"}` : ""}`);
|
|
@@ -34030,7 +34407,7 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
|
|
|
34030
34407
|
setMode: "set_mode.js"
|
|
34031
34408
|
};
|
|
34032
34409
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
34033
|
-
const scriptsDir =
|
|
34410
|
+
const scriptsDir = path17.join(providerDir, "scripts");
|
|
34034
34411
|
const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
|
|
34035
34412
|
if (latestScriptsDir) {
|
|
34036
34413
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -34038,10 +34415,10 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
|
|
|
34038
34415
|
lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
|
|
34039
34416
|
lines.push("These are the ONLY files you are allowed to modify. Replace the TODO stubs with working implementations.");
|
|
34040
34417
|
lines.push("");
|
|
34041
|
-
for (const file2 of
|
|
34418
|
+
for (const file2 of fs13.readdirSync(latestScriptsDir)) {
|
|
34042
34419
|
if (file2.endsWith(".js") && targetFileNames.has(file2)) {
|
|
34043
34420
|
try {
|
|
34044
|
-
const content =
|
|
34421
|
+
const content = fs13.readFileSync(path17.join(latestScriptsDir, file2), "utf-8");
|
|
34045
34422
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
34046
34423
|
lines.push("```javascript");
|
|
34047
34424
|
lines.push(content);
|
|
@@ -34051,14 +34428,14 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
|
|
|
34051
34428
|
}
|
|
34052
34429
|
}
|
|
34053
34430
|
}
|
|
34054
|
-
const refFiles =
|
|
34431
|
+
const refFiles = fs13.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
|
|
34055
34432
|
if (refFiles.length > 0) {
|
|
34056
34433
|
lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
|
|
34057
34434
|
lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
|
|
34058
34435
|
lines.push("");
|
|
34059
34436
|
for (const file2 of refFiles) {
|
|
34060
34437
|
try {
|
|
34061
|
-
const content =
|
|
34438
|
+
const content = fs13.readFileSync(path17.join(latestScriptsDir, file2), "utf-8");
|
|
34062
34439
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
34063
34440
|
lines.push("```javascript");
|
|
34064
34441
|
lines.push(content);
|
|
@@ -34099,11 +34476,11 @@ function buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domCon
|
|
|
34099
34476
|
lines.push("");
|
|
34100
34477
|
}
|
|
34101
34478
|
}
|
|
34102
|
-
const docsDir =
|
|
34479
|
+
const docsDir = path17.join(providerDir, "../../docs");
|
|
34103
34480
|
const loadGuide = (name) => {
|
|
34104
34481
|
try {
|
|
34105
|
-
const p =
|
|
34106
|
-
if (
|
|
34482
|
+
const p = path17.join(docsDir, name);
|
|
34483
|
+
if (fs13.existsSync(p)) return fs13.readFileSync(p, "utf-8");
|
|
34107
34484
|
} catch {
|
|
34108
34485
|
}
|
|
34109
34486
|
return null;
|
|
@@ -34337,7 +34714,7 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
|
|
|
34337
34714
|
parseApproval: "parse_approval.js"
|
|
34338
34715
|
};
|
|
34339
34716
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
34340
|
-
const scriptsDir =
|
|
34717
|
+
const scriptsDir = path17.join(providerDir, "scripts");
|
|
34341
34718
|
const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
|
|
34342
34719
|
if (latestScriptsDir) {
|
|
34343
34720
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -34345,11 +34722,11 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
|
|
|
34345
34722
|
lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
|
|
34346
34723
|
lines.push("These are the ONLY files you are allowed to modify. Replace TODO or heuristic-only logic with working PTY-aware implementations.");
|
|
34347
34724
|
lines.push("");
|
|
34348
|
-
for (const file2 of
|
|
34725
|
+
for (const file2 of fs13.readdirSync(latestScriptsDir)) {
|
|
34349
34726
|
if (!file2.endsWith(".js")) continue;
|
|
34350
34727
|
if (!targetFileNames.has(file2)) continue;
|
|
34351
34728
|
try {
|
|
34352
|
-
const content =
|
|
34729
|
+
const content = fs13.readFileSync(path17.join(latestScriptsDir, file2), "utf-8");
|
|
34353
34730
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
34354
34731
|
lines.push("```javascript");
|
|
34355
34732
|
lines.push(content);
|
|
@@ -34358,14 +34735,14 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
|
|
|
34358
34735
|
} catch {
|
|
34359
34736
|
}
|
|
34360
34737
|
}
|
|
34361
|
-
const refFiles =
|
|
34738
|
+
const refFiles = fs13.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
|
|
34362
34739
|
if (refFiles.length > 0) {
|
|
34363
34740
|
lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
|
|
34364
34741
|
lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
|
|
34365
34742
|
lines.push("");
|
|
34366
34743
|
for (const file2 of refFiles) {
|
|
34367
34744
|
try {
|
|
34368
|
-
const content =
|
|
34745
|
+
const content = fs13.readFileSync(path17.join(latestScriptsDir, file2), "utf-8");
|
|
34369
34746
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
34370
34747
|
lines.push("```javascript");
|
|
34371
34748
|
lines.push(content);
|
|
@@ -34398,11 +34775,11 @@ function buildCliAutoImplPrompt(ctx, type, provider, providerDir, functions, ref
|
|
|
34398
34775
|
lines.push("");
|
|
34399
34776
|
}
|
|
34400
34777
|
}
|
|
34401
|
-
const docsDir =
|
|
34778
|
+
const docsDir = path17.join(providerDir, "../../docs");
|
|
34402
34779
|
const loadGuide = (name) => {
|
|
34403
34780
|
try {
|
|
34404
|
-
const p =
|
|
34405
|
-
if (
|
|
34781
|
+
const p = path17.join(docsDir, name);
|
|
34782
|
+
if (fs13.existsSync(p)) return fs13.readFileSync(p, "utf-8");
|
|
34406
34783
|
} catch {
|
|
34407
34784
|
}
|
|
34408
34785
|
return null;
|
|
@@ -34706,26 +35083,26 @@ data: ${JSON.stringify(msg.data)}
|
|
|
34706
35083
|
}
|
|
34707
35084
|
}
|
|
34708
35085
|
}
|
|
34709
|
-
var
|
|
35086
|
+
var fs13, path17, os17;
|
|
34710
35087
|
var init_dev_auto_implement = __esm({
|
|
34711
35088
|
"../../oss/packages/daemon-core/src/daemon/dev-auto-implement.ts"() {
|
|
34712
35089
|
"use strict";
|
|
34713
|
-
|
|
34714
|
-
|
|
34715
|
-
|
|
35090
|
+
fs13 = __toESM(require("fs"));
|
|
35091
|
+
path17 = __toESM(require("path"));
|
|
35092
|
+
os17 = __toESM(require("os"));
|
|
34716
35093
|
init_dev_server();
|
|
34717
35094
|
init_dev_cli_debug();
|
|
34718
35095
|
}
|
|
34719
35096
|
});
|
|
34720
35097
|
|
|
34721
35098
|
// ../../oss/packages/daemon-core/src/daemon/dev-server.ts
|
|
34722
|
-
var http2,
|
|
35099
|
+
var http2, fs14, path18, DEV_SERVER_PORT, DevServer;
|
|
34723
35100
|
var init_dev_server = __esm({
|
|
34724
35101
|
"../../oss/packages/daemon-core/src/daemon/dev-server.ts"() {
|
|
34725
35102
|
"use strict";
|
|
34726
35103
|
http2 = __toESM(require("http"));
|
|
34727
|
-
|
|
34728
|
-
|
|
35104
|
+
fs14 = __toESM(require("fs"));
|
|
35105
|
+
path18 = __toESM(require("path"));
|
|
34729
35106
|
init_scaffold_template();
|
|
34730
35107
|
init_version_archive();
|
|
34731
35108
|
init_logger();
|
|
@@ -34829,8 +35206,8 @@ var init_dev_server = __esm({
|
|
|
34829
35206
|
}
|
|
34830
35207
|
getEndpointList() {
|
|
34831
35208
|
return this.routes.map((r) => {
|
|
34832
|
-
const
|
|
34833
|
-
return `${r.method.padEnd(5)} ${
|
|
35209
|
+
const path23 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
|
|
35210
|
+
return `${r.method.padEnd(5)} ${path23}`;
|
|
34834
35211
|
});
|
|
34835
35212
|
}
|
|
34836
35213
|
async start(port = DEV_SERVER_PORT) {
|
|
@@ -35112,12 +35489,12 @@ var init_dev_server = __esm({
|
|
|
35112
35489
|
// ─── DevConsole SPA ───
|
|
35113
35490
|
getConsoleDistDir() {
|
|
35114
35491
|
const candidates = [
|
|
35115
|
-
|
|
35116
|
-
|
|
35117
|
-
|
|
35492
|
+
path18.resolve(__dirname, "../../web-devconsole/dist"),
|
|
35493
|
+
path18.resolve(__dirname, "../../../web-devconsole/dist"),
|
|
35494
|
+
path18.join(process.cwd(), "packages/web-devconsole/dist")
|
|
35118
35495
|
];
|
|
35119
35496
|
for (const dir of candidates) {
|
|
35120
|
-
if (
|
|
35497
|
+
if (fs14.existsSync(path18.join(dir, "index.html"))) return dir;
|
|
35121
35498
|
}
|
|
35122
35499
|
return null;
|
|
35123
35500
|
}
|
|
@@ -35127,9 +35504,9 @@ var init_dev_server = __esm({
|
|
|
35127
35504
|
this.json(res, 500, { error: "DevConsole not found. Run: npm run build -w packages/web-devconsole" });
|
|
35128
35505
|
return;
|
|
35129
35506
|
}
|
|
35130
|
-
const htmlPath =
|
|
35507
|
+
const htmlPath = path18.join(distDir, "index.html");
|
|
35131
35508
|
try {
|
|
35132
|
-
const html =
|
|
35509
|
+
const html = fs14.readFileSync(htmlPath, "utf-8");
|
|
35133
35510
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
35134
35511
|
res.end(html);
|
|
35135
35512
|
} catch (e) {
|
|
@@ -35152,15 +35529,15 @@ var init_dev_server = __esm({
|
|
|
35152
35529
|
this.json(res, 404, { error: "Not found" });
|
|
35153
35530
|
return;
|
|
35154
35531
|
}
|
|
35155
|
-
const safePath =
|
|
35156
|
-
const filePath =
|
|
35532
|
+
const safePath = path18.normalize(pathname).replace(/^\.\.\//, "");
|
|
35533
|
+
const filePath = path18.join(distDir, safePath);
|
|
35157
35534
|
if (!filePath.startsWith(distDir)) {
|
|
35158
35535
|
this.json(res, 403, { error: "Forbidden" });
|
|
35159
35536
|
return;
|
|
35160
35537
|
}
|
|
35161
35538
|
try {
|
|
35162
|
-
const content =
|
|
35163
|
-
const ext =
|
|
35539
|
+
const content = fs14.readFileSync(filePath);
|
|
35540
|
+
const ext = path18.extname(filePath);
|
|
35164
35541
|
const contentType = _DevServer.MIME_MAP[ext] || "application/octet-stream";
|
|
35165
35542
|
res.writeHead(200, { "Content-Type": contentType, "Cache-Control": "public, max-age=31536000, immutable" });
|
|
35166
35543
|
res.end(content);
|
|
@@ -35268,14 +35645,14 @@ var init_dev_server = __esm({
|
|
|
35268
35645
|
const files = [];
|
|
35269
35646
|
const scan = (d, prefix) => {
|
|
35270
35647
|
try {
|
|
35271
|
-
for (const entry of
|
|
35648
|
+
for (const entry of fs14.readdirSync(d, { withFileTypes: true })) {
|
|
35272
35649
|
if (entry.name.startsWith(".") || entry.name.endsWith(".bak")) continue;
|
|
35273
35650
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
35274
35651
|
if (entry.isDirectory()) {
|
|
35275
35652
|
files.push({ path: rel, size: 0, type: "dir" });
|
|
35276
|
-
scan(
|
|
35653
|
+
scan(path18.join(d, entry.name), rel);
|
|
35277
35654
|
} else {
|
|
35278
|
-
const stat4 =
|
|
35655
|
+
const stat4 = fs14.statSync(path18.join(d, entry.name));
|
|
35279
35656
|
files.push({ path: rel, size: stat4.size, type: "file" });
|
|
35280
35657
|
}
|
|
35281
35658
|
}
|
|
@@ -35298,16 +35675,16 @@ var init_dev_server = __esm({
|
|
|
35298
35675
|
this.json(res, 404, { error: `Provider directory not found: ${type}` });
|
|
35299
35676
|
return;
|
|
35300
35677
|
}
|
|
35301
|
-
const fullPath =
|
|
35678
|
+
const fullPath = path18.resolve(dir, path18.normalize(filePath));
|
|
35302
35679
|
if (!fullPath.startsWith(dir)) {
|
|
35303
35680
|
this.json(res, 403, { error: "Forbidden" });
|
|
35304
35681
|
return;
|
|
35305
35682
|
}
|
|
35306
|
-
if (!
|
|
35683
|
+
if (!fs14.existsSync(fullPath) || fs14.statSync(fullPath).isDirectory()) {
|
|
35307
35684
|
this.json(res, 404, { error: `File not found: ${filePath}` });
|
|
35308
35685
|
return;
|
|
35309
35686
|
}
|
|
35310
|
-
const content =
|
|
35687
|
+
const content = fs14.readFileSync(fullPath, "utf-8");
|
|
35311
35688
|
this.json(res, 200, { type, path: filePath, content, lines: content.split("\n").length });
|
|
35312
35689
|
}
|
|
35313
35690
|
/** POST /api/providers/:type/file — write a file { path, content } */
|
|
@@ -35323,15 +35700,15 @@ var init_dev_server = __esm({
|
|
|
35323
35700
|
this.json(res, 404, { error: `Provider directory not found: ${type}` });
|
|
35324
35701
|
return;
|
|
35325
35702
|
}
|
|
35326
|
-
const fullPath =
|
|
35703
|
+
const fullPath = path18.resolve(dir, path18.normalize(filePath));
|
|
35327
35704
|
if (!fullPath.startsWith(dir)) {
|
|
35328
35705
|
this.json(res, 403, { error: "Forbidden" });
|
|
35329
35706
|
return;
|
|
35330
35707
|
}
|
|
35331
35708
|
try {
|
|
35332
|
-
if (
|
|
35333
|
-
|
|
35334
|
-
|
|
35709
|
+
if (fs14.existsSync(fullPath)) fs14.copyFileSync(fullPath, fullPath + ".bak");
|
|
35710
|
+
fs14.mkdirSync(path18.dirname(fullPath), { recursive: true });
|
|
35711
|
+
fs14.writeFileSync(fullPath, content, "utf-8");
|
|
35335
35712
|
this.log(`File saved: ${fullPath} (${content.length} chars)`);
|
|
35336
35713
|
this.providerLoader.reload();
|
|
35337
35714
|
this.json(res, 200, { saved: true, path: filePath, chars: content.length });
|
|
@@ -35347,9 +35724,9 @@ var init_dev_server = __esm({
|
|
|
35347
35724
|
return;
|
|
35348
35725
|
}
|
|
35349
35726
|
for (const name of ["scripts.js", "provider.json"]) {
|
|
35350
|
-
const p =
|
|
35351
|
-
if (
|
|
35352
|
-
const source =
|
|
35727
|
+
const p = path18.join(dir, name);
|
|
35728
|
+
if (fs14.existsSync(p)) {
|
|
35729
|
+
const source = fs14.readFileSync(p, "utf-8");
|
|
35353
35730
|
this.json(res, 200, { type, path: p, source, lines: source.split("\n").length });
|
|
35354
35731
|
return;
|
|
35355
35732
|
}
|
|
@@ -35368,11 +35745,11 @@ var init_dev_server = __esm({
|
|
|
35368
35745
|
this.json(res, 404, { error: `Provider not found: ${type}` });
|
|
35369
35746
|
return;
|
|
35370
35747
|
}
|
|
35371
|
-
const target =
|
|
35372
|
-
const targetPath =
|
|
35748
|
+
const target = fs14.existsSync(path18.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
|
|
35749
|
+
const targetPath = path18.join(dir, target);
|
|
35373
35750
|
try {
|
|
35374
|
-
if (
|
|
35375
|
-
|
|
35751
|
+
if (fs14.existsSync(targetPath)) fs14.copyFileSync(targetPath, targetPath + ".bak");
|
|
35752
|
+
fs14.writeFileSync(targetPath, source, "utf-8");
|
|
35376
35753
|
this.log(`Saved provider: ${targetPath} (${source.length} chars)`);
|
|
35377
35754
|
this.providerLoader.reload();
|
|
35378
35755
|
this.json(res, 200, { saved: true, path: targetPath, chars: source.length });
|
|
@@ -35529,21 +35906,21 @@ var init_dev_server = __esm({
|
|
|
35529
35906
|
}
|
|
35530
35907
|
let targetDir;
|
|
35531
35908
|
targetDir = this.providerLoader.getUserProviderDir(category, type);
|
|
35532
|
-
const jsonPath =
|
|
35533
|
-
if (
|
|
35909
|
+
const jsonPath = path18.join(targetDir, "provider.json");
|
|
35910
|
+
if (fs14.existsSync(jsonPath)) {
|
|
35534
35911
|
this.json(res, 409, { error: `Provider already exists at ${targetDir}`, path: targetDir });
|
|
35535
35912
|
return;
|
|
35536
35913
|
}
|
|
35537
35914
|
try {
|
|
35538
35915
|
const result = generateFiles(type, name, category, { cdpPorts, cli, processName, installPath, binary, extensionId, version: version2, osPaths, processNames });
|
|
35539
|
-
|
|
35540
|
-
|
|
35916
|
+
fs14.mkdirSync(targetDir, { recursive: true });
|
|
35917
|
+
fs14.writeFileSync(jsonPath, result["provider.json"], "utf-8");
|
|
35541
35918
|
const createdFiles = ["provider.json"];
|
|
35542
35919
|
if (result.files) {
|
|
35543
35920
|
for (const [relPath, content] of Object.entries(result.files)) {
|
|
35544
|
-
const fullPath =
|
|
35545
|
-
|
|
35546
|
-
|
|
35921
|
+
const fullPath = path18.join(targetDir, relPath);
|
|
35922
|
+
fs14.mkdirSync(path18.dirname(fullPath), { recursive: true });
|
|
35923
|
+
fs14.writeFileSync(fullPath, content, "utf-8");
|
|
35547
35924
|
createdFiles.push(relPath);
|
|
35548
35925
|
}
|
|
35549
35926
|
}
|
|
@@ -35592,45 +35969,45 @@ var init_dev_server = __esm({
|
|
|
35592
35969
|
}
|
|
35593
35970
|
// ─── Phase 2: Auto-Implement Backend ───
|
|
35594
35971
|
getLatestScriptVersionDir(scriptsDir) {
|
|
35595
|
-
if (!
|
|
35596
|
-
const versions =
|
|
35972
|
+
if (!fs14.existsSync(scriptsDir)) return null;
|
|
35973
|
+
const versions = fs14.readdirSync(scriptsDir).filter((d) => {
|
|
35597
35974
|
try {
|
|
35598
|
-
return
|
|
35975
|
+
return fs14.statSync(path18.join(scriptsDir, d)).isDirectory();
|
|
35599
35976
|
} catch {
|
|
35600
35977
|
return false;
|
|
35601
35978
|
}
|
|
35602
35979
|
}).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
|
|
35603
35980
|
if (versions.length === 0) return null;
|
|
35604
|
-
return
|
|
35981
|
+
return path18.join(scriptsDir, versions[0]);
|
|
35605
35982
|
}
|
|
35606
35983
|
resolveAutoImplWritableProviderDir(category, type, requestedDir) {
|
|
35607
|
-
const canonicalUserDir =
|
|
35608
|
-
const desiredDir = requestedDir ?
|
|
35609
|
-
const upstreamRoot =
|
|
35610
|
-
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${
|
|
35984
|
+
const canonicalUserDir = path18.resolve(this.providerLoader.getUserProviderDir(category, type));
|
|
35985
|
+
const desiredDir = requestedDir ? path18.resolve(requestedDir) : canonicalUserDir;
|
|
35986
|
+
const upstreamRoot = path18.resolve(this.providerLoader.getUpstreamDir());
|
|
35987
|
+
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path18.sep}`)) {
|
|
35611
35988
|
return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
|
|
35612
35989
|
}
|
|
35613
|
-
if (
|
|
35990
|
+
if (path18.basename(desiredDir) !== type) {
|
|
35614
35991
|
return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
|
|
35615
35992
|
}
|
|
35616
35993
|
const sourceDir = this.findProviderDir(type);
|
|
35617
35994
|
if (!sourceDir) {
|
|
35618
35995
|
return { dir: null, reason: `Provider source directory not found for '${type}'` };
|
|
35619
35996
|
}
|
|
35620
|
-
if (!
|
|
35621
|
-
|
|
35622
|
-
|
|
35997
|
+
if (!fs14.existsSync(desiredDir)) {
|
|
35998
|
+
fs14.mkdirSync(path18.dirname(desiredDir), { recursive: true });
|
|
35999
|
+
fs14.cpSync(sourceDir, desiredDir, { recursive: true });
|
|
35623
36000
|
this.log(`Auto-implement writable copy created: ${desiredDir}`);
|
|
35624
36001
|
}
|
|
35625
|
-
const providerJson =
|
|
35626
|
-
if (!
|
|
36002
|
+
const providerJson = path18.join(desiredDir, "provider.json");
|
|
36003
|
+
if (!fs14.existsSync(providerJson)) {
|
|
35627
36004
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
35628
36005
|
}
|
|
35629
36006
|
try {
|
|
35630
|
-
const providerData = JSON.parse(
|
|
36007
|
+
const providerData = JSON.parse(fs14.readFileSync(providerJson, "utf-8"));
|
|
35631
36008
|
if (providerData.disableUpstream !== true) {
|
|
35632
36009
|
providerData.disableUpstream = true;
|
|
35633
|
-
|
|
36010
|
+
fs14.writeFileSync(providerJson, JSON.stringify(providerData, null, 2));
|
|
35634
36011
|
}
|
|
35635
36012
|
} catch (error48) {
|
|
35636
36013
|
return {
|
|
@@ -35670,7 +36047,7 @@ var init_dev_server = __esm({
|
|
|
35670
36047
|
setMode: "set_mode.js"
|
|
35671
36048
|
};
|
|
35672
36049
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
35673
|
-
const scriptsDir =
|
|
36050
|
+
const scriptsDir = path18.join(providerDir, "scripts");
|
|
35674
36051
|
const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
|
|
35675
36052
|
if (latestScriptsDir) {
|
|
35676
36053
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -35678,10 +36055,10 @@ var init_dev_server = __esm({
|
|
|
35678
36055
|
lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
|
|
35679
36056
|
lines.push("These are the ONLY files you are allowed to modify. Replace the TODO stubs with working implementations.");
|
|
35680
36057
|
lines.push("");
|
|
35681
|
-
for (const file2 of
|
|
36058
|
+
for (const file2 of fs14.readdirSync(latestScriptsDir)) {
|
|
35682
36059
|
if (file2.endsWith(".js") && targetFileNames.has(file2)) {
|
|
35683
36060
|
try {
|
|
35684
|
-
const content =
|
|
36061
|
+
const content = fs14.readFileSync(path18.join(latestScriptsDir, file2), "utf-8");
|
|
35685
36062
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
35686
36063
|
lines.push("```javascript");
|
|
35687
36064
|
lines.push(content);
|
|
@@ -35691,14 +36068,14 @@ var init_dev_server = __esm({
|
|
|
35691
36068
|
}
|
|
35692
36069
|
}
|
|
35693
36070
|
}
|
|
35694
|
-
const refFiles =
|
|
36071
|
+
const refFiles = fs14.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
|
|
35695
36072
|
if (refFiles.length > 0) {
|
|
35696
36073
|
lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
|
|
35697
36074
|
lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
|
|
35698
36075
|
lines.push("");
|
|
35699
36076
|
for (const file2 of refFiles) {
|
|
35700
36077
|
try {
|
|
35701
|
-
const content =
|
|
36078
|
+
const content = fs14.readFileSync(path18.join(latestScriptsDir, file2), "utf-8");
|
|
35702
36079
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
35703
36080
|
lines.push("```javascript");
|
|
35704
36081
|
lines.push(content);
|
|
@@ -35739,11 +36116,11 @@ var init_dev_server = __esm({
|
|
|
35739
36116
|
lines.push("");
|
|
35740
36117
|
}
|
|
35741
36118
|
}
|
|
35742
|
-
const docsDir =
|
|
36119
|
+
const docsDir = path18.join(providerDir, "../../docs");
|
|
35743
36120
|
const loadGuide = (name) => {
|
|
35744
36121
|
try {
|
|
35745
|
-
const p =
|
|
35746
|
-
if (
|
|
36122
|
+
const p = path18.join(docsDir, name);
|
|
36123
|
+
if (fs14.existsSync(p)) return fs14.readFileSync(p, "utf-8");
|
|
35747
36124
|
} catch {
|
|
35748
36125
|
}
|
|
35749
36126
|
return null;
|
|
@@ -35916,7 +36293,7 @@ var init_dev_server = __esm({
|
|
|
35916
36293
|
parseApproval: "parse_approval.js"
|
|
35917
36294
|
};
|
|
35918
36295
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
35919
|
-
const scriptsDir =
|
|
36296
|
+
const scriptsDir = path18.join(providerDir, "scripts");
|
|
35920
36297
|
const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
|
|
35921
36298
|
if (latestScriptsDir) {
|
|
35922
36299
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -35924,11 +36301,11 @@ var init_dev_server = __esm({
|
|
|
35924
36301
|
lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
|
|
35925
36302
|
lines.push("These are the ONLY files you are allowed to modify. Replace TODO or heuristic-only logic with working PTY-aware implementations.");
|
|
35926
36303
|
lines.push("");
|
|
35927
|
-
for (const file2 of
|
|
36304
|
+
for (const file2 of fs14.readdirSync(latestScriptsDir)) {
|
|
35928
36305
|
if (!file2.endsWith(".js")) continue;
|
|
35929
36306
|
if (!targetFileNames.has(file2)) continue;
|
|
35930
36307
|
try {
|
|
35931
|
-
const content =
|
|
36308
|
+
const content = fs14.readFileSync(path18.join(latestScriptsDir, file2), "utf-8");
|
|
35932
36309
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
35933
36310
|
lines.push("```javascript");
|
|
35934
36311
|
lines.push(content);
|
|
@@ -35937,14 +36314,14 @@ var init_dev_server = __esm({
|
|
|
35937
36314
|
} catch {
|
|
35938
36315
|
}
|
|
35939
36316
|
}
|
|
35940
|
-
const refFiles =
|
|
36317
|
+
const refFiles = fs14.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
|
|
35941
36318
|
if (refFiles.length > 0) {
|
|
35942
36319
|
lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
|
|
35943
36320
|
lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
|
|
35944
36321
|
lines.push("");
|
|
35945
36322
|
for (const file2 of refFiles) {
|
|
35946
36323
|
try {
|
|
35947
|
-
const content =
|
|
36324
|
+
const content = fs14.readFileSync(path18.join(latestScriptsDir, file2), "utf-8");
|
|
35948
36325
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
35949
36326
|
lines.push("```javascript");
|
|
35950
36327
|
lines.push(content);
|
|
@@ -35977,11 +36354,11 @@ var init_dev_server = __esm({
|
|
|
35977
36354
|
lines.push("");
|
|
35978
36355
|
}
|
|
35979
36356
|
}
|
|
35980
|
-
const docsDir =
|
|
36357
|
+
const docsDir = path18.join(providerDir, "../../docs");
|
|
35981
36358
|
const loadGuide = (name) => {
|
|
35982
36359
|
try {
|
|
35983
|
-
const p =
|
|
35984
|
-
if (
|
|
36360
|
+
const p = path18.join(docsDir, name);
|
|
36361
|
+
if (fs14.existsSync(p)) return fs14.readFileSync(p, "utf-8");
|
|
35985
36362
|
} catch {
|
|
35986
36363
|
}
|
|
35987
36364
|
return null;
|
|
@@ -36243,7 +36620,7 @@ function getDefaultSessionHostEndpoint(appName = "adhdev") {
|
|
|
36243
36620
|
}
|
|
36244
36621
|
return {
|
|
36245
36622
|
kind: "unix",
|
|
36246
|
-
path: path22.join(
|
|
36623
|
+
path: path22.join(os18.tmpdir(), `${appName}-session-host.sock`)
|
|
36247
36624
|
};
|
|
36248
36625
|
}
|
|
36249
36626
|
function serializeEnvelope(envelope) {
|
|
@@ -36265,11 +36642,11 @@ function createLineParser(onEnvelope) {
|
|
|
36265
36642
|
}
|
|
36266
36643
|
};
|
|
36267
36644
|
}
|
|
36268
|
-
var
|
|
36645
|
+
var os18, path22, net2, import_crypto3, SessionHostClient;
|
|
36269
36646
|
var init_dist = __esm({
|
|
36270
36647
|
"../../oss/packages/session-host-core/dist/index.mjs"() {
|
|
36271
36648
|
"use strict";
|
|
36272
|
-
|
|
36649
|
+
os18 = __toESM(require("os"), 1);
|
|
36273
36650
|
path22 = __toESM(require("path"), 1);
|
|
36274
36651
|
net2 = __toESM(require("net"), 1);
|
|
36275
36652
|
import_crypto3 = require("crypto");
|
|
@@ -36812,9 +37189,187 @@ var init_runtime_support = __esm({
|
|
|
36812
37189
|
});
|
|
36813
37190
|
|
|
36814
37191
|
// ../../oss/packages/daemon-core/src/installer.ts
|
|
37192
|
+
function isExtensionInstalled(ide, marketplaceId) {
|
|
37193
|
+
if (!ide.cliCommand) return false;
|
|
37194
|
+
try {
|
|
37195
|
+
const result = (0, import_child_process10.execSync)(`"${ide.cliCommand}" --list-extensions`, {
|
|
37196
|
+
encoding: "utf-8",
|
|
37197
|
+
timeout: 15e3,
|
|
37198
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
37199
|
+
});
|
|
37200
|
+
const installed = result.trim().split("\n").map((e) => e.trim().toLowerCase());
|
|
37201
|
+
return installed.includes(marketplaceId.toLowerCase());
|
|
37202
|
+
} catch {
|
|
37203
|
+
return false;
|
|
37204
|
+
}
|
|
37205
|
+
}
|
|
37206
|
+
async function installExtension(ide, extension) {
|
|
37207
|
+
if (!ide.cliCommand) {
|
|
37208
|
+
return {
|
|
37209
|
+
extensionId: extension.id,
|
|
37210
|
+
marketplaceId: extension.marketplaceId,
|
|
37211
|
+
success: false,
|
|
37212
|
+
alreadyInstalled: false,
|
|
37213
|
+
error: `No CLI command found for ${ide.displayName}. Please install it manually.`
|
|
37214
|
+
};
|
|
37215
|
+
}
|
|
37216
|
+
const alreadyInstalled = isExtensionInstalled(ide, extension.marketplaceId);
|
|
37217
|
+
if (alreadyInstalled) {
|
|
37218
|
+
return {
|
|
37219
|
+
extensionId: extension.id,
|
|
37220
|
+
marketplaceId: extension.marketplaceId,
|
|
37221
|
+
success: true,
|
|
37222
|
+
alreadyInstalled: true
|
|
37223
|
+
};
|
|
37224
|
+
}
|
|
37225
|
+
if (extension.vsixUrl) {
|
|
37226
|
+
try {
|
|
37227
|
+
const tmpDir = (await import("os")).tmpdir();
|
|
37228
|
+
const vsixPath = `${tmpDir}/adhdev-extension-latest.vsix`;
|
|
37229
|
+
const res = await fetch(extension.vsixUrl);
|
|
37230
|
+
if (res.ok) {
|
|
37231
|
+
const buffer = Buffer.from(await res.arrayBuffer());
|
|
37232
|
+
const fs18 = await import("fs");
|
|
37233
|
+
fs18.writeFileSync(vsixPath, buffer);
|
|
37234
|
+
return new Promise((resolve13) => {
|
|
37235
|
+
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
37236
|
+
(0, import_child_process10.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
37237
|
+
resolve13({
|
|
37238
|
+
extensionId: extension.id,
|
|
37239
|
+
marketplaceId: extension.marketplaceId,
|
|
37240
|
+
success: !error48,
|
|
37241
|
+
alreadyInstalled: false,
|
|
37242
|
+
error: error48 ? stderr || error48.message : void 0
|
|
37243
|
+
});
|
|
37244
|
+
});
|
|
37245
|
+
});
|
|
37246
|
+
}
|
|
37247
|
+
} catch (e) {
|
|
37248
|
+
}
|
|
37249
|
+
}
|
|
37250
|
+
return new Promise((resolve13) => {
|
|
37251
|
+
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
37252
|
+
(0, import_child_process10.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
|
|
37253
|
+
if (error48) {
|
|
37254
|
+
resolve13({
|
|
37255
|
+
extensionId: extension.id,
|
|
37256
|
+
marketplaceId: extension.marketplaceId,
|
|
37257
|
+
success: false,
|
|
37258
|
+
alreadyInstalled: false,
|
|
37259
|
+
error: stderr || error48.message
|
|
37260
|
+
});
|
|
37261
|
+
} else {
|
|
37262
|
+
resolve13({
|
|
37263
|
+
extensionId: extension.id,
|
|
37264
|
+
marketplaceId: extension.marketplaceId,
|
|
37265
|
+
success: true,
|
|
37266
|
+
alreadyInstalled: false
|
|
37267
|
+
});
|
|
37268
|
+
}
|
|
37269
|
+
});
|
|
37270
|
+
});
|
|
37271
|
+
}
|
|
37272
|
+
async function installExtensions(ide, extensions, onProgress) {
|
|
37273
|
+
const results = [];
|
|
37274
|
+
for (let i = 0; i < extensions.length; i++) {
|
|
37275
|
+
const ext = extensions[i];
|
|
37276
|
+
const result = await installExtension(ide, ext);
|
|
37277
|
+
results.push(result);
|
|
37278
|
+
onProgress?.(i + 1, extensions.length, ext, result);
|
|
37279
|
+
}
|
|
37280
|
+
return results;
|
|
37281
|
+
}
|
|
37282
|
+
function getAIExtensions() {
|
|
37283
|
+
return EXTENSION_CATALOG.filter((e) => e.category === "ai-agent");
|
|
37284
|
+
}
|
|
37285
|
+
function launchIDE(ide, workspacePath) {
|
|
37286
|
+
if (!ide.cliCommand) return false;
|
|
37287
|
+
try {
|
|
37288
|
+
const args = workspacePath ? `"${workspacePath}"` : "";
|
|
37289
|
+
(0, import_child_process10.exec)(`"${ide.cliCommand}" ${args}`, { timeout: 1e4 });
|
|
37290
|
+
return true;
|
|
37291
|
+
} catch {
|
|
37292
|
+
return false;
|
|
37293
|
+
}
|
|
37294
|
+
}
|
|
37295
|
+
var import_child_process10, EXTENSION_CATALOG;
|
|
36815
37296
|
var init_installer = __esm({
|
|
36816
37297
|
"../../oss/packages/daemon-core/src/installer.ts"() {
|
|
36817
37298
|
"use strict";
|
|
37299
|
+
import_child_process10 = require("child_process");
|
|
37300
|
+
EXTENSION_CATALOG = [
|
|
37301
|
+
// AI Agent extensions
|
|
37302
|
+
{
|
|
37303
|
+
id: "roo-code",
|
|
37304
|
+
name: "Roo Code",
|
|
37305
|
+
displayName: "Roo Code (Roo Cline)",
|
|
37306
|
+
marketplaceId: "rooveterinaryinc.roo-cline",
|
|
37307
|
+
description: "Open-source AI coding assistant with multiple modes",
|
|
37308
|
+
category: "ai-agent",
|
|
37309
|
+
icon: "\u{1F998}",
|
|
37310
|
+
recommended: true,
|
|
37311
|
+
website: "https://roocode.com"
|
|
37312
|
+
},
|
|
37313
|
+
{
|
|
37314
|
+
id: "github-copilot",
|
|
37315
|
+
name: "GitHub Copilot",
|
|
37316
|
+
displayName: "GitHub Copilot",
|
|
37317
|
+
marketplaceId: "github.copilot",
|
|
37318
|
+
description: "AI pair programmer by GitHub",
|
|
37319
|
+
category: "ai-agent",
|
|
37320
|
+
icon: "\u{1F916}",
|
|
37321
|
+
recommended: true,
|
|
37322
|
+
requiresApiKey: true,
|
|
37323
|
+
apiKeyName: "GitHub account",
|
|
37324
|
+
website: "https://github.com/features/copilot"
|
|
37325
|
+
},
|
|
37326
|
+
{
|
|
37327
|
+
id: "copilot-chat",
|
|
37328
|
+
name: "GitHub Copilot Chat",
|
|
37329
|
+
displayName: "GitHub Copilot Chat",
|
|
37330
|
+
marketplaceId: "github.copilot-chat",
|
|
37331
|
+
description: "Chat interface for GitHub Copilot",
|
|
37332
|
+
category: "ai-agent",
|
|
37333
|
+
icon: "\u{1F4AC}",
|
|
37334
|
+
recommended: true,
|
|
37335
|
+
requiresApiKey: true,
|
|
37336
|
+
apiKeyName: "GitHub account"
|
|
37337
|
+
},
|
|
37338
|
+
{
|
|
37339
|
+
id: "cline",
|
|
37340
|
+
name: "Cline",
|
|
37341
|
+
displayName: "Cline",
|
|
37342
|
+
marketplaceId: "saoudrizwan.claude-dev",
|
|
37343
|
+
description: "Autonomous AI coding agent in your IDE",
|
|
37344
|
+
category: "ai-agent",
|
|
37345
|
+
icon: "\u{1F9E0}",
|
|
37346
|
+
recommended: false,
|
|
37347
|
+
requiresApiKey: true,
|
|
37348
|
+
apiKeyName: "Anthropic/OpenAI API key"
|
|
37349
|
+
},
|
|
37350
|
+
{
|
|
37351
|
+
id: "continue",
|
|
37352
|
+
name: "Continue",
|
|
37353
|
+
displayName: "Continue",
|
|
37354
|
+
marketplaceId: "continue.continue",
|
|
37355
|
+
description: "Open-source AI code assistant with custom models",
|
|
37356
|
+
category: "ai-agent",
|
|
37357
|
+
icon: "\u25B6\uFE0F",
|
|
37358
|
+
recommended: false
|
|
37359
|
+
},
|
|
37360
|
+
{
|
|
37361
|
+
id: "aider",
|
|
37362
|
+
name: "Aider",
|
|
37363
|
+
displayName: "Aider",
|
|
37364
|
+
marketplaceId: "aider.aider",
|
|
37365
|
+
description: "AI pair programming in your terminal",
|
|
37366
|
+
category: "ai-agent",
|
|
37367
|
+
icon: "\u{1F527}",
|
|
37368
|
+
recommended: false,
|
|
37369
|
+
requiresApiKey: true,
|
|
37370
|
+
apiKeyName: "OpenAI/Anthropic API key"
|
|
37371
|
+
}
|
|
37372
|
+
];
|
|
36818
37373
|
}
|
|
36819
37374
|
});
|
|
36820
37375
|
|
|
@@ -37019,6 +37574,18 @@ async function initDaemonComponents(config2) {
|
|
|
37019
37574
|
detectedIdes: detectedIdesRef
|
|
37020
37575
|
};
|
|
37021
37576
|
}
|
|
37577
|
+
async function startDaemonDevSupport(options) {
|
|
37578
|
+
const devServer = new DevServer({
|
|
37579
|
+
providerLoader: options.components.providerLoader,
|
|
37580
|
+
cdpManagers: options.components.cdpManagers,
|
|
37581
|
+
instanceManager: options.components.instanceManager,
|
|
37582
|
+
cliManager: options.components.cliManager,
|
|
37583
|
+
logFn: options.logFn
|
|
37584
|
+
});
|
|
37585
|
+
await devServer.start();
|
|
37586
|
+
options.components.providerLoader.watch();
|
|
37587
|
+
return devServer;
|
|
37588
|
+
}
|
|
37022
37589
|
async function shutdownDaemonComponents(components) {
|
|
37023
37590
|
const {
|
|
37024
37591
|
poller,
|
|
@@ -37079,6 +37646,84 @@ var init_daemon_lifecycle = __esm({
|
|
|
37079
37646
|
});
|
|
37080
37647
|
|
|
37081
37648
|
// ../../oss/packages/daemon-core/src/index.ts
|
|
37649
|
+
var src_exports = {};
|
|
37650
|
+
__export(src_exports, {
|
|
37651
|
+
AcpProviderInstance: () => AcpProviderInstance,
|
|
37652
|
+
AgentStreamPoller: () => AgentStreamPoller,
|
|
37653
|
+
CdpDomHandlers: () => CdpDomHandlers,
|
|
37654
|
+
CliProviderInstance: () => CliProviderInstance,
|
|
37655
|
+
DAEMON_WS_PATH: () => DAEMON_WS_PATH,
|
|
37656
|
+
DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
|
|
37657
|
+
DaemonAgentStreamManager: () => DaemonAgentStreamManager,
|
|
37658
|
+
DaemonCdpInitializer: () => DaemonCdpInitializer,
|
|
37659
|
+
DaemonCdpManager: () => DaemonCdpManager,
|
|
37660
|
+
DaemonCdpScanner: () => DaemonCdpScanner,
|
|
37661
|
+
DaemonCliManager: () => DaemonCliManager,
|
|
37662
|
+
DaemonCommandHandler: () => DaemonCommandHandler,
|
|
37663
|
+
DaemonCommandRouter: () => DaemonCommandRouter,
|
|
37664
|
+
DaemonStatusReporter: () => DaemonStatusReporter,
|
|
37665
|
+
DevServer: () => DevServer,
|
|
37666
|
+
IdeProviderInstance: () => IdeProviderInstance,
|
|
37667
|
+
LOG: () => LOG,
|
|
37668
|
+
NodePtyTransportFactory: () => NodePtyTransportFactory,
|
|
37669
|
+
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
37670
|
+
ProviderInstanceManager: () => ProviderInstanceManager,
|
|
37671
|
+
ProviderLoader: () => ProviderLoader,
|
|
37672
|
+
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
37673
|
+
VersionArchive: () => VersionArchive,
|
|
37674
|
+
appendRecentActivity: () => appendRecentActivity,
|
|
37675
|
+
buildSessionEntries: () => buildSessionEntries,
|
|
37676
|
+
buildStatusSnapshot: () => buildStatusSnapshot,
|
|
37677
|
+
connectCdpManager: () => connectCdpManager,
|
|
37678
|
+
detectAllVersions: () => detectAllVersions,
|
|
37679
|
+
detectCLIs: () => detectCLIs,
|
|
37680
|
+
detectIDEs: () => detectIDEs,
|
|
37681
|
+
ensureSessionHostReady: () => ensureSessionHostReady,
|
|
37682
|
+
findCdpManager: () => findCdpManager,
|
|
37683
|
+
forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance,
|
|
37684
|
+
getAIExtensions: () => getAIExtensions,
|
|
37685
|
+
getAvailableIdeIds: () => getAvailableIdeIds,
|
|
37686
|
+
getCurrentDaemonLogPath: () => getCurrentDaemonLogPath,
|
|
37687
|
+
getDaemonLogDir: () => getDaemonLogDir,
|
|
37688
|
+
getHostMemorySnapshot: () => getHostMemorySnapshot,
|
|
37689
|
+
getLogLevel: () => getLogLevel,
|
|
37690
|
+
getRecentActivity: () => getRecentActivity,
|
|
37691
|
+
getRecentCommands: () => getRecentCommands,
|
|
37692
|
+
getRecentLogs: () => getRecentLogs,
|
|
37693
|
+
getSavedProviderSessions: () => getSavedProviderSessions,
|
|
37694
|
+
getWorkspaceState: () => getWorkspaceState,
|
|
37695
|
+
hasCdpManager: () => hasCdpManager,
|
|
37696
|
+
initDaemonComponents: () => initDaemonComponents,
|
|
37697
|
+
installExtensions: () => installExtensions,
|
|
37698
|
+
installGlobalInterceptor: () => installGlobalInterceptor,
|
|
37699
|
+
isCdpConnected: () => isCdpConnected,
|
|
37700
|
+
isExtensionInstalled: () => isExtensionInstalled,
|
|
37701
|
+
isIdeRunning: () => isIdeRunning,
|
|
37702
|
+
isManagedStatusWaiting: () => isManagedStatusWaiting,
|
|
37703
|
+
isManagedStatusWorking: () => isManagedStatusWorking,
|
|
37704
|
+
isSetupComplete: () => isSetupComplete,
|
|
37705
|
+
killIdeProcess: () => killIdeProcess,
|
|
37706
|
+
launchIDE: () => launchIDE,
|
|
37707
|
+
launchWithCdp: () => launchWithCdp,
|
|
37708
|
+
listHostedCliRuntimes: () => listHostedCliRuntimes,
|
|
37709
|
+
loadConfig: () => loadConfig,
|
|
37710
|
+
logCommand: () => logCommand,
|
|
37711
|
+
markSetupComplete: () => markSetupComplete,
|
|
37712
|
+
maybeRunDaemonUpgradeHelperFromEnv: () => maybeRunDaemonUpgradeHelperFromEnv,
|
|
37713
|
+
normalizeActiveChatData: () => normalizeActiveChatData,
|
|
37714
|
+
normalizeManagedStatus: () => normalizeManagedStatus,
|
|
37715
|
+
probeCdpPort: () => probeCdpPort,
|
|
37716
|
+
readChatHistory: () => readChatHistory,
|
|
37717
|
+
registerExtensionProviders: () => registerExtensionProviders,
|
|
37718
|
+
resetConfig: () => resetConfig,
|
|
37719
|
+
saveConfig: () => saveConfig,
|
|
37720
|
+
setLogLevel: () => setLogLevel,
|
|
37721
|
+
setupIdeInstance: () => setupIdeInstance,
|
|
37722
|
+
shutdownDaemonComponents: () => shutdownDaemonComponents,
|
|
37723
|
+
startDaemonDevSupport: () => startDaemonDevSupport,
|
|
37724
|
+
updateConfig: () => updateConfig,
|
|
37725
|
+
upsertSavedProviderSession: () => upsertSavedProviderSession
|
|
37726
|
+
});
|
|
37082
37727
|
var init_src = __esm({
|
|
37083
37728
|
"../../oss/packages/daemon-core/src/index.ts"() {
|
|
37084
37729
|
"use strict";
|
|
@@ -37426,17 +38071,17 @@ function canPeerUsePrivilegedShareCommand(commandType, permission) {
|
|
|
37426
38071
|
return false;
|
|
37427
38072
|
}
|
|
37428
38073
|
}
|
|
37429
|
-
var
|
|
38074
|
+
var fs15, path19, os19, import_node_module2, esmRequire, logFile, log, logDebug, DaemonP2PSender;
|
|
37430
38075
|
var init_daemon_p2p = __esm({
|
|
37431
38076
|
"src/daemon-p2p.ts"() {
|
|
37432
38077
|
"use strict";
|
|
37433
|
-
|
|
38078
|
+
fs15 = __toESM(require("fs"));
|
|
37434
38079
|
init_src();
|
|
37435
|
-
|
|
37436
|
-
|
|
38080
|
+
path19 = __toESM(require("path"));
|
|
38081
|
+
os19 = __toESM(require("os"));
|
|
37437
38082
|
import_node_module2 = require("module");
|
|
37438
38083
|
esmRequire = (0, import_node_module2.createRequire)(__filename);
|
|
37439
|
-
logFile =
|
|
38084
|
+
logFile = path19.join(os19.tmpdir(), "adhdev_daemon_p2p.log");
|
|
37440
38085
|
log = (msg) => {
|
|
37441
38086
|
LOG.info("P2P", `[${(/* @__PURE__ */ new Date()).toISOString()}] [P2P] ${msg}`);
|
|
37442
38087
|
};
|
|
@@ -37504,17 +38149,17 @@ ${e?.stack || ""}`);
|
|
|
37504
38149
|
const prebuildKey = `${platform11}-${arch3}`;
|
|
37505
38150
|
try {
|
|
37506
38151
|
const candidates = [
|
|
37507
|
-
|
|
37508
|
-
|
|
37509
|
-
|
|
38152
|
+
path19.join(__dirname, "node_modules", "node-datachannel"),
|
|
38153
|
+
path19.join(__dirname, "..", "node_modules", "node-datachannel"),
|
|
38154
|
+
path19.join(__dirname, "..", "..", "node_modules", "node-datachannel")
|
|
37510
38155
|
];
|
|
37511
38156
|
for (const candidate of candidates) {
|
|
37512
|
-
const prebuildPath =
|
|
37513
|
-
if (
|
|
37514
|
-
const targetDir =
|
|
37515
|
-
const targetPath =
|
|
37516
|
-
|
|
37517
|
-
|
|
38157
|
+
const prebuildPath = path19.join(candidate, "prebuilds", prebuildKey, "node_datachannel.node");
|
|
38158
|
+
if (fs15.existsSync(prebuildPath)) {
|
|
38159
|
+
const targetDir = path19.join(candidate, "build", "Release");
|
|
38160
|
+
const targetPath = path19.join(targetDir, "node_datachannel.node");
|
|
38161
|
+
fs15.mkdirSync(targetDir, { recursive: true });
|
|
38162
|
+
fs15.copyFileSync(prebuildPath, targetPath);
|
|
37518
38163
|
try {
|
|
37519
38164
|
delete esmRequire.cache[esmRequire.resolve("node-datachannel")];
|
|
37520
38165
|
} catch {
|
|
@@ -38424,23 +39069,23 @@ function buildSessionHostEnv(baseEnv) {
|
|
|
38424
39069
|
}
|
|
38425
39070
|
function resolveSessionHostEntry() {
|
|
38426
39071
|
const packagedCandidates = [
|
|
38427
|
-
|
|
38428
|
-
|
|
39072
|
+
path20.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
|
|
39073
|
+
path20.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
38429
39074
|
];
|
|
38430
39075
|
for (const candidate of packagedCandidates) {
|
|
38431
|
-
if (
|
|
39076
|
+
if (fs16.existsSync(candidate)) {
|
|
38432
39077
|
return candidate;
|
|
38433
39078
|
}
|
|
38434
39079
|
}
|
|
38435
39080
|
return require.resolve("@adhdev/session-host-daemon");
|
|
38436
39081
|
}
|
|
38437
39082
|
function getSessionHostPidFile() {
|
|
38438
|
-
return
|
|
39083
|
+
return path20.join(os20.homedir(), ".adhdev", `${SESSION_HOST_APP_NAME}-session-host.pid`);
|
|
38439
39084
|
}
|
|
38440
|
-
function
|
|
39085
|
+
function killPid2(pid) {
|
|
38441
39086
|
try {
|
|
38442
39087
|
if (process.platform === "win32") {
|
|
38443
|
-
(0,
|
|
39088
|
+
(0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
|
|
38444
39089
|
} else {
|
|
38445
39090
|
process.kill(pid, "SIGTERM");
|
|
38446
39091
|
}
|
|
@@ -38453,26 +39098,26 @@ function stopSessionHost() {
|
|
|
38453
39098
|
let stopped = false;
|
|
38454
39099
|
const pidFile = getSessionHostPidFile();
|
|
38455
39100
|
try {
|
|
38456
|
-
if (
|
|
38457
|
-
const pid = Number.parseInt(
|
|
39101
|
+
if (fs16.existsSync(pidFile)) {
|
|
39102
|
+
const pid = Number.parseInt(fs16.readFileSync(pidFile, "utf8").trim(), 10);
|
|
38458
39103
|
if (Number.isFinite(pid)) {
|
|
38459
|
-
stopped =
|
|
39104
|
+
stopped = killPid2(pid) || stopped;
|
|
38460
39105
|
}
|
|
38461
39106
|
}
|
|
38462
39107
|
} catch {
|
|
38463
39108
|
} finally {
|
|
38464
39109
|
try {
|
|
38465
|
-
|
|
39110
|
+
fs16.unlinkSync(pidFile);
|
|
38466
39111
|
} catch {
|
|
38467
39112
|
}
|
|
38468
39113
|
}
|
|
38469
39114
|
if (process.platform !== "win32") {
|
|
38470
39115
|
try {
|
|
38471
|
-
const raw = (0,
|
|
39116
|
+
const raw = (0, import_child_process11.execFileSync)("pgrep", ["-f", "session-host-daemon"], { encoding: "utf8" }).trim();
|
|
38472
39117
|
for (const line of raw.split("\n")) {
|
|
38473
39118
|
const pid = Number.parseInt(line.trim(), 10);
|
|
38474
39119
|
if (Number.isFinite(pid)) {
|
|
38475
|
-
stopped =
|
|
39120
|
+
stopped = killPid2(pid) || stopped;
|
|
38476
39121
|
}
|
|
38477
39122
|
}
|
|
38478
39123
|
} catch {
|
|
@@ -38483,7 +39128,7 @@ function stopSessionHost() {
|
|
|
38483
39128
|
async function ensureSessionHostReady2() {
|
|
38484
39129
|
const spawnHost = () => {
|
|
38485
39130
|
const entry = resolveSessionHostEntry();
|
|
38486
|
-
const child = (0,
|
|
39131
|
+
const child = (0, import_child_process11.spawn)(process.execPath, [entry], {
|
|
38487
39132
|
detached: true,
|
|
38488
39133
|
stdio: "ignore",
|
|
38489
39134
|
windowsHide: true,
|
|
@@ -38513,15 +39158,16 @@ async function ensureSessionHostReady2() {
|
|
|
38513
39158
|
async function listHostedCliRuntimes2(endpoint) {
|
|
38514
39159
|
return listHostedCliRuntimes(endpoint);
|
|
38515
39160
|
}
|
|
38516
|
-
var
|
|
39161
|
+
var import_child_process11, fs16, os20, path20, SESSION_HOST_APP_NAME, SESSION_HOST_START_TIMEOUT_MS;
|
|
38517
39162
|
var init_session_host = __esm({
|
|
38518
39163
|
"src/session-host.ts"() {
|
|
38519
39164
|
"use strict";
|
|
38520
|
-
|
|
38521
|
-
|
|
38522
|
-
|
|
38523
|
-
|
|
39165
|
+
import_child_process11 = require("child_process");
|
|
39166
|
+
fs16 = __toESM(require("fs"));
|
|
39167
|
+
os20 = __toESM(require("os"));
|
|
39168
|
+
path20 = __toESM(require("path"));
|
|
38524
39169
|
init_src();
|
|
39170
|
+
init_dist();
|
|
38525
39171
|
SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
|
|
38526
39172
|
SESSION_HOST_START_TIMEOUT_MS = 15e3;
|
|
38527
39173
|
}
|
|
@@ -38531,28 +39177,29 @@ var init_session_host = __esm({
|
|
|
38531
39177
|
var adhdev_daemon_exports = {};
|
|
38532
39178
|
__export(adhdev_daemon_exports, {
|
|
38533
39179
|
AdhdevDaemon: () => AdhdevDaemon,
|
|
39180
|
+
getDaemonPid: () => getDaemonPid,
|
|
38534
39181
|
isDaemonRunning: () => isDaemonRunning,
|
|
38535
39182
|
stopDaemon: () => stopDaemon
|
|
38536
39183
|
});
|
|
38537
39184
|
function getDaemonPidFile() {
|
|
38538
|
-
const dir =
|
|
38539
|
-
if (!
|
|
38540
|
-
return
|
|
39185
|
+
const dir = path21.join(os21.homedir(), ".adhdev");
|
|
39186
|
+
if (!fs17.existsSync(dir)) fs17.mkdirSync(dir, { recursive: true });
|
|
39187
|
+
return path21.join(dir, "daemon.pid");
|
|
38541
39188
|
}
|
|
38542
39189
|
function writeDaemonPid(pid) {
|
|
38543
|
-
|
|
39190
|
+
fs17.writeFileSync(getDaemonPidFile(), String(pid), "utf-8");
|
|
38544
39191
|
}
|
|
38545
39192
|
function removeDaemonPid() {
|
|
38546
39193
|
try {
|
|
38547
|
-
|
|
39194
|
+
fs17.unlinkSync(getDaemonPidFile());
|
|
38548
39195
|
} catch (e) {
|
|
38549
39196
|
}
|
|
38550
39197
|
}
|
|
38551
39198
|
function isDaemonRunning() {
|
|
38552
39199
|
const pidFile = getDaemonPidFile();
|
|
38553
39200
|
try {
|
|
38554
|
-
if (!
|
|
38555
|
-
const pid = parseInt(
|
|
39201
|
+
if (!fs17.existsSync(pidFile)) return false;
|
|
39202
|
+
const pid = parseInt(fs17.readFileSync(pidFile, "utf-8").trim());
|
|
38556
39203
|
process.kill(pid, 0);
|
|
38557
39204
|
return true;
|
|
38558
39205
|
} catch {
|
|
@@ -38560,11 +39207,21 @@ function isDaemonRunning() {
|
|
|
38560
39207
|
return false;
|
|
38561
39208
|
}
|
|
38562
39209
|
}
|
|
39210
|
+
function getDaemonPid() {
|
|
39211
|
+
const pidFile = getDaemonPidFile();
|
|
39212
|
+
try {
|
|
39213
|
+
if (!fs17.existsSync(pidFile)) return null;
|
|
39214
|
+
const pid = parseInt(fs17.readFileSync(pidFile, "utf-8").trim(), 10);
|
|
39215
|
+
return Number.isFinite(pid) ? pid : null;
|
|
39216
|
+
} catch {
|
|
39217
|
+
return null;
|
|
39218
|
+
}
|
|
39219
|
+
}
|
|
38563
39220
|
function stopDaemon() {
|
|
38564
39221
|
const pidFile = getDaemonPidFile();
|
|
38565
39222
|
try {
|
|
38566
|
-
if (!
|
|
38567
|
-
const pid = parseInt(
|
|
39223
|
+
if (!fs17.existsSync(pidFile)) return false;
|
|
39224
|
+
const pid = parseInt(fs17.readFileSync(pidFile, "utf-8").trim());
|
|
38568
39225
|
process.kill(pid, "SIGTERM");
|
|
38569
39226
|
removeDaemonPid();
|
|
38570
39227
|
return true;
|
|
@@ -38573,7 +39230,7 @@ function stopDaemon() {
|
|
|
38573
39230
|
return false;
|
|
38574
39231
|
}
|
|
38575
39232
|
}
|
|
38576
|
-
var
|
|
39233
|
+
var os21, fs17, path21, import_http, import_ws3, import_chalk2, pkgVersion, DANGEROUS_PATTERNS, AdhdevDaemon;
|
|
38577
39234
|
var init_adhdev_daemon = __esm({
|
|
38578
39235
|
"src/adhdev-daemon.ts"() {
|
|
38579
39236
|
"use strict";
|
|
@@ -38583,20 +39240,22 @@ var init_adhdev_daemon = __esm({
|
|
|
38583
39240
|
init_screenshot_controller();
|
|
38584
39241
|
init_session_host();
|
|
38585
39242
|
init_dist();
|
|
38586
|
-
|
|
38587
|
-
|
|
38588
|
-
|
|
39243
|
+
os21 = __toESM(require("os"));
|
|
39244
|
+
fs17 = __toESM(require("fs"));
|
|
39245
|
+
path21 = __toESM(require("path"));
|
|
39246
|
+
import_http = require("http");
|
|
39247
|
+
import_ws3 = require("ws");
|
|
38589
39248
|
import_chalk2 = __toESM(require("chalk"));
|
|
38590
|
-
pkgVersion = "0.8.
|
|
39249
|
+
pkgVersion = "0.8.9";
|
|
38591
39250
|
if (pkgVersion === "unknown") {
|
|
38592
39251
|
try {
|
|
38593
39252
|
const possiblePaths = [
|
|
38594
|
-
|
|
38595
|
-
|
|
39253
|
+
path21.join(__dirname, "..", "package.json"),
|
|
39254
|
+
path21.join(__dirname, "package.json")
|
|
38596
39255
|
];
|
|
38597
39256
|
for (const p of possiblePaths) {
|
|
38598
39257
|
try {
|
|
38599
|
-
const data = JSON.parse(
|
|
39258
|
+
const data = JSON.parse(fs17.readFileSync(p, "utf-8"));
|
|
38600
39259
|
if (data.version) {
|
|
38601
39260
|
pkgVersion = data.version;
|
|
38602
39261
|
break;
|
|
@@ -38620,6 +39279,9 @@ var init_adhdev_daemon = __esm({
|
|
|
38620
39279
|
/\b:\/\)\s*\{/
|
|
38621
39280
|
];
|
|
38622
39281
|
AdhdevDaemon = class {
|
|
39282
|
+
localHttpServer = null;
|
|
39283
|
+
localWss = null;
|
|
39284
|
+
localClients = /* @__PURE__ */ new Set();
|
|
38623
39285
|
serverConn = null;
|
|
38624
39286
|
p2p = null;
|
|
38625
39287
|
screenshotController = null;
|
|
@@ -38647,11 +39309,7 @@ var init_adhdev_daemon = __esm({
|
|
|
38647
39309
|
return mode === "chat" || mode === "terminal";
|
|
38648
39310
|
}
|
|
38649
39311
|
async start(options = {}) {
|
|
38650
|
-
|
|
38651
|
-
const { installGlobalInterceptor: installGlobalInterceptor2 } = require("./logging/logger");
|
|
38652
|
-
installGlobalInterceptor2();
|
|
38653
|
-
} catch {
|
|
38654
|
-
}
|
|
39312
|
+
installGlobalInterceptor();
|
|
38655
39313
|
process.on("uncaughtException", (err) => {
|
|
38656
39314
|
LOG.error("Daemon", `Uncaught exception: ${err?.message}
|
|
38657
39315
|
${err?.stack || ""}`);
|
|
@@ -38727,6 +39385,7 @@ ${err?.stack || ""}`);
|
|
|
38727
39385
|
}
|
|
38728
39386
|
});
|
|
38729
39387
|
await this.components.cliManager.restoreHostedSessions();
|
|
39388
|
+
await this.startLocalIpcServer();
|
|
38730
39389
|
this.components.providerLoader.fetchLatest().then(({ updated }) => {
|
|
38731
39390
|
if (updated) {
|
|
38732
39391
|
this.components.providerLoader.reload();
|
|
@@ -38743,8 +39402,8 @@ ${err?.stack || ""}`);
|
|
|
38743
39402
|
cliInfo: {
|
|
38744
39403
|
type: "adhdev-daemon",
|
|
38745
39404
|
version: pkgVersion,
|
|
38746
|
-
platform:
|
|
38747
|
-
hostname:
|
|
39405
|
+
platform: os21.platform(),
|
|
39406
|
+
hostname: os21.hostname(),
|
|
38748
39407
|
machineId: config2.machineId,
|
|
38749
39408
|
instanceId
|
|
38750
39409
|
}
|
|
@@ -38883,6 +39542,7 @@ ${err?.stack || ""}`);
|
|
|
38883
39542
|
const cdpManagers = this.components?.cdpManagers;
|
|
38884
39543
|
const cdpStatus = cdpManagers && cdpManagers.size > 0 ? `\u2705 ${[...cdpManagers.entries()].map(([k, m]) => `${k}:${m.getPort()}`).join(", ")}` : "\u274C not connected";
|
|
38885
39544
|
console.log(` ${import_chalk2.default.bold("CDP:")} ${cdpStatus}`);
|
|
39545
|
+
console.log(` ${import_chalk2.default.bold("IPC:")} ${import_chalk2.default.cyan(`ws://127.0.0.1:${this.localPort}${DAEMON_WS_PATH}`)}`);
|
|
38886
39546
|
console.log(` ${import_chalk2.default.bold("P2P:")} ${this.p2p?.isAvailable ? "\u2705 available" : "\u274C unavailable"}`);
|
|
38887
39547
|
const providerCount = this.components?.providerLoader.getAll().length ?? 0;
|
|
38888
39548
|
console.log(` ${import_chalk2.default.bold("Providers:")} ${providerCount > 0 ? `\u2705 ${providerCount} loaded` : "\u274C not loaded"}`);
|
|
@@ -38927,8 +39587,8 @@ ${err?.stack || ""}`);
|
|
|
38927
39587
|
return;
|
|
38928
39588
|
}
|
|
38929
39589
|
const cwd = args?.dir || process.cwd();
|
|
38930
|
-
const { exec:
|
|
38931
|
-
|
|
39590
|
+
const { exec: exec3 } = require("child_process");
|
|
39591
|
+
exec3(cmdStr, { cwd, timeout: 6e4 }, (err, stdout, stderr) => {
|
|
38932
39592
|
if (!this.serverConn) return;
|
|
38933
39593
|
if (err) this.serverConn.sendMessage("log", { message: `\u274C ${err.message}`, level: "error" });
|
|
38934
39594
|
else {
|
|
@@ -38999,6 +39659,135 @@ ${err?.stack || ""}`);
|
|
|
38999
39659
|
return { success: false, error: e.message };
|
|
39000
39660
|
}
|
|
39001
39661
|
}
|
|
39662
|
+
async startLocalIpcServer() {
|
|
39663
|
+
if (this.localHttpServer || this.localWss) return;
|
|
39664
|
+
this.localHttpServer = (0, import_http.createServer)((req, res) => {
|
|
39665
|
+
const url2 = req.url || "/";
|
|
39666
|
+
if (req.method === "GET" && url2 === "/health") {
|
|
39667
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
39668
|
+
res.end(JSON.stringify({
|
|
39669
|
+
ok: true,
|
|
39670
|
+
pid: process.pid,
|
|
39671
|
+
wsPath: DAEMON_WS_PATH,
|
|
39672
|
+
port: this.localPort
|
|
39673
|
+
}));
|
|
39674
|
+
return;
|
|
39675
|
+
}
|
|
39676
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
39677
|
+
res.end(JSON.stringify({ error: "Not found" }));
|
|
39678
|
+
});
|
|
39679
|
+
this.localWss = new import_ws3.WebSocketServer({ noServer: true });
|
|
39680
|
+
this.localWss.on("connection", (ws) => this.handleLocalIpcConnection(ws));
|
|
39681
|
+
this.localHttpServer.on("upgrade", (req, socket, head) => {
|
|
39682
|
+
const wsUrl = new URL(req.url || "/", `http://${req.headers.host || "127.0.0.1"}`);
|
|
39683
|
+
if (wsUrl.pathname !== DAEMON_WS_PATH) {
|
|
39684
|
+
socket.write("HTTP/1.1 404 Not Found\r\n\r\n");
|
|
39685
|
+
socket.destroy();
|
|
39686
|
+
return;
|
|
39687
|
+
}
|
|
39688
|
+
this.localWss.handleUpgrade(req, socket, head, (ws) => {
|
|
39689
|
+
this.localWss.emit("connection", ws, req);
|
|
39690
|
+
});
|
|
39691
|
+
});
|
|
39692
|
+
await new Promise((resolve13, reject) => {
|
|
39693
|
+
const cleanup = () => {
|
|
39694
|
+
this.localHttpServer?.off("error", onError);
|
|
39695
|
+
this.localHttpServer?.off("listening", onListening);
|
|
39696
|
+
};
|
|
39697
|
+
const onError = (error48) => {
|
|
39698
|
+
cleanup();
|
|
39699
|
+
reject(error48);
|
|
39700
|
+
};
|
|
39701
|
+
const onListening = () => {
|
|
39702
|
+
cleanup();
|
|
39703
|
+
resolve13();
|
|
39704
|
+
};
|
|
39705
|
+
this.localHttpServer.once("error", onError);
|
|
39706
|
+
this.localHttpServer.once("listening", onListening);
|
|
39707
|
+
this.localHttpServer.listen(this.localPort, "127.0.0.1");
|
|
39708
|
+
});
|
|
39709
|
+
LOG.info("IPC", `Local IPC listening on ws://127.0.0.1:${this.localPort}${DAEMON_WS_PATH}`);
|
|
39710
|
+
}
|
|
39711
|
+
handleLocalIpcConnection(ws) {
|
|
39712
|
+
this.localClients.add(ws);
|
|
39713
|
+
this.sendLocalIpcWelcome(ws);
|
|
39714
|
+
ws.on("message", (raw) => {
|
|
39715
|
+
void this.handleLocalIpcMessage(ws, raw.toString());
|
|
39716
|
+
});
|
|
39717
|
+
ws.on("close", () => {
|
|
39718
|
+
this.localClients.delete(ws);
|
|
39719
|
+
});
|
|
39720
|
+
ws.on("error", () => {
|
|
39721
|
+
this.localClients.delete(ws);
|
|
39722
|
+
});
|
|
39723
|
+
}
|
|
39724
|
+
sendLocalIpcWelcome(ws) {
|
|
39725
|
+
try {
|
|
39726
|
+
const cliAgents = this.components ? this.components.instanceManager.collectAllStates().filter((state) => state?.category === "cli").map((state) => String(state?.instanceId || "")).filter(Boolean) : [];
|
|
39727
|
+
ws.send(JSON.stringify({
|
|
39728
|
+
type: "daemon:welcome",
|
|
39729
|
+
payload: {
|
|
39730
|
+
daemonVersion: pkgVersion,
|
|
39731
|
+
serverConnected: this.serverConn?.isConnected() ?? false,
|
|
39732
|
+
cdpConnected: (this.components?.cdpManagers.size || 0) > 0,
|
|
39733
|
+
localPort: this.localPort,
|
|
39734
|
+
cliAgents
|
|
39735
|
+
}
|
|
39736
|
+
}));
|
|
39737
|
+
} catch (error48) {
|
|
39738
|
+
LOG.warn("IPC", `Failed to send welcome: ${error48?.message || error48}`);
|
|
39739
|
+
}
|
|
39740
|
+
}
|
|
39741
|
+
async handleLocalIpcMessage(ws, raw) {
|
|
39742
|
+
let msg;
|
|
39743
|
+
try {
|
|
39744
|
+
msg = JSON.parse(raw);
|
|
39745
|
+
} catch {
|
|
39746
|
+
return;
|
|
39747
|
+
}
|
|
39748
|
+
if (!msg || typeof msg !== "object") return;
|
|
39749
|
+
if (msg.type === "ext:register") {
|
|
39750
|
+
this.sendLocalIpcWelcome(ws);
|
|
39751
|
+
return;
|
|
39752
|
+
}
|
|
39753
|
+
if (msg.type !== "ext:command") return;
|
|
39754
|
+
const payload = msg.payload && typeof msg.payload === "object" ? msg.payload : {};
|
|
39755
|
+
const command = typeof payload.command === "string" ? payload.command : "";
|
|
39756
|
+
const args = payload.args && typeof payload.args === "object" ? payload.args : {};
|
|
39757
|
+
const requestId = typeof payload.requestId === "string" ? payload.requestId : typeof payload.messageId === "string" ? payload.messageId : `ipc-${Date.now()}`;
|
|
39758
|
+
if (!command) {
|
|
39759
|
+
ws.send(JSON.stringify({
|
|
39760
|
+
type: "ext:command_result",
|
|
39761
|
+
payload: {
|
|
39762
|
+
requestId,
|
|
39763
|
+
success: false,
|
|
39764
|
+
error: "command required"
|
|
39765
|
+
}
|
|
39766
|
+
}));
|
|
39767
|
+
return;
|
|
39768
|
+
}
|
|
39769
|
+
try {
|
|
39770
|
+
const result = await this.components.router.execute(command, args, "ipc");
|
|
39771
|
+
ws.send(JSON.stringify({
|
|
39772
|
+
type: "ext:command_result",
|
|
39773
|
+
payload: {
|
|
39774
|
+
requestId,
|
|
39775
|
+
success: !!result?.success,
|
|
39776
|
+
result,
|
|
39777
|
+
error: result?.success ? void 0 : result?.error
|
|
39778
|
+
}
|
|
39779
|
+
}));
|
|
39780
|
+
} catch (error48) {
|
|
39781
|
+
ws.send(JSON.stringify({
|
|
39782
|
+
type: "ext:command_result",
|
|
39783
|
+
payload: {
|
|
39784
|
+
requestId,
|
|
39785
|
+
success: false,
|
|
39786
|
+
error: error48?.message || String(error48)
|
|
39787
|
+
}
|
|
39788
|
+
}));
|
|
39789
|
+
}
|
|
39790
|
+
}
|
|
39002
39791
|
// ─── executeDaemonCommand / stopIde: Removed — now in DaemonCommandRouter ───
|
|
39003
39792
|
sendResult(msg, success2, extra) {
|
|
39004
39793
|
if (!msg.id) return;
|
|
@@ -39039,6 +39828,23 @@ ${err?.stack || ""}`);
|
|
|
39039
39828
|
this.serverConn?.disconnect();
|
|
39040
39829
|
} catch {
|
|
39041
39830
|
}
|
|
39831
|
+
try {
|
|
39832
|
+
for (const client of this.localClients) {
|
|
39833
|
+
client.close();
|
|
39834
|
+
}
|
|
39835
|
+
this.localClients.clear();
|
|
39836
|
+
this.localWss?.close();
|
|
39837
|
+
this.localWss = null;
|
|
39838
|
+
await new Promise((resolve13) => {
|
|
39839
|
+
if (!this.localHttpServer) {
|
|
39840
|
+
resolve13();
|
|
39841
|
+
return;
|
|
39842
|
+
}
|
|
39843
|
+
this.localHttpServer.close(() => resolve13());
|
|
39844
|
+
this.localHttpServer = null;
|
|
39845
|
+
});
|
|
39846
|
+
} catch {
|
|
39847
|
+
}
|
|
39042
39848
|
removeDaemonPid();
|
|
39043
39849
|
console.log(import_chalk2.default.green(" \u2713 ADHDev Daemon stopped.\n"));
|
|
39044
39850
|
if (exitProcess) {
|
|
@@ -39112,10 +39918,10 @@ async function runWizard(options = {}) {
|
|
|
39112
39918
|
}
|
|
39113
39919
|
async function checkForUpdate() {
|
|
39114
39920
|
try {
|
|
39115
|
-
const { execSync:
|
|
39921
|
+
const { execSync: execSync7 } = await import("child_process");
|
|
39116
39922
|
let currentVersion = null;
|
|
39117
39923
|
try {
|
|
39118
|
-
currentVersion =
|
|
39924
|
+
currentVersion = execSync7("adhdev --version", {
|
|
39119
39925
|
encoding: "utf-8",
|
|
39120
39926
|
timeout: 3e3,
|
|
39121
39927
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -39125,7 +39931,7 @@ async function checkForUpdate() {
|
|
|
39125
39931
|
}
|
|
39126
39932
|
let latestVersion = null;
|
|
39127
39933
|
try {
|
|
39128
|
-
latestVersion =
|
|
39934
|
+
latestVersion = execSync7("npm show adhdev version", {
|
|
39129
39935
|
encoding: "utf-8",
|
|
39130
39936
|
timeout: 5e3,
|
|
39131
39937
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -39147,7 +39953,7 @@ async function checkForUpdate() {
|
|
|
39147
39953
|
}
|
|
39148
39954
|
const spinner = (await import("ora")).default("Updating adhdev CLI...").start();
|
|
39149
39955
|
try {
|
|
39150
|
-
|
|
39956
|
+
execSync7("npm install -g adhdev@latest", {
|
|
39151
39957
|
encoding: "utf-8",
|
|
39152
39958
|
timeout: 6e4,
|
|
39153
39959
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -39203,11 +40009,12 @@ async function quickSetup() {
|
|
|
39203
40009
|
console.log(` ${import_chalk3.default.bold("Status:")} ${loginResult ? import_chalk3.default.green("Ready to connect") : import_chalk3.default.yellow("Login required")}`);
|
|
39204
40010
|
console.log();
|
|
39205
40011
|
console.log(import_chalk3.default.gray(" Next steps:"));
|
|
39206
|
-
console.log(import_chalk3.default.gray(` ${loginResult ? "adhdev daemon \u2014 Start the main daemon (
|
|
40012
|
+
console.log(import_chalk3.default.gray(` ${loginResult ? "adhdev daemon \u2014 Start the main daemon (IDE / remote features)" : "adhdev setup \u2014 Sign in to finish setup and enable the daemon"}`));
|
|
39207
40013
|
console.log(import_chalk3.default.gray(" adhdev launch cursor \u2014 Launch Cursor IDE with remote control"));
|
|
39208
40014
|
console.log(import_chalk3.default.gray(" adhdev launch windsurf \u2014 Launch Windsurf IDE with remote control"));
|
|
39209
|
-
console.log(import_chalk3.default.gray(" adhdev
|
|
39210
|
-
console.log(import_chalk3.default.gray(" adhdev launch
|
|
40015
|
+
console.log(import_chalk3.default.gray(" adhdev daemon \u2014 Keep the daemon running for CLI agent launch"));
|
|
40016
|
+
console.log(import_chalk3.default.gray(" adhdev launch gemini \u2014 Start Gemini CLI agent"));
|
|
40017
|
+
console.log(import_chalk3.default.gray(" adhdev launch claude \u2014 Start Claude Code agent"));
|
|
39211
40018
|
console.log(import_chalk3.default.gray(" adhdev status \u2014 Check setup status"));
|
|
39212
40019
|
console.log();
|
|
39213
40020
|
console.log(import_chalk3.default.cyan(" Dashboard: https://adhf.dev/dashboard"));
|
|
@@ -39230,16 +40037,16 @@ async function loginFlow() {
|
|
|
39230
40037
|
let verificationUrl;
|
|
39231
40038
|
try {
|
|
39232
40039
|
const config2 = loadConfig();
|
|
39233
|
-
const
|
|
40040
|
+
const os22 = await import("os");
|
|
39234
40041
|
const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
|
|
39235
40042
|
method: "POST",
|
|
39236
40043
|
headers: { "Content-Type": "application/json" },
|
|
39237
40044
|
body: JSON.stringify({
|
|
39238
40045
|
clientMachineId: config2.machineId,
|
|
39239
40046
|
registeredMachineId: config2.registeredMachineId,
|
|
39240
|
-
hostname:
|
|
39241
|
-
platform:
|
|
39242
|
-
arch:
|
|
40047
|
+
hostname: os22.hostname(),
|
|
40048
|
+
platform: os22.platform(),
|
|
40049
|
+
arch: os22.arch()
|
|
39243
40050
|
})
|
|
39244
40051
|
});
|
|
39245
40052
|
if (!res.ok) {
|
|
@@ -39337,20 +40144,20 @@ async function startDaemonFlow() {
|
|
|
39337
40144
|
try {
|
|
39338
40145
|
const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
39339
40146
|
const daemon = new AdhdevDaemon2();
|
|
39340
|
-
const { execSync:
|
|
39341
|
-
const
|
|
39342
|
-
const
|
|
39343
|
-
const
|
|
39344
|
-
const platform11 =
|
|
40147
|
+
const { execSync: execSync7 } = await import("child_process");
|
|
40148
|
+
const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
40149
|
+
const logPath = getCurrentDaemonLogPath2();
|
|
40150
|
+
const os22 = await import("os");
|
|
40151
|
+
const platform11 = os22.platform();
|
|
39345
40152
|
try {
|
|
39346
40153
|
if (platform11 === "win32") {
|
|
39347
|
-
|
|
40154
|
+
execSync7("start /B adhdev daemon >NUL 2>&1", {
|
|
39348
40155
|
timeout: 3e3,
|
|
39349
40156
|
stdio: "ignore",
|
|
39350
40157
|
shell: "cmd.exe"
|
|
39351
40158
|
});
|
|
39352
40159
|
} else {
|
|
39353
|
-
|
|
40160
|
+
execSync7("nohup adhdev daemon >/dev/null 2>&1 &", {
|
|
39354
40161
|
timeout: 3e3,
|
|
39355
40162
|
stdio: "ignore"
|
|
39356
40163
|
});
|
|
@@ -39398,7 +40205,7 @@ async function installCliOnly() {
|
|
|
39398
40205
|
console.log(import_chalk3.default.gray(" The `adhdev` command lets you:"));
|
|
39399
40206
|
console.log(import_chalk3.default.gray(" \u2022 Start the main daemon (adhdev daemon)"));
|
|
39400
40207
|
console.log(import_chalk3.default.gray(" \u2022 Launch IDE with CDP (adhdev launch <ide>)"));
|
|
39401
|
-
console.log(import_chalk3.default.gray(" \u2022 Start CLI agents (adhdev launch <agent>)"));
|
|
40208
|
+
console.log(import_chalk3.default.gray(" \u2022 Start CLI agents (adhdev daemon && adhdev launch <agent>)"));
|
|
39402
40209
|
console.log(import_chalk3.default.gray(" \u2022 Check setup status (adhdev status)"));
|
|
39403
40210
|
console.log();
|
|
39404
40211
|
if (currentVersion) {
|