Archon/archon-ui-main
Wirasm 1a78a8e287
feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588)
* refactor: migrate layouts to TanStack Query and Radix UI patterns

- Created new modern layout components in src/components/layout/
- Migrated from old MainLayout/SideNavigation to new system
- Added BackendStatus component with proper separation of concerns
- Fixed horizontal scrollbar issues in project list
- Renamed old layouts folder to agent-chat for unused chat panel
- Added layout directory to Biome configuration
- Fixed all linting and TypeScript issues in new layout code
- Uses TanStack Query for backend health monitoring
- Temporarily imports old settings/credentials until full migration

* test: reorganize test infrastructure with colocated tests in subdirectories

- Move tests into dedicated tests/ subdirectories within each feature
- Create centralized test utilities in src/features/testing/
- Update all import paths to match new structure
- Configure tsconfig.prod.json to exclude test files
- Remove legacy test files from old test/ directory
- All 32 tests passing with proper provider wrapping

* fix: use error boundary wrapper for ProjectPage

- Export ProjectsViewWithBoundary from projects feature module
- Update ProjectPage to use boundary-wrapped version
- Provides proper error containment and recovery with TanStack Query integration

* cleanup: remove unused MCP client components

- Remove ToolTestingPanel, ClientCard, and MCPClients components
- These were part of an unimplemented MCP clients feature
- Clean up commented import in MCPPage
- Preparing for proper MCP feature migration to features directory

* cleanup: remove unused mcpService.ts

- Remove duplicate/unused mcpService.ts (579 lines)
- Keep mcpServerService.ts which is actively used by MCPPage and useMCPQueries
- mcpService was never imported or used anywhere in the codebase

* cleanup: remove unused mcpClientService and update deprecation comments

- Remove mcpClientService.ts (445 lines) - no longer used after removing MCP client components
- Update deprecation comments in mcpServerService to remove references to deleted service
- This completes the MCP service cleanup

* fix: correct test directory exclusion in coverage config

Update coverage exclusion from 'test/' to 'tests/' to match actual
project structure and ensure proper test file exclusion from coverage.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: fix ArchonChatPanel import path in agent-chat.mdx

Update import from deprecated layouts to agent-chat directory.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: improve backend health hook and types

- Use existing ETag infrastructure in useBackendHealth for 70% bandwidth reduction
- Honor React Query cancellation signals with proper timeout handling
- Remove duplicate HealthResponse interface, import from shared types
- Add React type import to fix potential strict TypeScript issues

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: remove .d.ts exclusion from production TypeScript config

