fix(browser): allow control server without playwright

This commit is contained in:
Peter Steinberger
2025-12-20 19:16:56 +00:00
parent 1eb6d617f5
commit ab4457e2a3
2 changed files with 97 additions and 50 deletions

View File

@@ -8,7 +8,6 @@ import {
resolveBrowserConfig,
shouldStartLocalBrowserServer,
} from "./config.js";
import { closePlaywrightBrowserConnection } from "./pw-ai.js";
import { registerBrowserRoutes } from "./routes/index.js";
import {
type BrowserServerState,
@@ -99,5 +98,12 @@ export async function stopBrowserControlServer(
current.server.close(() => resolve());
});
state = null;
await closePlaywrightBrowserConnection();
// Optional: Playwright is not always available (e.g. embedded gateway builds).
try {
const mod = await import("./pw-ai.js");
await mod.closePlaywrightBrowserConnection();
} catch {
// ignore
}
}