perf: optimize app startup and background lifecycles

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

View File

@@ -11,6 +11,7 @@ type AgentBrowserBody = {
url?: unknown;
action?: unknown;
visible?: unknown;
enabled?: unknown;
bounds?: unknown;
method?: unknown;
params?: unknown;
@@ -237,6 +238,20 @@ export async function handleAgentBrowserRoutes(
bounds: parseBounds(body.bounds),
});
await ensureProjectStillActive(ctx, project);
emitState(ctx, 'agent-browser:state', browser);
sendJson(res, 200, { success: true, browser });
return true;
}
if (url.pathname === '/api/agent-browser/diagnostics' && req.method === 'POST') {
requireRendererPresentation(req);
const body = await readBody(req);
const project = await resolveActiveProject(ctx, body.project_path);
const browser = await service.setDiagnostics({
projectPath: project.path,
enabled: body.enabled === true,
});
await ensureProjectStillActive(ctx, project);
sendJson(res, 200, { success: true, browser });
return true;
}