Before this change, the main skill served by the CLI (`agent-browser
skills get agent-browser`) was a ~40-line discovery stub whose content
was essentially "run `agent-browser skills get <name>` before doing
anything." Agents already inside the CLI got no signal from it — the
content they needed to actually use the tool lived only in the `--full`
references.
Split the two jobs apart:
- **`skill-data/core/`** (new) — the runtime usage guide. 420-line
`SKILL.md` covering the snapshot-and-ref loop, common workflows
(login, extract, screenshot, multi-tab, sessions, iframes, dialogs),
waiting strategies, element selection strategies, troubleshooting,
and when to load a specialized skill. Supplementary `references/` and
`templates/` (moved from `skills/agent-browser/`) provide the full
command reference under `--full`.
- **`skills/agent-browser/SKILL.md`** — still the discovery stub that
`npx skills add` installs, now marked `hidden: true` so it stays out
of `skills list` inside the CLI. Body is a clean pointer to
`agent-browser skills get core` and the specialized skills.
The `hidden: true` frontmatter flag is a new, general mechanism: skills
marked hidden are omitted from `skills list` and `skills get --all` but
can still be fetched by explicit name. This keeps the stub reachable
for anyone who installed via `npx skills add` without polluting the
CLI-side skill listing.
## Behavior
```
$ agent-browser skills list
agentcore Run agent-browser on AWS Bedrock AgentCore cloud browsers...
core Core agent-browser usage guide. Read this before running...
dogfood Systematically explore and test a web application...
electron Automate Electron desktop apps (VS Code, Slack, Discord...)
slack Interact with Slack workspaces using browser automation...
vercel-sandbox Run agent-browser + Chrome inside Vercel Sandbox microVMs...
$ agent-browser skills get core # the actual usage guide
# ~420 lines of workflows, patterns, troubleshooting
$ agent-browser skills get agent-browser # still works if called explicitly
# the thin stub, now pointing at `core`
```
External `npx skills add vercel-labs/agent-browser` behavior is
unchanged: it finds and installs the thin `agent-browser` stub, which
tells the agent to run `agent-browser skills get core` for real
content. Version drift protection is preserved — the stub is the only
thing that gets copied; the real content is always runtime-fetched.
## Updated
- `cli/src/skills.rs` — `SkillInfo.hidden: bool`, parsed from
frontmatter; `run_list` and `run_get --all` filter it. 3 new unit
tests for the frontmatter parser.
- `cli/src/output.rs` — top-level `--help` and `skills` subcommand help
reference `skills get core` / `skills get core --full`.
- `AGENTS.md` — "update these files for user-facing features" now
points at `skill-data/core/` instead of the stub, with a note that
the stub is not the right place for feature content.
- `README.md`, `docs/src/app/skills/page.mdx` — describe the new
split and `skills get core --full` as the recommended entry point.
- `evals/cases/{command-usage,skill-selection}.ts` — expect
`skills get core` in agent output instead of `skills get
agent-browser`. Eval lib still reads `skills/agent-browser/SKILL.md`
(simulating what an agent sees after `npx skills add`).
All 11 skills unit tests pass. `cargo clippy -- -D warnings` and
`cargo fmt --check` clean. Verified end-to-end: `skills list` shows
`core` + specialized (no stub), `skills get core` returns the new
content, `skills get agent-browser` still returns the stub on explicit
request.
106 lines
3.6 KiB
Bash
Executable File
106 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Template: Authenticated Session Workflow
|
|
# Purpose: Login once, save state, reuse for subsequent runs
|
|
# Usage: ./authenticated-session.sh <login-url> [state-file]
|
|
#
|
|
# RECOMMENDED: Use the auth vault instead of this template:
|
|
# echo "<pass>" | agent-browser auth save myapp --url <login-url> --username <user> --password-stdin
|
|
# agent-browser auth login myapp
|
|
# The auth vault stores credentials securely and the LLM never sees passwords.
|
|
#
|
|
# Environment variables:
|
|
# APP_USERNAME - Login username/email
|
|
# APP_PASSWORD - Login password
|
|
#
|
|
# Two modes:
|
|
# 1. Discovery mode (default): Shows form structure so you can identify refs
|
|
# 2. Login mode: Performs actual login after you update the refs
|
|
#
|
|
# Setup steps:
|
|
# 1. Run once to see form structure (discovery mode)
|
|
# 2. Update refs in LOGIN FLOW section below
|
|
# 3. Set APP_USERNAME and APP_PASSWORD
|
|
# 4. Delete the DISCOVERY section
|
|
|
|
set -euo pipefail
|
|
|
|
LOGIN_URL="${1:?Usage: $0 <login-url> [state-file]}"
|
|
STATE_FILE="${2:-./auth-state.json}"
|
|
|
|
echo "Authentication workflow: $LOGIN_URL"
|
|
|
|
# ================================================================
|
|
# SAVED STATE: Skip login if valid saved state exists
|
|
# ================================================================
|
|
if [[ -f "$STATE_FILE" ]]; then
|
|
echo "Loading saved state from $STATE_FILE..."
|
|
if agent-browser --state "$STATE_FILE" open "$LOGIN_URL" 2>/dev/null; then
|
|
agent-browser wait --load networkidle
|
|
|
|
CURRENT_URL=$(agent-browser get url)
|
|
if [[ "$CURRENT_URL" != *"login"* ]] && [[ "$CURRENT_URL" != *"signin"* ]]; then
|
|
echo "Session restored successfully"
|
|
agent-browser snapshot -i
|
|
exit 0
|
|
fi
|
|
echo "Session expired, performing fresh login..."
|
|
agent-browser close 2>/dev/null || true
|
|
else
|
|
echo "Failed to load state, re-authenticating..."
|
|
fi
|
|
rm -f "$STATE_FILE"
|
|
fi
|
|
|
|
# ================================================================
|
|
# DISCOVERY MODE: Shows form structure (delete after setup)
|
|
# ================================================================
|
|
echo "Opening login page..."
|
|
agent-browser open "$LOGIN_URL"
|
|
agent-browser wait --load networkidle
|
|
|
|
echo ""
|
|
echo "Login form structure:"
|
|
echo "---"
|
|
agent-browser snapshot -i
|
|
echo "---"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Note the refs: username=@e?, password=@e?, submit=@e?"
|
|
echo " 2. Update the LOGIN FLOW section below with your refs"
|
|
echo " 3. Set: export APP_USERNAME='...' APP_PASSWORD='...'"
|
|
echo " 4. Delete this DISCOVERY MODE section"
|
|
echo ""
|
|
agent-browser close
|
|
exit 0
|
|
|
|
# ================================================================
|
|
# LOGIN FLOW: Uncomment and customize after discovery
|
|
# ================================================================
|
|
# : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
|
|
# : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
|
|
#
|
|
# agent-browser open "$LOGIN_URL"
|
|
# agent-browser wait --load networkidle
|
|
# agent-browser snapshot -i
|
|
#
|
|
# # Fill credentials (update refs to match your form)
|
|
# agent-browser fill @e1 "$APP_USERNAME"
|
|
# agent-browser fill @e2 "$APP_PASSWORD"
|
|
# agent-browser click @e3
|
|
# agent-browser wait --load networkidle
|
|
#
|
|
# # Verify login succeeded
|
|
# FINAL_URL=$(agent-browser get url)
|
|
# if [[ "$FINAL_URL" == *"login"* ]] || [[ "$FINAL_URL" == *"signin"* ]]; then
|
|
# echo "Login failed - still on login page"
|
|
# agent-browser screenshot /tmp/login-failed.png
|
|
# agent-browser close
|
|
# exit 1
|
|
# fi
|
|
#
|
|
# # Save state for future runs
|
|
# echo "Saving state to $STATE_FILE"
|
|
# agent-browser state save "$STATE_FILE"
|
|
# echo "Login successful"
|
|
# agent-browser snapshot -i
|