gm-copilot-cli 2.0.240 → 2.0.241
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/copilot-profile.md +1 -1
- package/hooks/pre-tool-use-hook.js +90 -62
- package/index.html +1 -1
- package/manifest.yml +1 -1
- package/package.json +1 -1
- package/skills/agent-browser/SKILL.md +48 -19
- package/tools.json +1 -1
package/copilot-profile.md
CHANGED
|
@@ -225,12 +225,96 @@ const run = () => {
|
|
|
225
225
|
const command = (tool_input?.command || '').trim();
|
|
226
226
|
const stripFooter = (s) => s.replace(/\n\[Running tools\][\s\S]*$/, '').trimEnd();
|
|
227
227
|
|
|
228
|
+
// ─── agent-browser: CLI commands ──────────────────────────────────────────
|
|
229
|
+
const abCliMatch = command.match(/^agent-browser:\n([\s\S]+)$/);
|
|
230
|
+
if (abCliMatch) {
|
|
231
|
+
const abCode = abCliMatch[1];
|
|
232
|
+
const abNative = (() => {
|
|
233
|
+
const abDir = path.join(TOOLS_DIR, 'node_modules', 'agent-browser', 'bin');
|
|
234
|
+
const ext = IS_WIN ? '.exe' : '';
|
|
235
|
+
const archMap = { x64: 'x64', arm64: 'arm64', ia32: 'x64' };
|
|
236
|
+
const osMap = { win32: 'win32', darwin: 'darwin', linux: 'linux' };
|
|
237
|
+
const candidate = path.join(abDir, `agent-browser-${osMap[process.platform] || process.platform}-${archMap[process.arch] || process.arch}${ext}`);
|
|
238
|
+
return fs.existsSync(candidate) ? candidate : null;
|
|
239
|
+
})();
|
|
240
|
+
const abBin = abNative || (fs.existsSync(localBin('agent-browser')) ? localBin('agent-browser') : 'agent-browser');
|
|
241
|
+
const AB_CMDS = new Set(['open','goto','navigate','close','quit','exit','back','forward','reload','click','dblclick','type','fill','press','check','uncheck','select','drag','upload','hover','focus','scroll','scrollintoview','wait','screenshot','pdf','snapshot','get','is','find','eval','connect','tab','frame','dialog','state','session','network','cookies','storage','set','trace','profiler','record','console','errors','highlight','inspect','diff','keyboard','mouse','install','upgrade','confirm','deny','auth','device','window']);
|
|
242
|
+
const AB_GLOBAL_FLAGS = new Set(['--cdp','--headed','--headless','--session','--session-name','--auto-connect','--profile','--allow-file-access','--color-scheme','-p','--platform','--device']);
|
|
243
|
+
const AB_GLOBAL_FLAGS_WITH_VALUE = new Set(['--cdp','--session','--session-name','--profile','--color-scheme','-p','--platform','--device']);
|
|
244
|
+
const AB_SESSION_STATE = path.join(os.tmpdir(), 'gm-ab-sessions.json');
|
|
245
|
+
function readAbSessions() { try { return JSON.parse(fs.readFileSync(AB_SESSION_STATE, 'utf8')); } catch { return {}; } }
|
|
246
|
+
function writeAbSessions(s) { try { fs.writeFileSync(AB_SESSION_STATE, JSON.stringify(s)); } catch {} }
|
|
247
|
+
function parseAbLine(line) {
|
|
248
|
+
const tokens = line.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || [];
|
|
249
|
+
const globalArgs = [], rest = [];
|
|
250
|
+
let i = 0;
|
|
251
|
+
while (i < tokens.length) {
|
|
252
|
+
if (AB_GLOBAL_FLAGS.has(tokens[i])) {
|
|
253
|
+
globalArgs.push(tokens[i]);
|
|
254
|
+
if (AB_GLOBAL_FLAGS_WITH_VALUE.has(tokens[i]) && i + 1 < tokens.length && !tokens[i+1].startsWith('--')) globalArgs.push(tokens[++i]);
|
|
255
|
+
i++;
|
|
256
|
+
} else { rest.push(...tokens.slice(i)); break; }
|
|
257
|
+
}
|
|
258
|
+
return { globalArgs, rest };
|
|
259
|
+
}
|
|
260
|
+
const spawnAb = (bin, args, stdin) => {
|
|
261
|
+
const opts = { encoding: 'utf-8', timeout: 60000, windowsHide: true, ...(IS_WIN && { shell: true }), cwd: process.cwd(), ...(stdin !== undefined && { input: stdin }) };
|
|
262
|
+
const r = spawnSync(bin, args, opts);
|
|
263
|
+
if (!r.stdout && !r.stderr && r.error) return `[spawn error: ${r.error.message}]`;
|
|
264
|
+
const out = (r.stdout || '').trimEnd(), err = stripFooter(r.stderr || '').trimEnd();
|
|
265
|
+
return out && err ? out + '\n[stderr]\n' + err : stripFooter(out || err);
|
|
266
|
+
};
|
|
267
|
+
try {
|
|
268
|
+
const safeAb = abCode.trim();
|
|
269
|
+
const firstParsed = parseAbLine(safeAb.split('\n')[0].trim());
|
|
270
|
+
const firstWord = (firstParsed.rest[0] || '').toLowerCase();
|
|
271
|
+
const sessionName = (() => { const si = firstParsed.globalArgs.indexOf('--session'); return si >= 0 ? firstParsed.globalArgs[si+1] : 'default'; })();
|
|
272
|
+
const sessions = readAbSessions();
|
|
273
|
+
if (['open','goto','navigate'].includes(firstWord)) sessions[sessionName] = { url: firstParsed.rest[1] || '?', ts: Date.now() };
|
|
274
|
+
if (['close','quit','exit'].includes(firstWord)) delete sessions[sessionName];
|
|
275
|
+
writeAbSessions(sessions);
|
|
276
|
+
const openSessions = Object.entries(sessions);
|
|
277
|
+
let result;
|
|
278
|
+
if (AB_CMDS.has(firstWord)) {
|
|
279
|
+
const lines = safeAb.split('\n').map(l => l.trim()).filter(Boolean);
|
|
280
|
+
if (lines.length === 1) {
|
|
281
|
+
const { globalArgs, rest } = parseAbLine(lines[0]);
|
|
282
|
+
result = spawnAb(abBin, [...globalArgs, ...rest]);
|
|
283
|
+
} else {
|
|
284
|
+
const hasClose = lines.some(l => { const w = (parseAbLine(l).rest[0]||'').toLowerCase(); return ['close','quit','exit'].includes(w); });
|
|
285
|
+
const batchGlobals = firstParsed.globalArgs;
|
|
286
|
+
const cmds = lines.map(l => {
|
|
287
|
+
const { globalArgs, rest } = parseAbLine(l);
|
|
288
|
+
const mergedGlobals = [...batchGlobals.filter(f => !globalArgs.includes(f)), ...globalArgs];
|
|
289
|
+
const w = (rest[0]||'').toLowerCase();
|
|
290
|
+
if (['open','goto','navigate'].includes(w)) sessions[sessionName] = { url: rest[1]||'?', ts: Date.now() };
|
|
291
|
+
if (['close','quit','exit'].includes(w)) delete sessions[sessionName];
|
|
292
|
+
if (!AB_CMDS.has(w)) return [...mergedGlobals, 'eval', l.trim()];
|
|
293
|
+
return [...mergedGlobals, ...rest];
|
|
294
|
+
});
|
|
295
|
+
writeAbSessions(sessions);
|
|
296
|
+
result = spawnAb(abBin, ['batch'], JSON.stringify(cmds));
|
|
297
|
+
if (!hasClose && openSessions.length > 0) result += `\n\n[tab] Browser session "${sessionName}" still open. Close when done:\n agent-browser:\n close`;
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
result = spawnAb(abBin, ['eval', '--stdin'], safeAb);
|
|
301
|
+
}
|
|
302
|
+
if (openSessions.length > 1) {
|
|
303
|
+
const stale = openSessions.filter(([n]) => n !== sessionName).map(([n,v]) => ` "${n}" → ${v.url} (${Math.round((Date.now()-v.ts)/60000)}min ago)`).join('\n');
|
|
304
|
+
result = (result || '') + `\n\n[tab] ${openSessions.length - 1} other session(s) still open:\n${stale}\n Close with: agent-browser:\\nclose (or --session <name> close)`;
|
|
305
|
+
}
|
|
306
|
+
return allowWithNoop(`agent-browser output:\n\n${result || '(no output)'}`);
|
|
307
|
+
} catch(e) {
|
|
308
|
+
return allowWithNoop(`agent-browser error:\n\n${e.message || '(exec failed)'}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
228
312
|
const execMatch = command.match(/^exec(?::(\S+))?\n([\s\S]+)$/);
|
|
229
313
|
if (execMatch) {
|
|
230
314
|
const rawLang = (execMatch[1] || '').toLowerCase();
|
|
231
315
|
const code = execMatch[2];
|
|
232
316
|
if (/^\s*agent-browser\s/.test(code)) {
|
|
233
|
-
return deny(`Do not call agent-browser via exec:bash. Use
|
|
317
|
+
return deny(`Do not call agent-browser via exec:bash. Use agent-browser: for CLI commands:\n\nagent-browser:\nopen http://example.com\n\nMultiple commands:\n\nagent-browser:\nopen http://localhost:3001\nwait 2000\nsnapshot -i\n\nFor headed mode:\n\nagent-browser:\n--headed open http://localhost:3001\nwait --load networkidle\nsnapshot -i\n\nFor JS eval in browser:\n\nexec:agent-browser\ndocument.title`);
|
|
234
318
|
}
|
|
235
319
|
const cwd = tool_input?.cwd;
|
|
236
320
|
|
|
@@ -352,8 +436,8 @@ const run = () => {
|
|
|
352
436
|
const wrapped = `const __result = await (async () => {\n${safeCode}\n})();\nif (__result !== undefined) { if (typeof __result === 'object') { console.log(JSON.stringify(__result, null, 2)); } else { console.log(__result); } }`;
|
|
353
437
|
result = runWithFile(lang || 'nodejs', wrapped);
|
|
354
438
|
} else if (lang === 'agent-browser') {
|
|
355
|
-
// agent-browser
|
|
356
|
-
//
|
|
439
|
+
// exec:agent-browser = JS eval in browser page context only.
|
|
440
|
+
// Browser CLI commands (open, click, snapshot, headed mode, etc.) use agent-browser: prefix.
|
|
357
441
|
const abNative = (() => {
|
|
358
442
|
const abDir = path.join(TOOLS_DIR, 'node_modules', 'agent-browser', 'bin');
|
|
359
443
|
const ext = IS_WIN ? '.exe' : '';
|
|
@@ -363,63 +447,7 @@ const run = () => {
|
|
|
363
447
|
return fs.existsSync(candidate) ? candidate : null;
|
|
364
448
|
})();
|
|
365
449
|
const abBin = abNative || (fs.existsSync(localBin('agent-browser')) ? localBin('agent-browser') : 'agent-browser');
|
|
366
|
-
|
|
367
|
-
const AB_GLOBAL_FLAGS = new Set(['--cdp','--headed','--headless','--session','--session-name','--auto-connect','--profile','--allow-file-access','--color-scheme','-p','--platform','--device']);
|
|
368
|
-
const AB_GLOBAL_FLAGS_WITH_VALUE = new Set(['--cdp','--session','--session-name','--profile','--color-scheme','-p','--platform','--device']);
|
|
369
|
-
const AB_SESSION_STATE = path.join(os.tmpdir(), 'gm-ab-sessions.json');
|
|
370
|
-
function readAbSessions() { try { return JSON.parse(fs.readFileSync(AB_SESSION_STATE, 'utf8')); } catch { return {}; } }
|
|
371
|
-
function writeAbSessions(s) { try { fs.writeFileSync(AB_SESSION_STATE, JSON.stringify(s)); } catch {} }
|
|
372
|
-
function parseAbLine(line) {
|
|
373
|
-
const tokens = line.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || [];
|
|
374
|
-
const globalArgs = [], rest = [];
|
|
375
|
-
let i = 0;
|
|
376
|
-
while (i < tokens.length) {
|
|
377
|
-
if (AB_GLOBAL_FLAGS.has(tokens[i])) {
|
|
378
|
-
globalArgs.push(tokens[i]);
|
|
379
|
-
if (AB_GLOBAL_FLAGS_WITH_VALUE.has(tokens[i]) && i + 1 < tokens.length && !tokens[i+1].startsWith('--')) {
|
|
380
|
-
globalArgs.push(tokens[++i]);
|
|
381
|
-
}
|
|
382
|
-
i++;
|
|
383
|
-
} else { rest.push(...tokens.slice(i)); break; }
|
|
384
|
-
}
|
|
385
|
-
return { globalArgs, rest };
|
|
386
|
-
}
|
|
387
|
-
const firstLineParsed = parseAbLine(safeCode.trim().split('\n')[0].trim());
|
|
388
|
-
const firstWord = (firstLineParsed.rest[0] || '').toLowerCase();
|
|
389
|
-
const sessionName = (() => { const si = firstLineParsed.globalArgs.indexOf('--session'); return si >= 0 ? firstLineParsed.globalArgs[si+1] : 'default'; })();
|
|
390
|
-
const isOpen = ['open','goto','navigate'].includes(firstWord);
|
|
391
|
-
const isClose = ['close','quit','exit'].includes(firstWord);
|
|
392
|
-
const sessions = readAbSessions();
|
|
393
|
-
if (isOpen) sessions[sessionName] = { url: (firstLineParsed.rest[1] || '?'), ts: Date.now() };
|
|
394
|
-
if (isClose) delete sessions[sessionName];
|
|
395
|
-
writeAbSessions(sessions);
|
|
396
|
-
const openSessions = Object.entries(sessions);
|
|
397
|
-
if (AB_CMDS.has(firstWord)) {
|
|
398
|
-
const lines = safeCode.split('\n').map(l => l.trim()).filter(Boolean);
|
|
399
|
-
if (lines.length === 1) {
|
|
400
|
-
const { globalArgs, rest } = parseAbLine(lines[0]);
|
|
401
|
-
result = spawnDirect(abBin, [...globalArgs, ...rest]);
|
|
402
|
-
} else {
|
|
403
|
-
const hasClose = lines.some(l => { const w = (parseAbLine(l).rest[0]||'').toLowerCase(); return ['close','quit','exit'].includes(w); });
|
|
404
|
-
const cmds = lines.map(l => {
|
|
405
|
-
const { globalArgs, rest } = parseAbLine(l);
|
|
406
|
-
const w = (rest[0]||'').toLowerCase();
|
|
407
|
-
if (['open','goto','navigate'].includes(w)) sessions[sessionName] = { url: rest[1]||'?', ts: Date.now() };
|
|
408
|
-
if (['close','quit','exit'].includes(w)) delete sessions[sessionName];
|
|
409
|
-
if (!AB_CMDS.has(w)) return [...globalArgs, 'eval', l.trim()];
|
|
410
|
-
return [...globalArgs, ...rest];
|
|
411
|
-
});
|
|
412
|
-
writeAbSessions(sessions);
|
|
413
|
-
result = spawnDirect(abBin, ['batch'], JSON.stringify(cmds));
|
|
414
|
-
if (!hasClose && openSessions.length > 0) result += `\n\n[tab] Browser session "${sessionName}" still open. Close when done:\n exec:agent-browser\n close`;
|
|
415
|
-
}
|
|
416
|
-
} else {
|
|
417
|
-
result = spawnDirect(abBin, ['eval', '--stdin'], safeCode);
|
|
418
|
-
}
|
|
419
|
-
if (openSessions.length > 1) {
|
|
420
|
-
const stale = openSessions.filter(([n]) => n !== sessionName).map(([n,v]) => ` "${n}" → ${v.url} (${Math.round((Date.now()-v.ts)/60000)}min ago)`).join('\n');
|
|
421
|
-
result = (result || '') + `\n\n[tab] ${openSessions.length - 1} other session(s) still open:\n${stale}\n Close with: exec:agent-browser\\nclose (or --session <name> close)`;
|
|
422
|
-
}
|
|
450
|
+
result = spawnDirect(abBin, ['eval', '--stdin'], safeCode);
|
|
423
451
|
} else {
|
|
424
452
|
result = runWithFile(lang, safeCode);
|
|
425
453
|
}
|
|
@@ -433,8 +461,8 @@ const run = () => {
|
|
|
433
461
|
return deny(`Do not call ${command.match(/^bun\s+x\s+(\S+)/)[1]} directly. Use exec:<lang> syntax instead.\n\nExamples:\n exec:nodejs\n console.log("hello")\n\n exec:codesearch\n find all database queries\n\n exec:bash\n ls -la\n\nThe exec: prefix routes through the hook dispatcher which handles language detection, background tasks, and tool management automatically.`);
|
|
434
462
|
}
|
|
435
463
|
|
|
436
|
-
if (!/^exec(\s|:)/.test(command) && !/^git /.test(command) && !/(\bclaude\b)/.test(command) && !/^npm install .* \/config\/.gmweb/.test(command) && !/^bun install --cwd \/config\/.gmweb/.test(command)) {
|
|
437
|
-
return deny(`Bash is restricted to exec:<lang
|
|
464
|
+
if (!/^exec(\s|:)/.test(command) && !/^agent-browser:/.test(command) && !/^git /.test(command) && !/(\bclaude\b)/.test(command) && !/^npm install .* \/config\/.gmweb/.test(command) && !/^bun install --cwd \/config\/.gmweb/.test(command)) {
|
|
465
|
+
return deny(`Bash is restricted to exec:<lang>, agent-browser:, and git.\n\nexec:<lang> syntax (lang auto-detected if omitted):\n exec:nodejs / exec:python / exec:bash / exec:typescript\n exec:go / exec:rust / exec:java / exec:c / exec:cpp\n exec:cmd ← runs cmd.exe /c on Windows\n exec:agent-browser ← JS eval in browser page context (document.title, DOM queries, etc.)\n exec ← auto-detects language\n\nexec:agent-browser — JS eval in browser page context:\n exec:agent-browser\n document.title\n\n exec:agent-browser\n JSON.stringify([...document.querySelectorAll('h1')].map(h => h.textContent))\n\nagent-browser: — browser CLI commands (open, click, snapshot, headed mode, etc.):\n agent-browser:\n open http://localhost:3001\n\n agent-browser:\n --headed open http://localhost:3001\n wait --load networkidle\n snapshot -i\n\n agent-browser:\n close\n\nTask management shortcuts (body = args):\n exec:status\n <task_id>\n\n exec:sleep\n <task_id> [seconds] [--next-output]\n\n exec:type\n <task_id>\n <input to send to stdin>\n\n exec:close\n <task_id>\n\n exec:runner\n start|stop|status\n\nCode search shortcut:\n exec:codesearch\n <natural language query>\n\nAll other Bash commands are blocked.`);
|
|
438
466
|
}
|
|
439
467
|
}
|
|
440
468
|
|
package/index.html
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script type="module">
|
|
19
19
|
import { createElement as h, applyDiff, Fragment } from "webjsx";
|
|
20
20
|
const PLATFORM_NAME="Copilot CLI",PLATFORM_TYPE="CLI Tool",PLATFORM_TYPE_COLOR="#3b82f6";
|
|
21
|
-
const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.
|
|
21
|
+
const DESCRIPTION="State machine agent with hooks, skills, and automated git enforcement",VERSION="2.0.241";
|
|
22
22
|
const GITHUB_URL="https://github.com/AnEntrypoint/gm-copilot-cli",BADGE_LABEL="copilot-cli";
|
|
23
23
|
const FEATURES=[{"title":"State Machine","desc":"Immutable PLAN→EXECUTE→EMIT→VERIFY→COMPLETE phases with full mutable tracking"},{"title":"Semantic Search","desc":"Natural language codebase exploration via codesearch skill — no grep needed"},{"title":"Hooks","desc":"Pre-tool, session-start, prompt-submit, and stop hooks for full lifecycle control"},{"title":"Agents","desc":"gm, codesearch, and websearch agents pre-configured and ready to use"},{"title":"MCP Integration","desc":"Model Context Protocol server support built in"},{"title":"Auto-Recovery","desc":"Supervisor hierarchy ensures the system never crashes"}],INSTALL_STEPS=[{"desc":"Install via GitHub CLI","cmd":"gh extension install AnEntrypoint/gm-copilot-cli"},{"desc":"Restart your terminal — activates automatically"}];
|
|
24
24
|
const CURRENT_PLATFORM="gm-copilot-cli";
|
package/manifest.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-browser
|
|
3
3
|
description: Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
|
|
4
|
-
allowed-tools: agent-browser, Bash(exec:agent-browser*)
|
|
4
|
+
allowed-tools: agent-browser, Bash(agent-browser:*), Bash(exec:agent-browser*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Browser Automation with agent-browser
|
|
8
8
|
|
|
9
9
|
## Two Pathways
|
|
10
10
|
|
|
11
|
-
**
|
|
11
|
+
**Browser CLI commands** — use `agent-browser:` prefix via Bash for all browser control: navigating, clicking, filling forms, taking screenshots, reading snapshots.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
```
|
|
14
|
+
agent-browser:
|
|
15
|
+
open http://localhost:3001
|
|
16
|
+
wait 2000
|
|
17
|
+
snapshot -i
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Single commands:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
agent-browser:
|
|
24
|
+
open http://example.com
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
agent-browser:
|
|
29
|
+
close
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**JS eval in browser** — use `exec:agent-browser` via Bash when you need to run JavaScript in the page context. The body is piped to `eval --stdin`. Use this for DOM inspection, custom extraction logic, or anything requiring programmatic page access.
|
|
14
33
|
|
|
15
34
|
```
|
|
16
35
|
exec:agent-browser
|
|
17
36
|
document.title
|
|
18
37
|
```
|
|
19
38
|
|
|
20
|
-
Multi-line `exec:agent-browser` blocks where lines are recognized CLI commands run as a batch instead of eval — useful for sequencing page control steps when the `agent-browser` tool isn't available:
|
|
21
|
-
|
|
22
39
|
```
|
|
23
40
|
exec:agent-browser
|
|
24
|
-
|
|
25
|
-
wait 2000
|
|
26
|
-
snapshot -i
|
|
41
|
+
JSON.stringify([...document.querySelectorAll('h1')].map(h => h.textContent))
|
|
27
42
|
```
|
|
28
43
|
|
|
29
|
-
**Always close tabs when done**: every `open` is tracked. Use `
|
|
44
|
+
**Always close tabs when done**: every `open` is tracked. Use `agent-browser:\nclose` (or `--session <name> close`) when finished. Leaving sessions open accumulates stale tabs — the hook will warn you when other sessions are still open.
|
|
30
45
|
|
|
31
46
|
## Core Workflow
|
|
32
47
|
|
|
@@ -155,12 +170,22 @@ agent-browser --auto-connect snapshot
|
|
|
155
170
|
agent-browser --cdp 9222 snapshot
|
|
156
171
|
```
|
|
157
172
|
|
|
158
|
-
### Visual Browser (
|
|
173
|
+
### Visual Browser (Headed Mode)
|
|
159
174
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
agent-browser
|
|
175
|
+
Use `--headed` as the first flag on the first line — it propagates to all commands in the block:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
agent-browser:
|
|
179
|
+
--headed open https://example.com
|
|
180
|
+
wait --load networkidle
|
|
181
|
+
snapshot -i
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
agent-browser:
|
|
186
|
+
--headed open https://example.com
|
|
187
|
+
highlight @e1
|
|
188
|
+
record start demo.webm
|
|
164
189
|
```
|
|
165
190
|
|
|
166
191
|
### Local Files (PDFs, HTML)
|
|
@@ -451,10 +476,14 @@ agent-browser profiler stop [path] # Stop and save .json profile
|
|
|
451
476
|
```
|
|
452
477
|
|
|
453
478
|
### Visual Debugging
|
|
454
|
-
```
|
|
455
|
-
agent-browser
|
|
456
|
-
|
|
457
|
-
|
|
479
|
+
```
|
|
480
|
+
agent-browser:
|
|
481
|
+
--headed open <url>
|
|
482
|
+
record start <file.webm>
|
|
483
|
+
```
|
|
484
|
+
```
|
|
485
|
+
agent-browser:
|
|
486
|
+
record stop
|
|
458
487
|
```
|
|
459
488
|
|
|
460
489
|
### Comparisons & Diffs
|
|
@@ -543,6 +572,6 @@ exec:agent-browser
|
|
|
543
572
|
document.title
|
|
544
573
|
```
|
|
545
574
|
|
|
546
|
-
**Debugging complex interactions**: Use
|
|
575
|
+
**Debugging complex interactions**: Use headed mode — put `--headed` as the first flag on the first line of an `agent-browser:` block. It propagates to all subsequent commands in the block.
|
|
547
576
|
|
|
548
577
|
**Ground truth verification**: Use the ordinary pathway (`agent-browser screenshot`) for visual confirmation; use the exec pathway for JavaScript-level inspection.
|