knoxis-helper 1.4.6 → 1.4.7
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.
|
@@ -177,8 +177,10 @@ function callGroq(systemPrompt, userMessage) {
|
|
|
177
177
|
// === RUN CLAUDE TURN ===
|
|
178
178
|
function runClaudeTurn(message, isResume) {
|
|
179
179
|
return new Promise((resolve) => {
|
|
180
|
-
// Check claude is available
|
|
181
|
-
const
|
|
180
|
+
// Check claude is available (Windows uses `where`, Unix uses `which`)
|
|
181
|
+
const isWindows = process.platform === 'win32';
|
|
182
|
+
const detector = isWindows ? 'where' : 'which';
|
|
183
|
+
const which = spawnSync(detector, ['claude'], { stdio: 'pipe' });
|
|
182
184
|
if (which.status !== 0) {
|
|
183
185
|
resolve({ stdout: '', stderr: 'claude CLI not found', code: 127 });
|
|
184
186
|
return;
|
|
@@ -191,10 +193,14 @@ function runClaudeTurn(message, isResume) {
|
|
|
191
193
|
args.push('--session-id', SESSION_ID);
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
// shell: true on Windows so the claude.cmd shim resolves via PATHEXT.
|
|
197
|
+
// Required since Node 18.20.2/20.12.2 (CVE-2024-27980) refuses to spawn
|
|
198
|
+
// .cmd/.bat files without it.
|
|
194
199
|
const proc = spawn('claude', args, {
|
|
195
200
|
cwd: process.cwd(),
|
|
196
201
|
env: process.env,
|
|
197
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
202
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
203
|
+
shell: isWindows
|
|
198
204
|
});
|
|
199
205
|
|
|
200
206
|
let stdout = '';
|
|
@@ -337,7 +343,10 @@ async function main() {
|
|
|
337
343
|
if (phase1.code !== 0 && !phase1.stdout) {
|
|
338
344
|
console.log('');
|
|
339
345
|
console.log(' Phase 1 failed (exit ' + phase1.code + '). Falling back to single-shot.');
|
|
340
|
-
|
|
346
|
+
if (phase1.stderr) {
|
|
347
|
+
console.log(' stderr: ' + phase1.stderr.split('\n').slice(0, 5).join('\n '));
|
|
348
|
+
}
|
|
349
|
+
appendLog('Phase 1 failed (exit ' + phase1.code + '). stderr: ' + (phase1.stderr || '(empty)') + '\n');
|
|
341
350
|
const code = await runSingleShot(task);
|
|
342
351
|
const logFile = saveSessionLog();
|
|
343
352
|
if (logFile) console.log(' Log: ' + logFile);
|