Structured browser automation framework with deterministic tool calls — and an intelligent orchestrator that maps pages and reasons through them.
Current browser automation is messy:
- Scripts scattered everywhere, inconsistent interfaces
- Model has to guess/hope instead of knowing exactly what elements exist
- No comprehensive page map — tools work blind, taking screenshots and hoping
- Clean tool definitions — every action has a clear contract
- Deterministic execution — same input → same action → same result
bn_map_page_deep— comprehensive page mapper that runs BEFORE any action- Triggers lazy loads via scrolling
- Extracts ALL elements: inputs, buttons, links, images, headings, forms, lists, modals, ARIA elements
- Every element has exact attributes, selectors, visibility, position
- No more guessing — tools read the map and act precisely
- Orchestrator — sub-agent that takes a goal, maps the page, reasons, and executes
hailmary/
├── index.js # Main entry - executeTool(), orchestrate()
├── orchestrator.js # AI orchestrator - goal → map → reason → act
├── browser/
│ └── manager.js # Browser lifecycle (launch/close/getPage)
├── actions/
│ ├── bn_map_page_deep.js # ⭐ Comprehensive page mapper
│ ├── navigate.js # Go to URL
│ ├── click.js # Click element (selector or text)
│ ├── type.js # Type into inputs
│ ├── screenshot.js # Take screenshots
│ ├── getText.js # Extract text
│ ├── getUrl.js # Get current URL
│ ├── wait.js # Wait/delay
│ ├── pressKey.js # Press keyboard keys
│ ├── login.js # Facebook login
│ ├── marketplaceSearch.js # FB Marketplace search
│ └── analyzeProduct.js # Analyze listing details
└── schema/
└── tools.json # Tool definitions for the model
User goal → bn_map_page_deep → Get full page map → Reason with model → Execute actions → Done
Every action on a new page starts with bn_map_page_deep. The orchestrator maps first, then decides.
Comprehensive page mapper. Extracts:
| Category | Details |
|---|---|
inputs |
type, name, id, placeholder, value, disabled, aria-label, autocomplete |
buttons |
text, type, disabled, aria-label, aria-pressed |
links |
href, target, text, aria-label |
images |
src, alt, naturalWidth/Height, lazy status |
headings |
h1-h6 with text and position |
forms |
action, method, input count |
lists |
ul/ol with up to 50 items |
modals |
dialog elements, open state |
clickable |
divs/spans with click handlers or role=button |
searchable |
search inputs with exact selectors |
ariaElements |
all elements with ARIA roles |
disabledElements |
disabled form controls |
lazyImages |
not-yet-loaded images |
Returns summary (quick stats + top headings + search inputs) and full map (all elements with rect positions and attributes).
Sub-agent that takes a natural language goal and executes browser actions autonomously.
const { orchestrate } = require('hailmary');
const result = await orchestrate({
goal: 'search for ps5 in los angeles on facebook marketplace',
url: 'https://www.facebook.com/marketplace',
apiKey: 'your-openai-or-minimax-api-key', // optional — falls back to env
model: 'MiniMax-M2.7', // optional
maxSteps: 5 // optional, default 5
});
console.log(result.success); // true/false
console.log(result.finalUrl); // final URL after all steps
console.log(result.results); // array of step results with reasoningThe orchestrator:
- Navigates to URL
- Runs
bn_map_page_deep - Sends map + goal to the model
- Model outputs a JSON plan with reasoning + actions
- Executes the actions
- Repeats until done or max steps
| Tool | Description | Key Params |
|---|---|---|
navigate |
Go to a URL | url, waitUntil, timeout |
bn_map_page_deep |
⭐ Map all page elements | maxScrolls, scrollDelay |
click |
Click element | selector OR text, index |
type |
Type text | selector, text, pressEnter |
screenshot |
Take screenshot | filename, fullPage |
getText |
Get text content | selector (optional) |
getUrl |
Get current URL | - |
wait |
Wait time | milliseconds |
pressKey |
Press key | key |
login |
Facebook login | cookieFile (auto) |
loginAndSearch |
Login + search | site, searchTerm |
marketplaceSearch |
Search Marketplace | query, location |
analyzeProduct |
Analyze listing | url |
enterPin |
Enter 2FA PIN | pin |
# Direct tool execution
node index.js navigate '{"url":"https://facebook.com/marketplace"}'
node index.js bn_map_page_deep '{}'
node index.js screenshot '{"filename":"page.png"}'
# Orchestrator (goal + url)
node orchestrator.js "search for ps5" "https://www.facebook.com/marketplace"- Map first, act second — Never guess what elements exist
- Deterministic — No randomness. Clear success/failure.
- Schema-first — The tool definition IS the contract.
- Fail fast — Return clear error messages.
- Composable — Actions chain in sequences.
- No magic — Explicit is better than implicit.
🚧 Under active development. bn_map_page_deep and orchestrator are new.