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
P0 功能修复: - stats: Admin V2 仪表盘 API 路径修正 (/stats/dashboard → /admin/dashboard) - mcp: 桌面端 MCP 插件增加 isTauriRuntime() 守卫,避免浏览器模式崩溃 - admin: 侧边栏高亮逻辑修复 (startsWith → 精确匹配+子路径) P1 代码质量: - 删除 workflowBuilderStore.ts 死代码 (456行,零引用) - sqlite.rs 3 处 SQL 静默失败改为 tracing::warn! 日志 - mcp_tool_adapter 2 处 unwrap 改为安全回退 - orchestration_execute 添加 @reserved 标注 - TRUTH.md 测试数字校准 (734→803),Store 数 26→25
53 lines
1.7 KiB
TypeScript
53 lines
1.7 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';
|
|
import { isTauriRuntime } from './lib/tauri-gateway';
|
|
import { setupPluginListeners } from 'tauri-plugin-mcp';
|
|
|
|
// 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();
|
|
|
|
// Initialize tauri-plugin-mcp event listeners (dev mode + Tauri runtime only)
|
|
// Only works inside Tauri webview — gracefully skips in browser dev mode
|
|
if (import.meta.env.DEV && isTauriRuntime()) {
|
|
setupPluginListeners().catch(() => {});
|
|
}
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
<React.StrictMode>
|
|
<GlobalErrorBoundary
|
|
onError={handleGlobalError}
|
|
onReset={handleGlobalReset}
|
|
showConnectionStatus={true}
|
|
>
|
|
<ToastProvider>
|
|
<App />
|
|
</ToastProvider>
|
|
</GlobalErrorBoundary>
|
|
</React.StrictMode>,
|
|
);
|