feat: add browser launch --args, --user-agent, --proxy-bypass configuration support. (#35)

* feat: add browser launch args, user-agent, and proxy configuration support

* fix: User Agent env need added

* fix: command pass error

---------

Co-authored-by: Chris Tate <chris@ctate.dev>
This commit is contained in:
Oanakiaja
2026-01-22 00:19:37 -06:00
committed by GitHub
co-authored by Chris Tate
parent e892bceadf
commit 083a946aac
12 changed files with 1075 additions and 198 deletions
+24 -1
View File
@@ -197,12 +197,35 @@ export async function startDaemon(options?: { streamPort?: number }): Promise<vo
.map((p) => p.trim())
.filter(Boolean)
: undefined;
// Parse args from env (comma or newline separated)
const argsEnv = process.env.AGENT_BROWSER_ARGS;
const args = argsEnv
? argsEnv
.split(/[,\n]/)
.map((a) => a.trim())
.filter((a) => a.length > 0)
: undefined;
// Parse proxy from env
const proxyServer = process.env.AGENT_BROWSER_PROXY;
const proxyBypass = process.env.AGENT_BROWSER_PROXY_BYPASS;
const proxy = proxyServer
? {
server: proxyServer,
...(proxyBypass && { bypass: proxyBypass }),
}
: undefined;
await browser.launch({
id: 'auto',
action: 'launch',
action: 'launch' as const,
headless: process.env.AGENT_BROWSER_HEADED !== '1',
executablePath: process.env.AGENT_BROWSER_EXECUTABLE_PATH,
extensions: extensions,
args,
userAgent: process.env.AGENT_BROWSER_USER_AGENT,
proxy,
});
}