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-processor.js

rUv1d753a668424
diff --git a/.claude/checkpoints/task-1754364319.json b/.claude/checkpoints/task-1754364319.json
new file mode 100644
index 0000000000..886450c966
--- /dev/null
+++ b/.claude/checkpoints/task-1754364319.json
@@ -0,0 +1 @@
+{"checkpoint": "task-20250805-032518", "task": "{{user_prompt}} ", "timestamp": "2025-08-05T03:25:19Z", "commit": "7ce234b0defee81c68c2e08e9edf14762e0bae22", "github_release": "true"}
diff --git a/src/cli/simple-commands/stream-processor.js b/src/cli/simple-commands/stream-processor.js
index 25bddb77dd..70c35a6965 100644
--- a/src/cli/simple-commands/stream-processor.js
+++ b/src/cli/simple-commands/stream-processor.js
@@ -70,12 +70,11 @@ export class StreamJsonProcessor extends Transform {
return;
}
- // Use interactive-style formatting for non-interactive mode
+ // Use clean, concise formatting for non-interactive mode
switch (event.type) {
case 'system':
if (event.subtype === 'init') {
- console.log(`\n● ${this.agentName} - Agent Initialized`);
- console.log(` ⎿ Session: ${event.session_id?.substring(0, 8) || 'unknown'}`);
+ console.log(`\n🤖 ${this.agentName} - Started (Session: ${event.session_id?.substring(0, 8) || 'unknown'})`);
}
break;
@@ -83,100 +82,51 @@ export class StreamJsonProcessor extends Transform {
if (event.message?.content?.length > 0) {
const content = event.message.content[0];
if (content.type === 'text') {
- // Format text content with bullet and indentation
- const lines = content.text.split('\n');
- console.log(`\n● ${lines[0] || 'Processing...'}`);
- if (lines.length > 1) {
- lines.slice(1, 3).forEach(line => {
- if (line.trim()) {
- console.log(` ⎿ ${line.trim()}`);
- }
- });
- if (lines.length > 3) {
- console.log(` … +${lines.length - 3} lines (ctrl+r to expand)`);
- }
- }
- } else if (content.type === 'tool_use') {
- // Format tool calls like interactive mode
- const params = content.input ? this.formatToolParams(content.input) : '';
- console.log(`\n● ${this.agentName} - ${content.name}${params}`);
-
- // Show formatted input if available
- if (content.input && Object.keys(content.input).length > 0) {
- const inputStr = JSON.stringify(content.input, null, 2);
- if (inputStr.length > 200) {
- const preview = JSON.stringify(content.input, null, 0).substring(0, 100);
- console.log(` ⎿ ${preview}...`);
- console.log(` … +${inputStr.split('\n').length - 1} lines (ctrl+r to expand)`);
+ // Show only the first meaningful line, skip verbose details
+ const lines = content.text.split('\n').filter(line => line.trim());
+ if (lines.length > 0) {
+ const firstLine = lines[0].trim();
+ if (firstLine.length > 100) {
+ console.log(`💭 ${firstLine.substring(0, 97)}...`);
} else {
- console.log(` ⎿ ${inputStr.split('\n').map(l => l.trim()).filter(l => l).join(' ')}`);
+ console.log(`💭 ${firstLine}`);
}
}
+ } else if (content.type === 'tool_use') {
+ // Show tool use concisely
+ const toolName = content.name.replace(/([A-Z])/g, ' $1').trim();
+ console.log(`🔧 ${toolName}`);
}
}
break;
case 'user':
- // Tool results - format like interactive mode
+ // Tool results - show only success/failure
if (event.message?.content?.[0]?.type === 'tool_result') {
const result = event.message.content[0];
if (!result.is_error) {
- if (result.content) {
- try {
- const parsed = typeof result.content === 'string'
- ? JSON.parse(result.content)
- : result.content;
-
- if (typeof parsed === 'object') {
- console.log(` ⎿ {`);
- const keys = Object.keys(parsed).slice(0, 3);
- keys.forEach(key => {
- const value = JSON.stringify(parsed[key]);
- const displayValue = value.length > 50 ? value.substring(0, 47) + '...' : value;
- console.log(` "${key}": ${displayValue},`);
- });
- if (Object.keys(parsed).length > 3) {
- console.log(` … +${Object.keys(parsed).length - 3} lines (ctrl+r to expand)`);
- } else {
- // Remove last comma
- process.stdout.write('\x1B[1A\x1B[K'); // Move up and clear line
- const lastKey = keys[keys.length - 1];
- const value = JSON.stringify(parsed[lastKey]);
- const displayValue = value.length > 50 ? value.substring(0, 47) + '...' : value;
- console.log(` "${lastKey}": ${displayValue}`);
- }
- console.log(` }`);
- } else {
- console.log(` ⎿ ${result.content.substring(0, 100)}${result.content.length > 100 ? '...' : ''}`);
- }
- } catch (e) {
- console.log(` ⎿ ${result.content.substring(0, 100)}${result.content.length > 100 ? '...' : ''}`);
- }
- } else {
- console.log(` ⎿ Tool completed successfully`);
- }
+ console.log(` ✅ Tool completed`);
} else {
- console.log(` ⎿ ❌ Error: ${result.error || 'Unknown error'}`);
+ console.log(` ❌ Tool failed: ${result.error || 'Unknown error'}`);
}
}
break;
case 'result':
if (event.subtype === 'success') {
- console.log(`\n● ✅ ${this.agentName} completed successfully`);
- console.log(` ⎿ Duration: ${this.formatDuration(event.duration_ms)}`);
+ console.log(`\n✅ ${this.agentName} - Completed (${this.formatDuration(event.duration_ms)})`);
if (event.total_cost_usd) {
- console.log(` ⎿ Cost: $${event.total_cost_usd.toFixed(4)}`);
+ console.log(` 💰 Cost: $${event.total_cost_usd.toFixed(4)}`);
}
} else if (event.is_error) {
- console.log(`\n● ❌ ${this.agentName} failed`);
- console.log(` ⎿ Error: ${event.error || 'Unknown error'}`);
+ console.log(`\n❌ ${this.agentName} - Failed: ${event.error || 'Unknown error'}`);
}
break;
default:
- if (this.options.verbose) {
- console.log(`\n● [${event.type}] ${JSON.stringify(event).substring(0, 100)}...`);
+ // Only show important events in verbose mode
+ if (this.options.verbose && ['tool_call', 'error', 'warning'].includes(event.type)) {
+ console.log(`ℹ️ [${event.type}] ${event.message || JSON.stringify(event).substring(0, 80)}...`);
}
}
}