mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
feat: add per-agent logging UI and fix stuck agent issues
Changes: - Add per-agent log viewer with copy-to-clipboard functionality - New AgentLogEntry type for structured log entries - Logs stored per-agent in WebSocket state (up to 500 entries) - Log modal rendered via React Portal to avoid overflow issues - Click log icon on agent card to view full activity history - Fix agents getting stuck in "failed" state - Wrap client context manager in try/except (agent.py) - Remove failed agents from UI on error state (useWebSocket.ts) - Handle permanently failed features in get_all_complete() - Add friendlier agent state labels - "Hit an issue" → "Trying plan B..." - "Retrying..." → "Being persistent..." - Softer colors (yellow/orange instead of red) - Add scheduling scores for smarter feature ordering - compute_scheduling_scores() in dependency_resolver.py - Features that unblock others get higher priority - Update CLAUDE.md with parallel mode documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
45
CLAUDE.md
45
CLAUDE.md
@@ -45,6 +45,9 @@ python autonomous_agent_demo.py --project-dir my-app # if registered
|
||||
|
||||
# YOLO mode: rapid prototyping without browser testing
|
||||
python autonomous_agent_demo.py --project-dir my-app --yolo
|
||||
|
||||
# Parallel mode: run multiple agents concurrently (1-5 agents)
|
||||
python autonomous_agent_demo.py --project-dir my-app --parallel --max-concurrency 3
|
||||
```
|
||||
|
||||
### YOLO Mode (Rapid Prototyping)
|
||||
@@ -95,6 +98,8 @@ npm run lint # Run ESLint
|
||||
- `prompts.py` - Prompt template loading with project-specific fallback
|
||||
- `progress.py` - Progress tracking, database queries, webhook notifications
|
||||
- `registry.py` - Project registry for mapping names to paths (cross-platform)
|
||||
- `parallel_orchestrator.py` - Concurrent agent execution with dependency-aware scheduling
|
||||
- `api/dependency_resolver.py` - Cycle detection (Kahn's algorithm + DFS) and dependency validation
|
||||
|
||||
### Project Registry
|
||||
|
||||
@@ -121,26 +126,40 @@ The FastAPI server provides REST endpoints for the UI:
|
||||
Features are stored in SQLite (`features.db`) via SQLAlchemy. The agent interacts with features through an MCP server:
|
||||
|
||||
- `mcp_server/feature_mcp.py` - MCP server exposing feature management tools
|
||||
- `api/database.py` - SQLAlchemy models (Feature table with priority, category, name, description, steps, passes)
|
||||
- `api/database.py` - SQLAlchemy models (Feature table with priority, category, name, description, steps, passes, dependencies)
|
||||
|
||||
MCP tools available to the agent:
|
||||
- `feature_get_stats` - Progress statistics
|
||||
- `feature_get_next` - Get highest-priority pending feature
|
||||
- `feature_get_next` - Get highest-priority pending feature (respects dependencies)
|
||||
- `feature_claim_next` - Atomically claim next available feature (for parallel mode)
|
||||
- `feature_get_for_regression` - Random passing features for regression testing
|
||||
- `feature_mark_passing` - Mark feature complete
|
||||
- `feature_skip` - Move feature to end of queue
|
||||
- `feature_create_bulk` - Initialize all features (used by initializer)
|
||||
- `feature_add_dependency` - Add dependency between features (with cycle detection)
|
||||
- `feature_remove_dependency` - Remove a dependency
|
||||
|
||||
### React UI (ui/)
|
||||
|
||||
- Tech stack: React 18, TypeScript, TanStack Query, Tailwind CSS v4, Radix UI
|
||||
- Tech stack: React 18, TypeScript, TanStack Query, Tailwind CSS v4, Radix UI, dagre (graph layout)
|
||||
- `src/App.tsx` - Main app with project selection, kanban board, agent controls
|
||||
- `src/hooks/useWebSocket.ts` - Real-time updates via WebSocket
|
||||
- `src/hooks/useWebSocket.ts` - Real-time updates via WebSocket (progress, agent status, logs, agent updates)
|
||||
- `src/hooks/useProjects.ts` - React Query hooks for API calls
|
||||
- `src/lib/api.ts` - REST API client
|
||||
- `src/lib/types.ts` - TypeScript type definitions
|
||||
- `src/components/FolderBrowser.tsx` - Server-side filesystem browser for project folder selection
|
||||
- `src/components/NewProjectModal.tsx` - Multi-step project creation wizard
|
||||
|
||||
Key components:
|
||||
- `AgentMissionControl.tsx` - Dashboard showing active agents with mascots (Spark, Fizz, Octo, Hoot, Buzz)
|
||||
- `DependencyGraph.tsx` - Interactive node graph visualization with dagre layout
|
||||
- `CelebrationOverlay.tsx` - Confetti animation on feature completion
|
||||
- `FolderBrowser.tsx` - Server-side filesystem browser for project folder selection
|
||||
|
||||
Keyboard shortcuts (press `?` for help):
|
||||
- `D` - Toggle debug panel
|
||||
- `G` - Toggle Kanban/Graph view
|
||||
- `N` - Add new feature
|
||||
- `A` - Toggle AI assistant
|
||||
- `,` - Open settings
|
||||
|
||||
### Project Structure for Generated Apps
|
||||
|
||||
@@ -181,10 +200,20 @@ Defense-in-depth approach configured in `client.py`:
|
||||
### Real-time UI Updates
|
||||
|
||||
The UI receives updates via WebSocket (`/ws/projects/{project_name}`):
|
||||
- `progress` - Test pass counts
|
||||
- `progress` - Test pass counts (passing, in_progress, total)
|
||||
- `agent_status` - Running/paused/stopped/crashed
|
||||
- `log` - Agent output lines (streamed from subprocess stdout)
|
||||
- `log` - Agent output lines with optional featureId/agentIndex for attribution
|
||||
- `feature_update` - Feature status changes
|
||||
- `agent_update` - Multi-agent state updates (thinking/working/testing/success/error) with mascot names
|
||||
|
||||
### Parallel Mode
|
||||
|
||||
When running with `--parallel`, the orchestrator:
|
||||
1. Spawns multiple Claude agents as subprocesses (up to `--max-concurrency`)
|
||||
2. Each agent claims features atomically via `feature_claim_next`
|
||||
3. Features blocked by unmet dependencies are skipped
|
||||
4. Browser contexts are isolated per agent using `--isolated` flag
|
||||
5. AgentTracker parses output and emits `agent_update` messages for UI
|
||||
|
||||
### Design System
|
||||
|
||||
|
||||
Reference in New Issue
Block a user