Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
710 commits
Select commit Hold shift + click to select a range
453641f
Guard replay params against throwing getters
cursoragent Feb 13, 2026
f2a57d8
Make action-cache ordering resilient to trap-prone state
cursoragent Feb 13, 2026
2acbfab
Stabilize task control status after task settlement
cursoragent Feb 13, 2026
0f3066b
Harden async task handling against task-registry get traps
cursoragent Feb 13, 2026
d605778
Harden closeAgent cache/task registry reset fallbacks
cursoragent Feb 13, 2026
6a0f31d
Harden replay step recording against trap-prone task outputs
cursoragent Feb 13, 2026
4222ed4
Prevent task error-listener leaks on forwarder registration traps
cursoragent Feb 13, 2026
ca393c9
Clean HyperPage close listeners during wrapper reinitialization
cursoragent Feb 13, 2026
a688daa
Truncate oversized lifecycle diagnostics during agent teardown
cursoragent Feb 13, 2026
776b34c
Deduplicate scoped page close listeners across repeated events
cursoragent Feb 13, 2026
b8c7f69
Guard scoped cleanup callback reads and writes in HyperPage wrappers
cursoragent Feb 13, 2026
47f435c
Track scoped page cleanups internally when page property writes trap
cursoragent Feb 13, 2026
65daf15
Bound helper-surface diagnostics for session, pprint, and script errors
cursoragent Feb 13, 2026
6658c84
Preserve settled task-control statuses after agent shutdown
cursoragent Feb 13, 2026
72b7be9
Bound lifecycle warning diagnostics across task and listener paths
cursoragent Feb 13, 2026
6c111be
Bound scoped HyperPage listener diagnostics
cursoragent Feb 13, 2026
9bf8835
Bound MCP lifecycle diagnostics for connection and teardown errors
cursoragent Feb 13, 2026
76f5d9e
Bound aiAction debug-writer diagnostics
cursoragent Feb 13, 2026
6cffd06
Bound executeSingleAction failure diagnostics
cursoragent Feb 13, 2026
b429db6
Bound aiAction debug error payload diagnostics
cursoragent Feb 13, 2026
043d4f3
Make action registration resilient to trap-prone action types
cursoragent Feb 13, 2026
585f49d
Bound infrastructure error diagnostics in agent lifecycle APIs
cursoragent Feb 13, 2026
a49d0d1
Harden MCP initialization against trap-prone config fields
cursoragent Feb 13, 2026
5d57005
Guard MCP client construction failures in runtime APIs
cursoragent Feb 13, 2026
4051142
Bound browser-provider lifecycle diagnostics
cursoragent Feb 13, 2026
cf28aa0
Normalize and bound task and MCP initialization failure diagnostics
cursoragent Feb 13, 2026
b821224
Bound MCP client payload-normalization diagnostics
cursoragent Feb 13, 2026
a523d1f
Rethrow bounded MCP connect diagnostics
cursoragent Feb 13, 2026
51e79a0
Sanitize MCP disconnect server-id diagnostics
cursoragent Feb 13, 2026
9625d63
Harden MCP executeTool against trap-prone server registries
cursoragent Feb 13, 2026
90c3985
Ensure MCP connect cleanup survives registry traps
cursoragent Feb 13, 2026
4aae7f0
Handle MCP unregister failures deterministically
cursoragent Feb 13, 2026
6b7b094
Harden MCP server metadata accessors against trap-prone states
cursoragent Feb 13, 2026
a799170
Make MCP hasTool tolerant of partial registry failures
cursoragent Feb 13, 2026
e665e43
Guard MCP disconnect against trap-prone server retrieval
cursoragent Feb 13, 2026
8df334d
Sanitize MCP server info identifiers
cursoragent Feb 13, 2026
6b08c36
Harden MCP tool retrieval diagnostics in executeTool
cursoragent Feb 13, 2026
33218f2
Sanitize MCP server id list output
cursoragent Feb 13, 2026
0f96ae6
Sanitize MCP server info tool names
cursoragent Feb 13, 2026
968aec2
Sanitize MCP hasTool server identifiers
cursoragent Feb 13, 2026
70b1af9
Bound replay step failure diagnostics
cursoragent Feb 13, 2026
8076577
Sanitize replay output messages in action-cache replays
cursoragent Feb 13, 2026
2a69e1e
Harden MCP server tools registry access paths
cursoragent Feb 13, 2026
b7abb76
Bound replay iterable step materialization
cursoragent Feb 13, 2026
1591c0d
Validate MCP server tool registry shape before lookup
cursoragent Feb 13, 2026
46f1909
Sanitize replay action type identifiers
cursoragent Feb 13, 2026
b68679e
Normalize MCP server metadata reads in HyperAgent
cursoragent Feb 13, 2026
f44146b
Bound cached-action replay failure diagnostics
cursoragent Feb 13, 2026
08a4ca3
Normalize cached special-action replay payloads
cursoragent Feb 13, 2026
952c272
Harden action-cache script generation outputs
cursoragent Feb 13, 2026
60819fe
Bound replay special-action outputs and diagnostics
cursoragent Feb 13, 2026
fa4c36a
Bound action-cache helper dispatch diagnostics
cursoragent Feb 13, 2026
ba72673
Guard action-cache script sorting against trap-prone steps
cursoragent Feb 13, 2026
5d0e185
Bound element locator diagnostics and identifiers
cursoragent Feb 13, 2026
bf5b6aa
Bound runtime-context initialization diagnostics
cursoragent Feb 13, 2026
51ea80a
Bound find-element retry diagnostics
cursoragent Feb 13, 2026
5ffe19c
Bound XPath CDP resolver diagnostics
cursoragent Feb 13, 2026
9af753a
Bound Playwright method execution diagnostics
cursoragent Feb 13, 2026
7a8f201
Harden extract output diagnostics formatting
cursoragent Feb 13, 2026
28f3b02
Bound action-cache payload fields for replay safety
cursoragent Feb 13, 2026
198ada5
Sanitize and bound agent-loop runtime diagnostics
cursoragent Feb 13, 2026
adeb12b
Bound extract-action runtime diagnostics
cursoragent Feb 13, 2026
763db6a
Sanitize perform-action runtime text inputs
cursoragent Feb 13, 2026
92b31cc
Harden shared action-runtime text normalization
cursoragent Feb 13, 2026
f1eed9a
Expand top-level public type exports
cursoragent Feb 13, 2026
f67c7a1
Add compact summary for omitted agent history
cursoragent Feb 13, 2026
0ee77a6
Align system prompt with canonical select method
cursoragent Feb 13, 2026
9ee7de7
Make stuck detection progress-aware via DOM signatures
cursoragent Feb 13, 2026
83fcadc
Reduce false positives in frame ad/tracking filter
cursoragent Feb 13, 2026
1d8cc5b
Refresh docs for perform API and current runtime state
cursoragent Feb 13, 2026
58a5ca6
Bound CDP bounding-box diagnostics
cursoragent Feb 13, 2026
6e74787
Bound Playwright CDP adapter diagnostics
cursoragent Feb 13, 2026
768ad4b
Bound CDP interaction fallback diagnostics
cursoragent Feb 13, 2026
f439f56
Bound frame-context manager diagnostics
cursoragent Feb 13, 2026
0ac777d
Sanitize MCP runtime diagnostic formatting
cursoragent Feb 13, 2026
574c999
Add runtime migration notes to README
cursoragent Feb 13, 2026
82818e9
Bound PDF download error diagnostics
cursoragent Feb 13, 2026
8cf0430
Sanitize complete-action text payloads
cursoragent Feb 13, 2026
2bba826
Align input format contract with runtime prompt payload
cursoragent Feb 13, 2026
5149785
Bound complete-schema serialization diagnostics
cursoragent Feb 13, 2026
f1f8b1c
Bound debug writer diagnostic output
cursoragent Feb 13, 2026
8f8dd6f
Use perform in CDP flow example docs
cursoragent Feb 13, 2026
9eb5e23
Normalize CLI task-control diagnostics
cursoragent Feb 13, 2026
07c5b36
Sanitize browser-provider diagnostic errors
cursoragent Feb 13, 2026
7a51dec
Sanitize LLM provider response diagnostics
cursoragent Feb 13, 2026
cb7417c
Sanitize Gemini and DeepSeek diagnostics
cursoragent Feb 13, 2026
ef0acf1
Sanitize LLM config field diagnostic errors
cursoragent Feb 13, 2026
44dc7ac
Sanitize message-converter fallback diagnostics
cursoragent Feb 13, 2026
d1bec57
Sanitize OpenAI tool-call diagnostics
cursoragent Feb 13, 2026
f700966
Sanitize structured-response diagnostic payloads
cursoragent Feb 13, 2026
fdf2b4b
Sanitize OpenAI content diagnostics
cursoragent Feb 14, 2026
f878714
Harden schema converter diagnostics
cursoragent Feb 14, 2026
93768d2
Bound provider option traversal diagnostics
cursoragent Feb 14, 2026
51c8bbc
Migrate sample scripts to page.perform
cursoragent Feb 14, 2026
ecd1cf0
Align prompt method lists with runtime action set
cursoragent Feb 14, 2026
05495d1
Use perform-prefixed single-action diagnostics
cursoragent Feb 14, 2026
21d1809
Warn once for deprecated aiAction alias
cursoragent Feb 14, 2026
5d531f3
Write single-action debug artifacts under perform path
cursoragent Feb 14, 2026
541c998
Document canonical perform alias behavior
cursoragent Feb 14, 2026
14ed493
Refresh guidance for runtime DOM capture scripts
cursoragent Feb 14, 2026
95df0d6
Sanitize HyperAgent helper and lifecycle diagnostics
cursoragent Feb 14, 2026
06bde5a
Add canonical writePerformDebug utility
cursoragent Feb 14, 2026
0d9dcb0
Rename single-action internals to perform terminology
cursoragent Feb 14, 2026
4a44b24
Add perform context-switch retry delay option
cursoragent Feb 14, 2026
1c8d55e
Expand perform context-switch retry-delay coverage
cursoragent Feb 14, 2026
3c0f78c
Refresh current state for perform runtime changes
cursoragent Feb 14, 2026
ff3adfd
Guard against deprecation warning on perform calls
cursoragent Feb 14, 2026
c0ff6e0
Cap perform helper maxSteps for cached actions
cursoragent Feb 14, 2026
b90647c
Harden cached perform helper option normalization
cursoragent Feb 14, 2026
e5b88fa
Document perform retry options in public API
cursoragent Feb 14, 2026
8e570db
Cover perform retry compatibility with maxSteps alias
cursoragent Feb 14, 2026
f1d1a2c
Warn once for deprecated perform maxSteps option
cursoragent Feb 14, 2026
861b7cd
Sanitize control characters in page URL handling
cursoragent Feb 14, 2026
2d933d8
Sanitize agent-loop page URL diagnostics
cursoragent Feb 14, 2026
96fb16d
Reuse shared page URL sanitizer across runtime flows
cursoragent Feb 14, 2026
39346d2
Sanitize custom fallback values in page URL utility
cursoragent Feb 14, 2026
bfb0b08
Reuse shared URL normalization in prompt builder
cursoragent Feb 14, 2026
8f1307b
Cap cached perform helper frameIndex values
cursoragent Feb 14, 2026
f6c1969
Harden element locator debug frame metadata reads
cursoragent Feb 14, 2026
03f4e17
Harden OOPIF metadata reads in frame context manager
cursoragent Feb 14, 2026
e39dde5
Sanitize frame tree metadata in context manager
cursoragent Feb 14, 2026
3c1d9c4
Bound frame URL and name metadata in context manager
cursoragent Feb 14, 2026
112ba13
Harden a11y frame URL matching against trap-prone frames
cursoragent Feb 14, 2026
2da35d0
Bound page URL length in perform and find-element paths
cursoragent Feb 14, 2026
0939bb8
Fallback to XPath when frame enumeration fails
cursoragent Feb 14, 2026
c325bbf
Refresh perform retry flow details in CDP overview
cursoragent Feb 14, 2026
c1db726
Warn for deprecated perform maxSteps in wrapper path
cursoragent Feb 14, 2026
048c33c
Sanitize a11y DOM extraction diagnostics
cursoragent Feb 14, 2026
a95a09b
Sanitize a11y extraction error detail logs
cursoragent Feb 14, 2026
a45101a
Update current state with URL and frame hardening
cursoragent Feb 14, 2026
dc20ebc
Sanitize build-maps failure diagnostics
cursoragent Feb 14, 2026
7f25ca7
Sanitize scrollable detection diagnostics
cursoragent Feb 14, 2026
763c205
Harden batch bounding-box diagnostics and add tests
cursoragent Feb 14, 2026
e8c8368
Harden script injector diagnostics and add tests
cursoragent Feb 14, 2026
8ab95cc
Harden element resolver identifier diagnostics
cursoragent Feb 14, 2026
181186b
Harden performance tracker diagnostics and typing
cursoragent Feb 14, 2026
d4f17e2
Harden CLI input and raw-mode diagnostics
cursoragent Feb 14, 2026
cc91c5c
Harden MCP config diagnostics in CLI parser
cursoragent Feb 14, 2026
8be5172
Harden dom-capture callback diagnostics
cursoragent Feb 14, 2026
2d93a46
Harden retry warning diagnostics
cursoragent Feb 14, 2026
6871a78
Harden examine-dom and markdown diagnostics
cursoragent Feb 14, 2026
fbd2c36
Harden Anthropicschema warning diagnostics
cursoragent Feb 14, 2026
7b3a032
Harden perform-action diagnostic formatting
cursoragent Feb 14, 2026
024228d
Refresh runtime state notes with latest hardening
cursoragent Feb 14, 2026
de3e77f
Harden waitForSettledDOM stalled request diagnostics
cursoragent Feb 14, 2026
c586e03
Expand waitForSettledDOM timeout and stall coverage
cursoragent Feb 14, 2026
97eac73
Harden waitForSettledDOM listener lifecycle handling
cursoragent Feb 14, 2026
40f9f6d
Use formatUnknownError in wait diagnostics
cursoragent Feb 14, 2026
d6cb0d2
Sanitize replay diagnostic control characters
cursoragent Feb 14, 2026
7de96cc
Sanitize control chars in prompt builder payloads
cursoragent Feb 14, 2026
28564d5
Update runtime state notes for recent hardening
cursoragent Feb 14, 2026
b8500f4
Tighten known ad-domain hostname matching
cursoragent Feb 14, 2026
a5a3b3e
Normalize malformed examine-dom parsed elements
cursoragent Feb 14, 2026
46158b4
Normalize waitForSettledDOM timeout bounds
cursoragent Feb 14, 2026
2105b44
Tighten agent action typing without any
cursoragent Feb 14, 2026
bdefa85
Remove provider any-casts from LLM clients
cursoragent Feb 14, 2026
5e5b5ef
Normalize structured agent output types at runtime
cursoragent Feb 14, 2026
fe38968
Add configurable ad-frame filtering for CDP discovery
cursoragent Feb 14, 2026
2f39137
Propagate frame filter setting through DOM settle paths
cursoragent Feb 14, 2026
7ad1a26
Document configurable CDP frame filtering policy
cursoragent Feb 14, 2026
be7338a
Cover frame filter config in public API tests
cursoragent Feb 14, 2026
347ac10
Add per-call frame filter overrides across task and replay APIs
cursoragent Feb 14, 2026
d6951c7
Expand frame filter override regression coverage
cursoragent Feb 14, 2026
a88fdc3
Apply frame filter policy during initial DOM capture
cursoragent Feb 14, 2026
b462177
Harden frame filter option reads against param traps
cursoragent Feb 14, 2026
4294ed5
Document replay frame-filter overrides in API docs
cursoragent Feb 14, 2026
dfd2d2d
Add agent loop regression for frame filter propagation
cursoragent Feb 14, 2026
04ba7cc
Guard waitForSettledDOM frame-manager option setup
cursoragent Feb 14, 2026
8bba92d
Guard a11y frame manager configuration setters
cursoragent Feb 14, 2026
136f0c5
Harden runtime context against frame-manager setter traps
cursoragent Feb 14, 2026
9fcee2b
Add per-call cdpActions overrides for task perform and replay
cursoragent Feb 14, 2026
655997a
Document per-call CDP toggle behavior in deep dive
cursoragent Feb 14, 2026
db9dc82
Harden element locator debug payload logging
cursoragent Feb 14, 2026
886729b
Align examine-dom prompt with supported action methods
cursoragent Feb 14, 2026
23310e2
Respect cdpActions=false in cached-step execution path
cursoragent Feb 14, 2026
ab12612
Add trap-fallback regressions for cdp override reads
cursoragent Feb 14, 2026
62515f1
Harden CLI shutdown failure diagnostics
cursoragent Feb 14, 2026
237dedc
Sanitize CLI step failure rendering diagnostics
cursoragent Feb 14, 2026
254d56c
Add Anthropic multi-action tool choice regression
cursoragent Feb 14, 2026
a08bab4
Harden frame filter host-path matching heuristics
cursoragent Feb 14, 2026
d75d5c4
Cap prompt variable serialization for context budget
cursoragent Feb 14, 2026
a22ab9c
Expand trap-safe override regressions for task and replay
cursoragent Feb 14, 2026
bb90876
Harden prompt builder against trap-prone step arrays
cursoragent Feb 14, 2026
1d6c7b0
Harden constructor config toggle reads against traps
cursoragent Feb 14, 2026
9c25f18
Expand cached-helper option trap fallback coverage
cursoragent Feb 14, 2026
6124932
Harden constructor config ingestion against traps
cursoragent Feb 14, 2026
af80424
Harden open-tab prompt materialization against traps
cursoragent Feb 14, 2026
ccee955
Add regression for constructor llm getter traps
cursoragent Feb 14, 2026
d47f792
Improve open-tab fallback when tab list is unreadable
cursoragent Feb 14, 2026
bb159bd
Harden frame filter parsing for non-standard URLs
cursoragent Feb 14, 2026
c7bc88d
Harden prompt base-message materialization against traps
cursoragent Feb 14, 2026
a6cffe8
Harden constructor custom action ingestion against traps
cursoragent Feb 14, 2026
d7901d7
Fix frame-filter parsing for host-port urls
cursoragent Feb 14, 2026
12b6589
Refine frame-filter query signal host requirements
cursoragent Feb 14, 2026
6ecf72b
Harden debug option normalization against trap getters
cursoragent Feb 14, 2026
60e73cb
Harden page-url option reads against traps
cursoragent Feb 14, 2026
40b24c2
Harden settle options against trap-prone getters
cursoragent Feb 14, 2026
8f285e0
Harden settle listener cleanup against method getter traps
cursoragent Feb 14, 2026
0060361
Validate constructor llm payload shape strictly
cursoragent Feb 14, 2026
83165b0
Harden prompt task-goal rendering against traps
cursoragent Feb 14, 2026
af1cf39
Add settle regression for trapped listener method getters
cursoragent Feb 14, 2026
06d8f88
Document strict llm configuration contract
cursoragent Feb 14, 2026
7dcf2ea
Add constructor regression for malformed llm payloads
cursoragent Feb 14, 2026
29d5904
Document frame-filter URL normalization behavior
cursoragent Feb 14, 2026
1440fe5
Document CDP frame-filter URL matching nuances
cursoragent Feb 14, 2026
fea2b4e
Propagate record-video trace mode into network settle diagnostics
cursoragent Feb 14, 2026
d8a3db2
Refine settle trace regression log capture
cursoragent Feb 14, 2026
9179358
Harden settle debug option lookups against traps
cursoragent Feb 14, 2026
12150c5
Harden a11y DOM option reads against traps
cursoragent Feb 14, 2026
de565e5
Harden provider debug option reads against traps
cursoragent Feb 14, 2026
f40fd96
Harden CDP adapter debug option reads against traps
cursoragent Feb 14, 2026
8bda345
Harden a11y debug option lookups against traps
cursoragent Feb 14, 2026
00eee9a
Refresh stale provider selection TODO wording
cursoragent Feb 14, 2026
dc6607d
Refine settle context probing warning behavior
cursoragent Feb 14, 2026
3f1b322
Harden Playwright CDP client initialization flow
cursoragent Feb 14, 2026
203f85c
Clean stale markdown conversion TODO comments
cursoragent Feb 14, 2026
ce95854
Remove remaining TODO markers from src
cursoragent Feb 14, 2026
000b404
Improve open-tab prompt fallback resiliency
cursoragent Feb 14, 2026
1cba1fb
Harden OOPIF discovery context access
cursoragent Feb 14, 2026
3ab4b9b
Refresh stale OOPIF flow notes in CDP docs
cursoragent Feb 14, 2026
a4243ef
Harden HyperPage context and tab tracking reads
cursoragent Feb 14, 2026
7ea498a
Preserve readable frame metadata in locator debug output
cursoragent Feb 14, 2026
c053b56
Bind CDP session creation to context receivers
cursoragent Feb 14, 2026
94a7e96
Harden frame-context listener attach and detach guards
cursoragent Feb 14, 2026
c79c055
Bind frame metadata reads to frame receiver
cursoragent Feb 14, 2026
e865235
Harden pooled CDP listener cleanup in adapter
cursoragent Feb 14, 2026
fbd05ce
Only track frame listeners after successful registration
cursoragent Feb 14, 2026
1364943
Harden a11y frame URL matching against entry traps
cursoragent Feb 14, 2026
f1c78ac
Harden task page listener getter handling
cursoragent Feb 14, 2026
21503bb
Clarify main-frame vs OOPIF capture docs
cursoragent Feb 14, 2026
46a741c
Guard a11y runtime listener method access
cursoragent Feb 14, 2026
c05662b
Guard Playwright session send method access
cursoragent Feb 14, 2026
08464bf
Guard Playwright session listener method access
cursoragent Feb 14, 2026
1396fea
Expand adapter listener getter trap regressions
cursoragent Feb 14, 2026
dd20c76
Emit debug diagnostics for unavailable task listener methods
cursoragent Feb 14, 2026
cfe5445
Add initBrowser listener getter trap regression
cursoragent Feb 14, 2026
fe06d79
Use trap-safe context page materialization in HyperAgent
cursoragent Feb 14, 2026
87ec6d5
Guard Runtime.enable sender lookup in a11y context collection
cursoragent Feb 14, 2026
578d3c2
Guard a11y frame-sync debug setter access
cursoragent Feb 14, 2026
443cb49
Refresh OOPIF sync progression wording in CDP docs
cursoragent Feb 14, 2026
1024bdb
Surface context.pages getter diagnostics in getPages
cursoragent Feb 14, 2026
3454cdb
Add adapter regressions for listener call failures
cursoragent Feb 14, 2026
9934029
Guard cache-hydration debug setter in a11y provider
cursoragent Feb 14, 2026
ec8698b
Harden context.newPage access and diagnostics
cursoragent Feb 14, 2026
3bcbd74
Add getCurrentPage newPage trap regressions
cursoragent Feb 14, 2026
2bfd612
Guard frame-graph debug setter in agent loop
cursoragent Feb 14, 2026
601ebc3
Harden task error-forwarder listener method reads
cursoragent Feb 14, 2026
0f3b92a
Fallback to removeListener for task error cleanup
cursoragent Feb 14, 2026
f9961b6
Fallback to addListener for task error wiring
cursoragent Feb 14, 2026
6fd53ba
Harden Playwright detach method access in CDP adapter
cursoragent Feb 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
pull_request:
push:
branches:
- main
- master
- "cursor/**"

jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

- name: Build
run: yarn build

- name: Test
run: yarn test --runInBand
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- `yarn test` launches Jest; set `CI=true` for coverage and deterministic snapshots.
- `yarn cli -c "..." [--debug --hyperbrowser --mcp <path>]` runs the agent; `--hyperbrowser` switches to the remote provider and `--debug` drops artifacts into `debug/`.
- `yarn example <path>` (backed by `ts-node -r tsconfig-paths/register`) is the quickest way to execute flows in `examples/` or `scripts/`.
- DOM metadata builds at runtime via the a11y provider; the legacy `build-dom-tree-script` entry points at a removed file—avoid relying on it until refreshed.
- DOM metadata builds at runtime via the a11y provider; use runtime capture flows and `yarn example` probes rather than any removed legacy DOM-builder entrypoint.

## Agent Runtime & Integrations
- The agent loop (`agent/tools/agent.ts`) captures the accessibility tree via `captureDOMState` (text-first, optional streaming and snapshot cache). Visual overlays/screenshots are opt-in (`enableVisualMode`) and composited with CDP screenshots for `page.ai`.
Expand Down
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,56 @@ console.log(res);
await agent.closeAgent();
```

### Async Task Controls

`executeTaskAsync()` returns a control handle you can pause/resume/cancel, plus a `result` promise you can await when you need the final output.

```typescript
const task = await agent.executeTaskAsync("Sign in and fetch account details");

