Files
Ofer Shaal da900c2689 fix: resolve real-time visualization connection and timestamp issues (#96)
* fix: update WebSocket connection port and improve MindMap data filtering

- Changed WebSocket connection port from 3001 to 8080 for compatibility.
- Enhanced MindMap component to handle undefined currentGraphData, ensuring nodes and edges are filtered correctly.

This update improves the stability of the WebSocket connection and ensures the MindMap component functions correctly with varying data inputs.

* feat: enhance LifecycleTimeline and WebSocket handling

- Updated LifecycleTimeline component to include additional event types and improve icon and color handling.
- Modified WebSocketContext to handle both direct and nested message formats for initial state, ensuring compatibility with frontend expectations.
- Introduced a new script for emitting agent events to the EventStore, facilitating better visualization and tracking of agent lifecycle events.
- Adjusted API base URL for consistency and improved CORS settings for local development.

This update enhances the overall functionality and robustness of the event handling and visualization components.

* fix: update edge source ID in DataTransformer

- Changed the source ID for edges in the DataTransformer class to directly use the agent ID without a prefix. This aligns the edge representation with the agent node ID format, improving consistency in data visualization.

This update enhances the accuracy of the data transformation process.

* feat: add visualization dashboard and event emission scripts

- Introduced a new visualization dashboard for real-time agent activity tracking.
- Added scripts for emitting agent events (spawn, start, complete, error) to the EventStore.
- Implemented hooks for automatic event emission during task execution.
- Enhanced the settings configuration to include commands for visualization event emission.

This update significantly improves the monitoring and debugging capabilities of agent activities.

* feat: improve timestamp handling in DrillDownPanel and LifecycleTimeline

- Added a utility function `toTimestampMs` to safely convert timestamps from both ISO strings and numeric formats to milliseconds.
- Updated sorting and formatting of event timestamps in both the DrillDownPanel and LifecycleTimeline components to utilize the new timestamp conversion function.
- Enhanced the display of event logs and metadata to ensure consistent timestamp representation across the application.

This update improves the accuracy and reliability of timestamp handling in event visualizations.

---------

Co-authored-by: Dragan Spiridonov <spiridonovdragan@gmail.com>
2025-12-02 08:53:15 +01:00

84 lines
2.5 KiB
TypeScript

#!/usr/bin/env npx tsx
/**
* CLI to emit agent events to the EventStore for visualization
*
* Usage:
* npx tsx scripts/emit-agent-event.ts spawn <agentId> <agentType>
* npx tsx scripts/emit-agent-event.ts start <agentId>
* npx tsx scripts/emit-agent-event.ts complete <agentId> [duration]
* npx tsx scripts/emit-agent-event.ts error <agentId> <errorMessage>
*
* Examples:
* npx tsx scripts/emit-agent-event.ts spawn qe-test-generator researcher
* npx tsx scripts/emit-agent-event.ts start qe-test-generator
* npx tsx scripts/emit-agent-event.ts complete qe-test-generator 5000
* npx tsx scripts/emit-agent-event.ts error qe-test-generator "Connection failed"
*/
import {
emitAgentSpawn,
emitAgentStart,
emitAgentComplete,
emitAgentError,
type EmitResult,
} from '../src/visualization/emit-event';
async function main(): Promise<void> {
const [, , action, agentId, ...args] = process.argv;
if (!action || !agentId) {
console.log(`
Usage:
npx tsx scripts/emit-agent-event.ts spawn <agentId> <agentType>
npx tsx scripts/emit-agent-event.ts start <agentId>
npx tsx scripts/emit-agent-event.ts complete <agentId> [duration]
npx tsx scripts/emit-agent-event.ts error <agentId> <errorMessage>
Examples:
npx tsx scripts/emit-agent-event.ts spawn qe-test-generator researcher
npx tsx scripts/emit-agent-event.ts start qe-test-generator
npx tsx scripts/emit-agent-event.ts complete qe-test-generator 5000
npx tsx scripts/emit-agent-event.ts error qe-test-generator "Connection failed"
`);
process.exit(1);
}
let result: EmitResult;
switch (action) {
case 'spawn':
result = await emitAgentSpawn(agentId, args[0] || 'coder');
break;
case 'start':
result = await emitAgentStart(agentId);
break;
case 'complete':
result = await emitAgentComplete(agentId, parseInt(args[0]) || 0);
break;
case 'error':
result = await emitAgentError(agentId, args.join(' ') || 'Unknown error');
break;
default:
console.error(`Unknown action: ${action}`);
process.exit(1);
}
if (result.success) {
console.log(`✓ Event recorded: ${action} for agent ${agentId}`);
if (result.wsBroadcast) {
console.log('✓ Event broadcasted via WebSocket');
} else {
console.log('○ WebSocket broadcast skipped (server may not be running)');
}
} else {
console.error(`✗ Event failed: ${result.error}`);
process.exit(1);
}
}
main().catch(console.error);