@jackwener/browsermcp 0.0.34-embedded.3 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -24
- package/README.md +1 -92
- package/dist/docs/api-reference.md +10 -4
- package/dist/docs/errors.md +24 -0
- package/dist/docs/js-tool.md +10 -2
- package/dist/docs/tab-lifecycle.md +1 -1
- package/dist/src/api/api.js +2 -1
- package/dist/src/api/api.js.map +1 -1
- package/dist/src/api/browser.js +7 -1
- package/dist/src/api/browser.js.map +1 -1
- package/dist/src/api/tab.js +9 -6
- package/dist/src/api/tab.js.map +1 -1
- package/dist/src/backends/extension-page.js +8 -1
- package/dist/src/backends/extension-page.js.map +1 -1
- package/dist/src/docs/manifest.js +3 -6
- package/dist/src/docs/manifest.js.map +1 -1
- package/dist/src/mcp/js-session.js +29 -18
- package/dist/src/mcp/js-session.js.map +1 -1
- package/dist/src/mcp/js-worker.mjs +46 -15
- package/dist/src/protocol.js +1 -1
- package/dist/src/protocol.js.map +1 -1
- package/dist/src/shared/api-contract.js +117 -0
- package/dist/src/shared/api-contract.js.map +1 -0
- package/docs/api-reference.md +10 -4
- package/docs/errors.md +24 -0
- package/docs/js-tool.md +10 -2
- package/docs/tab-lifecycle.md +1 -1
- package/extension/dist/background.js +20043 -274
- package/package.json +3 -12
- package/dist/src/api/action-input.d.ts +0 -47
- package/dist/src/api/agent.d.ts +0 -10
- package/dist/src/api/api.d.ts +0 -50
- package/dist/src/api/browser.d.ts +0 -90
- package/dist/src/api/context.d.ts +0 -7
- package/dist/src/api/diff.d.ts +0 -8
- package/dist/src/api/errors.d.ts +0 -12
- package/dist/src/api/network.d.ts +0 -10
- package/dist/src/api/observation.d.ts +0 -4
- package/dist/src/api/streams.d.ts +0 -13
- package/dist/src/api/tab.d.ts +0 -315
- package/dist/src/api/webmcp.d.ts +0 -19
- package/dist/src/backends/backend.d.ts +0 -14
- package/dist/src/backends/browser-helpers.d.ts +0 -17
- package/dist/src/backends/extension-page.d.ts +0 -5
- package/dist/src/backends/managed-page.d.ts +0 -59
- package/dist/src/backends/page-transport.d.ts +0 -10
- package/dist/src/backends/page-types.d.ts +0 -82
- package/dist/src/docs/embedded.d.ts +0 -2
- package/dist/src/docs/embedded.js +0 -39
- package/dist/src/docs/embedded.js.map +0 -1
- package/dist/src/docs/manifest.d.ts +0 -23
- package/dist/src/docs/surface.d.ts +0 -12
- package/dist/src/electron/backend.d.ts +0 -50
- package/dist/src/electron/backend.js +0 -371
- package/dist/src/electron/backend.js.map +0 -1
- package/dist/src/electron/chrome.d.ts +0 -24
- package/dist/src/electron/chrome.js +0 -133
- package/dist/src/electron/chrome.js.map +0 -1
- package/dist/src/electron/driver.d.ts +0 -42
- package/dist/src/electron/driver.js +0 -238
- package/dist/src/electron/driver.js.map +0 -1
- package/dist/src/electron/event-buffer.d.ts +0 -16
- package/dist/src/electron/event-buffer.js +0 -59
- package/dist/src/electron/event-buffer.js.map +0 -1
- package/dist/src/electron/page.js +0 -834
- package/dist/src/electron/registry.d.ts +0 -104
- package/dist/src/electron/registry.js +0 -316
- package/dist/src/electron/registry.js.map +0 -1
- package/dist/src/electron/streams.d.ts +0 -16
- package/dist/src/electron/streams.js +0 -48
- package/dist/src/electron/streams.js.map +0 -1
- package/dist/src/embedded/index.d.ts +0 -39
- package/dist/src/embedded/index.js +0 -71
- package/dist/src/embedded/index.js.map +0 -1
- package/dist/src/host/bridge.d.ts +0 -50
- package/dist/src/host/doctor.d.ts +0 -34
- package/dist/src/host/extension.d.ts +0 -3
- package/dist/src/host/host.d.ts +0 -3
- package/dist/src/host/ipc.d.ts +0 -14
- package/dist/src/host/jsonc-config.d.ts +0 -1
- package/dist/src/host/launch.d.ts +0 -11
- package/dist/src/host/native-messaging.d.ts +0 -28
- package/dist/src/host/opencode.d.ts +0 -6
- package/dist/src/host/pi.d.ts +0 -6
- package/dist/src/host/registration.d.ts +0 -24
- package/dist/src/host/setup.d.ts +0 -7
- package/dist/src/host/socket.d.ts +0 -25
- package/dist/src/host/state.d.ts +0 -39
- package/dist/src/launcher/stdio.d.ts +0 -3
- package/dist/src/lib/paths.d.ts +0 -1
- package/dist/src/lib/sources.d.ts +0 -5
- package/dist/src/main.d.ts +0 -2
- package/dist/src/mcp/catalog.d.ts +0 -202
- package/dist/src/mcp/js-session.d.ts +0 -63
- package/dist/src/mcp/server.d.ts +0 -15
- package/dist/src/protocol.d.ts +0 -318
- package/dist/src/recon/analyzer.d.ts +0 -43
- package/dist/src/recon/discover.d.ts +0 -48
- package/dist/src/runtime/runtime.d.ts +0 -148
- package/dist/src/shared/aria-tree.d.ts +0 -2
- package/dist/src/shared/element-ref.d.ts +0 -4
- package/dist/src/shared/engine.d.ts +0 -50
- package/dist/src/shared/injected-source.d.ts +0 -2
- package/dist/src/shared/page-contract.d.ts +0 -256
- package/dist/src/sites/define.d.ts +0 -28
- package/dist/src/sites/drafts.d.ts +0 -39
- package/dist/src/sites/executor.d.ts +0 -34
- package/dist/src/sites/loader.d.ts +0 -84
- package/dist/src/sites/schema.d.ts +0 -11
- package/dist/src/version.d.ts +0 -2
package/docs/js-tool.md
CHANGED
|
@@ -13,9 +13,11 @@ await tab.observe();
|
|
|
13
13
|
Or borrow a user tab:
|
|
14
14
|
```js
|
|
15
15
|
let matches = await browser.user.openTabs({query: 'example.com', limit: 20});
|
|
16
|
-
matches;
|
|
16
|
+
matches.items;
|
|
17
17
|
```
|
|
18
|
-
|
|
18
|
+
The result reports `totalVisible`, `totalInScope`, `excluded`, `matched`, and `hasMore`. `scope:"unclaimed"` excludes actively owned and unsupported tabs. Query is a trimmed case-insensitive literal substring of URL OR title, without whitespace token splitting. For more results, pass `offset: matches.nextOffset` with the same query and limit; each call is a fresh snapshot. Zero matches is a valid result; invalid transport responses are errors.
|
|
19
|
+
|
|
20
|
+
Copy an item’s numeric `tabId` into `await browser.user.claimTab({tabId: ...})`. Store the returned Tab handle, then observe it. Session handles come from `await browser.tabs.list()` and `await browser.tabs.get(id)`.
|
|
19
21
|
|
|
20
22
|
After reading the observation, call `await tab.act({action:'click', target:{ref: '...'}})` using a returned ref, then `await tab.observe()` or `await tab.expect({text:'...'})` with the expected result. `await tab.read()` reads document text. Batch determined steps; return at new decision points.
|
|
21
23
|
|
|
@@ -36,3 +38,9 @@ Finish with `session_finalize`. Use `doctor` for connection/execution status and
|
|
|
36
38
|
Reuse the same target for verification: `await tab.expect({target, value:"42"})`. Continue captured output with `tab.observe(result.next)` or `tab.read(result.next)`. Pass an `openedTabs` entry directly to `browser.tabs.get`, and the returned download object to `tab.download(result.download)`.
|
|
37
39
|
|
|
38
40
|
Tab handles expose async methods: use `await tab.url()` and `await tab.title()`. Entries returned by `browser.tabs.list()` are snapshots with string `url` and `title` fields. Inspecting or converting a remote method to a string describes the method locally; it never reads the page.
|
|
41
|
+
|
|
42
|
+
### Page evaluation contract
|
|
43
|
+
|
|
44
|
+
Use `await tab.evaluate(value => value, {arg: data})`. The second argument is a strict options object with only `arg`, `frame`, and `timeoutMs`; extra positional arguments and unknown fields fail before dispatch. Source strings do not accept `arg`. Functions run in the page and cannot capture REPL variables.
|
|
45
|
+
|
|
46
|
+
Arguments are plain JSON data: null, booleans, strings, finite numbers (excluding negative zero), dense arrays and plain objects. Root `arg: undefined` is allowed. Nested undefined, non-finite numbers, BigInt, functions, special objects, accessors, symbol keys and cycles are rejected, never silently rewritten. Convert special values explicitly. API handles can be passed to APIs that accept them; they are not page data. Errors with `dispatched:false` mean the rejected invocation had no page effects. This does not undo earlier calls in the same cell.
|
package/docs/tab-lifecycle.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Use these methods in `js`, awaiting every call. Start with `await browser.nameSession('🔎 Research')`, then `let tab = await browser.tabs.new(url)`. Agent-created tabs open in a named Chrome group, in the background, muted until the user looks at them.
|
|
4
4
|
|
|
5
|
-
To use an existing tab, call `await browser.user.openTabs({query:'…',limit:20})`, then `let tab = await browser.user.claimTab({tabId})`. Discovery is recency-sorted,
|
|
5
|
+
To use an existing tab, call `await browser.user.openTabs({query:'…',limit:20})`, then `let tab = await browser.user.claimTab({tabId})`. Read the returned `items` array. Discovery reports its `scope:"unclaimed"`, visible/in-scope totals, excluded owned/unsupported counts, and match count. Matching is a trimmed, case-insensitive literal substring of URL OR title (no token splitting). Results are recency-sorted with tabId as a tie-breaker, default to 20 and allow up to 100 per page. Continue with `offset: nextOffset` while `hasMore`; each request is a fresh snapshot, so tab changes can shift pagination. Discovery never claims or loads a tab. To claim the foreground tab, use `{active:true}`. Unique URL/title lookup is also supported; `expectedUrl` and `expectedTitle` check exact identity when necessary. Claiming alone does not observe the page. Claimed user tabs stay outside the agent group and are never closed by finalize.
|
|
6
6
|
|
|
7
7
|
`await browser.tabs.list()` returns controlled tabs with string `id`, numeric backend `tabId`, `origin` and `state`. Obtain a handle with `await browser.tabs.get(id)`. The page id is stable across navigation and becomes stale after logical closure. In Electron it also survives WebContents replacement; `lifecycle` reports dormant, loading or ready. A newly attaching extension tab may return `pending:true` without an id; match its numeric `tabId` on a later list call. Unknown ids are rejected rather than adopted.
|
|
8
8
|
|