mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 14:16:34 +09:00
🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/cli/simple-commands/stream-processor.js
This commit is contained in:
1 parent
8eea3a4f8f
commit
06909ea4e2
3 files changed
+60
No files matched your search
@@ -0,0 +1 @@
|
||||
{"branch": "checkpoint/pre-edit-20250804-203017", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/stream-processor.js", "timestamp": "2025-08-04T20:30:17Z", "type": "pre-edit", "original_branch": "alpha-85"}
|
||||
@@ -0,0 +1 @@
|
||||
{"tag": "checkpoint-20250804-203018", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/stream-processor.js", "timestamp": "2025-08-04T20:30:18Z", "type": "post-edit", "branch": "alpha-85", "diff_summary": " .claude-flow/metrics/performance.json | 6 +++--- .claude-flow/metrics/system-metrics.json | 24 ++++++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 +++--- .claude/checkpoints/1754339400.json | 1 + .claude/checkpoints/1754339402.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/stream-processor.js | 2 ++ 7 files changed, 34 insertions(+), 6 deletions(-) "}
|
||||
@@ -64,6 +64,13 @@ export class StreamJsonProcessor extends Transform {
|
||||
processEvent(event) {
|
||||
this.eventCount++;
|
||||
|
||||
// If we have a concurrent display, update it instead of console logging
|
||||
if (this.display) {
|
||||
this.updateDisplay(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise use the original console output
|
||||
// Clear previous line and move cursor up
|
||||
if (!this.options.verbose) {
|
||||
process.stdout.write('\r\x1B[K'); // Clear current line
|
||||
@@ -123,6 +130,57 @@ export class StreamJsonProcessor extends Transform {
|
||||
this.updateProgress();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the concurrent display instead of console
|
||||
*/
|
||||
updateDisplay(event) {
|
||||
switch (event.type) {
|
||||
case 'system':
|
||||
if (event.subtype === 'init') {
|
||||
this.display.updateAgent(this.agentId, { status: 'active' });
|
||||
this.display.addActivity(this.agentId, 'Initialized');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'assistant':
|
||||
if (event.message?.content?.length > 0) {
|
||||
const content = event.message.content[0];
|
||||
if (content.type === 'text') {
|
||||
const preview = content.text.substring(0, 80);
|
||||
this.display.addActivity(this.agentId, preview);
|
||||
} else if (content.type === 'tool_use') {
|
||||
this.display.addActivity(this.agentId, `Using ${content.name}`, content.name);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
// Tool results
|
||||
if (event.message?.content?.[0]?.type === 'tool_result') {
|
||||
const result = event.message.content[0];
|
||||
if (!result.is_error) {
|
||||
this.display.addActivity(this.agentId, 'Tool completed', null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'result':
|
||||
if (event.subtype === 'success') {
|
||||
this.display.updateAgent(this.agentId, {
|
||||
status: 'completed',
|
||||
progress: 100
|
||||
});
|
||||
this.display.addActivity(this.agentId, 'Task completed successfully');
|
||||
} else if (event.is_error) {
|
||||
this.display.updateAgent(this.agentId, {
|
||||
status: 'failed'
|
||||
});
|
||||
this.display.addActivity(this.agentId, `Failed: ${event.error || 'Unknown error'}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updateProgress() {
|
||||
const elapsed = this.formatDuration(Date.now() - this.startTime);
|
||||
|
||||
Reference in new issue
Block a user