-
Notifications
You must be signed in to change notification settings - Fork 227
autobrowse: autonomous email inbox for signup/login/MFA tasks #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| ANTHROPIC_API_KEY=sk-ant-... | ||
| BROWSERBASE_API_KEY=bb_live_... | ||
| BROWSERBASE_PROJECT_ID=your-project-id | ||
|
|
||
| # Throwaway inbox provisioning (only needed for signup/login/MFA tasks). | ||
| # Points scripts/inbox.mjs at the browse.sh inbox endpoint, which owns the | ||
| # AgentMail key — you never handle an AgentMail credential directly. | ||
| BROWSE_SH_URL=https://browse.sh | ||
| BROWSE_SH_WEBHOOK_SECRET= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ tasks/ | |
| traces/ | ||
| *.log | ||
| .DS_Store | ||
| .inbox.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ const TOOLS = [ | |
| " browse get url/title/text — Get page info\n" + | ||
| " browse mouse drag <x1> <y1> <x2> <y2> — Drag (for sliders)\n" + | ||
| " browse back/reload/stop — Navigation/session control\n\n" + | ||
| "If a throwaway inbox was provisioned for this task (see the Agent Inbox section, when present), you may also run `node <path>/scripts/inbox.mjs wait-otp|latest ...` through this tool to read verification emails.\n\n" + | ||
| "Critical: Always `browse snapshot` after every action — refs invalidate on DOM changes.", | ||
| input_schema: { | ||
| type: "object", | ||
|
|
@@ -81,6 +82,8 @@ Options: | |
| --env local|remote Browser environment (default: local) | ||
| --model <model> Claude model for the inner agent (default: ${DEFAULT_MODEL}) | ||
| --run-number N Force a specific run number (default: auto-increment) | ||
| --inbox-email <addr> Throwaway inbox address for signup/login/MFA tasks | ||
| (provision it first via scripts/inbox.mjs create) | ||
| --help Show this help message | ||
|
|
||
| Environment variables: | ||
|
|
@@ -159,6 +162,17 @@ function getNextRunNumber(tracesDir) { | |
| } | ||
|
|
||
| const ALLOWED_COMMAND = "browse"; | ||
| // Absolute path to the throwaway-inbox helper. The agent may shell out to it | ||
| // (e.g. `node <abs>/scripts/inbox.mjs wait-otp ...`) when a task involves | ||
| // signup/login/MFA and an inbox was provisioned for the run. | ||
| const INBOX_SCRIPT = path.join(SKILL_DIR, "scripts", "inbox.mjs"); | ||
|
|
||
| function isAllowedCommand(executable, args) { | ||
| if (executable === ALLOWED_COMMAND) return true; | ||
| // node <abs-path-to-inbox.mjs> ... | ||
| if (executable === "node" && args[0] && path.resolve(args[0]) === INBOX_SCRIPT) return true; | ||
| return false; | ||
| } | ||
|
|
||
| function parseCommand(command) { | ||
| const args = []; | ||
|
|
@@ -250,8 +264,8 @@ function executeCommand(command) { | |
| } | ||
|
|
||
| const [executable, ...args] = parsed.args; | ||
| if (executable !== ALLOWED_COMMAND) { | ||
| return { output: `BLOCKED: only browse commands are allowed. Got: ${command.slice(0, 50)}`, error: true, duration_ms: 0 }; | ||
| if (!isAllowedCommand(executable, args)) { | ||
| return { output: `BLOCKED: only browse and inbox.mjs commands are allowed. Got: ${command.slice(0, 50)}`, error: true, duration_ms: 0 }; | ||
| } | ||
|
|
||
| const start = Date.now(); | ||
|
|
@@ -271,7 +285,34 @@ function executeCommand(command) { | |
| } | ||
| } | ||
|
|
||
| function buildSystemPrompt(strategy, traceDir, browseEnv) { | ||
| function buildInboxSection(inboxEmail, workspace, taskName) { | ||
| if (!inboxEmail) return ""; | ||
| return ` | ||
| # Agent Inbox | ||
|
|
||
| You have been provisioned a throwaway email inbox for this task: | ||
|
|
||
| ${inboxEmail} | ||
|
|
||
| Use this address for any signup, login, or MFA / email-verification step — type it into email fields exactly as shown. To read mail that arrives (verification links, one-time codes), shell out via the execute tool: | ||
|
|
||
| - Wait for an OTP / verification code: | ||
| \`node ${INBOX_SCRIPT} wait-otp --workspace ${workspace} --task ${taskName} --from <sender-domain> --within 60\` | ||
| Prints just the extracted code on stdout (or fails after the timeout). Use the sending domain you expect, e.g. \`--from stripe.com\`. Default matches a 4–8 digit code; pass \`--regex "<pattern>"\` for alphanumeric codes. | ||
|
|
||
| - Wait for a verification / magic link, then open it: | ||
| \`node ${INBOX_SCRIPT} wait-link --workspace ${workspace} --task ${taskName} --from <sender-domain> --within 60\` | ||
| Prints just the first URL found (optionally filter with \`--match <substr>\`, e.g. \`--match verify\`). Then \`browse open <that-url>\` to complete verification. | ||
|
|
||
| - Read the most recent message raw (fallback if the helpers above miss): | ||
| \`node ${INBOX_SCRIPT} latest --workspace ${workspace} --task ${taskName}\` | ||
| Prints the newest message as JSON (from, subject, text, html). | ||
|
|
||
| Do not call AgentMail or any other email API directly — only the commands above. | ||
| `; | ||
| } | ||
|
|
||
| function buildSystemPrompt(strategy, traceDir, browseEnv, inboxSection) { | ||
| const openFlag = browseEnv === "remote" ? "--remote" : "--local"; | ||
| const envDesc = browseEnv === "remote" | ||
| ? `Use **remote mode** (Browserbase) — Browserbase Identity, Verified browsers, CAPTCHA solving, residential proxies: | ||
|
|
@@ -352,7 +393,7 @@ ${envDesc} | |
| - **Page seems empty**: Try \`browse wait timeout 1000\` then \`browse snapshot\`; if you know the target element, use \`browse wait selector "<selector>"\` | ||
| - **Dropdown didn't open**: Wait briefly, then snapshot to check | ||
| - **Slider won't move with click**: Use \`browse press ArrowRight\` / \`browse press ArrowLeft\` after clicking the slider thumb | ||
|
|
||
| ${inboxSection} | ||
| # Current Navigation Strategy | ||
|
|
||
| The following strategy has been learned from previous iterations. Follow these guidelines: | ||
|
|
@@ -401,7 +442,9 @@ async function main() { | |
|
|
||
| const strategy = fs.readFileSync(strategyFile, "utf-8"); | ||
| const task = fs.readFileSync(taskFile, "utf-8"); | ||
| const systemPrompt = buildSystemPrompt(strategy, traceDir, browseEnv); | ||
| const inboxEmail = getArg("inbox-email"); | ||
| const inboxSection = buildInboxSection(inboxEmail, workspace, taskName); | ||
| const systemPrompt = buildSystemPrompt(strategy, traceDir, browseEnv, inboxSection); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Task placeholder never substitutedMedium Severity SKILL.md and Additional Locations (1)Reviewed by Cursor Bugbot for commit 2087aca. Configure here. |
||
|
|
||
| console.error(`\n${"=".repeat(60)}`); | ||
| console.error(` AUTOBROWSE — ${taskName} — Run ${runNumber}`); | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inbox wait killed by timeout
High Severity
Long-running
inbox.mjswait-otpandwait-linkcalls run throughexecuteCommandwith a fixed 30sexecFileSynctimeout, while the system prompt tells the agent to use--within 60. Polling is cut off early, so verification mail that arrives after 30 seconds fails even though the inbox helper would still be waiting.Additional Locations (1)
skills/autobrowse/scripts/evaluate.mjs#L298-L305Reviewed by Cursor Bugbot for commit 2087aca. Configure here.