adhdev 0.5.14 → 0.5.16
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 +122 -38
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +122 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16737,7 +16737,9 @@ var require_dist = __commonJS({
|
|
|
16737
16737
|
installExtensions: () => installExtensions,
|
|
16738
16738
|
installGlobalInterceptor: () => installGlobalInterceptor,
|
|
16739
16739
|
isExtensionInstalled: () => isExtensionInstalled,
|
|
16740
|
+
isIdeRunning: () => isIdeRunning,
|
|
16740
16741
|
isSetupComplete: () => isSetupComplete2,
|
|
16742
|
+
killIdeProcess: () => killIdeProcess,
|
|
16741
16743
|
launchIDE: () => launchIDE,
|
|
16742
16744
|
launchWithCdp: () => launchWithCdp,
|
|
16743
16745
|
loadConfig: () => loadConfig3,
|
|
@@ -16836,13 +16838,11 @@ var require_dist = __commonJS({
|
|
|
16836
16838
|
}
|
|
16837
16839
|
}
|
|
16838
16840
|
function checkPathExists(paths) {
|
|
16841
|
+
const home = (0, import_os2.homedir)();
|
|
16839
16842
|
for (const p of paths) {
|
|
16840
16843
|
if (p.includes("*")) {
|
|
16841
|
-
const
|
|
16842
|
-
const
|
|
16843
|
-
const suffix = p.substring(starIdx + 1);
|
|
16844
|
-
const homeNormalized = home.replace(/\//g, "\\\\");
|
|
16845
|
-
const resolved = homeNormalized + suffix;
|
|
16844
|
+
const username = home.split(/[\\/]/).pop() || "";
|
|
16845
|
+
const resolved = p.replace("*", username);
|
|
16846
16846
|
if ((0, import_fs22.existsSync)(resolved)) return resolved;
|
|
16847
16847
|
} else {
|
|
16848
16848
|
if ((0, import_fs22.existsSync)(p)) return p;
|
|
@@ -22315,8 +22315,8 @@ var require_dist = __commonJS({
|
|
|
22315
22315
|
if (!targetType) throw new Error("cliType or ideType required");
|
|
22316
22316
|
const isIde = this.deps.cdpManagers.has(targetType) || this.deps.providerLoader.getMeta(targetType)?.category === "ide";
|
|
22317
22317
|
if (isIde) {
|
|
22318
|
-
await this.stopIde(targetType);
|
|
22319
|
-
const launchResult = await this.executeDaemonCommand("launch_ide", { ideType: targetType, enableCdp: true });
|
|
22318
|
+
await this.stopIde(targetType, true);
|
|
22319
|
+
const launchResult = await this.executeDaemonCommand("launch_ide", { ideType: targetType, enableCdp: true, workspace: args?.workspace });
|
|
22320
22320
|
return { success: true, restarted: true, ideType: targetType, launch: launchResult };
|
|
22321
22321
|
}
|
|
22322
22322
|
return this.deps.cliManager.handleCliCommand(cmd, args);
|
|
@@ -22325,15 +22325,16 @@ var require_dist = __commonJS({
|
|
|
22325
22325
|
case "stop_ide": {
|
|
22326
22326
|
const ideType = args?.ideType;
|
|
22327
22327
|
if (!ideType) throw new Error("ideType required");
|
|
22328
|
-
|
|
22329
|
-
|
|
22328
|
+
const killProcess = args?.killProcess !== false;
|
|
22329
|
+
await this.stopIde(ideType, killProcess);
|
|
22330
|
+
return { success: true, ideType, stopped: true, processKilled: killProcess };
|
|
22330
22331
|
}
|
|
22331
22332
|
// ─── IDE restart ───
|
|
22332
22333
|
case "restart_ide": {
|
|
22333
22334
|
const ideType = args?.ideType;
|
|
22334
22335
|
if (!ideType) throw new Error("ideType required");
|
|
22335
|
-
await this.stopIde(ideType);
|
|
22336
|
-
const launchResult = await this.executeDaemonCommand("launch_ide", { ideType, enableCdp: true });
|
|
22336
|
+
await this.stopIde(ideType, true);
|
|
22337
|
+
const launchResult = await this.executeDaemonCommand("launch_ide", { ideType, enableCdp: true, workspace: args?.workspace });
|
|
22337
22338
|
return { success: true, ideType, restarted: true, launch: launchResult };
|
|
22338
22339
|
}
|
|
22339
22340
|
// ─── IDE launch + CDP connect ───
|
|
@@ -22379,10 +22380,48 @@ var require_dist = __commonJS({
|
|
|
22379
22380
|
}
|
|
22380
22381
|
return { success: result.success, ...result };
|
|
22381
22382
|
}
|
|
22382
|
-
// ───
|
|
22383
|
+
// ─── Detect IDEs ───
|
|
22383
22384
|
case "detect_ides": {
|
|
22384
|
-
|
|
22385
|
-
|
|
22385
|
+
const results = await detectIDEs();
|
|
22386
|
+
this.deps.detectedIdes.value = results;
|
|
22387
|
+
return { success: true, detectedInfo: results };
|
|
22388
|
+
}
|
|
22389
|
+
// ─── Set User Name ───
|
|
22390
|
+
case "set_user_name": {
|
|
22391
|
+
const name = args?.userName;
|
|
22392
|
+
if (!name || typeof name !== "string") throw new Error("userName required");
|
|
22393
|
+
updateConfig2({ userName: name });
|
|
22394
|
+
return { success: true, userName: name };
|
|
22395
|
+
}
|
|
22396
|
+
// ─── Daemon Self-Upgrade ───
|
|
22397
|
+
case "daemon_upgrade": {
|
|
22398
|
+
LOG5.info("Upgrade", "Remote upgrade requested from dashboard");
|
|
22399
|
+
try {
|
|
22400
|
+
const { execSync: execSync7 } = await import("child_process");
|
|
22401
|
+
const latest = execSync7("npm view adhdev version", { encoding: "utf-8", timeout: 1e4 }).trim();
|
|
22402
|
+
LOG5.info("Upgrade", `Latest available: v${latest}`);
|
|
22403
|
+
execSync7("npm install -g adhdev@latest", {
|
|
22404
|
+
encoding: "utf-8",
|
|
22405
|
+
timeout: 6e4,
|
|
22406
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
22407
|
+
});
|
|
22408
|
+
LOG5.info("Upgrade", `\u2705 Upgraded to v${latest}`);
|
|
22409
|
+
setTimeout(() => {
|
|
22410
|
+
LOG5.info("Upgrade", "Restarting daemon with new version...");
|
|
22411
|
+
const { spawn: spawn3 } = require("child_process");
|
|
22412
|
+
const child = spawn3(process.execPath, [process.argv[1], "daemon", "-p", "19222"], {
|
|
22413
|
+
detached: true,
|
|
22414
|
+
stdio: "ignore",
|
|
22415
|
+
env: { ...process.env }
|
|
22416
|
+
});
|
|
22417
|
+
child.unref();
|
|
22418
|
+
process.exit(0);
|
|
22419
|
+
}, 3e3);
|
|
22420
|
+
return { success: true, upgraded: true, version: latest };
|
|
22421
|
+
} catch (e) {
|
|
22422
|
+
LOG5.error("Upgrade", `Failed: ${e.message}`);
|
|
22423
|
+
return { success: false, error: e.message };
|
|
22424
|
+
}
|
|
22386
22425
|
}
|
|
22387
22426
|
// ─── Machine Settings ───
|
|
22388
22427
|
case "set_machine_nickname": {
|
|
@@ -22390,38 +22429,85 @@ var require_dist = __commonJS({
|
|
|
22390
22429
|
updateConfig2({ machineNickname: nickname || null });
|
|
22391
22430
|
return { success: true };
|
|
22392
22431
|
}
|
|
22432
|
+
default:
|
|
22433
|
+
break;
|
|
22393
22434
|
}
|
|
22394
22435
|
return null;
|
|
22395
22436
|
}
|
|
22396
22437
|
/**
|
|
22397
|
-
* IDE stop: CDP disconnect +
|
|
22438
|
+
* IDE stop: CDP disconnect + InstanceManager cleanup + optionally kill OS process
|
|
22398
22439
|
*/
|
|
22399
|
-
async stopIde(ideType) {
|
|
22400
|
-
const
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
} catch {
|
|
22440
|
+
async stopIde(ideType, killProcess = false) {
|
|
22441
|
+
const cdpKeysToRemove = [];
|
|
22442
|
+
for (const key of this.deps.cdpManagers.keys()) {
|
|
22443
|
+
if (key === ideType || key.startsWith(`${ideType}_`)) {
|
|
22444
|
+
cdpKeysToRemove.push(key);
|
|
22405
22445
|
}
|
|
22406
|
-
this.deps.cdpManagers.delete(ideType);
|
|
22407
|
-
LOG5.info("StopIDE", `CDP disconnected: ${ideType}`);
|
|
22408
22446
|
}
|
|
22409
|
-
const
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22447
|
+
for (const key of cdpKeysToRemove) {
|
|
22448
|
+
const cdp = this.deps.cdpManagers.get(key);
|
|
22449
|
+
if (cdp) {
|
|
22450
|
+
try {
|
|
22451
|
+
cdp.disconnect();
|
|
22452
|
+
} catch {
|
|
22453
|
+
}
|
|
22454
|
+
this.deps.cdpManagers.delete(key);
|
|
22455
|
+
LOG5.info("StopIDE", `CDP disconnected: ${key}`);
|
|
22414
22456
|
}
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22457
|
+
}
|
|
22458
|
+
const keysToRemove = [];
|
|
22459
|
+
for (const key of this.deps.instanceManager.instances?.keys?.() || []) {
|
|
22460
|
+
if (key === `ide:${ideType}` || typeof key === "string" && key.startsWith(`ide:${ideType}_`)) {
|
|
22461
|
+
keysToRemove.push(key);
|
|
22462
|
+
}
|
|
22463
|
+
}
|
|
22464
|
+
for (const instanceKey of keysToRemove) {
|
|
22465
|
+
const ideInstance = this.deps.instanceManager.getInstance(instanceKey);
|
|
22466
|
+
if (ideInstance) {
|
|
22467
|
+
if (ideInstance.getInstanceId) {
|
|
22468
|
+
this.deps.instanceIdMap.delete(ideInstance.getInstanceId());
|
|
22469
|
+
}
|
|
22470
|
+
if (ideInstance.getExtensionInstances) {
|
|
22471
|
+
for (const ext of ideInstance.getExtensionInstances()) {
|
|
22472
|
+
if (ext.getInstanceId) this.deps.instanceIdMap.delete(ext.getInstanceId());
|
|
22473
|
+
}
|
|
22474
|
+
}
|
|
22475
|
+
this.deps.instanceManager.removeInstance(instanceKey);
|
|
22476
|
+
LOG5.info("StopIDE", `Instance removed: ${instanceKey}`);
|
|
22477
|
+
}
|
|
22478
|
+
}
|
|
22479
|
+
if (keysToRemove.length === 0) {
|
|
22480
|
+
const instanceKey = `ide:${ideType}`;
|
|
22481
|
+
const ideInstance = this.deps.instanceManager.getInstance(instanceKey);
|
|
22482
|
+
if (ideInstance) {
|
|
22483
|
+
if (ideInstance.getInstanceId) {
|
|
22484
|
+
this.deps.instanceIdMap.delete(ideInstance.getInstanceId());
|
|
22418
22485
|
}
|
|
22486
|
+
if (ideInstance.getExtensionInstances) {
|
|
22487
|
+
for (const ext of ideInstance.getExtensionInstances()) {
|
|
22488
|
+
if (ext.getInstanceId) this.deps.instanceIdMap.delete(ext.getInstanceId());
|
|
22489
|
+
}
|
|
22490
|
+
}
|
|
22491
|
+
this.deps.instanceManager.removeInstance(instanceKey);
|
|
22492
|
+
LOG5.info("StopIDE", `Instance removed: ${instanceKey}`);
|
|
22493
|
+
}
|
|
22494
|
+
}
|
|
22495
|
+
if (killProcess) {
|
|
22496
|
+
const running = isIdeRunning(ideType);
|
|
22497
|
+
if (running) {
|
|
22498
|
+
LOG5.info("StopIDE", `Killing IDE process: ${ideType}`);
|
|
22499
|
+
const killed = await killIdeProcess(ideType);
|
|
22500
|
+
if (killed) {
|
|
22501
|
+
LOG5.info("StopIDE", `\u2705 Process killed: ${ideType}`);
|
|
22502
|
+
} else {
|
|
22503
|
+
LOG5.warn("StopIDE", `\u26A0 Could not kill process: ${ideType} (may need manual intervention)`);
|
|
22504
|
+
}
|
|
22505
|
+
} else {
|
|
22506
|
+
LOG5.info("StopIDE", `Process not running: ${ideType}`);
|
|
22419
22507
|
}
|
|
22420
|
-
this.deps.instanceManager.removeInstance(instanceKey);
|
|
22421
|
-
LOG5.info("StopIDE", `Instance removed: ${instanceKey}`);
|
|
22422
22508
|
}
|
|
22423
22509
|
this.deps.onStatusChange?.();
|
|
22424
|
-
LOG5.info("StopIDE", `IDE stopped: ${ideType}`);
|
|
22510
|
+
LOG5.info("StopIDE", `IDE stopped: ${ideType} (processKill=${killProcess})`);
|
|
22425
22511
|
}
|
|
22426
22512
|
};
|
|
22427
22513
|
var os10 = __toESM2(require("os"));
|
|
@@ -22608,7 +22694,6 @@ var require_dist = __commonJS({
|
|
|
22608
22694
|
peers: p2p?.connectedPeerCount || 0,
|
|
22609
22695
|
screenshotActive: p2p?.screenshotActive || false
|
|
22610
22696
|
},
|
|
22611
|
-
cdpConnected: [...cdpManagers.values()].some((c) => c.isConnected),
|
|
22612
22697
|
connectedExtensions: [],
|
|
22613
22698
|
detectedIdes: this.deps.detectedIdes || [],
|
|
22614
22699
|
availableProviders: this.deps.providerLoader.getAll().map((p) => ({
|
|
@@ -22650,7 +22735,6 @@ var require_dist = __commonJS({
|
|
|
22650
22735
|
acpName: a.acpName
|
|
22651
22736
|
})),
|
|
22652
22737
|
p2p: payload.p2p,
|
|
22653
|
-
cdpConnected: payload.cdpConnected,
|
|
22654
22738
|
timestamp: now
|
|
22655
22739
|
};
|
|
22656
22740
|
serverConn.sendMessage("status_report", wsPayload);
|
|
@@ -24264,7 +24348,7 @@ var require_dist = __commonJS({
|
|
|
24264
24348
|
return { ...b, text: b.text.slice(0, -3) };
|
|
24265
24349
|
}
|
|
24266
24350
|
return b;
|
|
24267
|
-
}).filter((b) => b.type !== "text" || b.text.trim());
|
|
24351
|
+
}).filter((b) => b.type !== "text" || b.type === "text" && b.text.trim());
|
|
24268
24352
|
if (finalBlocks.length > 0) {
|
|
24269
24353
|
this.messages.push({
|
|
24270
24354
|
role: "assistant",
|
|
@@ -29894,7 +29978,7 @@ var init_adhdev_daemon = __esm({
|
|
|
29894
29978
|
path2 = __toESM(require("path"));
|
|
29895
29979
|
crypto2 = __toESM(require("crypto"));
|
|
29896
29980
|
import_chalk = __toESM(require("chalk"));
|
|
29897
|
-
pkgVersion = "0.5.
|
|
29981
|
+
pkgVersion = "0.5.16";
|
|
29898
29982
|
if (pkgVersion === "unknown") {
|
|
29899
29983
|
try {
|
|
29900
29984
|
const possiblePaths = [
|