feat(browser): add remote-capable profiles

Co-authored-by: James Groat <james@groat.com>
This commit is contained in:
Peter Steinberger
2026-01-04 03:32:40 +00:00
parent 0e75aa2716
commit 12ba32c724
30 changed files with 2102 additions and 298 deletions

View File

@@ -36,9 +36,6 @@ export async function startBrowserControlServerFromConfig(): Promise<BrowserServ
const ctx = createBrowserRouteContext({
getState: () => state,
setRunning: (running) => {
if (state) state.running = running;
},
});
registerBrowserRoutes(app, ctx);
@@ -58,9 +55,8 @@ export async function startBrowserControlServerFromConfig(): Promise<BrowserServ
state = {
server,
port,
cdpPort: resolved.cdpPort,
running: null,
resolved,
profiles: new Map(),
};
logServer.info(`Browser control listening on http://127.0.0.1:${port}/`);
@@ -73,13 +69,19 @@ export async function stopBrowserControlServer(): Promise<void> {
const ctx = createBrowserRouteContext({
getState: () => state,
setRunning: (running) => {
if (state) state.running = running;
},
});
try {
await ctx.stopRunningBrowser();
const current = state;
if (current) {
for (const name of Object.keys(current.resolved.profiles)) {
try {
await ctx.forProfile(name).stopRunningBrowser();
} catch {
// ignore
}
}
}
} catch (err) {
logServer.warn(`clawd browser stop failed: ${String(err)}`);
}