adhdev 0.7.31 → 0.7.35
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 +164 -89
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +77 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/session-host-daemon/index.d.mts +1 -1
- package/vendor/session-host-daemon/index.d.ts +1 -1
- package/vendor/session-host-daemon/index.js +36 -4
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +36 -4
- package/vendor/session-host-daemon/index.mjs.map +1 -1
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.d.mts +293 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.d.ts +293 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js +536 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.js.map +1 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs +488 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/index.mjs.map +1 -0
- package/vendor/session-host-daemon/node_modules/@adhdev/session-host-core/package.json +7 -0
package/dist/cli/index.js
CHANGED
|
@@ -505,18 +505,18 @@ function checkPathExists(paths) {
|
|
|
505
505
|
return null;
|
|
506
506
|
}
|
|
507
507
|
async function detectIDEs() {
|
|
508
|
-
const
|
|
508
|
+
const os21 = (0, import_os2.platform)();
|
|
509
509
|
const results = [];
|
|
510
510
|
for (const def of getMergedDefinitions()) {
|
|
511
511
|
const cliPath = findCliCommand(def.cli);
|
|
512
|
-
const appPath = checkPathExists(def.paths[
|
|
512
|
+
const appPath = checkPathExists(def.paths[os21] || []);
|
|
513
513
|
const installed = !!(cliPath || appPath);
|
|
514
514
|
let resolvedCli = cliPath;
|
|
515
|
-
if (!resolvedCli && appPath &&
|
|
515
|
+
if (!resolvedCli && appPath && os21 === "darwin") {
|
|
516
516
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
517
517
|
if ((0, import_fs2.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
518
518
|
}
|
|
519
|
-
if (!resolvedCli && appPath &&
|
|
519
|
+
if (!resolvedCli && appPath && os21 === "win32") {
|
|
520
520
|
const { dirname: dirname10 } = await import("path");
|
|
521
521
|
const appDir = dirname10(appPath);
|
|
522
522
|
const candidates = [
|
|
@@ -583,16 +583,16 @@ async function detectCLIs(providerLoader) {
|
|
|
583
583
|
const results = await Promise.all(
|
|
584
584
|
cliList.map(async (cli) => {
|
|
585
585
|
try {
|
|
586
|
-
const pathResult = await execAsync(`${whichCmd} ${cli.command}
|
|
586
|
+
const pathResult = await execAsync(`${whichCmd} ${cli.command}`);
|
|
587
587
|
if (!pathResult) return { ...cli, installed: false };
|
|
588
588
|
const firstPath = pathResult.split("\n")[0];
|
|
589
589
|
let version2;
|
|
590
590
|
try {
|
|
591
591
|
const versionCommands = [
|
|
592
592
|
cli.versionCommand,
|
|
593
|
-
`${cli.command} --version
|
|
594
|
-
`${cli.command} -V
|
|
595
|
-
`${cli.command} -v
|
|
593
|
+
`${cli.command} --version`,
|
|
594
|
+
`${cli.command} -V`,
|
|
595
|
+
`${cli.command} -v`
|
|
596
596
|
].filter((v2) => !!v2);
|
|
597
597
|
for (const versionCommand of versionCommands) {
|
|
598
598
|
const versionResult = await execAsync(versionCommand, 3e3);
|
|
@@ -2998,10 +2998,13 @@ var init_ide_provider_instance = __esm({
|
|
|
2998
2998
|
if (result?.found && result.x != null && result.y != null) {
|
|
2999
2999
|
const x = result.x;
|
|
3000
3000
|
const y = result.y;
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3001
|
+
if (cdp.send) {
|
|
3002
|
+
await cdp.send("Input.dispatchMouseEvent", { type: "mousePressed", x, y, button: "left", clickCount: 1 });
|
|
3003
|
+
await cdp.send("Input.dispatchMouseEvent", { type: "mouseReleased", x, y, button: "left", clickCount: 1 });
|
|
3004
|
+
LOG.info("IdeInstance", `[IdeInstance:${this.type}] autoApprove: dispatched mouse event at ${x},${y}`);
|
|
3005
|
+
} else {
|
|
3006
|
+
LOG.warn("IdeInstance", `[IdeInstance:${this.type}] autoApprove: cdp.send() not available for coordinate click`);
|
|
3007
|
+
}
|
|
3005
3008
|
}
|
|
3006
3009
|
this.pushEvent({
|
|
3007
3010
|
event: "agent:auto_approved",
|
|
@@ -7482,14 +7485,6 @@ var init_provider_loader = __esm({
|
|
|
7482
7485
|
}
|
|
7483
7486
|
/**
|
|
7484
7487
|
* Get raw provider metadata by type (NO scripts loaded).
|
|
7485
|
-
* Use resolve() when you need scripts (readChat, listModels, etc).
|
|
7486
|
-
* @deprecated Use getMeta() for metadata or resolve() for scripts.
|
|
7487
|
-
*/
|
|
7488
|
-
get(type) {
|
|
7489
|
-
return this.providers.get(type);
|
|
7490
|
-
}
|
|
7491
|
-
/**
|
|
7492
|
-
* Get raw provider metadata by type (NO scripts loaded).
|
|
7493
7488
|
* Safe for: category checks, icon, displayName, targetFilter, cdpPorts.
|
|
7494
7489
|
* NOT safe for: script execution (readChat, listModels, sendMessage).
|
|
7495
7490
|
* Use resolve() when scripts are needed.
|
|
@@ -8512,7 +8507,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
8512
8507
|
}
|
|
8513
8508
|
} else if (plat === "win32") {
|
|
8514
8509
|
try {
|
|
8515
|
-
const
|
|
8510
|
+
const fs16 = require("fs");
|
|
8516
8511
|
const appNameMap = getMacAppIdentifiers();
|
|
8517
8512
|
const appName = appNameMap[ideId];
|
|
8518
8513
|
if (appName) {
|
|
@@ -8521,8 +8516,8 @@ function detectCurrentWorkspace(ideId) {
|
|
|
8521
8516
|
appName,
|
|
8522
8517
|
"storage.json"
|
|
8523
8518
|
);
|
|
8524
|
-
if (
|
|
8525
|
-
const data = JSON.parse(
|
|
8519
|
+
if (fs16.existsSync(storagePath)) {
|
|
8520
|
+
const data = JSON.parse(fs16.readFileSync(storagePath, "utf-8"));
|
|
8526
8521
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
8527
8522
|
if (workspaces.length > 0) {
|
|
8528
8523
|
const recent = workspaces[0];
|
|
@@ -9049,9 +9044,9 @@ var init_router = __esm({
|
|
|
9049
9044
|
LOG.info("Upgrade", "Restarting daemon with new version...");
|
|
9050
9045
|
try {
|
|
9051
9046
|
const path18 = require("path");
|
|
9052
|
-
const
|
|
9047
|
+
const fs16 = require("fs");
|
|
9053
9048
|
const pidFile = path18.join(process.env.HOME || process.env.USERPROFILE || "", ".adhdev", "daemon.pid");
|
|
9054
|
-
if (
|
|
9049
|
+
if (fs16.existsSync(pidFile)) fs16.unlinkSync(pidFile);
|
|
9055
9050
|
} catch {
|
|
9056
9051
|
}
|
|
9057
9052
|
const { spawn: spawn4 } = require("child_process");
|
|
@@ -9103,7 +9098,7 @@ var init_router = __esm({
|
|
|
9103
9098
|
}
|
|
9104
9099
|
}
|
|
9105
9100
|
const keysToRemove = [];
|
|
9106
|
-
for (const key of this.deps.instanceManager.
|
|
9101
|
+
for (const key of this.deps.instanceManager.listInstanceIds()) {
|
|
9107
9102
|
if (key === `ide:${ideType}` || typeof key === "string" && key.startsWith(`ide:${ideType}_`)) {
|
|
9108
9103
|
keysToRemove.push(key);
|
|
9109
9104
|
}
|
|
@@ -18816,12 +18811,12 @@ function findBinary(name) {
|
|
|
18816
18811
|
function isScriptBinary(binaryPath) {
|
|
18817
18812
|
if (!path9.isAbsolute(binaryPath)) return false;
|
|
18818
18813
|
try {
|
|
18819
|
-
const
|
|
18820
|
-
const resolved =
|
|
18814
|
+
const fs16 = require("fs");
|
|
18815
|
+
const resolved = fs16.realpathSync(binaryPath);
|
|
18821
18816
|
const head = Buffer.alloc(8);
|
|
18822
|
-
const fd =
|
|
18823
|
-
|
|
18824
|
-
|
|
18817
|
+
const fd = fs16.openSync(resolved, "r");
|
|
18818
|
+
fs16.readSync(fd, head, 0, 8, 0);
|
|
18819
|
+
fs16.closeSync(fd);
|
|
18825
18820
|
let i = 0;
|
|
18826
18821
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
18827
18822
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -18832,12 +18827,12 @@ function isScriptBinary(binaryPath) {
|
|
|
18832
18827
|
function looksLikeMachOOrElf(filePath) {
|
|
18833
18828
|
if (!path9.isAbsolute(filePath)) return false;
|
|
18834
18829
|
try {
|
|
18835
|
-
const
|
|
18836
|
-
const resolved =
|
|
18830
|
+
const fs16 = require("fs");
|
|
18831
|
+
const resolved = fs16.realpathSync(filePath);
|
|
18837
18832
|
const buf = Buffer.alloc(8);
|
|
18838
|
-
const fd =
|
|
18839
|
-
|
|
18840
|
-
|
|
18833
|
+
const fd = fs16.openSync(resolved, "r");
|
|
18834
|
+
fs16.readSync(fd, buf, 0, 8, 0);
|
|
18835
|
+
fs16.closeSync(fd);
|
|
18841
18836
|
let i = 0;
|
|
18842
18837
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
18843
18838
|
const b2 = buf.subarray(i);
|
|
@@ -18958,14 +18953,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
18958
18953
|
pty2 = require("node-pty");
|
|
18959
18954
|
if (os13.platform() !== "win32") {
|
|
18960
18955
|
try {
|
|
18961
|
-
const
|
|
18956
|
+
const fs16 = require("fs");
|
|
18962
18957
|
const ptyDir = path9.resolve(path9.dirname(require.resolve("node-pty")), "..");
|
|
18963
18958
|
const platformArch = `${os13.platform()}-${os13.arch()}`;
|
|
18964
18959
|
const helper = path9.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
|
|
18965
|
-
if (
|
|
18966
|
-
const stat4 =
|
|
18960
|
+
if (fs16.existsSync(helper)) {
|
|
18961
|
+
const stat4 = fs16.statSync(helper);
|
|
18967
18962
|
if (!(stat4.mode & 73)) {
|
|
18968
|
-
|
|
18963
|
+
fs16.chmodSync(helper, stat4.mode | 493);
|
|
18969
18964
|
LOG.info("CLI", "[node-pty] Fixed spawn-helper permissions");
|
|
18970
18965
|
}
|
|
18971
18966
|
}
|
|
@@ -19157,8 +19152,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
19157
19152
|
LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
|
|
19158
19153
|
}
|
|
19159
19154
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
19160
|
-
|
|
19161
|
-
|
|
19155
|
+
if (isWin) {
|
|
19156
|
+
shellArgs = ["/c", binaryPath, ...allArgs];
|
|
19157
|
+
} else {
|
|
19158
|
+
const fullCmd = [binaryPath, ...allArgs].map(shSingleQuote).join(" ");
|
|
19159
|
+
shellArgs = ["-l", "-c", fullCmd];
|
|
19160
|
+
}
|
|
19162
19161
|
} else {
|
|
19163
19162
|
shellCmd = binaryPath;
|
|
19164
19163
|
shellArgs = allArgs;
|
|
@@ -38551,6 +38550,12 @@ var init_provider_instance_manager = __esm({
|
|
|
38551
38550
|
get size() {
|
|
38552
38551
|
return this.instances.size;
|
|
38553
38552
|
}
|
|
38553
|
+
/**
|
|
38554
|
+
* All Instance IDs (for iteration without exposing the private Map)
|
|
38555
|
+
*/
|
|
38556
|
+
listInstanceIds() {
|
|
38557
|
+
return [...this.instances.keys()];
|
|
38558
|
+
}
|
|
38554
38559
|
// ─── State collect ────────────────────────────────
|
|
38555
38560
|
/**
|
|
38556
38561
|
* all Instance's current status collect
|
|
@@ -42992,7 +42997,20 @@ var init_dist = __esm({
|
|
|
42992
42997
|
request
|
|
42993
42998
|
};
|
|
42994
42999
|
const response = await new Promise((resolve12, reject) => {
|
|
42995
|
-
|
|
43000
|
+
const timeout = setTimeout(() => {
|
|
43001
|
+
this.requestWaiters.delete(requestId);
|
|
43002
|
+
reject(new Error(`Session host request timed out after 30s (${request.type})`));
|
|
43003
|
+
}, 3e4);
|
|
43004
|
+
this.requestWaiters.set(requestId, {
|
|
43005
|
+
resolve: (value) => {
|
|
43006
|
+
clearTimeout(timeout);
|
|
43007
|
+
resolve12(value);
|
|
43008
|
+
},
|
|
43009
|
+
reject: (error48) => {
|
|
43010
|
+
clearTimeout(timeout);
|
|
43011
|
+
reject(error48);
|
|
43012
|
+
}
|
|
43013
|
+
});
|
|
42996
43014
|
this.socket?.write(serializeEnvelope(envelope));
|
|
42997
43015
|
});
|
|
42998
43016
|
return response;
|
|
@@ -43475,8 +43493,8 @@ async function installExtension(ide, extension) {
|
|
|
43475
43493
|
const res = await fetch(extension.vsixUrl);
|
|
43476
43494
|
if (res.ok) {
|
|
43477
43495
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
43478
|
-
const
|
|
43479
|
-
|
|
43496
|
+
const fs16 = await import("fs");
|
|
43497
|
+
fs16.writeFileSync(vsixPath, buffer);
|
|
43480
43498
|
return new Promise((resolve12) => {
|
|
43481
43499
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
43482
43500
|
(0, import_child_process8.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
@@ -44201,10 +44219,10 @@ var init_server_connection = __esm({
|
|
|
44201
44219
|
this.setState("disconnected");
|
|
44202
44220
|
try {
|
|
44203
44221
|
const path18 = require("path");
|
|
44204
|
-
const
|
|
44222
|
+
const fs16 = require("fs");
|
|
44205
44223
|
const configPath = path18.join(process.env.HOME || process.env.USERPROFILE || "", ".adhdev", "config.json");
|
|
44206
|
-
if (
|
|
44207
|
-
|
|
44224
|
+
if (fs16.existsSync(configPath)) {
|
|
44225
|
+
fs16.unlinkSync(configPath);
|
|
44208
44226
|
LOG.info("Server", `[ServerConn] Config file removed. Re-run 'adhdev setup'.`);
|
|
44209
44227
|
}
|
|
44210
44228
|
} catch {
|
|
@@ -45294,19 +45312,70 @@ var init_screenshot_controller = __esm({
|
|
|
45294
45312
|
});
|
|
45295
45313
|
|
|
45296
45314
|
// src/session-host.ts
|
|
45315
|
+
var session_host_exports = {};
|
|
45316
|
+
__export(session_host_exports, {
|
|
45317
|
+
ensureSessionHostReady: () => ensureSessionHostReady2,
|
|
45318
|
+
listHostedCliRuntimes: () => listHostedCliRuntimes2,
|
|
45319
|
+
stopSessionHost: () => stopSessionHost
|
|
45320
|
+
});
|
|
45297
45321
|
function resolveSessionHostEntry() {
|
|
45298
|
-
const
|
|
45322
|
+
const packagedCandidates = [
|
|
45299
45323
|
path16.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
|
|
45300
|
-
path16.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
45301
|
-
path16.resolve(__dirname, "../../../oss/packages/session-host-daemon/dist/index.js")
|
|
45324
|
+
path16.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
45302
45325
|
];
|
|
45303
|
-
for (const candidate of
|
|
45304
|
-
if (
|
|
45326
|
+
for (const candidate of packagedCandidates) {
|
|
45327
|
+
if (fs14.existsSync(candidate)) {
|
|
45305
45328
|
return candidate;
|
|
45306
45329
|
}
|
|
45307
45330
|
}
|
|
45308
45331
|
return require.resolve("@adhdev/session-host-daemon");
|
|
45309
45332
|
}
|
|
45333
|
+
function getSessionHostPidFile() {
|
|
45334
|
+
return path16.join(os19.homedir(), ".adhdev", `${SESSION_HOST_APP_NAME}-session-host.pid`);
|
|
45335
|
+
}
|
|
45336
|
+
function killPid(pid) {
|
|
45337
|
+
try {
|
|
45338
|
+
if (process.platform === "win32") {
|
|
45339
|
+
(0, import_child_process9.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
|
|
45340
|
+
} else {
|
|
45341
|
+
process.kill(pid, "SIGTERM");
|
|
45342
|
+
}
|
|
45343
|
+
return true;
|
|
45344
|
+
} catch {
|
|
45345
|
+
return false;
|
|
45346
|
+
}
|
|
45347
|
+
}
|
|
45348
|
+
function stopSessionHost() {
|
|
45349
|
+
let stopped = false;
|
|
45350
|
+
const pidFile = getSessionHostPidFile();
|
|
45351
|
+
try {
|
|
45352
|
+
if (fs14.existsSync(pidFile)) {
|
|
45353
|
+
const pid = Number.parseInt(fs14.readFileSync(pidFile, "utf8").trim(), 10);
|
|
45354
|
+
if (Number.isFinite(pid)) {
|
|
45355
|
+
stopped = killPid(pid) || stopped;
|
|
45356
|
+
}
|
|
45357
|
+
}
|
|
45358
|
+
} catch {
|
|
45359
|
+
} finally {
|
|
45360
|
+
try {
|
|
45361
|
+
fs14.unlinkSync(pidFile);
|
|
45362
|
+
} catch {
|
|
45363
|
+
}
|
|
45364
|
+
}
|
|
45365
|
+
if (process.platform !== "win32") {
|
|
45366
|
+
try {
|
|
45367
|
+
const raw = (0, import_child_process9.execFileSync)("pgrep", ["-f", "session-host-daemon"], { encoding: "utf8" }).trim();
|
|
45368
|
+
for (const line of raw.split("\n")) {
|
|
45369
|
+
const pid = Number.parseInt(line.trim(), 10);
|
|
45370
|
+
if (Number.isFinite(pid)) {
|
|
45371
|
+
stopped = killPid(pid) || stopped;
|
|
45372
|
+
}
|
|
45373
|
+
}
|
|
45374
|
+
} catch {
|
|
45375
|
+
}
|
|
45376
|
+
}
|
|
45377
|
+
return stopped;
|
|
45378
|
+
}
|
|
45310
45379
|
async function ensureSessionHostReady2() {
|
|
45311
45380
|
return ensureSessionHostReady({
|
|
45312
45381
|
appName: SESSION_HOST_APP_NAME,
|
|
@@ -45328,11 +45397,13 @@ async function ensureSessionHostReady2() {
|
|
|
45328
45397
|
async function listHostedCliRuntimes2(endpoint) {
|
|
45329
45398
|
return listHostedCliRuntimes(endpoint);
|
|
45330
45399
|
}
|
|
45331
|
-
var import_child_process9, path16, SESSION_HOST_APP_NAME;
|
|
45400
|
+
var import_child_process9, fs14, os19, path16, SESSION_HOST_APP_NAME;
|
|
45332
45401
|
var init_session_host = __esm({
|
|
45333
45402
|
"src/session-host.ts"() {
|
|
45334
45403
|
"use strict";
|
|
45335
45404
|
import_child_process9 = require("child_process");
|
|
45405
|
+
fs14 = __toESM(require("fs"));
|
|
45406
|
+
os19 = __toESM(require("os"));
|
|
45336
45407
|
path16 = __toESM(require("path"));
|
|
45337
45408
|
init_src();
|
|
45338
45409
|
SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
|
|
@@ -45347,24 +45418,24 @@ __export(adhdev_daemon_exports, {
|
|
|
45347
45418
|
stopDaemon: () => stopDaemon
|
|
45348
45419
|
});
|
|
45349
45420
|
function getDaemonPidFile() {
|
|
45350
|
-
const dir = path17.join(
|
|
45351
|
-
if (!
|
|
45421
|
+
const dir = path17.join(os20.homedir(), ".adhdev");
|
|
45422
|
+
if (!fs15.existsSync(dir)) fs15.mkdirSync(dir, { recursive: true });
|
|
45352
45423
|
return path17.join(dir, "daemon.pid");
|
|
45353
45424
|
}
|
|
45354
45425
|
function writeDaemonPid(pid) {
|
|
45355
|
-
|
|
45426
|
+
fs15.writeFileSync(getDaemonPidFile(), String(pid), "utf-8");
|
|
45356
45427
|
}
|
|
45357
45428
|
function removeDaemonPid() {
|
|
45358
45429
|
try {
|
|
45359
|
-
|
|
45430
|
+
fs15.unlinkSync(getDaemonPidFile());
|
|
45360
45431
|
} catch (e) {
|
|
45361
45432
|
}
|
|
45362
45433
|
}
|
|
45363
45434
|
function isDaemonRunning() {
|
|
45364
45435
|
const pidFile = getDaemonPidFile();
|
|
45365
45436
|
try {
|
|
45366
|
-
if (!
|
|
45367
|
-
const pid = parseInt(
|
|
45437
|
+
if (!fs15.existsSync(pidFile)) return false;
|
|
45438
|
+
const pid = parseInt(fs15.readFileSync(pidFile, "utf-8").trim());
|
|
45368
45439
|
process.kill(pid, 0);
|
|
45369
45440
|
return true;
|
|
45370
45441
|
} catch {
|
|
@@ -45375,8 +45446,8 @@ function isDaemonRunning() {
|
|
|
45375
45446
|
function stopDaemon() {
|
|
45376
45447
|
const pidFile = getDaemonPidFile();
|
|
45377
45448
|
try {
|
|
45378
|
-
if (!
|
|
45379
|
-
const pid = parseInt(
|
|
45449
|
+
if (!fs15.existsSync(pidFile)) return false;
|
|
45450
|
+
const pid = parseInt(fs15.readFileSync(pidFile, "utf-8").trim());
|
|
45380
45451
|
process.kill(pid, "SIGTERM");
|
|
45381
45452
|
removeDaemonPid();
|
|
45382
45453
|
return true;
|
|
@@ -45385,7 +45456,7 @@ function stopDaemon() {
|
|
|
45385
45456
|
return false;
|
|
45386
45457
|
}
|
|
45387
45458
|
}
|
|
45388
|
-
var
|
|
45459
|
+
var os20, fs15, path17, import_chalk2, pkgVersion, DANGEROUS_PATTERNS, AdhdevDaemon;
|
|
45389
45460
|
var init_adhdev_daemon = __esm({
|
|
45390
45461
|
"src/adhdev-daemon.ts"() {
|
|
45391
45462
|
"use strict";
|
|
@@ -45395,11 +45466,11 @@ var init_adhdev_daemon = __esm({
|
|
|
45395
45466
|
init_screenshot_controller();
|
|
45396
45467
|
init_session_host();
|
|
45397
45468
|
init_dist();
|
|
45398
|
-
|
|
45399
|
-
|
|
45469
|
+
os20 = __toESM(require("os"));
|
|
45470
|
+
fs15 = __toESM(require("fs"));
|
|
45400
45471
|
path17 = __toESM(require("path"));
|
|
45401
45472
|
import_chalk2 = __toESM(require("chalk"));
|
|
45402
|
-
pkgVersion = "0.7.
|
|
45473
|
+
pkgVersion = "0.7.35";
|
|
45403
45474
|
if (pkgVersion === "unknown") {
|
|
45404
45475
|
try {
|
|
45405
45476
|
const possiblePaths = [
|
|
@@ -45408,7 +45479,7 @@ var init_adhdev_daemon = __esm({
|
|
|
45408
45479
|
];
|
|
45409
45480
|
for (const p of possiblePaths) {
|
|
45410
45481
|
try {
|
|
45411
|
-
const data = JSON.parse(
|
|
45482
|
+
const data = JSON.parse(fs15.readFileSync(p, "utf-8"));
|
|
45412
45483
|
if (data.version) {
|
|
45413
45484
|
pkgVersion = data.version;
|
|
45414
45485
|
break;
|
|
@@ -45534,8 +45605,8 @@ ${err?.stack || ""}`);
|
|
|
45534
45605
|
cliInfo: {
|
|
45535
45606
|
type: "adhdev-daemon",
|
|
45536
45607
|
version: pkgVersion,
|
|
45537
|
-
platform:
|
|
45538
|
-
hostname:
|
|
45608
|
+
platform: os20.platform(),
|
|
45609
|
+
hostname: os20.hostname(),
|
|
45539
45610
|
machineId: config2.machineId,
|
|
45540
45611
|
instanceId
|
|
45541
45612
|
}
|
|
@@ -45975,16 +46046,16 @@ async function loginFlow() {
|
|
|
45975
46046
|
let verificationUrl;
|
|
45976
46047
|
try {
|
|
45977
46048
|
const config2 = loadConfig();
|
|
45978
|
-
const
|
|
46049
|
+
const os21 = await import("os");
|
|
45979
46050
|
const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
|
|
45980
46051
|
method: "POST",
|
|
45981
46052
|
headers: { "Content-Type": "application/json" },
|
|
45982
46053
|
body: JSON.stringify({
|
|
45983
46054
|
clientMachineId: config2.machineId,
|
|
45984
46055
|
registeredMachineId: config2.registeredMachineId,
|
|
45985
|
-
hostname:
|
|
45986
|
-
platform:
|
|
45987
|
-
arch:
|
|
46056
|
+
hostname: os21.hostname(),
|
|
46057
|
+
platform: os21.platform(),
|
|
46058
|
+
arch: os21.arch()
|
|
45988
46059
|
})
|
|
45989
46060
|
});
|
|
45990
46061
|
if (!res.ok) {
|
|
@@ -46083,10 +46154,10 @@ async function startDaemonFlow() {
|
|
|
46083
46154
|
const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
46084
46155
|
const daemon = new AdhdevDaemon2();
|
|
46085
46156
|
const { execSync: execSync7 } = await import("child_process");
|
|
46086
|
-
const
|
|
46157
|
+
const os21 = await import("os");
|
|
46087
46158
|
const path18 = await import("path");
|
|
46088
|
-
const logPath = path18.join(
|
|
46089
|
-
const platform11 =
|
|
46159
|
+
const logPath = path18.join(os21.homedir(), ".adhdev", "daemon.log");
|
|
46160
|
+
const platform11 = os21.platform();
|
|
46090
46161
|
try {
|
|
46091
46162
|
if (platform11 === "win32") {
|
|
46092
46163
|
execSync7(`start /B adhdev daemon > "${logPath}" 2>&1`, {
|
|
@@ -46420,7 +46491,7 @@ function registerSetupCommands(program2, providerLoader) {
|
|
|
46420
46491
|
launchWithCdp: launchWithCdp2
|
|
46421
46492
|
} = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
46422
46493
|
const resolvedType = targetArg ? providerLoader.resolveAlias(targetArg.toLowerCase()) : null;
|
|
46423
|
-
const resolvedProvider = resolvedType ? providerLoader.
|
|
46494
|
+
const resolvedProvider = resolvedType ? providerLoader.getMeta(resolvedType) : null;
|
|
46424
46495
|
const cliType = resolvedProvider && (resolvedProvider.category === "cli" || resolvedProvider.category === "acp") ? resolvedType : null;
|
|
46425
46496
|
if (cliType) {
|
|
46426
46497
|
const workingDir = options.dir || options.workspace || process.cwd();
|
|
@@ -46778,12 +46849,15 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
46778
46849
|
}));
|
|
46779
46850
|
hideCommand(program2.command("daemon:restart").description("Restart ADHDev Daemon (stop \u2192 start)").option("-p, --port <port>", "Local WS server port", "19222").option("--server <url>", "Override server URL").option("--dev", "Enable Dev Mode").action(async (options) => {
|
|
46780
46851
|
const { stopDaemon: stopDaemon2, isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
46852
|
+
const { stopSessionHost: stopSessionHost2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
|
|
46781
46853
|
const { spawn: spawn4 } = await import("child_process");
|
|
46782
46854
|
if (isDaemonRunning2()) {
|
|
46783
46855
|
console.log(import_chalk5.default.yellow("\n Stopping existing daemon..."));
|
|
46784
46856
|
stopDaemon2();
|
|
46785
46857
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
46786
46858
|
}
|
|
46859
|
+
stopSessionHost2();
|
|
46860
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
46787
46861
|
console.log(import_chalk5.default.cyan(" Starting new daemon..."));
|
|
46788
46862
|
const args = ["daemon", "-p", options.port || "19222"];
|
|
46789
46863
|
if (options.server) args.push("--server", options.server);
|
|
@@ -46806,6 +46880,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
46806
46880
|
}));
|
|
46807
46881
|
hideCommand(program2.command("daemon:upgrade").description("Upgrade ADHDev to latest version and restart daemon").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
|
|
46808
46882
|
const { isDaemonRunning: isDaemonRunning2, stopDaemon: stopDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
|
|
46883
|
+
const { stopSessionHost: stopSessionHost2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
|
|
46809
46884
|
const { execSync: execSync7, spawn: spawn4 } = await import("child_process");
|
|
46810
46885
|
const fsMod = await import("fs");
|
|
46811
46886
|
const pathMod = await import("path");
|
|
@@ -46862,6 +46937,8 @@ function registerDaemonCommands(program2, pkgVersion3) {
|
|
|
46862
46937
|
console.log(import_chalk5.default.yellow("\n Restarting daemon..."));
|
|
46863
46938
|
stopDaemon2();
|
|
46864
46939
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
46940
|
+
stopSessionHost2();
|
|
46941
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
46865
46942
|
const child = spawn4(process.execPath, [process.argv[1], "daemon", "-p", "19222"], {
|
|
46866
46943
|
detached: true,
|
|
46867
46944
|
stdio: "ignore",
|
|
@@ -47040,7 +47117,6 @@ function registerProviderCommands(program2) {
|
|
|
47040
47117
|
}
|
|
47041
47118
|
}
|
|
47042
47119
|
});
|
|
47043
|
-
provider;
|
|
47044
47120
|
provider.command("create [type]").description("Interactive wizard to scaffold a new provider").option("-n, --name <name>", "Display name").option("-c, --category <cat>", "Category: ide, extension, cli, acp").option("-p, --port <port>", "Starting CDP port").option("--builtin", "Create in builtin directory").action(async (cliType, options) => {
|
|
47045
47121
|
try {
|
|
47046
47122
|
const readline = await import("readline/promises");
|
|
@@ -47072,14 +47148,14 @@ function registerProviderCommands(program2) {
|
|
|
47072
47148
|
let osPaths = {};
|
|
47073
47149
|
let processNames = {};
|
|
47074
47150
|
if (category === "ide") {
|
|
47075
|
-
const
|
|
47151
|
+
const fs16 = await import("fs");
|
|
47076
47152
|
const path18 = await import("path");
|
|
47077
|
-
const
|
|
47078
|
-
if (
|
|
47153
|
+
const os21 = await import("os");
|
|
47154
|
+
if (os21.platform() === "darwin") {
|
|
47079
47155
|
while (true) {
|
|
47080
47156
|
const p = (await rl.question(`macOS Application Path (e.g. /Applications/${defaultName}.app): `)).trim() || `/Applications/${defaultName}.app`;
|
|
47081
47157
|
if (p === "skip") break;
|
|
47082
|
-
if (!
|
|
47158
|
+
if (!fs16.existsSync(p)) {
|
|
47083
47159
|
console.log(import_chalk6.default.red(` \u2717 Path not found: ${p}`));
|
|
47084
47160
|
console.log(import_chalk6.default.gray(` (Please provide the exact absolute path to the .app or binary, or type 'skip')`));
|
|
47085
47161
|
continue;
|
|
@@ -47089,11 +47165,11 @@ function registerProviderCommands(program2) {
|
|
|
47089
47165
|
processNames["darwin"] = path18.basename(p, ".app");
|
|
47090
47166
|
break;
|
|
47091
47167
|
}
|
|
47092
|
-
} else if (
|
|
47168
|
+
} else if (os21.platform() === "win32") {
|
|
47093
47169
|
while (true) {
|
|
47094
47170
|
const p = (await rl.question(`Windows Executable Path (e.g. C:\\Program Files\\${defaultName}\\${defaultName}.exe): `)).trim();
|
|
47095
47171
|
if (!p || p === "skip") break;
|
|
47096
|
-
if (!
|
|
47172
|
+
if (!fs16.existsSync(p)) {
|
|
47097
47173
|
console.log(import_chalk6.default.red(` \u2717 Path not found: ${p}`));
|
|
47098
47174
|
console.log(import_chalk6.default.gray(` (Please provide the exact absolute path, or type 'skip')`));
|
|
47099
47175
|
continue;
|
|
@@ -47332,7 +47408,6 @@ function registerProviderCommands(program2) {
|
|
|
47332
47408
|
}]);
|
|
47333
47409
|
userComment = commentAnswer.comment || "";
|
|
47334
47410
|
}
|
|
47335
|
-
let consecutiveFailures = 0;
|
|
47336
47411
|
const targetDir = loader.getUserProviderDir(providerToFix.category, type);
|
|
47337
47412
|
console.log(import_chalk6.default.bold(`
|
|
47338
47413
|
\u25B6\uFE0F Generating [${functionsToFix.length}] function(s) natively via autonomous agent for ${type}...`));
|
|
@@ -47777,8 +47852,8 @@ function registerCdpCommands(program2) {
|
|
|
47777
47852
|
}
|
|
47778
47853
|
const output = typeof result === "string" ? result : JSON.stringify(result, null, 2);
|
|
47779
47854
|
if (options.output) {
|
|
47780
|
-
const
|
|
47781
|
-
|
|
47855
|
+
const fs16 = await import("fs");
|
|
47856
|
+
fs16.writeFileSync(options.output, output, "utf-8");
|
|
47782
47857
|
console.log(import_chalk6.default.green(`
|
|
47783
47858
|
\u2713 Saved to ${options.output} (${output.length} chars)
|
|
47784
47859
|
`));
|
|
@@ -47881,8 +47956,8 @@ function registerCdpCommands(program2) {
|
|
|
47881
47956
|
ws2.on("message", async (data) => {
|
|
47882
47957
|
const msg = JSON.parse(data.toString());
|
|
47883
47958
|
if (msg.id === 1 && msg.result?.data) {
|
|
47884
|
-
const
|
|
47885
|
-
|
|
47959
|
+
const fs16 = await import("fs");
|
|
47960
|
+
fs16.writeFileSync(options.output, Buffer.from(msg.result.data, "base64"));
|
|
47886
47961
|
console.log(import_chalk6.default.green(`
|
|
47887
47962
|
\u2713 Screenshot saved to ${options.output}
|
|
47888
47963
|
`));
|