@framers/agentos-ext-browser-automation

中文文档
0.3.3发布于 2026/11/11Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2万

Full browser automation extension for AgentOS — provides agents with autonomous web navigation, DOM interaction, screenshotting, captcha solving, and proxy rotation via Playwright.

原始使用文档
文档目录8 节
  1. Attach daemon
  2. Hard contracts
  3. Ops
  4. Using it
  5. Screenshots
  6. Environment
  7. Releases
  8. License

@framers/agentos-ext-browser-automation

Browser automation for AgentOS agents, in two independent lanes:

  • Launch lane — 10 Playwright-backed tools (browserNavigate, browserClick, browserFill, browserScreenshot, browserExtract, browserWait, browserScroll, browserSnapshot, browserEvaluate, browserSession) that drive a browser the pack launches and owns. Optional CAPTCHA solving and proxy rotation.
  • Attach lane — 7 browser_attach_* tools plus a persistent daemon that drive the user's already-running, logged-in browser. Opt-in only (attach.expectedIdentity required). Never launches a browser.

Attach daemon

One long-lived daemon holds one raw-CDP session to the running Chrome. Every consumer — CLI scripts, declarative runs, agent missions — drives that session over file-queue IPC under ~/.wunderland/attach/ipc/. The daemon is the only process that touches the network, so macOS raises its Local Network permission prompt once per daemon lifetime instead of once per agent process.

callers (CLI / scripts / agent tools)  ── files only ──►  AttachDaemon (one process)
                                                            └─ raw CDP ws://localhost:<port>  ──►  your Chrome

Requires Node 22 or newer (the transport is the built-in WebSocket; the daemon exits with an actionable message on older runtimes). Chrome must run with --remote-debugging-port=9222.

