fix: restore BrowserManager.navigate() and package entry point (#748)
Root cause: package.json `main` pointed at `dist/daemon.js` (the internal daemon process), so programmatic consumers of the package received the daemon module instead of a usable API. Additionally, `BrowserManager.launch()` required IPC-only fields (`id`, `action`), and `navigate()` existed only as a private function inside actions.ts. Changes: - Add src/index.ts as the public package entry point - Add BrowserLaunchOptions type (Pick<LaunchCommand> minus id/action/engine) to decouple the programmatic API from the IPC wire protocol - Change launch() signature from LaunchCommand to BrowserLaunchOptions - Add BrowserManager.navigate(url, options?) — consolidates domain check, scoped-header setup, and page.goto() into one reusable method; auto- recovers a new page when all pages have been closed (stale session) - Add BrowserManager.getUrl() and getTitle() convenience methods - Update package.json: main → ./dist/index.js, add types and exports["."] - Add tests: navigate() with headers, waitUntil, allowedDomains blocking, allowedDomains allow, non-http(s) scheme blocking, getUrl/getTitle, and compile-time type assertions verifying the public entry exports the right API surface (direct repro of #307) Fixes #307 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
640d259130
commit
1129a3e7fc
+10
-1
@@ -3,7 +3,16 @@
|
||||
"version": "0.18.0",
|
||||
"description": "Headless browser automation CLI for AI agents",
|
||||
"type": "module",
|
||||
"main": "dist/daemon.js",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"bin",
|
||||
|
||||
Reference in New Issue
Block a user