orchestrix-yuri 4.5.7 → 4.5.8
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.
|
@@ -274,9 +274,40 @@ function runClaude(args, cwd, timeout) {
|
|
|
274
274
|
return new Promise((resolve) => {
|
|
275
275
|
const binary = getClaudeBinary();
|
|
276
276
|
|
|
277
|
-
|
|
277
|
+
// Write long args (system-prompt, prompt) to temp files to avoid
|
|
278
|
+
// command-line argument length limits. Claude CLI's --system-prompt
|
|
279
|
+
// with the full SKILL.md (~11KB) exceeds shell/OS arg limits.
|
|
280
|
+
const tmpFiles = [];
|
|
281
|
+
const finalArgs = [];
|
|
282
|
+
for (let i = 0; i < args.length; i++) {
|
|
283
|
+
if (args[i] === '--system-prompt' && args[i + 1] && args[i + 1].length > 1000) {
|
|
284
|
+
const tmpFile = path.join(os.tmpdir(), `yuri-sp-${Date.now()}.txt`);
|
|
285
|
+
fs.writeFileSync(tmpFile, args[i + 1]);
|
|
286
|
+
tmpFiles.push(tmpFile);
|
|
287
|
+
finalArgs.push('--system-prompt-file', tmpFile);
|
|
288
|
+
i++; // skip the value
|
|
289
|
+
} else if (i === args.length - 1 && args[i].length > 1000 && !args[i].startsWith('-')) {
|
|
290
|
+
// Last arg = user prompt, write to temp file for stdin piping
|
|
291
|
+
const tmpFile = path.join(os.tmpdir(), `yuri-prompt-${Date.now()}.txt`);
|
|
292
|
+
fs.writeFileSync(tmpFile, args[i]);
|
|
293
|
+
tmpFiles.push(tmpFile);
|
|
294
|
+
finalArgs.push('-p', '-'); // read prompt from stdin
|
|
295
|
+
// We'll pipe this file via stdin below
|
|
296
|
+
finalArgs._stdinFile = tmpFile;
|
|
297
|
+
} else {
|
|
298
|
+
finalArgs.push(args[i]);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
log.engine(`Calling: claude ${finalArgs.slice(0, 4).join(' ')}... (cwd: ${cwd})`);
|
|
303
|
+
|
|
304
|
+
const cleanupTmp = () => {
|
|
305
|
+
for (const f of tmpFiles) {
|
|
306
|
+
try { fs.unlinkSync(f); } catch { /* ok */ }
|
|
307
|
+
}
|
|
308
|
+
};
|
|
278
309
|
|
|
279
|
-
const proc = execFile(binary,
|
|
310
|
+
const proc = execFile(binary, finalArgs, {
|
|
280
311
|
cwd,
|
|
281
312
|
timeout: timeout || 300000,
|
|
282
313
|
maxBuffer: 10 * 1024 * 1024, // 10MB
|
|
@@ -286,14 +317,15 @@ function runClaude(args, cwd, timeout) {
|
|
|
286
317
|
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: '80',
|
|
287
318
|
},
|
|
288
319
|
}, (err, stdout, stderr) => {
|
|
320
|
+
cleanupTmp();
|
|
289
321
|
if (err && err.killed) {
|
|
290
322
|
log.warn('Claude CLI timed out');
|
|
291
323
|
return resolve({ reply: '⏱ Response timed out.', raw: '' });
|
|
292
324
|
}
|
|
293
325
|
if (err) {
|
|
294
|
-
log.error(`Claude CLI error: ${err.message}`);
|
|
326
|
+
log.error(`Claude CLI error: ${err.message.slice(0, 200)}`);
|
|
295
327
|
if (stderr) log.info(`stderr: ${stderr.slice(0, 200)}`);
|
|
296
|
-
return resolve({ reply: `❌ Claude CLI error: ${err.message}`, raw: stderr });
|
|
328
|
+
return resolve({ reply: `❌ Claude CLI error: ${err.message.slice(0, 200)}`, raw: stderr });
|
|
297
329
|
}
|
|
298
330
|
|
|
299
331
|
try {
|