@jackwener/browsermcp 0.0.37-embedded.0 → 0.0.37
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 -36
- package/README.md +0 -91
- package/dist/docs/api-reference.md +5 -5
- package/dist/docs/api-use.md +2 -2
- package/dist/docs/js-tool.md +11 -1
- package/dist/src/api/action-input.js +1 -1
- package/dist/src/api/action-input.js.map +1 -1
- package/dist/src/api/commands.js +3 -3
- package/dist/src/api/commands.js.map +1 -1
- package/dist/src/api/errors.js +46 -2
- package/dist/src/api/errors.js.map +1 -1
- package/dist/src/api/observation.js +5 -0
- package/dist/src/api/observation.js.map +1 -1
- package/dist/src/api/tab.js +28 -3
- package/dist/src/api/tab.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 +22 -3
- package/dist/src/mcp/js-session.js.map +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/shared/aria-tree.js +29 -12
- package/dist/src/shared/aria-tree.js.map +1 -1
- package/docs/api-reference.md +5 -5
- package/docs/api-use.md +2 -2
- package/docs/js-tool.md +11 -1
- package/extension/dist/background.js +42 -1
- package/package.json +3 -12
- package/dist/src/api/action-input.d.ts +0 -62
- package/dist/src/api/agent.d.ts +0 -10
- package/dist/src/api/api.d.ts +0 -54
- package/dist/src/api/browser.d.ts +0 -93
- package/dist/src/api/commands.d.ts +0 -452
- 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 -312
- 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 -50
- 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 -40
- 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 -375
- 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 -43
- package/dist/src/electron/driver.js +0 -241
- 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 -72
- 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 -64
- package/dist/src/mcp/server.d.ts +0 -15
- package/dist/src/protocol.d.ts +0 -320
- 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/api-contract.d.ts +0 -86
- 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
|
@@ -21,7 +21,7 @@ The result reports `totalVisible`, `totalInScope`, `excluded`, `matched`, and `h
|
|
|
21
21
|
|
|
22
22
|
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)`.
|
|
23
23
|
|
|
24
|
-
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()`
|
|
24
|
+
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()` returns an object, not a string: read `result.text`, and pass `result.next` to `tab.read` to continue. Use `read({target:{role:"main"}})` or a specific article to exclude sidebars. Batch determined steps; return at new decision points.
|
|
25
25
|
|
|
26
26
|
When ARIA lacks detail, `await tab.observe({format:'dom'})` returns visible controls with live attributes and the same actionable refs. `await tab.read({target:{ref:'...'}})` reads full text/attributes without scrolling. DOM previews flag `truncated`; pass `dom.next` directly to `tab.observe` to continue the live control list. Child refs automatically retain their observed frame route. Explicit semantic queries and whole-document reads accept the returned `frame` path. A screenshot remains the evidence for canvas, layout and colors.
|
|
27
27
|
|
|
@@ -46,3 +46,13 @@ Tab handles expose async methods: use `await tab.url()` and `await tab.title()`.
|
|
|
46
46
|
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.
|
|
47
47
|
|
|
48
48
|
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.
|
|
49
|
+
|
|
50
|
+
### Readiness and bounded page work
|
|
51
|
+
|
|
52
|
+
`observe()` defaults to the viewport; `observe({viewport:false})` covers the rendered document. It does not scroll to load an entire feed. Empty wrappers and pointer annotations are omitted; unique labels and control states remain.
|
|
53
|
+
|
|
54
|
+
Use `await tab.goto(url, {ready:{target:{role:'main'}, text:'Expected content'}, timeoutMs:15000})` or `await tab.expect(condition, {timeoutMs:15000})` after an action. Targets must be unambiguous. DOM settling is not a content-ready guarantee.
|
|
55
|
+
|
|
56
|
+
`evaluate` defaults to 10000 ms. Pass `{timeoutMs:30000}` for known longer work. A timeout does not cancel page JavaScript and is never automatically retried. For feeds, collect and deduplicate in page-local state in short batches, return counts/progress each batch, and fetch final rows once. Page `window` state survives calls in the same document, but navigation/reload clears it. No generic API can infer how far arbitrary JavaScript got after a timeout.
|
|
57
|
+
|
|
58
|
+
The MCP REPL provides `browser`, `sites`, `tools`, `recon`, `helper` and `nodeRepl`; `describeTool` is not a global here. `helper` exposes the same typed browser commands as MCP. Use `docs_get` for signatures and return types. `tab.close()` returns `{tabId,closed:true}`; optional chaining without a result is not evidence of closure. Releasing a user tab relinquishes control; it does not undo navigation, scrolling or edits.
|
|
@@ -21242,6 +21242,47 @@ function date4(params) {
|
|
|
21242
21242
|
}
|
|
21243
21243
|
|
|
21244
21244
|
// src/api/errors.ts
|
|
21245
|
+
function compactErrorData(data) {
|
|
21246
|
+
let budget = 4e3;
|
|
21247
|
+
let truncated = false;
|
|
21248
|
+
function compact(value, depth) {
|
|
21249
|
+
if (budget <= 0 || depth > 4) {
|
|
21250
|
+
truncated = true;
|
|
21251
|
+
return "[omitted]";
|
|
21252
|
+
}
|
|
21253
|
+
if (typeof value === "string") {
|
|
21254
|
+
const limit = Math.min(600, budget);
|
|
21255
|
+
budget -= Math.min(limit, value.length);
|
|
21256
|
+
if (value.length > limit) {
|
|
21257
|
+
truncated = true;
|
|
21258
|
+
return value.slice(0, limit) + "\u2026";
|
|
21259
|
+
}
|
|
21260
|
+
return value;
|
|
21261
|
+
}
|
|
21262
|
+
if (Array.isArray(value)) {
|
|
21263
|
+
if (value.length > 8) truncated = true;
|
|
21264
|
+
return value.slice(0, 8).map((item) => compact(item, depth + 1));
|
|
21265
|
+
}
|
|
21266
|
+
if (value && typeof value === "object") {
|
|
21267
|
+
const result2 = {};
|
|
21268
|
+
const entries = Object.entries(value);
|
|
21269
|
+
if (entries.length > 20) truncated = true;
|
|
21270
|
+
for (const [key3, item] of entries.slice(0, 20)) {
|
|
21271
|
+
budget -= key3.length;
|
|
21272
|
+
if (key3 === "tabs" && Array.isArray(item)) {
|
|
21273
|
+
result2.tabCount = item.length;
|
|
21274
|
+
result2.tabDiscovery = "Use tabs_list to inspect tabs.";
|
|
21275
|
+
continue;
|
|
21276
|
+
}
|
|
21277
|
+
result2[key3] = compact(item, depth + 1);
|
|
21278
|
+
}
|
|
21279
|
+
return result2;
|
|
21280
|
+
}
|
|
21281
|
+
return value;
|
|
21282
|
+
}
|
|
21283
|
+
const result = compact(data, 0);
|
|
21284
|
+
return { ...result, ...truncated ? { detailsTruncated: true } : {} };
|
|
21285
|
+
}
|
|
21245
21286
|
var ActionError = class extends Error {
|
|
21246
21287
|
constructor(code, message, hint, data) {
|
|
21247
21288
|
super(message);
|
|
@@ -21254,7 +21295,7 @@ var ActionError = class extends Error {
|
|
|
21254
21295
|
hint;
|
|
21255
21296
|
data;
|
|
21256
21297
|
toJSON() {
|
|
21257
|
-
return { ...this.data, code: this.code, message: this.message, ...this.hint && { hint: this.hint } };
|
|
21298
|
+
return { ...compactErrorData(this.data ?? {}), code: this.code, message: this.message, ...this.hint && { hint: this.hint } };
|
|
21258
21299
|
}
|
|
21259
21300
|
};
|
|
21260
21301
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackwener/browsermcp",
|
|
3
|
-
"version": "0.0.37
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "Chrome-backed MCP browser service with optional site adapters.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"browsermcp": "dist/src/main.js"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "node scripts/clean.mjs && node scripts/extract-playwright-injected.mjs && tsc -p tsconfig.json && node scripts/gen-api-reference.mjs && node scripts/render-icons.mjs && node scripts/build-extension.mjs && node scripts/copy-assets.mjs
|
|
22
|
+
"build": "node scripts/clean.mjs && node scripts/extract-playwright-injected.mjs && tsc -p tsconfig.json && node scripts/gen-api-reference.mjs && node scripts/render-icons.mjs && node scripts/build-extension.mjs && node scripts/copy-assets.mjs",
|
|
23
23
|
"build:ext": "node scripts/render-icons.mjs && node scripts/build-extension.mjs",
|
|
24
24
|
"dev": "tsx src/main.ts",
|
|
25
25
|
"test": "vitest run",
|
|
@@ -32,10 +32,7 @@
|
|
|
32
32
|
"pack:store": "npm run build && node scripts/pack-extension.mjs store",
|
|
33
33
|
"pack:manual": "npm run build && node scripts/pack-extension.mjs manual",
|
|
34
34
|
"smoke:native": "node scripts/smoke-native-capabilities.mjs",
|
|
35
|
-
"generate:chrome": "node scripts/gen-chrome-reference.mjs"
|
|
36
|
-
"build:embedded": "tsc -p tsconfig.json && node scripts/build-embedded.mjs && node scripts/copy-assets.mjs",
|
|
37
|
-
"smoke:embedded": "npm run build:embedded && node scripts/run-embedded-smoke.mjs",
|
|
38
|
-
"smoke:embedded:package": "npm run build:embedded && node scripts/smoke-embedded-package.mjs"
|
|
35
|
+
"generate:chrome": "node scripts/gen-chrome-reference.mjs"
|
|
39
36
|
},
|
|
40
37
|
"files": [
|
|
41
38
|
"dist/",
|
|
@@ -63,11 +60,9 @@
|
|
|
63
60
|
"zod": "^4.6.5"
|
|
64
61
|
},
|
|
65
62
|
"devDependencies": {
|
|
66
|
-
"@electron/asar": "^4.3.1",
|
|
67
63
|
"@resvg/resvg-js": "^2.6.2",
|
|
68
64
|
"@types/chrome": "^0.3.0",
|
|
69
65
|
"@types/node": "^22.20.3",
|
|
70
|
-
"electron": "^44.9.0",
|
|
71
66
|
"esbuild": "^0.28.2",
|
|
72
67
|
"playwright-core": "^1.63.0",
|
|
73
68
|
"tsx": "^4.23.13",
|
|
@@ -78,10 +73,6 @@
|
|
|
78
73
|
"./adapter-sdk": {
|
|
79
74
|
"types": "./adapter-sdk/index.d.ts",
|
|
80
75
|
"default": "./adapter-sdk/index.js"
|
|
81
|
-
},
|
|
82
|
-
"./embedded": {
|
|
83
|
-
"types": "./dist/src/embedded/index.d.ts",
|
|
84
|
-
"default": "./dist/src/embedded/index.js"
|
|
85
76
|
}
|
|
86
77
|
}
|
|
87
78
|
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { Expectation } from '../shared/page-contract.js';
|
|
3
|
-
import type { ActAction, Target } from './tab.js';
|
|
4
|
-
export interface RawTarget {
|
|
5
|
-
ref?: string | number;
|
|
6
|
-
selector?: string;
|
|
7
|
-
within?: string;
|
|
8
|
-
nth?: number;
|
|
9
|
-
role?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
text?: string;
|
|
13
|
-
testid?: string;
|
|
14
|
-
x?: number;
|
|
15
|
-
y?: number;
|
|
16
|
-
frame?: Target['frame'];
|
|
17
|
-
}
|
|
18
|
-
export interface ActToolInput {
|
|
19
|
-
action: ActAction;
|
|
20
|
-
target?: RawTarget;
|
|
21
|
-
to?: RawTarget;
|
|
22
|
-
value?: string;
|
|
23
|
-
files?: string[];
|
|
24
|
-
direction?: 'up' | 'down' | 'left' | 'right';
|
|
25
|
-
amount?: number;
|
|
26
|
-
method?: 'cdp' | 'dom';
|
|
27
|
-
timeoutMs?: number;
|
|
28
|
-
settleMs?: number;
|
|
29
|
-
}
|
|
30
|
-
export declare const targetShape: z.ZodObject<{
|
|
31
|
-
ref: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
32
|
-
selector: z.ZodOptional<z.ZodString>;
|
|
33
|
-
within: z.ZodOptional<z.ZodString>;
|
|
34
|
-
nth: z.ZodOptional<z.ZodNumber>;
|
|
35
|
-
role: z.ZodOptional<z.ZodString>;
|
|
36
|
-
name: z.ZodOptional<z.ZodString>;
|
|
37
|
-
label: z.ZodOptional<z.ZodString>;
|
|
38
|
-
text: z.ZodOptional<z.ZodString>;
|
|
39
|
-
testid: z.ZodOptional<z.ZodString>;
|
|
40
|
-
x: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
y: z.ZodOptional<z.ZodNumber>;
|
|
42
|
-
frame: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
|
|
43
|
-
}, z.core.$strict>;
|
|
44
|
-
type Need = 'required' | 'nonempty' | 'present' | 'optional' | 'forbidden';
|
|
45
|
-
export declare const ACTION_RULES: Record<ActAction, {
|
|
46
|
-
target: Need;
|
|
47
|
-
value: Need;
|
|
48
|
-
files: Need;
|
|
49
|
-
to: Need;
|
|
50
|
-
scroll: boolean;
|
|
51
|
-
}>;
|
|
52
|
-
/** What the model can copy into the next call. Wire shape is error.details.expected. */
|
|
53
|
-
export declare function expectedAct(action: ActAction): Record<string, string>;
|
|
54
|
-
export declare function pickTarget(t: RawTarget | undefined, action: ActAction, slot: 'target' | 'to'): Target | undefined;
|
|
55
|
-
export declare function checkActInput(input: ActToolInput): {
|
|
56
|
-
target?: Target;
|
|
57
|
-
to?: Target;
|
|
58
|
-
method?: 'cdp' | 'dom';
|
|
59
|
-
};
|
|
60
|
-
/** Validate the public contract before sending a compiled expectation to the page. */
|
|
61
|
-
export declare function checkExpect(what: Expectation): void;
|
|
62
|
-
export {};
|
package/dist/src/api/agent.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The object model — the single surface behind both the typed MCP tools and the `js` session.
|
|
3
|
-
* agent.browsers → browser.tabs / browser.user / browser.capabilities → tab.observe / tab.act / …
|
|
4
|
-
* sites.<site>.<command>(args) · recon.discover(tab) · tools.define · browser.nameSession / browser.tabs.finalize
|
|
5
|
-
* Split by object: tab.ts, browser.ts, api.ts (context.ts carries what they share). This file re-exports them.
|
|
6
|
-
*/
|
|
7
|
-
export * from './tab.js';
|
|
8
|
-
export * from './browser.js';
|
|
9
|
-
export * from './api.js';
|
|
10
|
-
export * from './context.js';
|
package/dist/src/api/api.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { type BrowserHelper, type BrowserCommands } from './commands.js';
|
|
2
|
-
/**
|
|
3
|
-
* The object model's entry: agent.browsers · sites.<site>.<command>() · recon.discover(tab) · tools.define.
|
|
4
|
-
* One surface behind both the typed entry tools and the `js` session.
|
|
5
|
-
*/
|
|
6
|
-
import type { Runtime } from '../runtime/runtime.js';
|
|
7
|
-
import { discoverEndpoints, type DiscoverResult } from '../recon/discover.js';
|
|
8
|
-
import { listDefinedTools, type ToolDefinition } from '../sites/define.js';
|
|
9
|
-
import type { DraftExpectation } from '../sites/drafts.js';
|
|
10
|
-
import { Tab } from './tab.js';
|
|
11
|
-
import { Browser } from './browser.js';
|
|
12
|
-
export interface AgentApi {
|
|
13
|
-
helper: BrowserHelper;
|
|
14
|
-
agent: {
|
|
15
|
-
browsers: {
|
|
16
|
-
getDefault(): Promise<Browser>;
|
|
17
|
-
};
|
|
18
|
-
browser: Browser;
|
|
19
|
-
documentation: {
|
|
20
|
-
get(name: string): Promise<string | null>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
sites: Record<string, unknown> & {
|
|
24
|
-
search(q: string, limit?: number): Promise<unknown>;
|
|
25
|
-
list(): Promise<unknown>;
|
|
26
|
-
enable(site: string, opts?: {
|
|
27
|
-
write?: boolean;
|
|
28
|
-
}): Promise<{
|
|
29
|
-
site: string;
|
|
30
|
-
tools: string[];
|
|
31
|
-
}>;
|
|
32
|
-
disable(site: string): Promise<boolean>;
|
|
33
|
-
run(site: string, name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
34
|
-
};
|
|
35
|
-
recon: {
|
|
36
|
-
discover(tab: Tab, opts?: Parameters<typeof discoverEndpoints>[1]): Promise<DiscoverResult>;
|
|
37
|
-
};
|
|
38
|
-
tools: {
|
|
39
|
-
define(def: ToolDefinition | (Omit<ToolDefinition, 'func'> & {
|
|
40
|
-
func?: string | ((ctx: Record<string, unknown>) => unknown);
|
|
41
|
-
})): ReturnType<Runtime['defineTool']>;
|
|
42
|
-
try(draftId: string, args: Record<string, unknown>, expect: DraftExpectation): ReturnType<Runtime['tryToolDraft']>;
|
|
43
|
-
activate(draftId: string): ReturnType<Runtime['activateToolDraft']>;
|
|
44
|
-
discard(draftId: string): Promise<ReturnType<Runtime['discardToolDraft']>>;
|
|
45
|
-
list(): Promise<ReturnType<typeof listDefinedTools>>;
|
|
46
|
-
remove(site: string, name: string): ReturnType<Runtime['removeTool']>;
|
|
47
|
-
};
|
|
48
|
-
session: {
|
|
49
|
-
id: string;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export declare function createAgentApi(rt: Runtime, sessionId: string): AgentApi & {
|
|
53
|
-
commands: BrowserCommands;
|
|
54
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { type TabDiscoveryOptions, type TabDiscoveryResult } from '../shared/api-contract.js';
|
|
2
|
-
import type { StreamOptions, StreamReadOptions, StreamBatch } from '../protocol.js';
|
|
3
|
-
import type { CloseUserTabsResult } from '../protocol.js';
|
|
4
|
-
import { Tab } from './tab.js';
|
|
5
|
-
import type { SessionContext } from './context.js';
|
|
6
|
-
export declare class Browser {
|
|
7
|
-
readonly id: string;
|
|
8
|
-
readonly type: 'extension' | 'electron';
|
|
9
|
-
private readonly ctx;
|
|
10
|
-
constructor(id: string, type: 'extension' | 'electron', ctx: SessionContext);
|
|
11
|
-
toJSON(): {
|
|
12
|
-
type: 'Browser';
|
|
13
|
-
id: string;
|
|
14
|
-
backend: string;
|
|
15
|
-
};
|
|
16
|
-
private page;
|
|
17
|
-
private ext;
|
|
18
|
-
/** Chrome APIs through the connected backend. Electron supports an explicit compatibility subset. */
|
|
19
|
-
readonly chrome: {
|
|
20
|
-
call: (method: string, args?: unknown[]) => Promise<unknown>;
|
|
21
|
-
describe: (member: string) => Promise<unknown>;
|
|
22
|
-
watch: (event: string, options?: StreamOptions) => Promise<import("./streams.js").EventStream>;
|
|
23
|
-
};
|
|
24
|
-
/** This extension's own service-worker logs; not logs of other installed extensions. */
|
|
25
|
-
readonly logs: {
|
|
26
|
-
watch: (options?: StreamOptions) => Promise<import("./streams.js").EventStream>;
|
|
27
|
-
read: (options?: StreamReadOptions) => Promise<StreamBatch>;
|
|
28
|
-
};
|
|
29
|
-
readonly tabs: {
|
|
30
|
-
new: (url?: string) => Promise<Tab>;
|
|
31
|
-
list: () => Promise<Array<{
|
|
32
|
-
id?: string;
|
|
33
|
-
tabId: number;
|
|
34
|
-
pending?: true;
|
|
35
|
-
url?: string;
|
|
36
|
-
title?: string;
|
|
37
|
-
active: boolean;
|
|
38
|
-
selected: boolean;
|
|
39
|
-
lifecycle?: "dormant" | "loading" | "ready";
|
|
40
|
-
origin: "agent" | "user";
|
|
41
|
-
state: "active" | "handoff";
|
|
42
|
-
}>>;
|
|
43
|
-
get: (tab: string | {
|
|
44
|
-
tab?: string;
|
|
45
|
-
tabId: number;
|
|
46
|
-
}, opts?: {
|
|
47
|
-
timeoutMs?: number;
|
|
48
|
-
}) => Promise<Tab>;
|
|
49
|
-
selected: () => Promise<Tab | undefined>;
|
|
50
|
-
finalize: (opts?: {
|
|
51
|
-
keep?: Array<{
|
|
52
|
-
tab: string | Tab;
|
|
53
|
-
status: "deliverable" | "handoff";
|
|
54
|
-
}>;
|
|
55
|
-
}) => Promise<{
|
|
56
|
-
closed: string[];
|
|
57
|
-
released: string[];
|
|
58
|
-
retained: string[];
|
|
59
|
-
failed: Array<{
|
|
60
|
-
page: string;
|
|
61
|
-
reason: string;
|
|
62
|
-
}>;
|
|
63
|
-
}>;
|
|
64
|
-
};
|
|
65
|
-
readonly user: {
|
|
66
|
-
/** Unclaimed supported tabs in the visible scope. Query is trimmed, case-insensitive literal substring of URL OR title (no token splitting). Inspect items, matched, totalInScope, excluded and hasMore; continue with nextOffset. Each call takes a fresh snapshot. */
|
|
67
|
-
openTabs: (options?: {
|
|
68
|
-
query?: string | undefined;
|
|
69
|
-
limit?: number | undefined;
|
|
70
|
-
offset?: number | undefined;
|
|
71
|
-
} | undefined) => Promise<TabDiscoveryResult>;
|
|
72
|
-
/** Claim by foreground, id, or unique url/title lookup; expected fields verify the tab's current identity. */
|
|
73
|
-
claimTab: (tab: {
|
|
74
|
-
tabId?: number;
|
|
75
|
-
active?: boolean;
|
|
76
|
-
title?: string;
|
|
77
|
-
url?: string;
|
|
78
|
-
expectedUrl?: string;
|
|
79
|
-
expectedTitle?: string;
|
|
80
|
-
}) => Promise<Tab>;
|
|
81
|
-
/** Close user tabs by Chrome id without claiming or loading their pages. */
|
|
82
|
-
closeTabs: (tabIds: number[]) => Promise<CloseUserTabsResult>;
|
|
83
|
-
};
|
|
84
|
-
nameSession(name: string): Promise<void>;
|
|
85
|
-
readonly capabilities: {
|
|
86
|
-
list: () => Promise<Array<{
|
|
87
|
-
id: string;
|
|
88
|
-
description: string;
|
|
89
|
-
}>>;
|
|
90
|
-
get: (id: string) => Promise<Record<string, unknown>>;
|
|
91
|
-
};
|
|
92
|
-
documentation(): Promise<string>;
|
|
93
|
-
}
|