Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Register 15 structured tools via navigator.modelContext (Chrome 146+) for direct state queries without DOM scraping. Reduces token consumption ~67% vs DevTools MCP snapshot-based debugging. Dev mode only. Tools: get_zclaw_state, check_connection, send_message, cancel_stream, get_streaming_state, list_conversations, get_current_conversation, switch_conversation, get_token_usage, get_offline_queue, get_saas_account, get_available_models, get_current_agent, list_agents, get_console_errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 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';
|
|
import { initWebMCPTools } from './lib/webmcp-tools';
|
|
|
|
// 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();
|
|
};
|
|
|
|
// Initialize WebMCP debugging tools (dev mode only, Chrome 146+)
|
|
initWebMCPTools();
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
<React.StrictMode>
|
|
<GlobalErrorBoundary
|
|
onError={handleGlobalError}
|
|
onReset={handleGlobalReset}
|
|
showConnectionStatus={true}
|
|
>
|
|
<ToastProvider>
|
|
<App />
|
|
</ToastProvider>
|
|
</GlobalErrorBoundary>
|
|
</React.StrictMode>,
|
|
);
|