Removing **/*.d.ts exclusion to fix import.meta.env type errors in
production builds. The exclusion was preventing src/env.d.ts from
being included, breaking ImportMetaEnv interface definitions.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: implement modern MCP feature architecture

- Add new /features/mcp with TanStack Query integration
- Components: McpClientList, McpStatusBar, McpConfigSection
- Services: mcpApi with ETag caching
- Hooks: useMcpStatus, useMcpConfig, useMcpClients, useMcpSessionInfo
- Views: McpView with error boundary wrapper
- Full TypeScript types for MCP protocol

Part of TanStack Query migration phase 2.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: complete MCP modernization and cleanup

- Remove deprecated mcpServerService.ts (237 lines)
- Remove unused useMCPQueries.ts hooks (77 lines)
- Simplify MCPPage.tsx to use new feature architecture
- Export useSmartPolling from ui/hooks for MCP feature
- Add Python MCP API routes for backend integration

This completes the MCP migration to TanStack Query with:
- ETag caching for 70% bandwidth reduction
- Smart polling with visibility awareness
- Vertical slice architecture
- Full TypeScript type safety

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: correct MCP transport mode display and complete cleanup

- Fix backend API to return correct "streamable-http" transport mode
- Update frontend to dynamically display transport type from config
- Remove unused MCP functions (startMCPServer, stopMCPServer, getMCPServerStatus)
- Clean up unused MCPServerResponse interface
- Update log messages to show accurate transport mode
- Complete aggressive MCP cleanup with 75% code reduction (617 lines removed)

Backend changes:
- python/src/server/api_routes/mcp_api.py: Fix transport and logs
- Reduced from 818 to 201 lines while preserving all functionality

Frontend changes:
- McpStatusBar: Dynamic transport display based on config
- McpView: Pass config to status bar component
- api.ts: Remove unused MCP management functions

All MCP tools tested and verified working after cleanup.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* simplify MCP API to status-only endpoints

- Remove Docker container management functionality
- Remove start/stop/restart endpoints
- Simplify to status and config endpoints only
- Container is now managed entirely via docker-compose

* feat: complete MCP feature migration to TanStack Query

- Add MCP feature with TanStack Query hooks and services
- Create useMcpQueries hook with smart polling for status/config
- Implement mcpApi service with streamable-http transport
- Add MCP page component with real-time updates
- Export MCP hooks from features/ui for global access
- Fix logging bug in mcp_api.py (invalid error kwarg)
- Update docker command to v2 syntax (docker compose)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: clean up unused CSS and unify Tron-themed scrollbars

- Remove 200+ lines of unused CSS classes (62% file size reduction)
- Delete unused: glass classes, neon-dividers, card animations, screensaver animations
- Remove unused knowledge-item-card and hide-scrollbar styles
- Remove unused flip-card and card expansion animations
- Update scrollbar-thin to match Tron theme with blue glow effects
- Add gradient and glow effects to thin scrollbars for consistency
- Keep only actively used styles: neon-grid, scrollbars, animation delays

File reduced from 11.2KB to 4.3KB with no visual regressions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address CodeRabbit CSS review feedback

- Fix neon-grid Tailwind @apply with arbitrary values (breaking build)
- Convert hardcoded RGBA colors to HSL tokens using --blue-accent
- Add prefers-reduced-motion accessibility support
- Add Firefox dark mode scrollbar-color support
- Optimize transitions to specific properties instead of 'all'

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: properly close Docker client to prevent resource leak

- Add finally block to ensure Docker client is closed
- Prevents resource leak in get_container_status function
- Fix linting issues (whitespace and newline)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-06 13:43:53 +03:00
..
public
src feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
tests feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
.dockerignore feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
.eslintrc.cjs POC: TanStack Query POC implementation (#567) 2025-09-05 11:30:05 +03:00
.gitignore
biome.json feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
Dockerfile
index.html
package-lock.json feat: Document Browser with Domain Filtering (Updated Architecture) (#564) 2025-09-06 13:27:17 +03:00
package.json POC: TanStack Query POC implementation (#567) 2025-09-05 11:30:05 +03:00
postcss.config.js
README.md
tailwind.config.js
tsconfig.json feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
tsconfig.node.json
tsconfig.prod.json feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
vite.config.ts feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00
vitest.config.ts feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization (#588) 2025-09-06 13:43:53 +03:00

Archon UI - Knowledge Engine Web Interface

A modern React-based web interface for the Archon Knowledge Engine MCP Server. Built with TypeScript, Vite, and Tailwind CSS.

🎨 UI Overview

Archon UI provides a comprehensive dashboard for managing your AI's knowledge base:

UI Architecture

Key Features

  • 📊 MCP Dashboard: Monitor and control the MCP server
  • ⚙️ Settings Management: Configure credentials and RAG strategies
  • 🕷️ Web Crawling: Crawl documentation sites and build knowledge base
  • 📚 Knowledge Management: Browse, search, and organize knowledge items
  • 💬 Interactive Chat: Test RAG queries with real-time responses
  • 📈 Real-time Updates: WebSocket-based live updates across the UI

🏗️ Architecture

Technology Stack

  • React 18.3: Modern React with hooks and functional components
  • TypeScript: Full type safety and IntelliSense support
  • Vite: Fast build tool and dev server
  • Tailwind CSS: Utility-first styling
  • Framer Motion: Smooth animations and transitions
  • Lucide Icons: Beautiful and consistent iconography
  • React Router: Client-side routing

Project Structure

archon-ui-main/
├── src/
│   ├── components/          # Reusable UI components
│   │   ├── ui/             # Base UI components (Button, Card, etc.)
│   │   ├── layouts/        # Layout components (Sidebar, Header)
│   │   └── animations/     # Animation components
│   ├── pages/              # Page components
│   │   ├── MCPPage.tsx     # MCP Dashboard
│   │   ├── Settings.tsx    # Settings page
│   │   ├── Crawl.tsx       # Web crawling interface
│   │   ├── KnowledgeBase.tsx # Knowledge management
│   │   └── Chat.tsx        # RAG chat interface
│   ├── services/           # API and service layers
│   │   ├── api.ts          # Base API configuration
│   │   ├── mcpService.ts   # MCP server communication
│   │   └── chatService.ts  # Chat/RAG service
│   ├── contexts/           # React contexts
│   │   └── ToastContext.tsx # Toast notifications
│   ├── hooks/              # Custom React hooks
│   │   └── useStaggeredEntrance.ts # Animation hook
│   ├── types/              # TypeScript type definitions
│   └── lib/                # Utility functions
├── public/                 # Static assets
└── test/                   # Test files

📄 Pages Documentation

1. MCP Dashboard (/mcp)

The central control panel for the MCP server.

Components:

  • Server Control Panel: Start/stop server, view status, select transport mode
  • Server Logs Viewer: Real-time log streaming with auto-scroll
  • Available Tools Table: Dynamic tool discovery and documentation
  • MCP Test Panel: Interactive tool testing interface

Features:

  • Dual transport support (SSE/stdio)
  • Real-time status polling (5-second intervals)
  • WebSocket-based log streaming
  • Copy-to-clipboard configuration
  • Tool parameter validation

2. Settings (/settings)

Comprehensive configuration management.

Sections:

  • Credentials:
    • OpenAI API key (encrypted storage)
    • Supabase connection details
    • MCP server configuration
  • RAG Strategies:
    • Contextual Embeddings toggle
    • Hybrid Search toggle
    • Agentic RAG (code extraction) toggle
    • Reranking toggle

Features:

  • Secure credential storage with encryption
  • Real-time validation
  • Toast notifications for actions
  • Default value management

3. Web Crawling (/crawl)

Interface for crawling documentation sites.

Components:

  • URL Input: Smart URL validation
  • Crawl Options: Max depth, concurrent sessions
  • Progress Monitoring: Real-time crawl status
  • Results Summary: Pages crawled, chunks stored

Features:

  • Intelligent URL type detection
  • Sitemap support
  • Recursive crawling
  • Batch processing

4. Knowledge Base (/knowledge)

Browse and manage your knowledge items.

Components:

  • Knowledge Grid: Card-based knowledge display
  • Search/Filter: Search by title, type, tags
  • Knowledge Details: View full item details
  • Actions: Delete, refresh, organize

Features:

  • Pagination support
  • Real-time updates via WebSocket
  • Type-based filtering (technical/business)
  • Metadata display

5. RAG Chat (/chat)

Interactive chat interface for testing RAG queries.

Components:

  • Chat Messages: Threaded conversation view
  • Input Area: Query input with source selection
  • Results Display: Formatted RAG results
  • Source Selector: Filter by knowledge source

Features:

  • Real-time streaming responses
  • Source attribution
  • Markdown rendering
  • Copy functionality

🧩 Component Library

Base UI Components

Button

<Button 
  variant="primary|secondary|ghost" 
  size="sm|md|lg"
  accentColor="blue|green|purple|orange|pink"
  onClick={handleClick}
>
  Click me
</Button>

Card

<Card accentColor="blue" className="p-6">
  <h3>Card Title</h3>
  <p>Card content</p>
</Card>

LoadingSpinner

<LoadingSpinner size="sm|md|lg" />

Layout Components

Sidebar

  • Collapsible navigation
  • Active route highlighting
  • Icon + text navigation items
  • Responsive design

Header

  • Dark mode toggle
  • User menu
  • Breadcrumb navigation

Animation Components

PageTransition

Wraps pages with smooth fade/slide animations:

<PageTransition>
  <YourPageContent />
</PageTransition>

🔌 Services

mcpService

Handles all MCP server communication:

  • startServer(): Start the MCP server
  • stopServer(): Stop the MCP server
  • getStatus(): Get current server status
  • streamLogs(): WebSocket log streaming
  • getAvailableTools(): Fetch MCP tools

api

Base API configuration with:

  • Automatic error handling
  • Request/response interceptors
  • Base URL configuration
  • TypeScript generics

chatService

RAG query interface:

  • sendMessage(): Send RAG query
  • streamResponse(): Stream responses
  • getSources(): Get available sources

🎨 Styling

Tailwind Configuration

  • Custom color palette
  • Dark mode support
  • Custom animations
  • Responsive breakpoints

Theme Variables

--primary: Blue accent colors
--secondary: Gray/neutral colors
--success: Green indicators
--warning: Orange indicators
--error: Red indicators

🚀 Development

Setup

# Install dependencies
npm install

# Start dev server
npm run dev

# Build for production
npm run build

# Run tests
npm test

Environment Variables

VITE_API_URL=http://localhost:8080

Hot Module Replacement

Vite provides instant HMR for:

  • React components
  • CSS modules
  • TypeScript files

🧪 Testing

Unit Tests

  • Component testing with React Testing Library
  • Service mocking with MSW
  • Hook testing with @testing-library/react-hooks

Integration Tests

  • Page-level testing
  • API integration tests
  • WebSocket testing

📦 Build & Deployment

Docker Support

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 5173
CMD ["npm", "run", "preview"]

Production Optimization

  • Code splitting by route
  • Lazy loading for pages
  • Image optimization
  • Bundle size analysis

🔧 Configuration Files

vite.config.ts

  • Path aliases
  • Build optimization
  • Development server config

tsconfig.json

  • Strict type checking
  • Path mappings
  • Compiler options

tailwind.config.js

  • Custom theme
  • Plugin configuration
  • Purge settings

🤝 Contributing

Code Style

  • ESLint configuration
  • Prettier formatting
  • TypeScript strict mode
  • Component naming conventions

Git Workflow

  • Feature branches
  • Conventional commits
  • PR templates
  • Code review process