@adhdev/daemon-core 0.8.11 → 0.8.12
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/index.js +106 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -71
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +15 -2
- package/src/cli-adapters/pty-transport.ts +1 -1
- package/src/commands/cdp-commands.ts +45 -8
package/dist/index.js
CHANGED
|
@@ -699,11 +699,10 @@ var init_terminal_screen = __esm({
|
|
|
699
699
|
});
|
|
700
700
|
|
|
701
701
|
// src/cli-adapters/pty-transport.ts
|
|
702
|
-
var
|
|
702
|
+
var pty, NodePtyRuntimeTransport, NodePtyTransportFactory;
|
|
703
703
|
var init_pty_transport = __esm({
|
|
704
704
|
"src/cli-adapters/pty-transport.ts"() {
|
|
705
705
|
"use strict";
|
|
706
|
-
os7 = __toESM(require("os"));
|
|
707
706
|
try {
|
|
708
707
|
pty = require("node-pty");
|
|
709
708
|
} catch {
|
|
@@ -741,7 +740,7 @@ var init_pty_transport = __esm({
|
|
|
741
740
|
spawn(command, args, options) {
|
|
742
741
|
if (!pty) throw new Error("node-pty is not installed");
|
|
743
742
|
const handle = pty.spawn(command, args, {
|
|
744
|
-
name:
|
|
743
|
+
name: "xterm-256color",
|
|
745
744
|
cols: options.cols,
|
|
746
745
|
rows: options.rows,
|
|
747
746
|
cwd: options.cwd,
|
|
@@ -768,6 +767,17 @@ function stripTerminalNoise(str) {
|
|
|
768
767
|
function sanitizeTerminalText(str) {
|
|
769
768
|
return stripTerminalNoise(stripAnsi(str));
|
|
770
769
|
}
|
|
770
|
+
function applyPreferredTerminalColorEnv(env) {
|
|
771
|
+
if (env.NO_COLOR) return;
|
|
772
|
+
if (!env.TERM || env.TERM === "xterm-color") {
|
|
773
|
+
env.TERM = "xterm-256color";
|
|
774
|
+
}
|
|
775
|
+
if (!env.COLORTERM) env.COLORTERM = "truecolor";
|
|
776
|
+
if (process.platform === "win32") {
|
|
777
|
+
if (!env.FORCE_COLOR) env.FORCE_COLOR = "1";
|
|
778
|
+
if (!env.CLICOLOR) env.CLICOLOR = "1";
|
|
779
|
+
}
|
|
780
|
+
}
|
|
771
781
|
function buildCliSpawnEnv(baseEnv, overrides) {
|
|
772
782
|
const env = {};
|
|
773
783
|
const source = { ...baseEnv, ...overrides || {} };
|
|
@@ -776,10 +786,11 @@ function buildCliSpawnEnv(baseEnv, overrides) {
|
|
|
776
786
|
env[key] = value;
|
|
777
787
|
}
|
|
778
788
|
for (const key of Object.keys(env)) {
|
|
779
|
-
if (key === "INIT_CWD" || key === "
|
|
789
|
+
if (key === "INIT_CWD" || key === "npm_command" || key === "npm_execpath" || key === "npm_node_execpath" || key.startsWith("npm_") || key.startsWith("npm_config_") || key.startsWith("npm_package_") || key.startsWith("npm_lifecycle_") || key.startsWith("PNPM_") || key.startsWith("YARN_") || key.startsWith("BUN_")) {
|
|
780
790
|
delete env[key];
|
|
781
791
|
}
|
|
782
792
|
}
|
|
793
|
+
applyPreferredTerminalColorEnv(env);
|
|
783
794
|
return env;
|
|
784
795
|
}
|
|
785
796
|
function computeTerminalQueryTail(buffer) {
|
|
@@ -795,7 +806,7 @@ function computeTerminalQueryTail(buffer) {
|
|
|
795
806
|
return "";
|
|
796
807
|
}
|
|
797
808
|
function findBinary(name) {
|
|
798
|
-
const isWin =
|
|
809
|
+
const isWin = os7.platform() === "win32";
|
|
799
810
|
try {
|
|
800
811
|
const cmd = isWin ? `where ${name}` : `which ${name}`;
|
|
801
812
|
return (0, import_child_process4.execSync)(cmd, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n")[0].trim();
|
|
@@ -843,7 +854,7 @@ function looksLikeMachOOrElf(filePath) {
|
|
|
843
854
|
}
|
|
844
855
|
function shSingleQuote(arg) {
|
|
845
856
|
if (/^[a-zA-Z0-9@%_+=:,./-]+$/.test(arg)) return arg;
|
|
846
|
-
if (
|
|
857
|
+
if (os7.platform() === "win32") {
|
|
847
858
|
return `"${arg.replace(/"/g, '""')}"`;
|
|
848
859
|
}
|
|
849
860
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
@@ -910,11 +921,11 @@ function normalizeCliProviderForRuntime(raw) {
|
|
|
910
921
|
}
|
|
911
922
|
};
|
|
912
923
|
}
|
|
913
|
-
var
|
|
924
|
+
var os7, path7, import_child_process4, pty2, ProviderCliAdapter;
|
|
914
925
|
var init_provider_cli_adapter = __esm({
|
|
915
926
|
"src/cli-adapters/provider-cli-adapter.ts"() {
|
|
916
927
|
"use strict";
|
|
917
|
-
|
|
928
|
+
os7 = __toESM(require("os"));
|
|
918
929
|
path7 = __toESM(require("path"));
|
|
919
930
|
import_child_process4 = require("child_process");
|
|
920
931
|
init_logger();
|
|
@@ -922,11 +933,11 @@ var init_provider_cli_adapter = __esm({
|
|
|
922
933
|
init_pty_transport();
|
|
923
934
|
try {
|
|
924
935
|
pty2 = require("node-pty");
|
|
925
|
-
if (
|
|
936
|
+
if (os7.platform() !== "win32") {
|
|
926
937
|
try {
|
|
927
938
|
const fs15 = require("fs");
|
|
928
939
|
const ptyDir = path7.resolve(path7.dirname(require.resolve("node-pty")), "..");
|
|
929
|
-
const platformArch = `${
|
|
940
|
+
const platformArch = `${os7.platform()}-${os7.arch()}`;
|
|
930
941
|
const helper = path7.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
|
|
931
942
|
if (fs15.existsSync(helper)) {
|
|
932
943
|
const stat = fs15.statSync(helper);
|
|
@@ -948,7 +959,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
948
959
|
this.transportFactory = transportFactory;
|
|
949
960
|
this.cliType = provider.type;
|
|
950
961
|
this.cliName = provider.name;
|
|
951
|
-
this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/,
|
|
962
|
+
this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/, os7.homedir()) : workingDir;
|
|
952
963
|
const t = provider.timeouts || {};
|
|
953
964
|
this.timeouts = {
|
|
954
965
|
ptyFlush: t.ptyFlush ?? 50,
|
|
@@ -1255,7 +1266,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
1255
1266
|
if (this.ptyProcess) return;
|
|
1256
1267
|
const { spawn: spawnConfig } = this.provider;
|
|
1257
1268
|
const binaryPath = findBinary(spawnConfig.command);
|
|
1258
|
-
const isWin =
|
|
1269
|
+
const isWin = os7.platform() === "win32";
|
|
1259
1270
|
const allArgs = [...spawnConfig.args, ...this.extraArgs];
|
|
1260
1271
|
LOG.info("CLI", `[${this.cliType}] Spawning in ${this.workingDir}`);
|
|
1261
1272
|
this.resetTraceSession();
|
|
@@ -2738,18 +2749,18 @@ function checkPathExists(paths) {
|
|
|
2738
2749
|
return null;
|
|
2739
2750
|
}
|
|
2740
2751
|
async function detectIDEs() {
|
|
2741
|
-
const
|
|
2752
|
+
const os17 = (0, import_os2.platform)();
|
|
2742
2753
|
const results = [];
|
|
2743
2754
|
for (const def of getMergedDefinitions()) {
|
|
2744
2755
|
const cliPath = findCliCommand(def.cli);
|
|
2745
|
-
const appPath = checkPathExists(def.paths[
|
|
2756
|
+
const appPath = checkPathExists(def.paths[os17] || []);
|
|
2746
2757
|
const installed = !!(cliPath || appPath);
|
|
2747
2758
|
let resolvedCli = cliPath;
|
|
2748
|
-
if (!resolvedCli && appPath &&
|
|
2759
|
+
if (!resolvedCli && appPath && os17 === "darwin") {
|
|
2749
2760
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
2750
2761
|
if ((0, import_fs2.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
2751
2762
|
}
|
|
2752
|
-
if (!resolvedCli && appPath &&
|
|
2763
|
+
if (!resolvedCli && appPath && os17 === "win32") {
|
|
2753
2764
|
const { dirname: dirname7 } = await import("path");
|
|
2754
2765
|
const appDir = dirname7(appPath);
|
|
2755
2766
|
const candidates = [
|
|
@@ -2801,8 +2812,8 @@ function execAsync(cmd, timeoutMs = 5e3) {
|
|
|
2801
2812
|
});
|
|
2802
2813
|
}
|
|
2803
2814
|
async function detectCLIs(providerLoader) {
|
|
2804
|
-
const
|
|
2805
|
-
const whichCmd =
|
|
2815
|
+
const platform9 = os2.platform();
|
|
2816
|
+
const whichCmd = platform9 === "win32" ? "where" : "which";
|
|
2806
2817
|
const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
|
|
2807
2818
|
const results = await Promise.all(
|
|
2808
2819
|
cliList.map(async (cli) => {
|
|
@@ -6951,17 +6962,44 @@ async function handleDiscoverAgents(h, args) {
|
|
|
6951
6962
|
const agents = await h.getCdp().discoverAgentWebviews();
|
|
6952
6963
|
return { success: true, agents };
|
|
6953
6964
|
}
|
|
6965
|
+
function normalizeWindowsRequestedPath(requestedPath) {
|
|
6966
|
+
const trimmed = requestedPath.trim();
|
|
6967
|
+
if (!trimmed) return ".";
|
|
6968
|
+
const slashDriveMatch = trimmed.match(/^[/\\]([A-Za-z])(?:[/\\](.*))?$/);
|
|
6969
|
+
if (slashDriveMatch) {
|
|
6970
|
+
const drive = slashDriveMatch[1].toUpperCase();
|
|
6971
|
+
const rest = (slashDriveMatch[2] || "").replace(/[/\\]+/g, "\\");
|
|
6972
|
+
return rest ? `${drive}:\\${rest}` : `${drive}:\\`;
|
|
6973
|
+
}
|
|
6974
|
+
if (/^[A-Za-z]:$/.test(trimmed)) {
|
|
6975
|
+
return `${trimmed[0].toUpperCase()}:\\`;
|
|
6976
|
+
}
|
|
6977
|
+
if (/^[A-Za-z]:[^/\\].*$/.test(trimmed)) {
|
|
6978
|
+
return `${trimmed[0].toUpperCase()}:\\${trimmed.slice(2).replace(/[/\\]+/g, "\\")}`;
|
|
6979
|
+
}
|
|
6980
|
+
if (/^[A-Za-z]:[/\\]/.test(trimmed)) {
|
|
6981
|
+
return `${trimmed[0].toUpperCase()}:${trimmed.slice(2)}`;
|
|
6982
|
+
}
|
|
6983
|
+
return trimmed;
|
|
6984
|
+
}
|
|
6954
6985
|
function resolveSafePath(requestedPath) {
|
|
6986
|
+
const rawPath = typeof requestedPath === "string" ? requestedPath.trim() : "";
|
|
6987
|
+
const inputPath = rawPath || ".";
|
|
6955
6988
|
const home = os6.homedir();
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
resolved = path6.join(home, requestedPath.slice(1));
|
|
6959
|
-
} else if (path6.isAbsolute(requestedPath)) {
|
|
6960
|
-
resolved = requestedPath;
|
|
6961
|
-
} else {
|
|
6962
|
-
resolved = path6.resolve(requestedPath);
|
|
6989
|
+
if (inputPath.startsWith("~")) {
|
|
6990
|
+
return path6.resolve(path6.join(home, inputPath.slice(1)));
|
|
6963
6991
|
}
|
|
6964
|
-
|
|
6992
|
+
if (process.platform === "win32") {
|
|
6993
|
+
const normalized = normalizeWindowsRequestedPath(inputPath);
|
|
6994
|
+
if (path6.win32.isAbsolute(normalized)) {
|
|
6995
|
+
return path6.win32.normalize(normalized);
|
|
6996
|
+
}
|
|
6997
|
+
return path6.win32.resolve(normalized);
|
|
6998
|
+
}
|
|
6999
|
+
if (path6.isAbsolute(inputPath)) {
|
|
7000
|
+
return path6.normalize(inputPath);
|
|
7001
|
+
}
|
|
7002
|
+
return path6.resolve(inputPath);
|
|
6965
7003
|
}
|
|
6966
7004
|
function listDirectoryEntriesSafe(dirPath) {
|
|
6967
7005
|
const entries = fs4.readdirSync(dirPath, { withFileTypes: true });
|
|
@@ -7791,7 +7829,7 @@ var DaemonCommandHandler = class {
|
|
|
7791
7829
|
};
|
|
7792
7830
|
|
|
7793
7831
|
// src/commands/cli-manager.ts
|
|
7794
|
-
var
|
|
7832
|
+
var os9 = __toESM(require("os"));
|
|
7795
7833
|
var path9 = __toESM(require("path"));
|
|
7796
7834
|
var crypto4 = __toESM(require("crypto"));
|
|
7797
7835
|
var import_chalk = __toESM(require("chalk"));
|
|
@@ -7799,7 +7837,7 @@ init_provider_cli_adapter();
|
|
|
7799
7837
|
init_config();
|
|
7800
7838
|
|
|
7801
7839
|
// src/providers/cli-provider-instance.ts
|
|
7802
|
-
var
|
|
7840
|
+
var os8 = __toESM(require("os"));
|
|
7803
7841
|
var path8 = __toESM(require("path"));
|
|
7804
7842
|
var crypto3 = __toESM(require("crypto"));
|
|
7805
7843
|
var fs5 = __toESM(require("fs"));
|
|
@@ -8197,7 +8235,7 @@ var CliProviderInstance = class {
|
|
|
8197
8235
|
LOG.info("CLI", `[${this.type}] discovered provider session id: ${nextSessionId}`);
|
|
8198
8236
|
}
|
|
8199
8237
|
probeOpenCodeSessionId() {
|
|
8200
|
-
const dbPath = path8.join(
|
|
8238
|
+
const dbPath = path8.join(os8.homedir(), ".local", "share", "opencode", "opencode.db");
|
|
8201
8239
|
if (!fs5.existsSync(dbPath)) return null;
|
|
8202
8240
|
const minCreatedAt = Math.max(0, this.startedAt - 6e4);
|
|
8203
8241
|
const directories = this.getProbeDirectories();
|
|
@@ -8205,7 +8243,7 @@ var CliProviderInstance = class {
|
|
|
8205
8243
|
return this.querySqliteText(dbPath, query, [...directories, minCreatedAt]);
|
|
8206
8244
|
}
|
|
8207
8245
|
probeCodexSessionId() {
|
|
8208
|
-
const dbPath = path8.join(
|
|
8246
|
+
const dbPath = path8.join(os8.homedir(), ".codex", "state_5.sqlite");
|
|
8209
8247
|
if (!fs5.existsSync(dbPath)) return null;
|
|
8210
8248
|
const minCreatedAt = Math.max(0, Math.floor((this.startedAt - 6e4) / 1e3));
|
|
8211
8249
|
const directories = this.getProbeDirectories();
|
|
@@ -8213,7 +8251,7 @@ var CliProviderInstance = class {
|
|
|
8213
8251
|
return this.querySqliteText(dbPath, query, [...directories, minCreatedAt]);
|
|
8214
8252
|
}
|
|
8215
8253
|
probeGooseSessionId() {
|
|
8216
|
-
const dbPath = path8.join(
|
|
8254
|
+
const dbPath = path8.join(os8.homedir(), ".local", "share", "goose", "sessions", "sessions.db");
|
|
8217
8255
|
if (!fs5.existsSync(dbPath)) return null;
|
|
8218
8256
|
const minCreatedAtIso = new Date(Math.max(0, this.startedAt - 6e4)).toISOString().slice(0, 19).replace("T", " ");
|
|
8219
8257
|
const directories = this.getProbeDirectories();
|
|
@@ -9408,7 +9446,7 @@ var DaemonCliManager = class {
|
|
|
9408
9446
|
async startSession(cliType, workingDir, cliArgs, initialModel, options) {
|
|
9409
9447
|
const trimmed = (workingDir || "").trim();
|
|
9410
9448
|
if (!trimmed) throw new Error("working directory required");
|
|
9411
|
-
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/,
|
|
9449
|
+
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os9.homedir()) : path9.resolve(trimmed);
|
|
9412
9450
|
const normalizedType = this.providerLoader.resolveAlias(cliType);
|
|
9413
9451
|
const provider = this.providerLoader.getByAlias(cliType);
|
|
9414
9452
|
const key = crypto4.randomUUID();
|
|
@@ -9844,13 +9882,13 @@ ${installInfo}`
|
|
|
9844
9882
|
// src/launch.ts
|
|
9845
9883
|
var import_child_process6 = require("child_process");
|
|
9846
9884
|
var net = __toESM(require("net"));
|
|
9847
|
-
var
|
|
9885
|
+
var os11 = __toESM(require("os"));
|
|
9848
9886
|
var path11 = __toESM(require("path"));
|
|
9849
9887
|
|
|
9850
9888
|
// src/providers/provider-loader.ts
|
|
9851
9889
|
var fs6 = __toESM(require("fs"));
|
|
9852
9890
|
var path10 = __toESM(require("path"));
|
|
9853
|
-
var
|
|
9891
|
+
var os10 = __toESM(require("os"));
|
|
9854
9892
|
var chokidar = __toESM(require("chokidar"));
|
|
9855
9893
|
init_logger();
|
|
9856
9894
|
var ProviderLoader = class _ProviderLoader {
|
|
@@ -9870,7 +9908,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
9870
9908
|
static META_FILE = ".meta.json";
|
|
9871
9909
|
constructor(options) {
|
|
9872
9910
|
this.logFn = options?.logFn || LOG.forComponent("Provider").asLogFn();
|
|
9873
|
-
const defaultProvidersDir = path10.join(
|
|
9911
|
+
const defaultProvidersDir = path10.join(os10.homedir(), ".adhdev", "providers");
|
|
9874
9912
|
if (options?.userDir) {
|
|
9875
9913
|
this.userDir = options.userDir;
|
|
9876
9914
|
this.log(`Config 'providerDir' applied: ${this.userDir}`);
|
|
@@ -10470,8 +10508,8 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
10470
10508
|
return { updated: false };
|
|
10471
10509
|
}
|
|
10472
10510
|
this.log("Downloading latest providers from GitHub...");
|
|
10473
|
-
const tmpTar = path10.join(
|
|
10474
|
-
const tmpExtract = path10.join(
|
|
10511
|
+
const tmpTar = path10.join(os10.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
|
|
10512
|
+
const tmpExtract = path10.join(os10.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
|
|
10475
10513
|
await this.downloadFile(_ProviderLoader.GITHUB_TARBALL_URL, tmpTar);
|
|
10476
10514
|
fs6.mkdirSync(tmpExtract, { recursive: true });
|
|
10477
10515
|
execSync7(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
|
|
@@ -10858,9 +10896,9 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
10858
10896
|
}
|
|
10859
10897
|
}
|
|
10860
10898
|
compareVersions(a, b) {
|
|
10861
|
-
const
|
|
10862
|
-
const pa =
|
|
10863
|
-
const pb =
|
|
10899
|
+
const normalize3 = (v) => v.split(/[-_+]/)[0].split(".").map((x) => parseInt(x, 10) || 0);
|
|
10900
|
+
const pa = normalize3(a);
|
|
10901
|
+
const pb = normalize3(b);
|
|
10864
10902
|
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
10865
10903
|
const va = pa[i] || 0;
|
|
10866
10904
|
const vb = pb[i] || 0;
|
|
@@ -10936,7 +10974,7 @@ async function isCdpActive(port) {
|
|
|
10936
10974
|
});
|
|
10937
10975
|
}
|
|
10938
10976
|
async function killIdeProcess(ideId) {
|
|
10939
|
-
const plat =
|
|
10977
|
+
const plat = os11.platform();
|
|
10940
10978
|
const appName = getMacAppIdentifiers()[ideId];
|
|
10941
10979
|
const winProcesses = getWinProcessNames()[ideId];
|
|
10942
10980
|
try {
|
|
@@ -10995,7 +11033,7 @@ async function killIdeProcess(ideId) {
|
|
|
10995
11033
|
}
|
|
10996
11034
|
}
|
|
10997
11035
|
function isIdeRunning(ideId) {
|
|
10998
|
-
const plat =
|
|
11036
|
+
const plat = os11.platform();
|
|
10999
11037
|
try {
|
|
11000
11038
|
if (plat === "darwin") {
|
|
11001
11039
|
const appName = getMacAppIdentifiers()[ideId];
|
|
@@ -11031,7 +11069,7 @@ function isIdeRunning(ideId) {
|
|
|
11031
11069
|
}
|
|
11032
11070
|
}
|
|
11033
11071
|
function detectCurrentWorkspace(ideId) {
|
|
11034
|
-
const plat =
|
|
11072
|
+
const plat = os11.platform();
|
|
11035
11073
|
if (plat === "darwin") {
|
|
11036
11074
|
try {
|
|
11037
11075
|
const appName = getMacAppIdentifiers()[ideId];
|
|
@@ -11051,7 +11089,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
11051
11089
|
const appName = appNameMap[ideId];
|
|
11052
11090
|
if (appName) {
|
|
11053
11091
|
const storagePath = path11.join(
|
|
11054
|
-
process.env.APPDATA || path11.join(
|
|
11092
|
+
process.env.APPDATA || path11.join(os11.homedir(), "AppData", "Roaming"),
|
|
11055
11093
|
appName,
|
|
11056
11094
|
"storage.json"
|
|
11057
11095
|
);
|
|
@@ -11073,7 +11111,7 @@ function detectCurrentWorkspace(ideId) {
|
|
|
11073
11111
|
return void 0;
|
|
11074
11112
|
}
|
|
11075
11113
|
async function launchWithCdp(options = {}) {
|
|
11076
|
-
const
|
|
11114
|
+
const platform9 = os11.platform();
|
|
11077
11115
|
let targetIde;
|
|
11078
11116
|
const ides = await detectIDEs();
|
|
11079
11117
|
if (options.ideId) {
|
|
@@ -11142,9 +11180,9 @@ async function launchWithCdp(options = {}) {
|
|
|
11142
11180
|
}
|
|
11143
11181
|
const port = await findFreePort(portPair);
|
|
11144
11182
|
try {
|
|
11145
|
-
if (
|
|
11183
|
+
if (platform9 === "darwin") {
|
|
11146
11184
|
await launchMacOS(targetIde, port, workspace, options.newWindow);
|
|
11147
|
-
} else if (
|
|
11185
|
+
} else if (platform9 === "win32") {
|
|
11148
11186
|
await launchWindows(targetIde, port, workspace, options.newWindow);
|
|
11149
11187
|
} else {
|
|
11150
11188
|
await launchLinux(targetIde, port, workspace, options.newWindow);
|
|
@@ -11225,8 +11263,8 @@ init_logger();
|
|
|
11225
11263
|
// src/logging/command-log.ts
|
|
11226
11264
|
var fs7 = __toESM(require("fs"));
|
|
11227
11265
|
var path12 = __toESM(require("path"));
|
|
11228
|
-
var
|
|
11229
|
-
var LOG_DIR2 = process.platform === "win32" ? path12.join(process.env.LOCALAPPDATA || process.env.APPDATA || path12.join(
|
|
11266
|
+
var os12 = __toESM(require("os"));
|
|
11267
|
+
var LOG_DIR2 = process.platform === "win32" ? path12.join(process.env.LOCALAPPDATA || process.env.APPDATA || path12.join(os12.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path12.join(os12.homedir(), "Library", "Logs", "adhdev") : path12.join(os12.homedir(), ".local", "share", "adhdev", "logs");
|
|
11230
11268
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
11231
11269
|
var MAX_DAYS = 7;
|
|
11232
11270
|
try {
|
|
@@ -11361,7 +11399,7 @@ cleanOldFiles();
|
|
|
11361
11399
|
init_logger();
|
|
11362
11400
|
|
|
11363
11401
|
// src/status/snapshot.ts
|
|
11364
|
-
var
|
|
11402
|
+
var os13 = __toESM(require("os"));
|
|
11365
11403
|
init_config();
|
|
11366
11404
|
init_terminal_screen();
|
|
11367
11405
|
init_logger();
|
|
@@ -11477,16 +11515,16 @@ function buildStatusSnapshot(options) {
|
|
|
11477
11515
|
version: options.version,
|
|
11478
11516
|
daemonMode: options.daemonMode,
|
|
11479
11517
|
machine: {
|
|
11480
|
-
hostname:
|
|
11481
|
-
platform:
|
|
11482
|
-
arch:
|
|
11483
|
-
cpus:
|
|
11518
|
+
hostname: os13.hostname(),
|
|
11519
|
+
platform: os13.platform(),
|
|
11520
|
+
arch: os13.arch(),
|
|
11521
|
+
cpus: os13.cpus().length,
|
|
11484
11522
|
totalMem: memSnap.totalMem,
|
|
11485
11523
|
freeMem: memSnap.freeMem,
|
|
11486
11524
|
availableMem: memSnap.availableMem,
|
|
11487
|
-
loadavg:
|
|
11488
|
-
uptime:
|
|
11489
|
-
release:
|
|
11525
|
+
loadavg: os13.loadavg(),
|
|
11526
|
+
uptime: os13.uptime(),
|
|
11527
|
+
release: os13.release()
|
|
11490
11528
|
},
|
|
11491
11529
|
machineNickname: options.machineNickname ?? cfg.machineNickname ?? null,
|
|
11492
11530
|
timestamp: options.timestamp ?? Date.now(),
|
|
@@ -11506,11 +11544,11 @@ function buildStatusSnapshot(options) {
|
|
|
11506
11544
|
var import_child_process7 = require("child_process");
|
|
11507
11545
|
var import_child_process8 = require("child_process");
|
|
11508
11546
|
var fs8 = __toESM(require("fs"));
|
|
11509
|
-
var
|
|
11547
|
+
var os14 = __toESM(require("os"));
|
|
11510
11548
|
var path13 = __toESM(require("path"));
|
|
11511
11549
|
var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
|
|
11512
11550
|
function getUpgradeLogPath() {
|
|
11513
|
-
const home =
|
|
11551
|
+
const home = os14.homedir();
|
|
11514
11552
|
const dir = path13.join(home, ".adhdev");
|
|
11515
11553
|
fs8.mkdirSync(dir, { recursive: true });
|
|
11516
11554
|
return path13.join(dir, "daemon-upgrade.log");
|
|
@@ -11550,7 +11588,7 @@ async function waitForPidExit(pid, timeoutMs) {
|
|
|
11550
11588
|
}
|
|
11551
11589
|
}
|
|
11552
11590
|
function stopSessionHostProcesses(appName) {
|
|
11553
|
-
const pidFile = path13.join(
|
|
11591
|
+
const pidFile = path13.join(os14.homedir(), ".adhdev", `${appName}-session-host.pid`);
|
|
11554
11592
|
try {
|
|
11555
11593
|
if (fs8.existsSync(pidFile)) {
|
|
11556
11594
|
const pid = Number.parseInt(fs8.readFileSync(pidFile, "utf8").trim(), 10);
|
|
@@ -11579,7 +11617,7 @@ function stopSessionHostProcesses(appName) {
|
|
|
11579
11617
|
}
|
|
11580
11618
|
}
|
|
11581
11619
|
function removeDaemonPidFile() {
|
|
11582
|
-
const pidFile = path13.join(
|
|
11620
|
+
const pidFile = path13.join(os14.homedir(), ".adhdev", "daemon.pid");
|
|
11583
11621
|
try {
|
|
11584
11622
|
fs8.unlinkSync(pidFile);
|
|
11585
11623
|
} catch {
|
|
@@ -13089,10 +13127,10 @@ var ProviderInstanceManager = class {
|
|
|
13089
13127
|
// src/providers/version-archive.ts
|
|
13090
13128
|
var fs10 = __toESM(require("fs"));
|
|
13091
13129
|
var path14 = __toESM(require("path"));
|
|
13092
|
-
var
|
|
13130
|
+
var os15 = __toESM(require("os"));
|
|
13093
13131
|
var import_child_process9 = require("child_process");
|
|
13094
13132
|
var import_os3 = require("os");
|
|
13095
|
-
var ARCHIVE_PATH = path14.join(
|
|
13133
|
+
var ARCHIVE_PATH = path14.join(os15.homedir(), ".adhdev", "version-history.json");
|
|
13096
13134
|
var MAX_ENTRIES_PER_PROVIDER = 20;
|
|
13097
13135
|
var VersionArchive = class {
|
|
13098
13136
|
history = {};
|
|
@@ -13179,7 +13217,7 @@ function getVersion(binary, versionCommand) {
|
|
|
13179
13217
|
function checkPathExists2(paths) {
|
|
13180
13218
|
for (const p of paths) {
|
|
13181
13219
|
if (p.includes("*")) {
|
|
13182
|
-
const home =
|
|
13220
|
+
const home = os15.homedir();
|
|
13183
13221
|
const resolved = p.replace(/\*/g, home.split(path14.sep).pop() || "");
|
|
13184
13222
|
if (fs10.existsSync(resolved)) return resolved;
|
|
13185
13223
|
} else {
|
|
@@ -15507,7 +15545,7 @@ async function handleCliRaw(ctx, req, res) {
|
|
|
15507
15545
|
// src/daemon/dev-auto-implement.ts
|
|
15508
15546
|
var fs13 = __toESM(require("fs"));
|
|
15509
15547
|
var path17 = __toESM(require("path"));
|
|
15510
|
-
var
|
|
15548
|
+
var os16 = __toESM(require("os"));
|
|
15511
15549
|
function getAutoImplPid(ctx) {
|
|
15512
15550
|
const proc = ctx.autoImplProcess;
|
|
15513
15551
|
return proc && typeof proc.pid === "number" && proc.pid > 0 ? proc.pid : null;
|
|
@@ -15710,7 +15748,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15710
15748
|
});
|
|
15711
15749
|
const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
|
|
15712
15750
|
const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
|
|
15713
|
-
const tmpDir = path17.join(
|
|
15751
|
+
const tmpDir = path17.join(os16.tmpdir(), "adhdev-autoimpl");
|
|
15714
15752
|
if (!fs13.existsSync(tmpDir)) fs13.mkdirSync(tmpDir, { recursive: true });
|
|
15715
15753
|
const promptFile = path17.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
|
|
15716
15754
|
fs13.writeFileSync(promptFile, prompt, "utf-8");
|
|
@@ -15864,7 +15902,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15864
15902
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
15865
15903
|
const baseArgs = [...spawn4.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
15866
15904
|
let shellCmd;
|
|
15867
|
-
const isWin =
|
|
15905
|
+
const isWin = os16.platform() === "win32";
|
|
15868
15906
|
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
15869
15907
|
if (command === "claude") {
|
|
15870
15908
|
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
@@ -15908,7 +15946,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15908
15946
|
try {
|
|
15909
15947
|
const pty3 = require("node-pty");
|
|
15910
15948
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
15911
|
-
const isWin2 =
|
|
15949
|
+
const isWin2 = os16.platform() === "win32";
|
|
15912
15950
|
child = pty3.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
15913
15951
|
name: "xterm-256color",
|
|
15914
15952
|
cols: 120,
|