slipwing 0.0.0-stage → 0.1.0

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.
Files changed (99) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +143 -3
  3. package/bin/agent-desktop-win32-x64.exe +0 -0
  4. package/bin/workflow.js +512 -0
  5. package/browser/LICENSE +201 -0
  6. package/browser/LICENSE-axe-core-THIRD-PARTY.txt +66 -0
  7. package/browser/LICENSE-axe-core.txt +362 -0
  8. package/browser/bin/agent-browser-win32-x64.exe +0 -0
  9. package/browser/skill-data/agentcore/SKILL.md +115 -0
  10. package/browser/skill-data/core/SKILL.md +279 -0
  11. package/browser/skill-data/core/references/authentication.md +413 -0
  12. package/browser/skill-data/core/references/commands.md +727 -0
  13. package/browser/skill-data/core/references/profiling.md +120 -0
  14. package/browser/skill-data/core/references/proxy-support.md +221 -0
  15. package/browser/skill-data/core/references/session-management.md +215 -0
  16. package/browser/skill-data/core/references/snapshot-refs.md +244 -0
  17. package/browser/skill-data/core/references/streaming.md +107 -0
  18. package/browser/skill-data/core/references/trust-boundaries.md +69 -0
  19. package/browser/skill-data/core/references/video-recording.md +254 -0
  20. package/browser/skill-data/core/references/webgpu.md +118 -0
  21. package/browser/skill-data/core/templates/authenticated-session.sh +109 -0
  22. package/browser/skill-data/core/templates/capture-workflow.sh +69 -0
  23. package/browser/skill-data/core/templates/form-automation.sh +63 -0
  24. package/browser/skill-data/derive-client/SKILL.md +88 -0
  25. package/browser/skill-data/dogfood/SKILL.md +224 -0
  26. package/browser/skill-data/dogfood/references/issue-taxonomy.md +109 -0
  27. package/browser/skill-data/dogfood/templates/dogfood-report-template.md +53 -0
  28. package/browser/skill-data/electron/SKILL.md +236 -0
  29. package/browser/skill-data/modern-web-guidance/SKILL.md +165 -0
  30. package/browser/skill-data/slack/SKILL.md +288 -0
  31. package/browser/skill-data/slack/references/slack-tasks.md +349 -0
  32. package/browser/skill-data/slack/templates/slack-report-template.md +163 -0
  33. package/browser/skill-data/vercel/SKILL.md +160 -0
  34. package/browser/skill-data/vercel-sandbox/SKILL.md +237 -0
  35. package/browser/skill-data/webmcp-gen/SKILL.md +52 -0
  36. package/browser/skills/agent-browser/SKILL.md +51 -0
  37. package/bundle.json +19 -0
  38. package/lib/browser-move.js +185 -0
  39. package/lib/bundle-version.js +32 -0
  40. package/lib/choose.js +382 -0
  41. package/lib/cli-options.js +47 -0
  42. package/lib/control-changes.js +47 -0
  43. package/lib/current-page.js +165 -0
  44. package/lib/error-code.js +19 -0
  45. package/lib/final-picture.js +31 -0
  46. package/lib/final-words.json +7 -0
  47. package/lib/flow-record.js +32 -0
  48. package/lib/host-client.js +65 -0
  49. package/lib/host-command.js +175 -0
  50. package/lib/host-paths.js +22 -0
  51. package/lib/host-server.js +383 -0
  52. package/lib/host-waits.js +12 -0
  53. package/lib/host-watch.js +340 -0
  54. package/lib/mcp-guide.js +45 -0
  55. package/lib/mcp-server.js +264 -0
  56. package/lib/notify.js +31 -0
  57. package/lib/page-choice.js +273 -0
  58. package/lib/page-input.js +141 -0
  59. package/lib/page-lease.js +87 -0
  60. package/lib/page-line.js +83 -0
  61. package/lib/page-pointer.js +191 -0
  62. package/lib/page-read.js +44 -0
  63. package/lib/platform.js +89 -0
  64. package/lib/png-mark.js +83 -0
  65. package/lib/prefs.js +228 -0
  66. package/lib/routine-approvals.js +67 -0
  67. package/lib/routine-command.js +150 -0
  68. package/lib/routine-effects.js +119 -0
  69. package/lib/routine-store.js +143 -0
  70. package/lib/script-args.js +48 -0
  71. package/lib/script-call.js +63 -0
  72. package/lib/script-desktop.js +731 -0
  73. package/lib/script-final.js +93 -0
  74. package/lib/script-fix.js +121 -0
  75. package/lib/script-input.js +25 -0
  76. package/lib/script-match.js +90 -0
  77. package/lib/script-picture.js +104 -0
  78. package/lib/script-repeat.js +43 -0
  79. package/lib/script-run.js +367 -0
  80. package/lib/script-screen.js +53 -0
  81. package/lib/script-visible.js +228 -0
  82. package/lib/script-wait.js +15 -0
  83. package/lib/script-web.js +338 -0
  84. package/lib/skill-command.js +81 -0
  85. package/lib/space.js +56 -0
  86. package/lib/text-match.js +18 -0
  87. package/lib/watch-helper.ps1 +200 -0
  88. package/lib/web-page.js +214 -0
  89. package/lib/window-move.js +213 -0
  90. package/lib/windows-bin.js +44 -0
  91. package/package.json +32 -5
  92. package/scripts/initialize-state.ps1 +13 -0
  93. package/skills/slipwing/SKILL.md +189 -0
  94. package/skills/slipwing/chrome.md +62 -0
  95. package/skills/slipwing/desktop.md +82 -0
  96. package/skills/slipwing/human.md +63 -0
  97. package/skills/slipwing/jobs.md +82 -0
  98. package/skills/slipwing/routines.md +73 -0
  99. package/skills/slipwing/watches.md +37 -0
