mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 22:28:10 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js
This commit is contained in:
1 parent
b493699930
commit
c363f1207c
3 files changed
+40
-1
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250812-184906", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js", "timestamp": "2025-08-12T18:49:06Z", "type": "pre-edit", "original_branch": "alpha-89"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250812-184908", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js", "timestamp": "2025-08-12T18:49:08Z", "type": "post-edit", "branch": "alpha-89", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 490 ++++++++++++++++++++++++++++--- .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/1755024432.json | 1 + .claude/checkpoints/1755024434.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/stream-chain.js | 2 +- 7 files changed, 462 insertions(+), 40 deletions(-) "}
|
||||
@@ -390,7 +390,44 @@ async function executeStreamStep(prompt, inputStream, isLast, flags = {}) {
|
||||
console.log(` Debug: Executing: claude ${args.join(' ')}`);
|
||||
}
|
||||
|
||||
// Spawn Claude process
|
||||
// Try exec instead of spawn for better compatibility
|
||||
const command = `claude ${args.join(' ')}`;
|
||||
|
||||
exec(command, {
|
||||
timeout: stepTimeout,
|
||||
maxBuffer: 1024 * 1024 * 10 // 10MB buffer
|
||||
}, (error, stdout, stderr) => {
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (timedOut) {
|
||||
return; // Already handled by timeout
|
||||
}
|
||||
|
||||
const duration = Date.now() - startTime;
|
||||
|
||||
if (error && error.code === 'TIMEOUT') {
|
||||
// Handle timeout via exec
|
||||
timedOut = true;
|
||||
console.log('⚠️ Claude CLI timed out, falling back to mock mode...');
|
||||
mockStreamStep(prompt, inputStream, isLast, { ...flags, mock: true }, safeResolve, Date.now());
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.verbose && stderr) {
|
||||
console.error('Error output:', stderr);
|
||||
}
|
||||
|
||||
safeResolve({
|
||||
success: !error || error.code === 0,
|
||||
duration,
|
||||
output: stdout || '',
|
||||
stream: (!isLast && stdout) ? stdout : null,
|
||||
error: stderr || (error ? error.message : null)
|
||||
});
|
||||
});
|
||||
|
||||
// Keep the original spawn logic as backup (commented out)
|
||||
/*
|
||||
const claudeProcess = spawn('claude', args, {
|
||||
stdio: ['pipe', 'pipe', 'pipe']
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user