feat: install Playwright Chromium for OpenClaw browser tool (#2362)

Ubuntu 24.04 replaced chromium-browser with a snap redirect that fails
on cloud VMs without snapd. Playwright's bundled Chromium is
self-contained (~170MB), works headless, and has no snap dependency.

Installed as a non-fatal post-install step — if it fails, the agent
still works but without browser capabilities.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ahmed Abushagur 2026-03-08 21:20:33 -07:00 committed by GitHub
parent 3d7ad51f6d
commit 57a7a9e033
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "0.15.23",
"version": "0.15.24",
"type": "module",
"bin": {
"spawn": "cli.js"

View file

@ -569,14 +569,21 @@ function createAgents(runner: CloudRunner): Record<string, AgentConfig> {
cloudInitTier: "full",
preProvision: detectGithubAuth,
modelDefault: "openrouter/auto",
install: () =>
installAgent(
install: async () => {
await installAgent(
runner,
"openclaw",
`source ~/.bashrc 2>/dev/null; ${NPM_PREFIX_SETUP} && npm install -g \${_NPM_G_FLAGS} openclaw && ` +
"{ grep -qF '.npm-global/bin' ~/.bashrc 2>/dev/null || echo 'export PATH=\"$HOME/.npm-global/bin:$PATH\"' >> ~/.bashrc; } && " +
"{ [ ! -f ~/.zshrc ] || grep -qF '.npm-global/bin' ~/.zshrc 2>/dev/null || echo 'export PATH=\"$HOME/.npm-global/bin:$PATH\"' >> ~/.zshrc; }",
),
);
// Install Playwright Chromium for OpenClaw's browser tool (headless, no snap dependency)
try {
await runner.runServer("npx playwright install chromium --with-deps 2>/dev/null", 300);
} catch {
logWarn("Playwright Chromium install failed (browser tool will be unavailable)");
}
},
envVars: (apiKey) => [
`OPENROUTER_API_KEY=${apiKey}`,
`ANTHROPIC_API_KEY=${apiKey}`,