修改后端接口 outbox 和 信息同步 worker

This commit is contained in:
mark
2026-09-27 14:59:22 +08:00
parent e74535f044
commit 1b15f8bbbb
40 changed files with 17231 additions and 2157 deletions
+5
View File
@@ -1,5 +1,6 @@
import { initDatabase, closeDb } from './db/database'
import { startWebSocketServer } from './transport/websocket'
import { syncWorker } from './sync/worker'
import { WorkflowEngine } from './workflow/engine'
import { ToolRegistry, readFileTool } from './tools/registry'
import type { AgentContext, LLMConfig, StreamCallbacks } from './types'
@@ -32,9 +33,13 @@ function main() {
const wss = startWebSocketServer(WS_PORT)
console.log(`[core] WebSocket 端口: ${WS_PORT}`)
// 3. 启动云端同步 Worker(本地变更 → outbox → 云端推送;云端变更 → 拉取合并)
syncWorker.start()
// 优雅退出
process.on('SIGINT', () => {
console.log('\n[core] 正在关闭...')
syncWorker.stop()
wss.close()
closeDb()
process.exit(0)