fix(error): add global error handler, fix stores and dispatcher

- Global unhandledrejection handler with IPC+network filtering
- Agent dispatcher heartbeat uses handleInfraError (was fire-and-forget)
- All stores: layout, workspace, anchors, theme, plugins, machines,
  wake-scheduler — silent failures replaced with handleInfraError
- initGlobalErrorHandler() called in App.svelte onMount
This commit is contained in:
Hibryda 2026-03-18 01:22:12 +01:00
parent 8b3b0ab720
commit 93b3db8b1f
10 changed files with 73 additions and 35 deletions

View file

@ -18,6 +18,8 @@
triggerFocusFlash, emitProjectTabSwitch, emitTerminalToggle,
} from './lib/stores/workspace.svelte';
import { disableWakeScheduler } from './lib/stores/wake-scheduler.svelte';
import { initGlobalErrorHandler } from './lib/utils/global-error-handler';
import { handleInfraError } from './lib/utils/handle-error';
import { pruneSeen } from './lib/adapters/btmsg-bridge';
import { invoke } from '@tauri-apps/api/core';
@ -94,6 +96,9 @@
}
onMount(() => {
// Global unhandled rejection safety net
initGlobalErrorHandler();
// Step 0: Theme
initTheme();
getSetting('project_max_aspect').then(v => {
@ -114,7 +119,7 @@
// Step 2: Agent dispatcher
startAgentDispatcher();
startHealthTick();
pruneSeen().catch(() => {}); // housekeeping: remove stale seen_messages on startup
pruneSeen().catch(e => handleInfraError(e, 'app.pruneSeen')); // housekeeping: remove stale seen_messages on startup
markStep(2);
// Disable wake scheduler in test mode to prevent timer interference