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