feat(gateway): enhance gateway process management with auto-reconnection

Improve Gateway lifecycle management with the following features:

- Add exponential backoff reconnection (1s-30s delay, max 10 attempts)
- Add health check monitoring every 30 seconds
- Add proper restart method with graceful shutdown
- Handle server-initiated notifications (channel status, chat messages)
- Add 'reconnecting' state for better UI feedback
- Enhance IPC handlers with isConnected and health check endpoints
- Update preload script with new event channels
- Improve type safety and error handling throughout

Also fixes several TypeScript errors and unused variable warnings.
This commit is contained in:
Haze
2026-02-05 23:15:07 +08:00
Unverified
parent b8ab0208d0
commit 1646536e40
15 changed files with 601 additions and 74 deletions

View File

@@ -16,10 +16,12 @@ const electronAPI = {
const validChannels = [
// Gateway
'gateway:status',
'gateway:isConnected',
'gateway:start',
'gateway:stop',
'gateway:restart',
'gateway:rpc',
'gateway:health',
// Shell
'shell:openExternal',
'shell:showItemInFolder',
@@ -74,6 +76,9 @@ const electronAPI = {
const validChannels = [
'gateway:status-changed',
'gateway:message',
'gateway:notification',
'gateway:channel-status',
'gateway:chat-message',
'gateway:exit',
'gateway:error',
'navigate',
@@ -106,6 +111,9 @@ const electronAPI = {
const validChannels = [
'gateway:status-changed',
'gateway:message',
'gateway:notification',
'gateway:channel-status',
'gateway:chat-message',
'gateway:exit',
'gateway:error',
'navigate',