src / configSchematics.ts
import { createConfigSchematics } from "@lmstudio/sdk";
// A current, broadly-deployed Chrome/macOS UA. Chosen to look ordinary —
// a too-recent UA is itself a signal, and an outdated one fails feature
// checks. Update periodically as Chrome's stable channel moves.
const DEFAULT_USER_AGENT =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 " +
"(KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
export const configSchematics = createConfigSchematics()
.field(
"binCommand",
"string",
{
displayName: "agent-browser command",
hint: "Command used to invoke agent-browser. Use 'npx agent-browser' for zero-install, or 'agent-browser' if installed globally.",
},
"npx agent-browser",
)
.field(
"session",
"string",
{
displayName: "Session name",
hint: "Isolated agent-browser session name. Each session has its own browser instance and cookies.",
},
"lmstudio",
)
.field(
"headed",
"boolean",
{
displayName: "Show browser window",
hint: "If enabled, agent-browser launches a visible Chrome window instead of running headlessly.",
},
false,
)
.field(
"timeoutMs",
"numeric",
{
displayName: "Default timeout (ms)",
hint: "Default operation timeout passed to agent-browser via --timeout.",
min: 1000,
max: 300000,
int: true,
},
30000,
)
.field(
"screenshotDir",
"string",
{
displayName: "Screenshot directory",
hint: "Directory where screenshots are saved. Defaults to the plugin working directory if blank.",
},
"",
)
.field(
"userAgent",
"string",
{
displayName: "User-Agent",
hint: "User-Agent header sent by the browser. Defaults to a recent Chrome/macOS UA so traffic blends in. Leave blank to use agent-browser's default.",
},
DEFAULT_USER_AGENT,
)
.field(
"viewport",
"string",
{
displayName: "Viewport size",
hint: "Browser viewport as WIDTHxHEIGHT (e.g. '1440x900'). Applied as the launch window size. Leave blank to use agent-browser's default.",
placeholder: "1440x900",
},
"1440x900",
)
.field(
"acceptLanguage",
"string",
{
displayName: "Accept-Language",
hint: "Accept-Language header value. Applied via --headers so requests look like a real browser. Leave blank to disable.",
},
"en-US,en;q=0.9",
)
.field(
"colorScheme",
"select",
{
displayName: "Color scheme",
hint: "Preferred color scheme reported to pages via prefers-color-scheme. Most users have 'light' or 'dark' set; 'no-preference' is unusual.",
options: [
{ value: "light", displayName: "Light" },
{ value: "dark", displayName: "Dark" },
{ value: "no-preference", displayName: "No preference (default)" },
],
},
"light",
)
.field(
"extraBrowserArgs",
"string",
{
displayName: "Extra Chromium launch args",
hint: "Comma-separated Chromium command-line flags appended to --args. Default suppresses the navigator.webdriver flag, which is the most common automation tell.",
},
"--disable-blink-features=AutomationControlled",
)
.build();