@workermill/agent 0.4.0 → 0.4.2
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/planner.js +18 -10
- package/package.json +1 -1
package/dist/planner.js
CHANGED
|
@@ -300,22 +300,26 @@ async function cloneTargetRepo(repo, token, scmProvider, taskId) {
|
|
|
300
300
|
function runAnalyst(claudePath, model, prompt, repoPath, env, timeoutMs = 120_000) {
|
|
301
301
|
return new Promise((resolve) => {
|
|
302
302
|
const proc = spawn(claudePath, [
|
|
303
|
-
"
|
|
304
|
-
|
|
305
|
-
"--
|
|
306
|
-
model,
|
|
307
|
-
"--permission-mode",
|
|
308
|
-
"bypassPermissions",
|
|
309
|
-
"--output-format",
|
|
310
|
-
"stream-json",
|
|
303
|
+
"--print",
|
|
304
|
+
"--verbose",
|
|
305
|
+
"--output-format", "stream-json",
|
|
306
|
+
"--model", model,
|
|
307
|
+
"--permission-mode", "bypassPermissions",
|
|
311
308
|
], {
|
|
312
309
|
cwd: repoPath,
|
|
313
310
|
env,
|
|
314
311
|
stdio: ["pipe", "pipe", "pipe"],
|
|
315
312
|
});
|
|
313
|
+
// Write prompt via stdin (same as runClaudeCli — not via -p arg)
|
|
314
|
+
proc.stdin.write(prompt);
|
|
315
|
+
proc.stdin.end();
|
|
316
316
|
let resultText = "";
|
|
317
317
|
let fullText = "";
|
|
318
|
+
let stderrOutput = "";
|
|
318
319
|
let lineBuffer = "";
|
|
320
|
+
proc.stderr.on("data", (chunk) => {
|
|
321
|
+
stderrOutput += chunk.toString();
|
|
322
|
+
});
|
|
319
323
|
proc.stdout.on("data", (data) => {
|
|
320
324
|
lineBuffer += data.toString();
|
|
321
325
|
const lines = lineBuffer.split("\n");
|
|
@@ -343,12 +347,16 @@ function runAnalyst(claudePath, model, prompt, repoPath, env, timeoutMs = 120_00
|
|
|
343
347
|
proc.kill("SIGTERM");
|
|
344
348
|
resolve(resultText || fullText || "");
|
|
345
349
|
}, timeoutMs);
|
|
346
|
-
proc.on("exit", () => {
|
|
350
|
+
proc.on("exit", (code) => {
|
|
347
351
|
clearTimeout(timeout);
|
|
352
|
+
if (code !== 0 && stderrOutput) {
|
|
353
|
+
console.error(`${chalk.yellow("⚠")} Analyst exited with code ${code}: ${stderrOutput.substring(0, 200)}`);
|
|
354
|
+
}
|
|
348
355
|
resolve(resultText || fullText || "");
|
|
349
356
|
});
|
|
350
|
-
proc.on("error", () => {
|
|
357
|
+
proc.on("error", (err) => {
|
|
351
358
|
clearTimeout(timeout);
|
|
359
|
+
console.error(`${chalk.yellow("⚠")} Analyst spawn error: ${err.message}`);
|
|
352
360
|
resolve("");
|
|
353
361
|
});
|
|
354
362
|
});
|