Skip to content

Commit c691b26

Browse files
authored
fix: improve config schema and serve from docs site (vercel-labs#1248)
Fix idleTimeout description to document human-friendly formats (30s, 5m, 1h) alongside raw milliseconds. Add trailing newline. Serve the schema from the docs app at agent-browser.dev/schema.json via a prebuild copy step, and update all $schema URLs to use the stable docs-hosted URL instead of raw GitHub.
1 parent 4f9edf9 commit c691b26

File tree

6 files changed

+181
-19
lines changed

6 files changed

+181
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ A [JSON Schema](agent-browser.schema.json) is available for IDE autocomplete and
734734

735735
```json
736736
{
737-
"$schema": "https://raw.githubusercontent.com/vercel-labs/agent-browser/main/agent-browser.schema.json",
737+
"$schema": "https://agent-browser.dev/schema.json",
738738
"headed": true
739739
}
740740
```

agent-browser.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
},
148148
"idleTimeout": {
149149
"type": "string",
150-
"description": "Auto-shutdown the daemon after N ms of inactivity (e.g., '60000')."
150+
"description": "Auto-shutdown the daemon after inactivity (e.g., '30s', '5m', '1h', or raw milliseconds like '60000')."
151151
},
152152
"model": {
153153
"type": "string",
@@ -163,4 +163,4 @@
163163
}
164164
},
165165
"additionalProperties": true
166-
}
166+
}

