This commit is contained in:
Harivansh Rathi 2026-03-11 03:38:50 -04:00
parent 81b0a2f47a
commit 3919bbf708
2 changed files with 44 additions and 0 deletions

View file

@ -188,6 +188,7 @@ export interface BrowserToolOptions {
stateDir?: string;
agentDir?: string;
headed?: boolean;
windowClass?: string;
}
interface BrowserCommandContext {
@ -287,6 +288,15 @@ function shouldLaunchHeaded(options?: BrowserToolOptions): boolean {
return isTruthyEnv(process.env.COMPANION_AGENT_BROWSER_HEADED);
}
function getBrowserWindowClass(
options?: BrowserToolOptions,
): string | undefined {
const rawValue =
options?.windowClass ?? process.env.COMPANION_BROWSER_WINDOW_CLASS;
const windowClass = rawValue?.trim();
return windowClass ? windowClass : undefined;
}
function createBrowserCommandContext(
profilePath: string,
stateDir: string,
@ -356,6 +366,10 @@ function buildBrowserCommand(
if (shouldLaunchHeaded(options)) {
baseArgs.push("--headed");
}
const windowClass = getBrowserWindowClass(options);
if (windowClass) {
baseArgs.push("--args", `--class=${windowClass}`);
}
switch (input.action) {
case "open": {