claudia/bun.lockb
Mark Ruvald Pedersen 1b08ced83b feat: implement web server mode
Add comprehensive web server functionality to Claudia, enabling Claude
Code execution from mobile browsers while maintaining feature parity
with the desktop Tauri app.

Enable users to access Claude Code from mobile devices via web browser,
addressing the limitation of desktop-only access. This allows for:
- Mobile development workflows
- Remote access to Claude Code functionality
- Browser-based Claude execution without desktop app installation
- Cross-platform compatibility

- **Axum web server** with WebSocket support for real-time streaming
- **Dual-mode event system** supporting both Tauri desktop and DOM web
  events
- **Session management** with HashMap-based tracking of active WebSocket
  connections
- **Process spawning** for actual Claude binary execution with stdout
  streaming
- **REST API** mirroring all Tauri command functionality

- `web_server.rs`: Main server w/ WebSocket handlers and REST endpoints
- Real Claude binary execution with subprocess spawning
- WebSocket message streaming for real-time output
- Comprehensive session state management
- CORS configuration for mobile browser access

- `apiAdapter.ts`: Environment detection and unified API layer
- `ClaudeCodeSession.tsx`: Enhanced with DOM event support for web mode
- WebSocket client with automatic failover from Tauri to web mode
- Event dispatching system compatible with existing UI components

- **Build system**: `just web` command for integrated build and run
- **Binary detection**: Bundled binary first, system PATH fallback
- **Message protocol**: JSON-based WebSocket communication
- **Event handling**: Session-scoped and generic event dispatching
- **Error handling**: Comprehensive error propagation and UI feedback

-  Basic WebSocket streaming and session management
-  REST API endpoints for all core functionality
-  Event handling compatibility between Tauri and web modes
-  Error handling and WebSocket connection management
-  Process spawning and output streaming
-  Comprehensive debugging and tracing

- Session-scoped event dispatching needs refinement for multi-user
  scenarios
- Process cancellation requires additional implementation
- stderr handling not yet fully implemented
- Limited to single concurrent session per connection

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 14:13:30 +05:30

179 KiB
Executable file