@@ -0,0 +1,118 @@
1
+ # WebGPU
2
+
3
+ Screenshots and video of WebGPU pages (three.js `WebGPURenderer`, Babylon.js, raw WebGPU) in headless Chrome. Without setup this is a silent failure: the page loads, the screenshot succeeds, and the canvas is black.
4
+
5
+ ## Quick start
6
+
7
+ ```bash
8
+ agent-browser --webgpu open https://my-webgpu-app.example.com
9
+ # wait for the app to render (see "Timing" below)
10
+ agent-browser screenshot app.png
11
+ ```
12
+
13
+ `--webgpu` (or `AGENT_BROWSER_WEBGPU=1`, or `"webgpu": true` in `~/.agent-browser/config.json` or a file loaded with `--config`) applies a launch preset:
14
+
15
+ - everywhere: `--enable-unsafe-webgpu` (WebGPU is hidden in headless/blocklisted environments by default)
16
+ - Linux only: `--enable-features=Vulkan --use-angle=vulkan --use-vulkan=swiftshader --use-webgpu-adapter=swiftshader --disable-vulkan-surface` — routes WebGPU through SwiftShader's software Vulkan, so it works with no GPU (containers, CI)
17
+
18
+ macOS uses the hardware Metal backend; Windows uses D3D. Nothing extra to install on either.
19
+
20
+ ## Platform matrix (verified)
21
+
22
+ | Platform | WebGPU rendering (headless) | Screenshots of WebGPU canvases |
23
+ |---|---|---|
24
+ | macOS | works | works headless |
25
+ | Windows | works (hardware D3D) | **headless captures black** — use `--headed` on a logged-in desktop |
26
+ | Linux | works (SwiftShader Vulkan) | headless capture not supported upstream — add `--headed` (virtual display starts automatically) |
27
+
28
+ The Windows/Linux screenshot gap is an upstream headless-Chrome limitation: WebGPU canvas *presentation* never reaches the headless compositor, even though rendering itself works (verified by pixel readback). It is not an agent-browser or flag problem — no known flag combination fixes it. Rendering, `eval`-based pixel readbacks, and compute all work headless everywhere.
29
+
30
+ On Linux, `--headed` is all you need even on displayless servers and containers: when no `DISPLAY` is set and Xvfb is installed (`apt-get install -y xvfb`), agent-browser starts a private virtual display for the browser and tears it down with it. Set `AGENT_BROWSER_NO_XVFB=1` to opt out. Do not wrap the CLI in `xvfb-run`: it removes the display when the CLI exits while the browser keeps running.
31
+
32
+ ```bash
33
+ agent-browser --webgpu --headed open https://my-webgpu-app.example.com
34
+ agent-browser screenshot app.png # real WebGPU pixels, no display hardware
35
+ ```
36
+
37
+ On Windows, the session must run headed in a logged-in desktop session (an ssh/Session-0 context is not enough — schedule the launch on the interactive desktop, e.g. `schtasks /IT`, then drive it from anywhere).
38
+
39
+ ## Verify the pipeline
40
+
41
+ ```bash
42
+ agent-browser doctor --webgpu
43
+ ```
44
+
45
+ This launches a scratch session with the preset and pixel-checks two stages separately:
46
+
47
+ 1. **render** — requests an adapter (with retries; a cold Chrome returns null while the GPU process starts), clears an offscreen texture to red through a real render pass, and reads the buffer back. Proves WebGPU works at all, and reports the adapter (e.g. `nvidia ampere`, `apple metal-3`, `google swiftshader`).
48
+ 2. **screenshot** — decodes an actual screenshot of a presenting canvas. Proves the capture path. Expected to fail headless on Windows/Linux (see matrix); the failure message says so and points at `--headed`.
49
+
50
+ Add `--headed` (`agent-browser doctor --webgpu --headed`) to validate the capture path itself — on displayless Linux the probe starts its own Xvfb, so both checks should pass.
51
+
52
+ ## Linux / containers / CI
53
+
54
+ The SwiftShader Vulkan path needs the system Vulkan loader and Mesa ICD. Without them `requestAdapter()` returns null (or fails with "A valid external Instance reference no longer exists"):
55
+
56
+ ```bash
57
+ apt-get install -y libvulkan1 mesa-vulkan-drivers
58
+ ```
59
+
60
+ Container recipe (Debian/Ubuntu base; xvfb needed only for the screenshot path). Verified with both Chrome for Testing and Debian's `chromium` package (set `AGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromium` for the latter — useful on ARM64, where Chrome for Testing has no Linux builds):
61
+
62
+ ```dockerfile
63
+ FROM node:22-bookworm-slim
64
+ RUN apt-get update && apt-get install -y \
65
+ ca-certificates libvulkan1 mesa-vulkan-drivers xvfb xauth \
66
+ && rm -rf /var/lib/apt/lists/*
67
+ RUN npm install -g agent-browser \
68
+ && agent-browser install # downloads Chrome for Testing
69
+ ```
70
+
71
+ No real GPU or `/dev/dri` is required. To prefer a real GPU on a Linux machine that has working hardware Vulkan, override both the Vulkan driver and the adapter — the preset pins `--use-vulkan=swiftshader`, so overriding only the adapter still enumerates SwiftShader (user `--args` win over the preset):
72
+
73
+ ```bash
74
+ agent-browser --webgpu --args "--use-vulkan=native,--use-webgpu-adapter=default" open ...
75
+ ```
76
+
77
+ ## Secure contexts
78
+
79
+ `navigator.gpu` only exists in secure contexts. `https://`, `http://localhost`, and `file://` qualify; a plain `http://` LAN address or `data:` URL does not — WebGPU will be `undefined` there no matter which flags are set.
80
+
81
+ ## Timing: don't screenshot too early
82
+
83
+ WebGPU apps initialize asynchronously. A screenshot taken at `load` captures a blank canvas with no error anywhere. In particular:
84
+
85
+ - **three.js `WebGPURenderer`**: `renderer.init()` is async; the first frame lands only after it resolves. Also note three.js **silently falls back to WebGL2** when it can't get a WebGPU adapter — the page "works" but you're not testing WebGPU (and on old setups the WebGL fallback itself may be black).
86
+ - Wait for an app-specific signal before capturing: a canvas with content, a "ready" DOM marker, or simply a rendered-frame check:
87
+
88
+ ```bash
89
+ agent-browser wait --fn "window.__appReady === true"
90
+ # or generically: give the render loop a frame or two
91
+ agent-browser eval "new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))"
92
+ agent-browser screenshot app.png
93
+ ```
94
+
95
+ To check which backend a three.js app actually got:
96
+
97
+ ```bash
98
+ agent-browser eval "document.querySelector('canvas').getContext('webgpu') ? 'webgpu' : 'webgl-fallback'"
99
+ ```
100
+
101
+ ## Reading pixels back inside the page
102
+
103
+ If you `eval` your own WebGPU readback, don't snapshot the canvas (`drawImage(webgpuCanvas, ...)`) — it depends on presentation timing and reads transparent black on Windows even when rendering works. Render to an offscreen texture and read it back deterministically:
104
+
105
+ ```js
106
+ const tex = device.createTexture({ size: [w, h], format: 'rgba8unorm',
107
+ usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC });
108
+ // ...render to tex, then:
109
+ encoder.copyTextureToBuffer({ texture: tex }, { buffer, bytesPerRow }, [w, h]);
110
+ device.queue.submit([encoder.finish()]);
111
+ await buffer.mapAsync(GPUMapMode.READ);
112
+ ```
113
+
114
+ This works headless on every platform (it's how `doctor --webgpu` proves rendering).
115
+
116
+ ## Performance expectations
117
+
118
+ SwiftShader is a CPU rasterizer. Simple scenes render fine; heavy three.js scenes are single-digit FPS. For screenshots that's usually irrelevant; for smooth video capture of complex scenes, use hardware (macOS/Windows, or Linux with `--use-vulkan=native,--use-webgpu-adapter=default` and real Vulkan drivers).
@@ -0,0 +1,109 @@
1
+ #!/bin/bash
2
+ # Template: Authenticated Session Workflow
3
+ # Purpose: Login once, save state, reuse for subsequent runs
4
+ # Usage: ./authenticated-session.sh <login-url> [state-file]
5
+ #
6
+ # RECOMMENDED: Use the auth vault instead of this template:
7
+ # echo "<pass>" | agent-browser auth save myapp --url <login-url> --username <user> --password-stdin
8
+ # agent-browser auth login myapp
9
+ # The auth vault stores credentials securely and the LLM never sees passwords.
10
+ #
11
+ # Environment variables:
12
+ # APP_USERNAME - Login username/email
13
+ # APP_PASSWORD - Login password
14
+ #
15
+ # Two modes:
16
+ # 1. Discovery mode (default): Shows form structure so you can identify refs
17
+ # 2. Login mode: Performs actual login after you update the refs
18
+ #
19
+ # Setup steps:
20
+ # 1. Run once to see form structure (discovery mode)
21
+ # 2. Update refs in LOGIN FLOW section below
22
+ # 3. Set APP_USERNAME and APP_PASSWORD
23
+ # 4. Delete the DISCOVERY section
24
+
25
+ set -euo pipefail
26
+
27
+ LOGIN_URL="${1:?Usage: $0 <login-url> [state-file]}"
28
+ STATE_FILE="${2:-./auth-state.json}"
29
+
30
+ echo "Authentication workflow: $LOGIN_URL"
31
+
32
+ # ================================================================
33
+ # SAVED STATE: Skip login if valid saved state exists
34
+ # ================================================================
35
+ if [[ -f "$STATE_FILE" ]]; then
36
+ echo "Loading saved state from $STATE_FILE..."
37
+ if agent-browser --state "$STATE_FILE" open "$LOGIN_URL" 2>/dev/null; then
38
+ agent-browser wait --load load
39
+
40
+ CURRENT_URL=$(agent-browser get url)
41
+ if [[ "$CURRENT_URL" != *"login"* ]] && [[ "$CURRENT_URL" != *"signin"* ]]; then
42
+ echo "Session restored successfully"
43
+ agent-browser snapshot -i
44
+ exit 0
45
+ fi
46
+ echo "Session expired, performing fresh login..."
47
+ agent-browser close 2>/dev/null || true
48
+ else
49
+ echo "Failed to load state, re-authenticating..."
50
+ fi
51
+ rm -f "$STATE_FILE"
52
+ fi
53
+
54
+ # ================================================================
55
+ # DISCOVERY MODE: Shows form structure (delete after setup)
56
+ # ================================================================
57
+ echo "Opening login page..."
58
+ agent-browser open "$LOGIN_URL"
59
+ agent-browser wait --load domcontentloaded
60
+ agent-browser wait --fn "(() => { const usable = (el) => { const style = getComputedStyle(el); return !el.disabled && !el.readOnly && style.display !== 'none' && style.visibility !== 'hidden' && el.getClientRects().length > 0; }; const username = Array.from(document.querySelectorAll('input[type=email], input[type=text], input[autocomplete=username], input[name*=email i], input[name*=user i], input[name*=login i]')).some(usable); const password = Array.from(document.querySelectorAll('input[type=password]')).some(usable); return username && password; })()"
61
+
62
+ echo ""
63
+ echo "Login form structure:"
64
+ echo "---"
65
+ agent-browser snapshot -i
66
+ echo "---"
67
+ echo ""
68
+ echo "Next steps:"
69
+ echo " 1. Note the refs: username=@e?, password=@e?, submit=@e?"
70
+ echo " 2. Update the LOGIN FLOW section below with your refs"
71
+ echo " 3. Set: export APP_USERNAME='...' APP_PASSWORD='...'"
72
+ echo " 4. Delete this DISCOVERY MODE section"
73
+ echo ""
74
+ agent-browser close
75
+ exit 0
76
+
77
+ # ================================================================
78
+ # LOGIN FLOW: Uncomment and customize after discovery
79
+ # ================================================================
80
+ # : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
81
+ # : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
82
+ #
83
+ # agent-browser open "$LOGIN_URL"
84
+ # agent-browser wait --load domcontentloaded
85
+ # agent-browser wait --fn "(() => { const usable = (el) => { const style = getComputedStyle(el); return !el.disabled && !el.readOnly && style.display !== 'none' && style.visibility !== 'hidden' && el.getClientRects().length > 0; }; const username = Array.from(document.querySelectorAll('input[type=email], input[type=text], input[autocomplete=username], input[name*=email i], input[name*=user i], input[name*=login i]')).some(usable); const password = Array.from(document.querySelectorAll('input[type=password]')).some(usable); return username && password; })()"
86
+ # agent-browser snapshot -i
87
+ #
88
+ # # Fill credentials (update refs to match your form)
89
+ # agent-browser fill @e1 "$APP_USERNAME"
90
+ # agent-browser fill @e2 "$APP_PASSWORD"
91
+ # agent-browser click @e3
92
+ # Replace this with the app-specific post-login wait, for example:
93
+ # agent-browser wait --url "**/dashboard"
94
+ # agent-browser wait --text "Welcome"
95
+ #
96
+ # # Verify login succeeded
97
+ # FINAL_URL=$(agent-browser get url)
98
+ # if [[ "$FINAL_URL" == *"login"* ]] || [[ "$FINAL_URL" == *"signin"* ]]; then
99
+ # echo "Login failed - still on login page"
100
+ # agent-browser screenshot /tmp/login-failed.png
101
+ # agent-browser close
102
+ # exit 1
103
+ # fi
104
+ #
105
+ # # Save state for future runs
106
+ # echo "Saving state to $STATE_FILE"
107
+ # agent-browser state save "$STATE_FILE"
108
+ # echo "Login successful"
109
+ # agent-browser snapshot -i
@@ -0,0 +1,69 @@
1
+ #!/bin/bash
2
+ # Template: Content Capture Workflow
3
+ # Purpose: Extract content from web pages (text, screenshots, PDF)
4
+ # Usage: ./capture-workflow.sh <url> [output-dir]
5
+ #
6
+ # Outputs:
7
+ # - page-full.png: Full page screenshot
8
+ # - page-structure.txt: Page element structure with refs
9
+ # - page-text.txt: All text content
10
+ # - page.pdf: PDF version
11
+ #
12
+ # Optional: Load auth state for protected pages
13
+
14
+ set -euo pipefail
15
+
16
+ TARGET_URL="${1:?Usage: $0 <url> [output-dir]}"
17
+ OUTPUT_DIR="${2:-.}"
18
+
19
+ echo "Capturing: $TARGET_URL"
20
+ mkdir -p "$OUTPUT_DIR"
21
+
22
+ # Optional: Load authentication state
23
+ # if [[ -f "./auth-state.json" ]]; then
24
+ # echo "Loading authentication state..."
25
+ # agent-browser state load "./auth-state.json"
26
+ # fi
27
+
28
+ # Navigate to target
29
+ agent-browser open "$TARGET_URL"
30
+ agent-browser wait --load load
31
+
32
+ # Get metadata
33
+ TITLE=$(agent-browser get title)
34
+ URL=$(agent-browser get url)
35
+ echo "Title: $TITLE"
36
+ echo "URL: $URL"
37
+
38
+ # Capture full page screenshot
39
+ agent-browser screenshot --full "$OUTPUT_DIR/page-full.png"
40
+ echo "Saved: $OUTPUT_DIR/page-full.png"
41
+
42
+ # Get page structure with refs
43
+ agent-browser snapshot -i > "$OUTPUT_DIR/page-structure.txt"
44
+ echo "Saved: $OUTPUT_DIR/page-structure.txt"
45
+
46
+ # Extract all text content
47
+ agent-browser get text body > "$OUTPUT_DIR/page-text.txt"
48
+ echo "Saved: $OUTPUT_DIR/page-text.txt"
49
+
50
+ # Save as PDF
51
+ agent-browser pdf "$OUTPUT_DIR/page.pdf"
52
+ echo "Saved: $OUTPUT_DIR/page.pdf"
53
+
54
+ # Optional: Extract specific elements using refs from structure
55
+ # agent-browser get text @e5 > "$OUTPUT_DIR/main-content.txt"
56
+
57
+ # Optional: Handle infinite scroll pages
58
+ # for i in {1..5}; do
59
+ # agent-browser scroll down 1000
60
+ # agent-browser wait 1000
61
+ # done
62
+ # agent-browser screenshot --full "$OUTPUT_DIR/page-scrolled.png"
63
+
64
+ # Cleanup
65
+ agent-browser close
66
+
67
+ echo ""
68
+ echo "Capture complete:"
69
+ ls -la "$OUTPUT_DIR"
@@ -0,0 +1,63 @@
1
+ #!/bin/bash
2
+ # Template: Form Automation Workflow
3
+ # Purpose: Fill and submit web forms with validation
4
+ # Usage: ./form-automation.sh <form-url>
5
+ #
6
+ # This template demonstrates the snapshot-interact-verify pattern:
7
+ # 1. Navigate to form
8
+ # 2. Snapshot to get element refs
9
+ # 3. Fill fields using refs
10
+ # 4. Submit and verify result
11
+ #
12
+ # Customize: Update the refs (@e1, @e2, etc.) based on your form's snapshot output
13
+
14
+ set -euo pipefail
15
+
16
+ FORM_URL="${1:?Usage: $0 <form-url>}"
17
+
18
+ echo "Form automation: $FORM_URL"
19
+
20
+ # Step 1: Navigate to form
21
+ agent-browser open "$FORM_URL"
22
+ agent-browser wait --load domcontentloaded
23
+ agent-browser wait --fn "Array.from(document.querySelectorAll('input:not([type=hidden]), textarea, select')).some((el) => { const style = getComputedStyle(el); return !el.disabled && !el.readOnly && style.display !== 'none' && style.visibility !== 'hidden' && el.getClientRects().length > 0; })"
24
+
25
+ # Step 2: Snapshot to discover form elements
26
+ echo ""
27
+ echo "Form structure:"
28
+ agent-browser snapshot -i
29
+
30
+ # Step 3: Fill form fields (customize these refs based on snapshot output)
31
+ #
32
+ # Common field types:
33
+ # agent-browser fill @e1 "John Doe" # Text input
34
+ # agent-browser fill @e2 "user@example.com" # Email input
35
+ # agent-browser fill @e3 "SecureP@ss123" # Password input
36
+ # agent-browser select @e4 "Option Value" # Dropdown
37
+ # agent-browser check @e5 # Checkbox
38
+ # agent-browser click @e6 # Radio button
39
+ # agent-browser fill @e7 "Multi-line text" # Textarea
40
+ # agent-browser upload @e8 /path/to/file.pdf # File upload
41
+ #
42
+ # Uncomment and modify:
43
+ # agent-browser fill @e1 "Test User"
44
+ # agent-browser fill @e2 "test@example.com"
45
+ # agent-browser click @e3 # Submit button
46
+
47
+ # Step 4: Wait for submission
48
+ # agent-browser wait --url "**/success" # Or wait for redirect
49
+ # agent-browser wait --text "Success" # Or wait for confirmation text
50
+
51
+ # Step 5: Verify result
52
+ echo ""
53
+ echo "Result:"
54
+ agent-browser get url
55
+ agent-browser snapshot -i
56
+
57
+ # Optional: Capture evidence
58
+ agent-browser screenshot /tmp/form-result.png
59
+ echo "Screenshot saved: /tmp/form-result.png"
60
+
61
+ # Cleanup
62
+ agent-browser close
63
+ echo "Done"
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: derive-client
3
+ description: Reverse-engineer a website's internal API by recording browser traffic into a HAR file, then generate a standalone client or CLI that calls the endpoints directly, with no browser needed after the first recording. Use when asked to "derive a client", "build a CLI for <site>", "reverse engineer this site's API", "record network requests", "turn this site into an API", or when the same site will be automated repeatedly and direct HTTP calls would beat driving the browser every time.
4
+ allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)
5
+ ---
6
+
7
+ # Derive an API client from a recorded session
8
+
9
+ Driving a browser is the right tool for the first visit and the wrong tool for the hundredth. This skill records a site's network traffic once while you use it, then turns the captured requests into a standalone client (script, CLI, or library) that talks to the site's internal API directly.
10
+
11
+ The recording alone contains everything needed: agent-browser embeds text response bodies (JSON/HTML/JS) in the HAR by default, so endpoint shapes can be studied offline after the browser is closed.
12
+
13
+ For a task the agent itself will repeat, `agent-browser flow start` and `flow save` do steps 1 to 4 in the core and `flow run` replays it without a browser. Use this skill when you need a standalone client outside agent-browser.
14
+
15
+ ## Workflow
16
+
17
+ ```
18
+ 1. Record Start HAR capture, drive the flows you want in the client
19
+ 2. Identify Find the real API endpoints among the noise
20
+ 3. Extract Pull request shapes, response schemas, and auth material
21
+ 4. Generate Write the client, one function per flow
22
+ 5. Verify Call every endpoint for real before declaring done
23
+ ```
24
+
25
+ ## 1. Record
26
+
27
+ ```bash
28
+ agent-browser network har start # embeds text response bodies by default
29
+ # ... drive the site: search, open a detail page, paginate, etc. ...
30
+ agent-browser network har stop /tmp/site.har
31
+ ```
32
+
33
+ - Exercise **every flow the client should support**, and run each one at least twice with different inputs (two search terms, two detail pages). Diffing the recorded URLs reveals which parts are parameters.
34
+ - If the site needs login, log in **before** starting the HAR so credentials don't land in the recording unnecessarily. The session cookies are exported separately in step 3.
35
+ - `--content all` embeds binary bodies too (base64); `--content none` disables embedding. Per-body cap is 2 MB.
36
+
37
+ While the session is still open, `agent-browser network requests` and `network request <id>` give the same data interactively — but only the HAR survives navigation and browser close, so prefer it for anything multi-page.
38
+
39
+ ## 2. Identify endpoints
40
+
41
+ Query the HAR with `jq`:
42
+
43
+ ```bash
44
+ # All JSON API calls: method, URL, status
45
+ jq -r '.log.entries[]
46
+ | select(.response.content.mimeType | test("json"))
47
+ | "\(.request.method) \(.response.status) \(.request.url)"' /tmp/site.har
48
+ ```
49
+
50
+ Ignore analytics and infrastructure noise: telemetry endpoints (`/collect`, `/track`, `/beacon`, `/log`), third-party domains (google-analytics, segment, sentry, datadog, intercom, hotjar), and static assets. The real API is usually first-party, JSON, and correlates with the actions you performed.
51
+
52
+ ## 3. Extract shapes and auth
53
+
54
+ ```bash
55
+ # Full detail for one endpoint: request headers, POST body, response body
56
+ jq '.log.entries[] | select(.request.url | test("api/search"))
57
+ | {request: {method: .request.method, headers: .request.headers,
58
+ postData: .request.postData.text},
59
+ response: .response.content.text}' /tmp/site.har
60
+ ```
61
+
62
+ - **Response schema**: read `.response.content.text` — this is the real payload, use it to derive types.
63
+ - **Auth**: compare request headers across endpoints. Look for `authorization`, `cookie`, `x-csrf-token`, `x-api-key`, and site-specific `x-*` headers. Replay only the ones that matter — test by omission in step 5.
64
+ - **Cookies**: export the live session with `agent-browser cookies get --json > cookies.json` for the client to load at runtime. Never hardcode cookie values into generated source.
65
+
66
+ ## 4. Generate the client
67
+
68
+ - One function per recorded flow (`search(query)`, `getItem(id)`), typed from the observed response bodies.
69
+ - Auth material (cookies, bearer tokens) loads from a file or environment variable, with a clear error telling the user to re-run the browser login when it expires.
70
+ - Reproduce the headers the API actually requires — some sites 403 without a matching `user-agent`, `referer`, or `x-requested-with`.
71
+ - Keep pagination, sort, and filter parameters that appeared in the recorded query strings as function options.
72
+
73
+ ## 5. Verify
74
+
75
+ Call every generated function against the live API and compare the response shape with the recording. Common failures:
76
+
77
+ | Symptom | Cause | Fix |
78
+ |---------|-------|-----|
79
+ | 401/403 | Expired or missing session | Re-login via agent-browser, re-export cookies |
80
+ | 403/419 on writes | CSRF token is per-session or per-form | Fetch the token endpoint first, or keep that flow browser-driven |
81
+ | Works then breaks | Signed/expiring request params | Fall back to the browser for that step; derive the rest |
82
+ | Different shape than HAR | A/B tests or geo-dependent responses | Re-record and treat the union as optional fields |
83
+
84
+ ## Caveats
85
+
86
+ - Internal APIs are unversioned and change without notice — keep the HAR so the client can be re-derived.
87
+ - Respect the site's terms of service and rate limits; add delays for bulk fetching.
88
+ - HAR files contain live session credentials (cookies, tokens, POST bodies). Treat them like secrets: keep them out of version control and delete them when done.
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: dogfood
3
+ description: Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to "dogfood", "QA", "exploratory test", "find issues", "bug hunt", "test this app/site/platform", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.
4
+ allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)
5
+ ---
6
+
7
+ # Dogfood
8
+
9
+ Systematically explore a web application, find issues, and produce a report with full reproduction evidence for every finding.
10
+
11
+ ## Setup
12
+
13
+ Only the **Target URL** is required. Everything else has sensible defaults -- use them unless the user explicitly provides an override.
14
+
15
+ | Parameter | Default | Example override |
16
+ |-----------|---------|-----------------|
17
+ | **Target URL** | _(required)_ | `vercel.com`, `http://localhost:3000` |
18
+ | **Session name** | Slugified domain (e.g., `vercel.com` -> `vercel-com`) | `--session my-session` |
19
+ | **Output directory** | `./dogfood-output/` | `Output directory: /tmp/qa` |
20
+ | **Scope** | Full app | `Focus on the billing page` |
21
+ | **Authentication** | None | `Sign in to user@example.com` |
22
+
23
+ If the user says something like "dogfood vercel.com", start immediately with defaults. Do not ask clarifying questions unless authentication is mentioned but credentials are missing.
24
+
25
+ Always use `agent-browser` directly -- never `npx agent-browser`. The direct binary uses the fast Rust client. `npx` routes through Node.js and is significantly slower.
26
+
27
+ ## Workflow
28
+
29
+ ```
30
+ 1. Initialize Set up session, output dirs, report file
31
+ 2. Authenticate Sign in if needed, save state
32
+ 3. Orient Navigate to starting point, take initial snapshot
33
+ 4. Explore Systematically visit pages and test features
34
+ 5. Document Screenshot + record each issue as found
35
+ 6. Wrap up Update summary counts, close session
36
+ ```
37
+
38
+ ### 1. Initialize
39
+
40
+ ```bash
41
+ mkdir -p {OUTPUT_DIR}/screenshots {OUTPUT_DIR}/videos
42
+ ```
43
+
44
+ Copy the report template into the output directory and fill in the header fields:
45
+
46
+ ```bash
47
+ cp {SKILL_DIR}/templates/dogfood-report-template.md {OUTPUT_DIR}/report.md
48
+ ```
49
+
50
+ Start a named session:
51
+
52
+ ```bash
53
+ agent-browser --session {SESSION} open {TARGET_URL}
54
+ agent-browser --session {SESSION} wait --load domcontentloaded
55
+ ```
56
+
57
+ ### 2. Authenticate
58
+
59
+ If the app requires login:
60
+
61
+ ```bash
62
+ agent-browser --session {SESSION} snapshot -i
63
+ # Identify login form refs, fill credentials
64
+ agent-browser --session {SESSION} fill @e1 "{EMAIL}"
65
+ agent-browser --session {SESSION} fill @e2 "{PASSWORD}"
66
+ agent-browser --session {SESSION} click @e3
67
+ # Replace this with the target app's post-login URL, text, or JS condition:
68
+ agent-browser --session {SESSION} wait --url "{POST_LOGIN_URL_PATTERN}"
69
+ # Or:
70
+ # agent-browser --session {SESSION} wait --text "{POST_LOGIN_TEXT}"
71
+ # agent-browser --session {SESSION} wait --fn "{POST_LOGIN_CONDITION}"
72
+ ```
73
+
74
+ For OTP/email codes: ask the user, wait for their response, then enter the code.
75
+
76
+ After successful login, save state for potential reuse:
77
+
78
+ ```bash
79
+ agent-browser --session {SESSION} state save {OUTPUT_DIR}/auth-state.json
80
+ ```
81
+
82
+ ### 3. Orient
83
+
84
+ Take an initial annotated screenshot and snapshot to understand the app structure:
85
+
86
+ ```bash
87
+ agent-browser --session {SESSION} screenshot --annotate {OUTPUT_DIR}/screenshots/initial.png
88
+ agent-browser --session {SESSION} snapshot -i
89
+ ```
90
+
91
+ Identify the main navigation elements and map out the sections to visit.
92
+
93
+ ### 4. Explore
94
+
95
+ Read [references/issue-taxonomy.md](references/issue-taxonomy.md) for the full list of what to look for and the exploration checklist.
96
+
97
+ **Strategy -- work through the app systematically:**
98
+
99
+ - Start from the main navigation. Visit each top-level section.
100
+ - Within each section, test interactive elements: click buttons, fill forms, open dropdowns/modals.
101
+ - Check edge cases: empty states, error handling, boundary inputs.
102
+ - Try realistic end-to-end workflows (create, edit, delete flows).
103
+ - Check the browser console for errors periodically.
104
+
105
+ **At each page:**
106
+
107
+ ```bash
108
+ agent-browser --session {SESSION} snapshot -i
109
+ agent-browser --session {SESSION} screenshot --annotate {OUTPUT_DIR}/screenshots/{page-name}.png
110
+ agent-browser --session {SESSION} errors
111
+ agent-browser --session {SESSION} console
112
+ ```
113
+
114
+ Use your judgment on how deep to go. Spend more time on core features and less on peripheral pages. If you find a cluster of issues in one area, investigate deeper.
115
+
116
+ ### 5. Document Issues (Repro-First)
117
+
118
+ Steps 4 and 5 happen together -- explore and document in a single pass. When you find an issue, stop exploring and document it immediately before moving on. Do not explore the whole app first and document later.
119
+
120
+ Every issue must be reproducible. When you find something wrong, do not just note it -- prove it with evidence. The goal is that someone reading the report can see exactly what happened and replay it.
121
+
122
+ **Choose the right level of evidence for the issue:**
123
+
124
+ #### Interactive / behavioral issues (functional, ux, console errors on action)
125
+
126
+ These require user interaction to reproduce -- use full repro with video and step-by-step screenshots:
127
+
128
+ 1. **Start a repro video** _before_ reproducing:
129
+
130
+ ```bash
131
+ agent-browser --session {SESSION} record start {OUTPUT_DIR}/videos/issue-{NNN}-repro.webm
132
+ ```
133
+
134
+ 2. **Walk through the steps at human pace.** Pause 1-2 seconds between actions so the video is watchable. Take a screenshot at each step:
135
+
136
+ ```bash
137
+ agent-browser --session {SESSION} screenshot {OUTPUT_DIR}/screenshots/issue-{NNN}-step-1.png
138
+ sleep 1
139
+ # Perform action (click, fill, etc.)
140
+ sleep 1
141
+ agent-browser --session {SESSION} screenshot {OUTPUT_DIR}/screenshots/issue-{NNN}-step-2.png
142
+ sleep 1
143
+ # ...continue until the issue manifests
144
+ ```
145
+
146
+ 3. **Capture the broken state.** Pause so the viewer can see it, then take an annotated screenshot:
147
+
148
+ ```bash
149
+ sleep 2
150
+ agent-browser --session {SESSION} screenshot --annotate {OUTPUT_DIR}/screenshots/issue-{NNN}-result.png
151
+ ```
152
+
153
+ 4. **Stop the video:**
154
+
155
+ ```bash
156
+ agent-browser --session {SESSION} record stop
157
+ ```
158
+
159
+ 5. Write numbered repro steps in the report, each referencing its screenshot.
160
+
161
+ #### Static / visible-on-load issues (typos, placeholder text, clipped text, misalignment, console errors on load)
162
+
163
+ These are visible without interaction -- a single annotated screenshot is sufficient. No video, no multi-step repro:
164
+
165
+ ```bash
166
+ agent-browser --session {SESSION} screenshot --annotate {OUTPUT_DIR}/screenshots/issue-{NNN}.png
167
+ ```
168
+
169
+ Write a brief description and reference the screenshot in the report. Set **Repro Video** to `N/A`.
170
+
171
+ ---
172
+
173
+ **For all issues:**
174
+
175
+ 1. **Append to the report immediately.** Do not batch issues for later. Write each one as you find it so nothing is lost if the session is interrupted.
176
+
177
+ 2. **Increment the issue counter** (ISSUE-001, ISSUE-002, ...).
178
+
179
+ ### 6. Wrap Up
180
+
181
+ Aim to find **5-10 well-documented issues**, then wrap up. Depth of evidence matters more than total count -- 5 issues with full repro beats 20 with vague descriptions.
182
+
183
+ After exploring:
184
+
185
+ 1. Re-read the report and update the summary severity counts so they match the actual issues. Every `### ISSUE-` block must be reflected in the totals.
186
+ 2. Close the session:
187
+
188
+ ```bash
189
+ agent-browser --session {SESSION} close
190
+ ```
191
+
192
+ 3. Tell the user the report is ready and summarize findings: total issues, breakdown by severity, and the most critical items.
193
+
194
+ ## Guidance
195
+
196
+ - **Repro is everything.** Every issue needs proof -- but match the evidence to the issue. Interactive bugs need video and step-by-step screenshots. Static bugs (typos, placeholder text, visual glitches visible on load) only need a single annotated screenshot.
197
+ - **Verify reproducibility before collecting evidence.** Before recording video or taking screenshots, verify the issue is reproducible with at least one retry. If it can't be reproduced consistently, it's not a valid issue.
198
+ - **Don't record video for static issues.** A typo or clipped text doesn't benefit from a video. Save video for issues that involve user interaction, timing, or state changes.
199
+ - **For interactive issues, screenshot each step.** Capture the before, the action, and the after -- so someone can see the full sequence.
200
+ - **Write repro steps that map to screenshots.** Each numbered step in the report should reference its corresponding screenshot. A reader should be able to follow the steps visually without touching a browser.
201
+ - **Use the right snapshot command.**
202
+ - `snapshot -i` — for finding clickable/fillable elements (buttons, inputs, links)
203
+ - `snapshot` (no flag) — for reading page content (text, headings, data lists)
204
+ - **Be thorough but use judgment.** You are not following a test script -- you are exploring like a real user would. If something feels off, investigate.
205
+ - **Write findings incrementally.** Append each issue to the report as you discover it. If the session is interrupted, findings are preserved. Never batch all issues for the end.
206
+ - **Never delete output files.** Do not `rm` screenshots, videos, or the report mid-session. Do not close the session and restart. Work forward, not backward.
207
+ - **Never read the target app's source code.** You are testing as a user, not auditing code. Do not read HTML, JS, or config files of the app under test. All findings must come from what you observe in the browser.
208
+ - **Check the console.** Many issues are invisible in the UI but show up as JS errors or failed requests.
209
+ - **Test like a user, not a robot.** Try common workflows end-to-end. Click things a real user would click. Enter realistic data.
210
+ - **Type like a human.** When filling form fields during video recording, use `type` instead of `fill` -- it types character-by-character. Use `fill` only outside of video recording when speed matters.
211
+ - **Pace repro videos for humans.** Add `sleep 1` between actions and `sleep 2` before the final result screenshot. Videos should be watchable at 1x speed -- a human reviewing the report needs to see what happened, not a blur of instant state changes.
212
+ - **Be efficient with commands.** Batch multiple `agent-browser` commands in a single shell call when they are independent (e.g., `agent-browser ... screenshot ... && agent-browser ... console`). Use `agent-browser --session {SESSION} scroll down 300` for scrolling -- do not use `key` or `evaluate` to scroll.
213
+
214
+ ## References
215
+
216
+ | Reference | When to Read |
217
+ |-----------|--------------|
218
+ | [references/issue-taxonomy.md](references/issue-taxonomy.md) | Start of session -- calibrate what to look for, severity levels, exploration checklist |
219
+
220
+ ## Templates
221
+
222
+ | Template | Purpose |
223
+ |----------|---------|
224
+ | [templates/dogfood-report-template.md](templates/dogfood-report-template.md) | Copy into output directory as the report file |