// Optional runtime control
task.pause();
task.resume();

// Await final outcome at any time
const final = await task.result;
console.log(final.status, final.output);

// Task failures reject with HyperagentTaskError (includes taskId + cause)
task.result.catch((error) => {
console.error(error.taskId, error.cause?.message);
});
```

### Migration Notes (Current Runtime Contract)

- **`page.perform()` is the canonical single-action API.**
- `page.aiAction()` is still available as a compatibility alias.
- Calling `page.aiAction()` emits a one-time deprecation warning per agent instance.
- Prefer `perform` for all new code and docs.
- **`executeTaskAsync()` now has a first-class completion promise.**
- Use `task.result` to await the final output deterministically.
- **Top-level type exports are available from `@hyperbrowser/agent`.**
- You can import common task/cache/config types from the package root instead of internal paths.
- **CDP remains configurable per agent.**
- If needed for a workflow, disable CDP with `cdpActions: false` to force Playwright fallback.
- **Single-action debug artifacts use canonical perform naming.**
- `executeSingleAction` debug output is written under `debug/perform/...`.

### Importing Public Types

Core workflow types are available directly from the package entrypoint:

```typescript
import type {
ActionCacheOutput,
AgentTaskOutput,
HyperAgentConfig,
PerformTaskParams,
TaskOutput,
} from "@hyperbrowser/agent";
```

## Two Modes of Operation

HyperAgent provides two complementary APIs optimized for different use cases:
Expand All @@ -135,8 +185,26 @@ await page.goto("https://example.com/login");
await page.perform("fill email with user@example.com");
await page.perform("fill password with mypassword");
await page.perform("click the login button");

// Optional retries tuning for single-action mode
await page.perform("click the login button", {
maxElementRetries: 5,
retryDelayMs: 250,
maxContextSwitchRetries: 4,
contextSwitchRetryDelayMs: 500,
});
```

