perf: optimize app startup and background lifecycles

This commit is contained in:
inman committed 2026-08-19 00:56:15 +08:00
1 parent 31332f6d76
commit 927e13349b
121 files changed
+4359 -1400

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { HostApiContext } from './context';
import { handleAiProxyRoutes } from './routes/ai-proxy';
import { handleAiHardwareRoutes } from './routes/ai-hardware';
import { handleAppRoutes } from './routes/app';
import { handleAuthRoutes } from './routes/auth';
import { handleOpencodeRoutes } from './routes/opencode';
import { handleImageWorkspaceRoutes } from './routes/image-workspace';
import { handleImagePromptMuseumRoutes } from './routes/image-prompt-museum';
import { handleLearningRoutes } from './routes/learning';
import { handleWorksRoutes } from './routes/works';
import { handleUserSyncRoutes } from './routes/user-sync';
import { handleSettingsRoutes } from './routes/settings';
import { handleProviderRoutes } from './routes/providers';
import { handleLogRoutes } from './routes/logs';
import { handleUsageRoutes } from './routes/usage';
import { handleFileRoutes } from './routes/files';
import { handleMeowaGameAssetsRoutes } from './routes/meowa-game-assets';
import { handleAgentBrowserRoutes } from './routes/agent-browser';
export type HostApiRouteHandler = (
req: IncomingMessage,
res: ServerResponse,
url: URL,
ctx: HostApiContext,
) => Promise<boolean>;
/**
* The same route list is used by the loopback compatibility server and by the
* Main-owned IPC dispatcher. Keeping one ordered list prevents the two
* transports from drifting into subtly different authorization or response
* behavior.
*/
export const hostApiRouteHandlers: readonly HostApiRouteHandler[] = [
handleAiProxyRoutes,
handleAiHardwareRoutes,
handleAppRoutes,
handleAuthRoutes,
handleImageWorkspaceRoutes,
handleImagePromptMuseumRoutes,
handleLearningRoutes,
handleWorksRoutes,
handleAgentBrowserRoutes,
handleUserSyncRoutes,
handleOpencodeRoutes,
handleSettingsRoutes,
handleProviderRoutes,
handleFileRoutes,
handleMeowaGameAssetsRoutes,
handleLogRoutes,
handleUsageRoutes,
];