I'll help you add log streaming support to the agent-web-ui. Let me first explore the current structure of the web UI to understand how it's organized and then implement the log streaming feature.
[tool: list_dir — Tool use: list_dir]
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/src/App.tsx]
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/src/services/websocket.ts]
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/src/services/websocket.ts]
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/src/types/api.ts]
[tool: list_dir — Tool use: list_dir]
[tool: list_dir — Tool use: list_dir]
Perfect! I can see there's already a monitoring directory but it's empty. Let me also check the layout components to understand how to integrate log streaming into the UI.
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/src/components/layout/MainLayout.tsx]
Now let me look at the chat interface to understand how it's structured:
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/src/features/chat/ChatInterface.tsx]
Now I have a good understanding of the structure. Let me create a comprehensive log streaming feature for the agent-web-ui. I'll:
- First extend the WebSocket types to include log-related messages
- Enhance the WebSocket service to support log streaming
- Create a logs monitoring feature
- Add a logs tab/section to the UI
Let's start:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/types/api.ts]
Now let's enhance the WebSocket service to support log streaming:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/services/websocket.ts]
Now let's create a log store to manage log state:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/stores/logStore.ts]
Next, let's create the log monitoring components:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/features/monitoring/LogViewer.tsx]
Let me fix the TypeScript error with the timestamp formatting:
[tool: search_replace — Tool use: search_replace • Edit file: agent-web-ui/src/features/monitoring/LogViewer.tsx]
Now let's create a compact log panel that can be integrated into the chat interface:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/features/monitoring/LogPanel.tsx]
Now let's add the logs route to the main app and update the navigation:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/App.tsx]
Now let's update the navigation to include the logs section:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/components/layout/MainLayout.tsx]
Now let's integrate the compact log panel into the ChatInterface to show logs alongside the chat:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/src/features/chat/ChatInterface.tsx]
Finally, let's update the main CSS to support the line-clamp utility we used:
[tool: read_file — Tool use: read_file • Read file: agent-web-ui/tailwind.config.js]
Let me check if we need to add the line-clamp plugin:
[tool: edit_file — Tool use: edit_file • Edit file: agent-web-ui/tailwind.config.js]
Let me modify the CSS to use a simpler approach for line clamping since the line-clamp plugin might not be available:
[tool: search_replace — Tool use: search_replace • Edit file: agent-web-ui/src/features/monitoring/LogViewer.tsx]
[tool: search_replace — Tool use: search_replace • Edit file: agent-web-ui/src/features/monitoring/LogPanel.tsx]
Perfect! I've successfully implemented comprehensive log streaming support for the agent-web-ui. Here's a summary of what has been added:
🎉 Log Streaming Implementation Complete!
Features Added:
1. Enhanced WebSocket Service
- Added support for log streaming WebSocket messages (
get_log_sources, subscribe_logs, unsubscribe_logs)
- Automatic connection ID tracking for log subscriptions
- Clean disconnection handling with log unsubscription
2. Log Management Store
- Created
useLogStore with Zustand for managing log state
- Real-time log entry filtering by level and search
- Automatic WebSocket event handling for log streaming
- Memory-efficient log storage with configurable limits
3. Two Log Display Components
Full Log Viewer (/logs route):
- Comprehensive log viewer with advanced filtering
- Source-based log subscription management
- Log level filtering (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- Search functionality across log messages
- Expandable log entries with metadata (module, function, line)
- Auto-scroll with manual override
- Real-time streaming status indicator
Compact Log Panel (embedded in chat):
- Collapsible log panel integrated into the chat interface
- Auto-subscribes to key log sources (agent, memory_manager, api)
- Shows recent important logs (INFO, WARNING, ERROR, CRITICAL)
- Visual indicators for error and warning counts
- Minimal footprint when collapsed
4. UI Integration
- Added "Logs" navigation item in the main sidebar
- Integrated LogPanel into ChatInterface for real-time monitoring
- Updated routing to include the full log viewer page
5. Type Safety
- Extended TypeScript types for log streaming messages
- Proper typing for log entries and subscription management
How It Works:
- When a session starts: The log store automatically initializes log streaming
- WebSocket connection: Gets available log sources from the backend
- Auto-subscription: Automatically subscribes to important log sources (agent, memory_manager, api)
- Real-time updates: Logs stream in real-time and are filtered/displayed appropriately
- User control: Users can toggle log sources, filter by level, search, and manage display preferences
User Experience:
- In Chat: Users see a compact log panel below the chat that shows real-time system activity
- Full Logs Page: Complete log management interface with advanced filtering and search
- Visual Feedback: Color-coded log levels with emoji icons for quick recognition
- Smart Defaults: Automatically shows important logs while filtering out noise
The implementation is fully integrated with the existing WebSocket log streaming API and provides both developer-friendly detailed logging and user-friendly activity monitoring. Users can now see exactly what the agent system is doing in real-time, making debugging and system monitoring much more transparent!
Want to test it out? Start the API server and the web UI, create a session, and you'll see logs streaming in both the chat interface and the dedicated logs page. 🚀