mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-19 19:41:06 +00:00
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package browser
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
|
|
"browseros-dev/proc"
|
|
)
|
|
|
|
type ArgsConfig struct {
|
|
Root string
|
|
Ports proc.Ports
|
|
UserDataDir string
|
|
Headless bool
|
|
LoadDevExtensions bool
|
|
}
|
|
|
|
func BuildArgs(cfg ArgsConfig) []string {
|
|
binary := "/Applications/BrowserOS.app/Contents/MacOS/BrowserOS"
|
|
|
|
args := []string{binary}
|
|
|
|
if cfg.LoadDevExtensions {
|
|
args = append(args, "--no-first-run", "--no-default-browser-check")
|
|
}
|
|
|
|
args = append(args,
|
|
"--use-mock-keychain",
|
|
"--show-component-extension-options",
|
|
"--disable-browseros-server",
|
|
"--browseros-dock-icon=dev",
|
|
)
|
|
|
|
if cfg.LoadDevExtensions {
|
|
args = append(args, "--disable-browseros-extensions")
|
|
} else {
|
|
args = append(args, "--enable-logging=stderr")
|
|
}
|
|
|
|
if cfg.Headless {
|
|
args = append(args, "--headless=new")
|
|
}
|
|
|
|
args = append(args,
|
|
fmt.Sprintf("--remote-debugging-port=%d", cfg.Ports.CDP),
|
|
fmt.Sprintf("--browseros-mcp-port=%d", cfg.Ports.Server),
|
|
fmt.Sprintf("--browseros-extension-port=%d", cfg.Ports.Extension),
|
|
fmt.Sprintf("--user-data-dir=%s", cfg.UserDataDir),
|
|
)
|
|
|
|
if cfg.LoadDevExtensions {
|
|
agentExtDir := filepath.Join(cfg.Root, "apps/agent/dist/chrome-mv3-dev")
|
|
args = append(args, fmt.Sprintf("--load-extension=%s", agentExtDir))
|
|
args = append(args, "chrome://newtab")
|
|
}
|
|
|
|
return args
|
|
}
|