Component Map
Deployment Modes
Request Flow
- HTTP request arrives at Hono router (
src/server.ts) - Auth middleware validates session cookie or Bearer token
- Route handler validates input with Zod schemas
- For chat: lazy-loaded runtime (
ensureChatRuntime()) processes with AI SDK - For tasks:
addTask()enqueues to BullMQ or in-memory queue - Queue worker picks up task, routes to agent adapter via
AgentRegistry - Agent executes tools via
ChatToolHandler(respecting security mode) - Result stored in LibSQL, notifications dispatched asynchronously
Storage Layer
All persistence goes through the storage adapter (src/storage/):
- Schema: Drizzle ORM with LibSQL/SQLite backend
- Tables:
users,sessions,tasks,conversations,messages,memory_chunks,experiences,provider_configs,invite_codes - Migrations:
src/storage/migrations.ts