**Perform retry options**:
- `maxElementRetries`: attempts to refetch/find a target element before failing.
- `retryDelayMs`: delay between element-refetch retries.
- `maxContextSwitchRetries`: retries when a tab/context switch interrupts an in-flight action.
- `contextSwitchRetryDelayMs`: delay between context-switch retries (defaults to 500ms, capped for safety).
- `cdpActions`: override CDP usage for this call (`true` by default from agent config).
- `filterAdTrackingFrames`: override iframe filtering for this action (`true` by default). Set to `false` when you intentionally need ad/tracking iframes in scope.
- `maxSteps` (**deprecated**): compatibility alias for `maxElementRetries`.
- Using `maxSteps` emits a one-time deprecation warning per agent instance.

### 🧠 `page.ai()` - Complex Multi-Step Tasks

**Best for**: Complex workflows requiring multiple steps and visual context
Expand All @@ -152,6 +220,8 @@ await page.perform("click the login button");

- `useDomCache` (boolean): Reuse DOM snapshots for speed
- `enableVisualMode` (boolean): Enable screenshots and overlays (default: false)
- `cdpActions` (boolean): override CDP usage for this task (inherits agent-level default when omitted)
- `filterAdTrackingFrames` (boolean): override ad/tracking iframe filtering for this task (inherits agent-level default when omitted)

