@adhdev/daemon-core 0.7.20 → 0.7.22
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 +23 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +3 -0
- package/src/daemon/dev-auto-implement.ts +16 -9
- package/src/logging/command-log.ts +5 -3
- package/src/logging/logger.ts +5 -3
package/dist/index.mjs
CHANGED
|
@@ -558,7 +558,7 @@ var init_logger = __esm({
|
|
|
558
558
|
LEVEL_NUM = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
559
559
|
LEVEL_LABEL = { debug: "DBG", info: "INF", warn: "WRN", error: "ERR" };
|
|
560
560
|
currentLevel = "info";
|
|
561
|
-
LOG_DIR = process.platform === "darwin" ? path3.join(os4.homedir(), "Library", "Logs", "adhdev") : path3.join(os4.homedir(), ".local", "share", "adhdev", "logs");
|
|
561
|
+
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");
|
|
562
562
|
MAX_LOG_SIZE = 5 * 1024 * 1024;
|
|
563
563
|
MAX_LOG_DAYS = 7;
|
|
564
564
|
try {
|
|
@@ -953,6 +953,9 @@ function looksLikeMachOOrElf(filePath) {
|
|
|
953
953
|
}
|
|
954
954
|
function shSingleQuote(arg) {
|
|
955
955
|
if (/^[a-zA-Z0-9@%_+=:,./-]+$/.test(arg)) return arg;
|
|
956
|
+
if (os12.platform() === "win32") {
|
|
957
|
+
return `"${arg.replace(/"/g, '""')}"`;
|
|
958
|
+
}
|
|
956
959
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
957
960
|
}
|
|
958
961
|
function estimatePromptDisplayLines(text, cols = 100) {
|
|
@@ -8202,7 +8205,7 @@ init_logger();
|
|
|
8202
8205
|
import * as fs6 from "fs";
|
|
8203
8206
|
import * as path8 from "path";
|
|
8204
8207
|
import * as os9 from "os";
|
|
8205
|
-
var LOG_DIR2 = process.platform === "darwin" ? path8.join(os9.homedir(), "Library", "Logs", "adhdev") : path8.join(os9.homedir(), ".local", "share", "adhdev", "logs");
|
|
8208
|
+
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");
|
|
8206
8209
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
8207
8210
|
var MAX_DAYS = 7;
|
|
8208
8211
|
try {
|
|
@@ -13265,17 +13268,20 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
13265
13268
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
13266
13269
|
const baseArgs = [...spawn3.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
13267
13270
|
let shellCmd;
|
|
13271
|
+
const isWin = os15.platform() === "win32";
|
|
13272
|
+
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
13268
13273
|
if (command === "claude") {
|
|
13269
13274
|
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
13270
13275
|
if (model) args.push("--model", model);
|
|
13271
|
-
const escapedArgs = args.map(
|
|
13276
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
13272
13277
|
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.`;
|
|
13273
|
-
shellCmd = `${command} ${escapedArgs} -p
|
|
13278
|
+
shellCmd = `${command} ${escapedArgs} -p ${escapeArg(metaPrompt)}`;
|
|
13274
13279
|
} else if (command === "gemini") {
|
|
13275
13280
|
const args = [...baseArgs, "-y", "-s", "false"];
|
|
13276
13281
|
if (model) args.push("-m", model);
|
|
13277
|
-
const escapedArgs = args.map(
|
|
13278
|
-
|
|
13282
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
13283
|
+
const metaPrompt = `Read the file at ${promptFile} and follow ALL the instructions in it exactly. Do not ask questions, just execute.`;
|
|
13284
|
+
shellCmd = `${command} ${escapedArgs} -p ${escapeArg(metaPrompt)}`;
|
|
13279
13285
|
} else if (command === "codex") {
|
|
13280
13286
|
const args = ["exec", ...baseArgs];
|
|
13281
13287
|
if (!args.includes("--dangerously-bypass-approvals-and-sandbox")) {
|
|
@@ -13285,12 +13291,16 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
13285
13291
|
args.push("--skip-git-repo-check");
|
|
13286
13292
|
}
|
|
13287
13293
|
if (model) args.push("--model", model);
|
|
13288
|
-
const escapedArgs = args.map(
|
|
13294
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
13289
13295
|
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.`;
|
|
13290
|
-
shellCmd = `${command} ${escapedArgs}
|
|
13296
|
+
shellCmd = `${command} ${escapedArgs} ${escapeArg(metaPrompt)}`;
|
|
13291
13297
|
} else {
|
|
13292
|
-
const escapedArgs = baseArgs.map(
|
|
13293
|
-
|
|
13298
|
+
const escapedArgs = baseArgs.map(escapeArg).join(" ");
|
|
13299
|
+
if (isWin) {
|
|
13300
|
+
shellCmd = `type "${promptFile}" | ${command} ${escapedArgs}`;
|
|
13301
|
+
} else {
|
|
13302
|
+
shellCmd = `cat '${promptFile}' | ${command} ${escapedArgs}`;
|
|
13303
|
+
}
|
|
13294
13304
|
}
|
|
13295
13305
|
sendAutoImplSSE(ctx, { event: "progress", data: { function: "_init", status: "spawning", message: `Spawning agent: ${shellCmd.substring(0, 200)}... (prompt: ${prompt.length} chars)` } });
|
|
13296
13306
|
ctx.autoImplStatus = { running: true, type, progress: [] };
|
|
@@ -13301,8 +13311,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
13301
13311
|
try {
|
|
13302
13312
|
const pty3 = __require("node-pty");
|
|
13303
13313
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
13304
|
-
const
|
|
13305
|
-
child = pty3.spawn(
|
|
13314
|
+
const isWin2 = os15.platform() === "win32";
|
|
13315
|
+
child = pty3.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
13306
13316
|
name: "xterm-256color",
|
|
13307
13317
|
cols: 120,
|
|
13308
13318
|
rows: 40,
|
|
@@ -13312,7 +13322,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
13312
13322
|
isPty = true;
|
|
13313
13323
|
} catch (err) {
|
|
13314
13324
|
ctx.log(`PTY not available, using child_process: ${err.message}`);
|
|
13315
|
-
child = spawnFn("sh", ["-c", shellCmd], {
|
|
13325
|
+
child = spawnFn(isWin ? "cmd.exe" : "sh", [isWin ? "/c" : "-c", shellCmd], {
|
|
13316
13326
|
cwd: providerDir,
|
|
13317
13327
|
shell: false,
|
|
13318
13328
|
timeout: 9e5,
|