- Add AppUpdater module with update lifecycle management - Create UpdateSettings UI component with progress display - Add Progress UI component based on Radix UI - Create update Zustand store for state management - Register update IPC handlers in main process - Auto-check for updates on production startup - Add commit documentation for commits 2-6
3.1 KiB
3.1 KiB
Commit 2: Gateway Refinements
Summary
Enhance Gateway process management with auto-reconnection, health checks, and improved state management for more robust WebSocket communication.
Changes
Electron Main Process
electron/gateway/manager.ts
- Added
'reconnecting'state toGatewayStatus - Implemented
ReconnectConfigwith exponential backoff strategy - Added
maxAttempts,baseDelay,maxDelayconfiguration - New methods:
isConnected()- Check WebSocket connection statusrestart()- Stop and start GatewayclearAllTimers()- Clean up timers on shutdownstartHealthCheck()- Periodic health monitoringcheckHealth()- Manual health check
- Enhanced
handleMessage()to dispatch JSON-RPC responses and notifications - Expanded
GatewayManagerEventsfor notification forwarding
electron/gateway/client.ts
- Extended with new interfaces:
SkillBundle,CronTask,ProviderConfig - Added cron task management methods:
listCronTasks(),createCronTask(),updateCronTask(),deleteCronTask(),runCronTask()
- Added provider management methods:
listProviders(),setProvider(),removeProvider(),testProvider()
- Enhanced system calls:
getHealth()now includesversion- Added
getVersion(),getSkillBundles(),installBundle()
electron/main/ipc-handlers.ts
- Added
gateway:isConnected,gateway:healthIPC handlers - Added
mainWindow.isDestroyed()checks before sending events - Forward new gateway events:
gateway:notification,gateway:channel-status,gateway:chat-message
electron/preload/index.ts
- Added new IPC channels for gateway operations
- Added notification event channels
React Renderer
src/stores/gateway.ts
- Added
health: GatewayHealth | null,lastError: string | nullto state - Added
checkHealth(),rpc(),clearError()actions - Enhanced
init()to listen for error and notification events
src/types/gateway.ts
- Added
'reconnecting'toGatewayStatusstate enum - Added
version,reconnectAttemptsfields - New interfaces:
GatewayHealth,GatewayNotification,ProviderConfig
src/components/common/StatusBadge.tsx
- Added
'reconnecting'status with warning variant
Technical Details
Reconnection Strategy
- Exponential backoff:
delay = min(baseDelay * 2^attempt, maxDelay) - Default: 1s base delay, 30s max delay, 10 max attempts
- Automatic reconnection on unexpected disconnection
- Manual control via
shouldReconnectflag
Health Check
- Periodic ping/pong via JSON-RPC
system.health - Returns status, uptime, version information
- Triggers reconnection on consecutive failures
Event Flow
Gateway Process -> WebSocket -> GatewayManager -> IPC -> Renderer
|
v
Event Emitter
|
+---------------+---------------+
| | |
status notification channel:status
Version
v0.1.0-alpha (incremental)