@@ -14,7 +14,7 @@ Server starts on `http://localhost:3000`, redirects to `/gm/`.
1414## Architecture
1515
1616```
17- server.js HTTP server + WebSocket + all API routes (raw http.createServer)
17+ server.js Bootstrap: imports, constants, wiring of all factories; delegates to lib/ modules for HTTP handler, WS setup, routes, startup
1818database.js SQLite connection, schema DDL, migrations (queries extracted to lib/db-queries.js)
1919acp-queries.js ACP query helpers (UUID, timestamp, JSON utilities)
2020bin/gmgui.cjs CLI entry point (npx agentgui / bun x agentgui)
@@ -62,8 +62,14 @@ lib/routes-agent-actions.js Agent auth and update HTTP route handlers (POST /ap
6262lib/routes-auth-config.js Auth config HTTP route handlers (GET /api/auth/configs, POST /api/auth/save-config)
6363lib/routes-upload.js Express sub-app: POST /api/upload/:conversationId (Busboy file upload) + GET /files/:conversationId fsbrowse router; createExpressApp(deps) factory
6464lib/http-utils.js HTTP utility functions (parseBody, acceptsEncoding, compressAndSend, sendJSON)
65+ lib/http-handler.js Main HTTP request handler factory: createHttpHandler(deps) => async (req,res); rate limiting, auth, CORS, route dispatch, static file serving
6566lib/provider-config.js Provider config helpers (buildSystemPrompt, maskKey, getProviderConfigs, saveProviderConfig, PROVIDER_CONFIGS)
6667lib/server-utils.js Server utility functions (logError, errLogPath, makeCleanupExecution, makeGetModelsForAgent)
68+ lib/routes-registry.js Route + WS handler registration: createRegistry(wsRouter, deps) => _routes; wires all HTTP route _match objects and all WS handler registrations
69+ lib/ws-setup.js WebSocket server setup: createWsSetup(server, deps) => { wss, hotReloadClients }; connection auth, client tracking, watch file reload, heartbeat
70+ lib/ws-legacy-handlers.js Legacy WS message handler: subscribe/unsubscribe/terminal PTY/pm2 commands; called from ws-setup.js onLegacy
71+ lib/server-startup.js Server startup: createOnServerReady(deps) => { onServerReady, getJsonlWatcher }; tools, ACP, speech, PM2 monitoring init
72+ lib/server-startup2.js Startup helpers: createAutoImport (hasIndexFilesChanged + performAutoImport), createDbRecovery (orphaned session cleanup), createPluginLoader (plugin extension loading)
6773lib/routes-debug.js Debug/backup/restore/ws-stats HTTP route handlers
6874lib/routes-threads.js Thread CRUD HTTP route handlers (ACP v0.2.3 thread API)
6975lib/ws-protocol.js WebSocket RPC router (WsRouter class)
0 commit comments