Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/stream-chain.js

rUvc363f1207c55
diff --git a/.claude/checkpoints/1755024546.json b/.claude/checkpoints/1755024546.json
new file mode 100644
index 0000000000..8ab7e00af9
--- /dev/null
+++ b/.claude/checkpoints/1755024546.json
@@ -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"}
diff --git a/.claude/checkpoints/1755024548.json b/.claude/checkpoints/1755024548.json
new file mode 100644
index 0000000000..35f02d6879
--- /dev/null
+++ b/.claude/checkpoints/1755024548.json
@@ -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(-) "}
diff --git a/src/cli/simple-commands/stream-chain.js b/src/cli/simple-commands/stream-chain.js
index e07ee6b2a0..d40f665e62 100644
--- a/src/cli/simple-commands/stream-chain.js
+++ b/src/cli/simple-commands/stream-chain.js
@@ -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']
});