VibeGame / src /lib /server /context.md
dylanebert's picture
improved prompting/UX
db9635c
# Server Context
WebSocket server with LangGraph agent for AI-assisted game development.
## Key Components
- **api.ts** - WebSocket message routing and connection management
- **langgraph-agent.ts** - LangGraph agent with tool deduplication and conflict detection
- **mcp-client.ts** - Editor tools with pre-validation and standardized responses
- **tools.ts** - Console observation with tail limiting
- **task-tracker.ts** - Task planning and management tools
- **console-buffer.ts** - Console buffering with lifecycle events and tail limiting
## Architecture
LangGraph agent with robust tool execution:
- Virtual file system with version tracking and edit history
- Tool call deduplication to prevent redundant operations
- Sequential tool execution with state tracking
- Pre-validation for edit operations to detect conflicts
- Context7 integration for external library documentation
- Buffered streaming with segment handling
- AbortController for canceling conversations
## Message Protocol
- `auth` - HF token authentication
- `chat` - User messages
- `abort` - Stop running conversation
- `clear_conversation` - Clear conversation history
- `editor_sync` - Sync editor content to virtual file system
- `editor_update` - Update ContentManager from agent changes
- `console_sync` - Forward console messages
- `status` - Connection and processing state