cli/src/native/actions.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,16 +1064,14 @@ impl DaemonState {
10641064
}
10651065
}
10661066
}
1067-
"Page.screencastFrame" => {
1068-
// Frame broadcasting and acks are handled in real-time by the
1069-
// stream server's background CDP event loop. Here we just
1070-
// collect acks as a fallback for non-streaming mode.
1071-
if self.stream_server.is_none() {
1072-
if let Some(sid) =
1073-
event.params.get("sessionId").and_then(|v| v.as_i64())
1074-
{
1075-
pending_acks.push(sid);
1076-
}
1067+
// Frame broadcasting and acks are handled in real-time by the
1068+
// stream server's background CDP event loop. Here we just
1069+
// collect acks as a fallback for non-streaming mode.
1070+
"Page.screencastFrame" if self.stream_server.is_none() => {
1071+
if let Some(sid) =
1072+
event.params.get("sessionId").and_then(|v| v.as_i64())
1073+
{
1074+
pending_acks.push(sid);
10771075
}
10781076
}
10791077
"Page.javascriptDialogOpening" => {

cli/src/native/browser.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,8 @@ async fn poll_network_idle(
13021302
}
13031303
}
13041304
}
1305-
"Page.loadEventFired" => {
1306-
if p.is_empty() {
1307-
idle_start = Some(tokio::time::Instant::now());
1308-
}
1305+
"Page.loadEventFired" if p.is_empty() => {
1306+
idle_start = Some(tokio::time::Instant::now());
13091307
}
13101308
_ => {}
13111309
}

docs/public/schema.json

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Agent Browser Configuration",
4+
"description": "Configuration file for agent-browser (e.g., agent-browser.json or ~/.agent-browser/config.json)",
5+
"type": "object",
6+
"properties": {
7+
"headed": {
8+
"type": "boolean",
9+
"description": "Show browser window instead of running headless."
10+
},
11+
"json": {
12+
"type": "boolean",
13+
"description": "Output in JSON format."
14+
},
15+
"debug": {
16+
"type": "boolean",
17+
"description": "Enable debug output."
18+
},
19+
"session": {
20+
"type": "string",
21+
"description": "Session identifier."
22+
},
23+
"sessionName": {
24+
"type": "string",
25+
"description": "Auto-save/load state persistence name."
26+
},
27+
"executablePath": {
28+
"type": "string",
29+
"description": "Path to a custom browser executable."
30+
},
31+
"extensions": {
32+
"type": "array",
33+
"items": {
34+
"type": "string"
35+
},
36+
"description": "Paths to browser extensions. Extensions from user-level and project-level configs are concatenated."
37+
},
38+
"profile": {
39+
"type": "string",
40+
"description": "Path to the browser profile data directory."
41+
},
42+
"state": {
43+
"type": "string",
44+
"description": "Path to load/save browser state."
45+
},
46+
"proxy": {
47+
"type": "string",
48+
"description": "Proxy server URL (e.g., http://localhost:8080)."
49+
},
50+
"proxyBypass": {
51+
"type": "string",
52+
"description": "Comma-separated domains to bypass the proxy (e.g., localhost,*.internal.com)."
53+
},
54+
"args": {
55+
"type": "string",
56+
"description": "Additional comma-separated launch arguments for the browser."
57+
},
58+
"userAgent": {
59+
"type": "string",
60+
"description": "Custom User-Agent string."
61+
},
62+
"provider": {
63+
"type": "string",
64+
"description": "Provider to use, such as 'ios'."
65+
},
66+
"device": {
67+
"type": "string",
68+
"description": "Device name or identifier for emulation or providers (e.g., 'iPhone 16 Pro')."
69+
},
70+
"ignoreHttpsErrors": {
71+
"type": "boolean",
72+
"description": "Ignore HTTPS errors during navigation."
73+
},
74+
"allowFileAccess": {
75+
"type": "boolean",
76+
"description": "Allow file:// URLs to access local files."
77+
},
78+
"cdp": {
79+
"type": "string",
80+
"description": "Chrome DevTools Protocol endpoint URL."
81+
},
82+
"autoConnect": {
83+
"type": "boolean",
84+
"description": "Auto-discover and connect to a running Chrome instance."
85+
},
86+
"annotate": {
87+
"type": "boolean",
88+
"description": "Annotated screenshot with numbered element labels."
89+
},
90+
"colorScheme": {
91+
"type": "string",
92+
"enum": ["dark", "light", "no-preference"],
93+
"description": "Color scheme preference."
94+
},
95+
"downloadPath": {
96+
"type": "string",
97+
"description": "Default directory for browser downloads."
98+
},
99+
"contentBoundaries": {
100+
"type": "boolean",
101+
"description": "Wrap page output in boundary markers for LLM safety."
102+
},
103+
"maxOutput": {
104+
"type": "integer",
105+
"minimum": 0,
106+
"description": "Max characters for page output (truncates beyond limit)."
107+
},
108+
"allowedDomains": {
109+
"type": "array",
110+
"items": {
111+
"type": "string"
112+
},
113+
"description": "Allowed domain patterns (e.g., ['example.com', '*.example.com'])."
114+
},
115+
"actionPolicy": {
116+
"type": "string",
117+
"description": "Path to action policy JSON file."
118+
},
119+
"confirmActions": {
120+
"type": "string",
121+
"description": "Comma-separated action categories requiring confirmation."
122+
},
123+
"confirmInteractive": {
124+
"type": "boolean",
125+
"description": "Enable interactive confirmation prompts (auto-denies if stdin is not a TTY)."
126+
},
127+
"engine": {
128+
"type": "string",
129+
"enum": ["chrome", "lightpanda"],
130+
"default": "chrome",
131+
"description": "Browser engine to use."
132+
},
133+
"screenshotDir": {
134+
"type": "string",
135+
"description": "Default screenshot output directory."
136+
},
137+
"screenshotQuality": {
138+
"type": "integer",
139+
"minimum": 0,
140+
"maximum": 100,
141+
"description": "JPEG quality for screenshots (0-100)."
142+
},
143+
"screenshotFormat": {
144+
"type": "string",
145+
"enum": ["png", "jpeg"],
146+
"description": "Screenshot format."
147+
},
148+
"idleTimeout": {
149+
"type": "string",
150+
"description": "Auto-shutdown the daemon after inactivity (e.g., '30s', '5m', '1h', or raw milliseconds like '60000')."
151+
},
152+
"model": {
153+
"type": "string",
154+
"description": "AI model for chat command (e.g., 'openai/gpt-4o')."
155+
},
156+
"noAutoDialog": {
157+
"type": "boolean",
158+
"description": "Disable automatic dismissal of alert/beforeunload dialogs."
159+
},
160+
"headers": {
161+
"type": "string",
162+
"description": "Custom HTTP headers supplied as a JSON-formatted string."
163+
}
164+
},
165+
"additionalProperties": true
166+
}

docs/src/app/configuration/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ AGENT_BROWSER_CONFIG=./ci-config.json agent-browser open example.com
3939
}
4040
```
4141

42-
A [JSON Schema](https://github.com/vercel-labs/agent-browser/blob/main/agent-browser.schema.json) is available for IDE autocomplete and validation. Add a `$schema` key to your config file to enable it:
42+
A [JSON Schema](https://agent-browser.dev/schema.json) is available for IDE autocomplete and validation. Add a `$schema` key to your config file to enable it:
4343

4444
```json
4545
{
46-
"$schema": "https://raw.githubusercontent.com/vercel-labs/agent-browser/main/agent-browser.schema.json",
46+
"$schema": "https://agent-browser.dev/schema.json",
4747
"headed": true
4848
}
4949
```

0 commit comments

Comments
 (0)