Client Layer
The Tauri desktop application provides the user interface for AgentX.
Technology Stack
- Desktop Framework: Tauri v2
- Frontend: React 19 with TypeScript
- Build Tool: Vite
- Icons: Lucide React
- Styling: CSS with CSS variables (theme system)
Project Structure
client/
├── src/
│ ├── App.tsx # Main app, wraps RootLayout
│ ├── layouts/ # Layout components
│ │ ├── RootLayout.tsx # Top bar + page content area
│ │ ├── TopBar.tsx # Logo, page nav, conversation tabs, toolbar
│ │ └── ConversationTabBar.tsx # Browser-style conversation tabs
│ ├── pages/ # Page components
│ │ ├── StartPage.tsx # Landing page with agent greeting
│ │ ├── DashboardPage.tsx # Health, memory stats, DB metrics
│ │ └── AgentXPage.tsx # Main conversation workspace
│ ├── components/
│ │ ├── chat/ # Chat panel, message bubbles, input
│ │ ├── panels/ # Settings, Memory, Tools (drawer content)
│ │ └── modals/ # Translation, Prompt Library (modal content)
│ ├── contexts/ # React contexts
│ │ ├── ServerContext.tsx # Multi-server state
│ │ ├── ConversationContext.tsx # Tab management + message state
│ │ ├── AgentProfileContext.tsx # Agent profile selection
│ │ ├── ThemeContext.tsx # CSS variable theme system
│ │ └── ModalContext.tsx # Stack-based modal/drawer management
│ ├── lib/
│ │ ├── api.ts # Typed API client
│ │ ├── hooks.ts # React data hooks
│ │ ├── messages.ts # Discriminated union message types
│ │ └── theme.ts # Theme definitions
│ └── main.tsx # Entry point
├── src-tauri/ # Rust/Tauri backend
│ ├── Cargo.toml
│ ├── tauri.conf.json
│ └── src/
└── vite.config.ts
Layout Architecture
Three-page layout with horizontal navigation:
- Start — Landing page with agent avatar and greeting
- Dashboard — Health status, memory stats, DB storage metrics
- AgentX — Main conversation workspace with browser-style tabs
Navigation
- TopBar provides page nav pills (left), conversation tab bar (center), and toolbar icons (right)
- Conversation tabs are browser-style: add, close, switch, rename, reorder
- Drawer panels slide in from the right for Settings, Memory, and Tools (triggered from toolbar)
- Modal dialogs for Translation and Prompt Library (triggered from toolbar)
State Management
ConversationContextmanages tabs and messages with localStorage persistenceAgentProfileContextmanages agent profile selection and settingsServerContextprovides multi-server stateThemeContextapplies CSS variable themes viadocument.documentElement.styleModalContextmanages a stack of open modals/drawers
Message Types
Conversation messages use a discriminated union (lib/messages.ts):
UserMessage— user input with optional edit actionAssistantMessage— agent response with markdown, thinking, metadataToolCallMessage— tool invocation with status (pending/running/completed/failed)ToolResultMessage— tool output with success/fail and durationMemoryInjectionMessage— recalled facts with confidence, entities with type badgesSystemMessage— subtle centered textErrorMessage— red-tinted error block
SSE Streaming
The chat stream (lib/api.ts streamChat()) handles these events:
start— agent name, model, context window infomemory_context— recalled facts, entities, relevant turnschunk— streaming token contenttool_call— tool name, arguments, call IDtool_result— tool output, success/fail, durationdone— total tokens, time, thinking contentclose— stream complete
Development
- Dev server:
http://localhost:1420(Vite) - HMR enabled on port 1421 for fast iteration
- Tauri window wraps the Vite dev server
See Development Setup for more information.