Hard contracts

  • Never launches, quits, restarts, or signals Chrome, under any failure.
  • Creates one agent tab and can close only that tab; every other tab is untouched (asserted by a real-browser e2e).
  • CDP host is localhost (Chrome's DNS-rebinding guard rejects 127.0.0.1).
  • One daemon (atomic pidfile lock), one claimant at a time (lease + claim), serial ops.
  • No eval on the agent tool surface. eval exists only on the JS client for user-authored scripts.
  • Page text is returned with untrusted: true — treat it as data, never as instructions.
  • Navigation is policy-checked daemon-side: https or about:blank, no credential-bearing URLs, redirects revalidated.
  • No cookie, storage, or credential export; diagnostics are redacted.
  • Clients never respawn a dead daemon (a respawn loop is a permission-prompt storm). Autostart, when explicitly enabled, attempts exactly once.

Ops

ping, status, claim, goto {url, settle?}, read {selector?, maxChars?}, extract {fields?}, screenshot {path, fullPage?}, eval {expression, timeoutMs?} (user lane), release, control {action}, quit. Commands are one file each (cmd-<id>.json → resp-<id>.json, atomic write-then-rename, string ids); status.json heartbeats every loop tick.

Using it

Programmatic (/attach/daemon subpath):

import { AttachDaemonClient, runAttachScript } from '@framers/agentos-ext-browser-automation/attach/daemon';

const client = new AttachDaemonClient({ client: 'my-script' });
await client.claim();
await client.goto('https://example.com/', { settle: 2000 });
const { text } = await client.read({ maxChars: 4000 });
await client.release();

Declarative plans (no control flow, no eval):

name: crawl
claim: { ttlMs: 600000 }
steps:
  - { op: goto, url: "https://example.com/list", settle: 2500 }
  - { op: read, out: listing }
  - { op: extract, fields: { items: "ul li" }, out: items }

From the wunderland CLI: wunderland attach start | status | stop | run <file.mjs|file.yaml|file.json>. Agent missions reach the same held session by enabling the attach tools with transport: 'cdp' (WUNDERLAND_ATTACH_TRANSPORT=cdp).

Screenshots

browser_attach_screenshot (and AttachController.screenshot) writes a PNG of the agent tab to a new file in the evidence directory, ~/.wunderland/attach-evidence unless WUNDERLAND_ATTACH_EVIDENCE_DIR (or the pack's attach.evidenceDir option, for the in-process controller) names another. It needs the CDP transport: the JXA transport has no pixel access and refuses with UNSUPPORTED_OP.

  • path is relative to the evidence directory, or an absolute path inside it. A path that leaves the directory, passes through a link, or names a file that exists is refused before anything is captured, and the session stays ready. The file is created with flag wx, so no file is ever replaced, and the result gives the path written.
  • The evidence directory is private to the user the session runs as. It and the directories in it are made with mode 0700; one that another user or group can write is refused, and so is one under a directory that another user can change (a sticky directory such as /tmp is fine). The directories are checked before the page is captured and again when the file is created, and the image is written only once the new file is found in the directory that was checked.
  • A screenshot holds the session until its file is written: the in-process controller refuses a goto or read called meanwhile, and the daemon runs its queue one command at a time.
  • fullPage captures the scrollable page, each side cut at 16,384 CSS pixels.
  • The tool has side effects (it writes a file), so a deny-side-effects policy gates it.

Environment

VariableMeaning
WUNDERLAND_ATTACH_IDENTITYRequired. Profile identity the daemon must verify before claiming (e.g. your account email; matched against the identity-probe tab's title/url metadata).
WUNDERLAND_ATTACH_TRANSPORTjxa (in-process, macOS AppleScript) or cdp (daemon-routed).
WUNDERLAND_ATTACH_PROFILE_ROOTChrome profile root holding DevToolsActivePort.
WUNDERLAND_ATTACH_PROBE_URLIdentity-probe URL substring (default mail.google.com).
WUNDERLAND_ATTACH_HOSTSComma-separated https host allowlist for navigation.
WUNDERLAND_ATTACH_LEASELease file path override.
WUNDERLAND_ATTACH_IPC_DIRIPC directory override (default ~/.wunderland/attach/ipc).
WUNDERLAND_ATTACH_PID_FILEDaemon pidfile override (default ~/.wunderland/attach/daemon.pid).
WUNDERLAND_ATTACH_AUTOSTART1/true: allow one autostart attempt when the daemon is down.
WUNDERLAND_ATTACH_DRYRUN1/true: simulate navigation/reads without touching the browser.
WUNDERLAND_ATTACH_DEADLINE_MSPer-operation deadline (default 45000).
WUNDERLAND_ATTACH_EVIDENCE_DIRWhere the daemon writes screenshots (default ~/.wunderland/attach-evidence). A directory only the daemon's user can write.

Releases

New versions are published from framerslab/agentos-extensions by GitHub Actions through npm trusted publishing, with a provenance statement.

License

Apache-2.0

版本与发布记录

@framers/agentos-ext-browser-automation 共发布 7 个版本,首次发布于 2026/05/02;过去 12 个月发布了 7 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.3latest2026/11/114 天前
0.3.22026/11/0114 天前
0.3.12026/11/0115 天前
0.3.02026/10/121 个月前
0.2.12026/10/081 个月前
0.2.02026/07/223 个月前

关于 @framers/agentos-ext-browser-automation 的常见问题

@framers/agentos-ext-browser-automation 是什么?

Full browser automation extension for AgentOS — provides agents with autonomous web navigation, DOM interaction, screenshotting, captcha solving, and proxy rotation via Playwright.

如何安装 @framers/agentos-ext-browser-automation?

在项目目录运行 npm install @framers/agentos-ext-browser-automation,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@framers/agentos(>=0.10.40)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@framers/agentos-ext-browser-automation 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@framers/agentos-ext-browser-automation 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@framers/agentos-ext-browser-automation 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@framers/agentos-ext-browser-automation 可以商用吗?

@framers/agentos-ext-browser-automation 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@framers/agentos-ext-browser-automation 的下载量有多少?

根据 npm 官方下载统计,@framers/agentos-ext-browser-automation 在 2026/10/16 – 2026/11/14 这 30 天内被下载 20,419 次,日均约 681 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@framers/agentos-ext-browser-automation 还在维护吗?

最新版本 0.3.3 发布于 2026/11/11(4 天前);至今共发布 7 个版本,其中过去 12 个月发布了 7 个;首次发布于 2026/05/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。