@adhdev/daemon-standalone 0.7.20 → 0.7.21
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
CHANGED
|
@@ -18808,7 +18808,7 @@ var init_logger = __esm2({
|
|
|
18808
18808
|
LEVEL_NUM = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
18809
18809
|
LEVEL_LABEL = { debug: "DBG", info: "INF", warn: "WRN", error: "ERR" };
|
|
18810
18810
|
currentLevel = "info";
|
|
18811
|
-
LOG_DIR = process.platform === "darwin" ? path3.join(os4.homedir(), "Library", "Logs", "adhdev") : path3.join(os4.homedir(), ".local", "share", "adhdev", "logs");
|
|
18811
|
+
LOG_DIR = process.platform === "win32" ? path3.join(process.env.LOCALAPPDATA || process.env.APPDATA || path3.join(os4.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path3.join(os4.homedir(), "Library", "Logs", "adhdev") : path3.join(os4.homedir(), ".local", "share", "adhdev", "logs");
|
|
18812
18812
|
MAX_LOG_SIZE = 5 * 1024 * 1024;
|
|
18813
18813
|
MAX_LOG_DAYS = 7;
|
|
18814
18814
|
try {
|
|
@@ -19196,6 +19196,9 @@ function looksLikeMachOOrElf(filePath) {
|
|
|
19196
19196
|
}
|
|
19197
19197
|
function shSingleQuote(arg) {
|
|
19198
19198
|
if (/^[a-zA-Z0-9@%_+=:,./-]+$/.test(arg)) return arg;
|
|
19199
|
+
if (os12.platform() === "win32") {
|
|
19200
|
+
return `"${arg.replace(/"/g, '""')}"`;
|
|
19201
|
+
}
|
|
19199
19202
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
19200
19203
|
}
|
|
19201
19204
|
function estimatePromptDisplayLines(text, cols = 100) {
|
|
@@ -26193,7 +26196,7 @@ init_config();
|
|
|
26193
26196
|
init_workspaces();
|
|
26194
26197
|
init_config();
|
|
26195
26198
|
init_logger();
|
|
26196
|
-
var LOG_DIR2 = process.platform === "darwin" ? path8.join(os9.homedir(), "Library", "Logs", "adhdev") : path8.join(os9.homedir(), ".local", "share", "adhdev", "logs");
|
|
26199
|
+
var LOG_DIR2 = process.platform === "win32" ? path8.join(process.env.LOCALAPPDATA || process.env.APPDATA || path8.join(os9.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path8.join(os9.homedir(), "Library", "Logs", "adhdev") : path8.join(os9.homedir(), ".local", "share", "adhdev", "logs");
|
|
26197
26200
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
26198
26201
|
var MAX_DAYS = 7;
|
|
26199
26202
|
try {
|
|
@@ -30975,17 +30978,20 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
30975
30978
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
30976
30979
|
const baseArgs = [...spawn32.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
30977
30980
|
let shellCmd;
|
|
30981
|
+
const isWin = os15.platform() === "win32";
|
|
30982
|
+
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
30978
30983
|
if (command === "claude") {
|
|
30979
30984
|
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
30980
30985
|
if (model) args.push("--model", model);
|
|
30981
|
-
const escapedArgs = args.map(
|
|
30986
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
30982
30987
|
const metaPrompt = `Read the file at ${promptFile} and follow ALL the instructions. Implement the specific function requested, then test it via CDP curl targeting 127.0.0.1:19280, wait for confirmation of success, and then close. DO NOT start working on other features not listed in the prompt constraint.`;
|
|
30983
|
-
shellCmd = `${command} ${escapedArgs} -p
|
|
30988
|
+
shellCmd = `${command} ${escapedArgs} -p ${escapeArg(metaPrompt)}`;
|
|
30984
30989
|
} else if (command === "gemini") {
|
|
30985
30990
|
const args = [...baseArgs, "-y", "-s", "false"];
|
|
30986
30991
|
if (model) args.push("-m", model);
|
|
30987
|
-
const escapedArgs = args.map(
|
|
30988
|
-
|
|
30992
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
30993
|
+
const metaPrompt = `Read the file at ${promptFile} and follow ALL the instructions in it exactly. Do not ask questions, just execute.`;
|
|
30994
|
+
shellCmd = `${command} ${escapedArgs} -p ${escapeArg(metaPrompt)}`;
|
|
30989
30995
|
} else if (command === "codex") {
|
|
30990
30996
|
const args = ["exec", ...baseArgs];
|
|
30991
30997
|
if (!args.includes("--dangerously-bypass-approvals-and-sandbox")) {
|
|
@@ -30995,12 +31001,16 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
30995
31001
|
args.push("--skip-git-repo-check");
|
|
30996
31002
|
}
|
|
30997
31003
|
if (model) args.push("--model", model);
|
|
30998
|
-
const escapedArgs = args.map(
|
|
31004
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
30999
31005
|
const metaPrompt = `Read the file at ${promptFile} and follow ALL instructions strictly. DO NOT spend time exploring the filesystem or other providers. You have full authority to implement ALL required script files and independently test them against 127.0.0.1:19280 via CDP CURL. Upon complete validation of ALL assigned files, print exactly "_PIPELINE_COMPLETE_SIGNAL_" to gracefully close the pipeline. DO NOT WAIT FOR APPROVAL, execute completely autonomously.`;
|
|
31000
|
-
shellCmd = `${command} ${escapedArgs}
|
|
31006
|
+
shellCmd = `${command} ${escapedArgs} ${escapeArg(metaPrompt)}`;
|
|
31001
31007
|
} else {
|
|
31002
|
-
const escapedArgs = baseArgs.map(
|
|
31003
|
-
|
|
31008
|
+
const escapedArgs = baseArgs.map(escapeArg).join(" ");
|
|
31009
|
+
if (isWin) {
|
|
31010
|
+
shellCmd = `type "${promptFile}" | ${command} ${escapedArgs}`;
|
|
31011
|
+
} else {
|
|
31012
|
+
shellCmd = `cat '${promptFile}' | ${command} ${escapedArgs}`;
|
|
31013
|
+
}
|
|
31004
31014
|
}
|
|
31005
31015
|
sendAutoImplSSE(ctx, { event: "progress", data: { function: "_init", status: "spawning", message: `Spawning agent: ${shellCmd.substring(0, 200)}... (prompt: ${prompt.length} chars)` } });
|
|
31006
31016
|
ctx.autoImplStatus = { running: true, type, progress: [] };
|
|
@@ -31011,8 +31021,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
31011
31021
|
try {
|
|
31012
31022
|
const pty3 = __require("node-pty");
|
|
31013
31023
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
31014
|
-
const
|
|
31015
|
-
child = pty3.spawn(
|
|
31024
|
+
const isWin2 = os15.platform() === "win32";
|
|
31025
|
+
child = pty3.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
31016
31026
|
name: "xterm-256color",
|
|
31017
31027
|
cols: 120,
|
|
31018
31028
|
rows: 40,
|
|
@@ -31022,7 +31032,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
31022
31032
|
isPty = true;
|
|
31023
31033
|
} catch (err) {
|
|
31024
31034
|
ctx.log(`PTY not available, using child_process: ${err.message}`);
|
|
31025
|
-
child = spawnFn("sh", ["-c", shellCmd], {
|
|
31035
|
+
child = spawnFn(isWin ? "cmd.exe" : "sh", [isWin ? "/c" : "-c", shellCmd], {
|
|
31026
31036
|
cwd: providerDir,
|
|
31027
31037
|
shell: false,
|
|
31028
31038
|
timeout: 9e5,
|