Files
zclaw_openfang/desktop/src/main.tsx
iven 185763868a feat: production readiness improvements
## Error Handling
- Add GlobalErrorBoundary with error classification and recovery
- Add custom error types (SecurityError, ConnectionError, TimeoutError)
- Fix ErrorAlert component syntax errors

## Offline Mode
- Add offlineStore for offline state management
- Implement message queue with localStorage persistence
- Add exponential backoff reconnection (1s→60s)
- Add OfflineIndicator component with status display
- Queue messages when offline, auto-retry on reconnect

## Security Hardening
- Add AES-256-GCM encryption for chat history storage
- Add secure API key storage with OS keychain integration
- Add security audit logging system
- Add XSS prevention and input validation utilities
- Add rate limiting and token generation helpers

## CI/CD (Gitea Actions)
- Add .gitea/workflows/ci.yml for continuous integration
- Add .gitea/workflows/release.yml for release automation
- Support Windows Tauri build and release

## UI Components
- Add LoadingSpinner, LoadingOverlay, LoadingDots components
- Add MessageSkeleton, ConversationListSkeleton skeletons
- Add EmptyMessages, EmptyConversations empty states
- Integrate loading states in ChatArea and ConversationList

## E2E Tests
- Fix WebSocket mock for streaming response tests
- Fix approval endpoint route matching
- Add store state exposure for testing
- All 19 core-features tests now passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 00:03:22 +08:00

41 lines
1.2 KiB
TypeScript

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './index.css';
import { ToastProvider } from './components/ui/Toast';
import { GlobalErrorBoundary } from './components/ui/ErrorBoundary';
// Global error handler for uncaught errors
const handleGlobalError = (error: Error, errorInfo: React.ErrorInfo) => {
console.error('[GlobalErrorHandler] Uncaught error:', error);
console.error('[GlobalErrorHandler] Component stack:', errorInfo.componentStack);
// In production, you could send this to an error reporting service
// e.g., Sentry, LogRocket, etc.
if (import.meta.env.PROD) {
// sendToErrorReportingService(error, errorInfo);
}
};
// Global reset handler - reload the page
const handleGlobalReset = () => {
console.log('[GlobalErrorHandler] Resetting application...');
// Clear any cached state
localStorage.removeItem('app-state');
sessionStorage.clear();
};
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<GlobalErrorBoundary
onError={handleGlobalError}
onReset={handleGlobalReset}
showConnectionStatus={true}
>
<ToastProvider>
<App />
</ToastProvider>
</GlobalErrorBoundary>
</React.StrictMode>,
);