**Example**:

Expand Down Expand Up @@ -301,6 +371,12 @@ const agent = new HyperAgent({
});
```

`llm` must be either:
- a provider config object (`{ provider, model, ... }`), or
- an object implementing the HyperAgent LLM client interface (`invoke`, `invokeStructured`, `getProviderId`, `getModelId`, `getCapabilities`).

Invalid/malformed `llm` payloads fail fast with a configuration error.

### MCP Support

HyperAgent functions as a fully functional MCP client. For best results, we recommend using
Expand Down Expand Up @@ -339,6 +415,17 @@ console.log(response);
await agent.closeAgent();
```

You can dynamically disconnect MCP servers later:

```typescript
// Fire-and-forget disconnect
agent.disconnectFromMCPServer("server-id");

// Awaited disconnect with success/failure result
const didDisconnect = await agent.disconnectFromMCPServerAsync("server-id");
console.log({ didDisconnect });
```

### Custom Actions

HyperAgent's capabilities can be extended with custom actions. Custom actions require 3 things:
Expand Down Expand Up @@ -448,6 +535,8 @@ const page = await agent.newPage();
const replay = await page.runFromActionCache(cache, {
maxXPathRetries: 3, // Retry XPath resolution up to 3 times before LLM fallback
debug: true,
cdpActions: true, // Optional: override CDP usage for this replay
filterAdTrackingFrames: false, // Optional: include ad/tracking iframes during replay resolution
});

console.log(replay);
Expand Down Expand Up @@ -494,7 +583,11 @@ HyperAgent integrates seamlessly with Playwright, so you can still use familiar
- **Deep Iframe Support**: Tracking across nested and cross-origin iframes (OOPIFs)
- **Exact Coordinates**: Actions use precise CDP coordinates for reliability

Frame filtering normalizes protocol-relative and scheme-less iframe URLs for host-based matching, while intentionally avoiding host-based ad matches for path-only URLs.

Keep in mind that CDP is still experimental, and stability is not guaranteed. If you'd like the agent to use Playwright's native locators/actions instead, set `cdpActions: false` when you create the agent and it will fall back automatically.
If you need to inspect ad/tracking iframes for a specific workflow, keep CDP enabled and set `filterAdTrackingFrames: false` in `new HyperAgent({ ... })`.
You can also override this per invocation using `page.ai(..., { filterAdTrackingFrames: false })` or `page.perform(..., { filterAdTrackingFrames: false })`.

The CDP layer is still evolving—expect rapid polish (and the occasional sharp edge). If you hit something quirky you can toggle CDP off for that workflow and drop us a bug report.

Expand Down
Loading