@github/copilot-language-server 1.562.0 → 1.564.0
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/dist/assets/cls-builtin-plugins/package.json +12 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/.mcp.json +9 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/.plugin/plugin.json +11 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/README.md +69 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/channel.json +12 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/dist/browser-mcp.cjs +130 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/dist/browser-run-worker.cjs +2656 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/dist/native-host.cjs +45 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/hooks/hooks.json +16 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/scripts/activate.mjs +29 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/scripts/deactivate.mjs +7 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/scripts/doctor.mjs +1580 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/scripts/nativeMessagingRegistration.mjs +8198 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/skills/activate/SKILL.md +24 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/skills/browser-use/BROWSER-RUN.md +382 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/skills/browser-use/SKILL.md +254 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/skills/deactivate/SKILL.md +23 -0
- package/dist/assets/cls-builtin-plugins/plugins/browser-use/skills/doctor/SKILL.md +42 -0
- package/dist/main.js +1181 -1147
- package/package.json +9 -8
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: activate
|
|
3
|
+
description: Activate Copilot Browser in the current session, upgrade its registration, or repair incomplete setup.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Perform a controlled activation of this Browser Use plugin installation.
|
|
7
|
+
|
|
8
|
+
Session start normally performs this activation automatically. Use this skill to enable Browser
|
|
9
|
+
immediately in the current session, upgrade the active registration, repair incomplete or
|
|
10
|
+
mismatched setup, or when the user explicitly requests activation.
|
|
11
|
+
|
|
12
|
+
Resolve `../../scripts/activate.mjs` relative to this skill's directory and run exactly:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
node <absolute-path-to-activate.mjs>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Wait for the activation process to finish before using Browser tools.
|
|
19
|
+
|
|
20
|
+
The script checks connectivity itself for up to 15 seconds and returns early when a browser
|
|
21
|
+
connects. Report the activation result without adding your own sleep or connectivity polling.
|
|
22
|
+
Use `/browser-use:doctor` if Browser has connection problems.
|
|
23
|
+
|
|
24
|
+
If activation fails, report the failure without retrying with modified arguments.
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# Browser Code Mode
|
|
2
|
+
|
|
3
|
+
Read this reference completely before the first `run_javascript` call in a task. `run_javascript` executes
|
|
4
|
+
one disposable Guest Program against one existing Browser Connection. Use it for repetitive or
|
|
5
|
+
conditional work, or to batch known actions and their result checks. Direct tools remain suitable
|
|
6
|
+
for short, non-repetitive steps. A run is sequential, not an atomic transaction; committed input is
|
|
7
|
+
not rolled back if a later step fails.
|
|
8
|
+
|
|
9
|
+
## Call shape
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"connectionId": "opaque ID from connection_request",
|
|
14
|
+
"summary": "Short description shown in the browser approval UI",
|
|
15
|
+
"code": "const title = await tab.locator('h1').innerText(); return { title };",
|
|
16
|
+
"timeoutMs": 15000
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`summary` is required and limited to 160 characters. It describes the intended run but is not an
|
|
21
|
+
authorization or a verified execution plan. `code` is an async-function body, not JSON, a quoted
|
|
22
|
+
string, or a Markdown fence. `timeoutMs` is optional, accepts integers from 1000 through 30000,
|
|
23
|
+
and can only lower the 30-second active JavaScript budget. Browser operation waits do not consume
|
|
24
|
+
that budget; Guest callbacks and resumptions do. Per-operation timeouts are separate.
|
|
25
|
+
|
|
26
|
+
The browser issues a Run Grant before the Guest Program starts, requesting approval unless
|
|
27
|
+
persistent policy or an applicable origin grant allows it. Nested operations do not prompt separately.
|
|
28
|
+
Same-origin navigation remains in that Run Grant. `tab.goto()` checks approval before targeting a
|
|
29
|
+
different scheme, hostname, or non-default port. Hostname aliases such as `localhost` and
|
|
30
|
+
`127.0.0.1` remain distinct even on the same port. The popup says **Run on** when starting the Run
|
|
31
|
+
Grant and **Extend run to** when adding an origin. A cross-origin redirect or later operation
|
|
32
|
+
pauses for any required approval before page data is returned. A retained all-operations origin
|
|
33
|
+
approval may authorize later runs on that origin. A current policy block defeats older grants.
|
|
34
|
+
|
|
35
|
+
## Globals
|
|
36
|
+
|
|
37
|
+
- `tab`: the Browser Connection's single managed tab.
|
|
38
|
+
- `checkpoint(name, value)`: retain one named JSON-serializable stage result, including when a later
|
|
39
|
+
operation fails. Names contain 1 to 64 characters; at most 64 checkpoints share the output
|
|
40
|
+
budget.
|
|
41
|
+
- `text(value)`: append one bounded text item.
|
|
42
|
+
- `image(handle)`: append an `ImageHandle` returned by `tab.screenshot()`.
|
|
43
|
+
- `console.log/info/warn/error(...values)`: append bounded diagnostic logs.
|
|
44
|
+
- `sleep(milliseconds)`: await a delay capped at 10 seconds.
|
|
45
|
+
- `setTimeout(callback, milliseconds)` and `clearTimeout(id)`: timers capped at 10 seconds. Pending
|
|
46
|
+
timers do not keep the Guest Program alive.
|
|
47
|
+
- `exit()`: finish successfully with a `null` return value.
|
|
48
|
+
|
|
49
|
+
Node.js, `process`, `require`, files, environment variables, `fetch`, network sockets, imports,
|
|
50
|
+
page evaluation, raw CDP, and private Browser capabilities are unavailable.
|
|
51
|
+
|
|
52
|
+
## `tab` interface
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
type WaitState = "attached" | "detached" | "visible" | "hidden";
|
|
56
|
+
type LocatorText = string | RegExp;
|
|
57
|
+
type FrameSnapshot = {
|
|
58
|
+
frameRef: string; // diagnostics and tree relationships only; not a routing argument
|
|
59
|
+
owner?: { id?: string; name?: string };
|
|
60
|
+
title: string;
|
|
61
|
+
url: string;
|
|
62
|
+
content: string;
|
|
63
|
+
omissions: string[];
|
|
64
|
+
frames: FrameSnapshot[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type Snapshot = {
|
|
68
|
+
title: string;
|
|
69
|
+
url: string;
|
|
70
|
+
content: string;
|
|
71
|
+
omissions: string[];
|
|
72
|
+
focus?: { ref: string };
|
|
73
|
+
selection?: { ref: string; kind: string; start: number; end: number; collapsed: boolean };
|
|
74
|
+
frames?: FrameSnapshot[];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type ImageHandle = Readonly<{
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
mimeType: "image/jpeg";
|
|
81
|
+
sizeBytes: number;
|
|
82
|
+
}>;
|
|
83
|
+
|
|
84
|
+
type LocatorFilter = {
|
|
85
|
+
hasText?: LocatorText;
|
|
86
|
+
hasNotText?: LocatorText;
|
|
87
|
+
has?: Locator;
|
|
88
|
+
hasNot?: Locator;
|
|
89
|
+
visible?: boolean;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
type ClickOptions = {
|
|
93
|
+
button?: "left" | "right" | "middle";
|
|
94
|
+
modifiers?: Array<"Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift">;
|
|
95
|
+
force?: boolean;
|
|
96
|
+
timeoutMs?: number;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
type KeyboardInput = string | { key: string; text?: never } | { text: string; key?: never };
|
|
100
|
+
|
|
101
|
+
type Locator = {
|
|
102
|
+
locator(selector: string, filter?: LocatorFilter): Locator;
|
|
103
|
+
getByRole(role: string, options?: { name?: LocatorText; exact?: boolean }): Locator;
|
|
104
|
+
getByText(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
105
|
+
getByLabel(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
106
|
+
getByPlaceholder(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
107
|
+
getByTestId(testId: string): Locator;
|
|
108
|
+
filter(options?: LocatorFilter): Locator;
|
|
109
|
+
first(): Locator;
|
|
110
|
+
last(): Locator;
|
|
111
|
+
nth(index: number): Locator;
|
|
112
|
+
and(other: Locator): Locator;
|
|
113
|
+
or(other: Locator): Locator;
|
|
114
|
+
contentFrame(): FrameLocator;
|
|
115
|
+
closedShadow(): Locator;
|
|
116
|
+
all(): Promise<Locator[]>;
|
|
117
|
+
|
|
118
|
+
click(options?: ClickOptions): Promise<null>;
|
|
119
|
+
dblclick(options?: ClickOptions): Promise<null>;
|
|
120
|
+
fill(value: string, options?: { timeoutMs?: number }): Promise<null>;
|
|
121
|
+
type(value: string, options?: { timeoutMs?: number }): Promise<null>;
|
|
122
|
+
press(input: KeyboardInput, options?: { timeoutMs?: number }): Promise<null>;
|
|
123
|
+
waitFor(options: { state: WaitState; timeoutMs?: number }): Promise<null>;
|
|
124
|
+
scrollIntoViewIfNeeded(options?: { timeoutMs?: number }): Promise<null>;
|
|
125
|
+
count(): Promise<number>;
|
|
126
|
+
isVisible(): Promise<boolean>;
|
|
127
|
+
isEnabled(): Promise<boolean>;
|
|
128
|
+
allTextContents(options?: { timeoutMs?: number }): Promise<string[]>;
|
|
129
|
+
textContent(options?: { timeoutMs?: number }): Promise<string | null>;
|
|
130
|
+
innerText(options?: { timeoutMs?: number }): Promise<string>;
|
|
131
|
+
getAttribute(name: string, options?: { timeoutMs?: number }): Promise<string | null>;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
type FrameLocator = {
|
|
135
|
+
locator(selector: string, filter?: LocatorFilter): Locator;
|
|
136
|
+
getByRole(role: string, options?: { name?: LocatorText; exact?: boolean }): Locator;
|
|
137
|
+
getByText(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
138
|
+
getByLabel(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
139
|
+
getByPlaceholder(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
140
|
+
getByTestId(testId: string): Locator;
|
|
141
|
+
frameLocator(selector: string): FrameLocator;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
type Tab = {
|
|
145
|
+
frameLocator(selector: string): FrameLocator;
|
|
146
|
+
locator(selector: string, filter?: LocatorFilter): Locator;
|
|
147
|
+
getByRole(role: string, options?: { name?: LocatorText; exact?: boolean }): Locator;
|
|
148
|
+
getByText(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
149
|
+
getByLabel(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
150
|
+
getByPlaceholder(text: LocatorText, options?: { exact?: boolean }): Locator;
|
|
151
|
+
getByTestId(testId: string): Locator;
|
|
152
|
+
|
|
153
|
+
url(): Promise<string>;
|
|
154
|
+
goto(url: string, options?: { timeoutMs?: number }): Promise<string>;
|
|
155
|
+
reload(options?: { timeoutMs?: number }): Promise<string>;
|
|
156
|
+
goBack(options?: { timeoutMs?: number }): Promise<string>;
|
|
157
|
+
goForward(options?: { timeoutMs?: number }): Promise<string>;
|
|
158
|
+
waitForURL(pattern: string, options?: { timeoutMs?: number }): Promise<string>;
|
|
159
|
+
snapshot(): Promise<Snapshot>;
|
|
160
|
+
screenshot(options?: { fullPage?: boolean; clip?: { x: number; y: number; width: number; height: number }; timeoutMs?: number }): Promise<ImageHandle>;
|
|
161
|
+
click(ref: string, options?: ClickOptions & { doubleClick?: boolean }): Promise<{ outcome: string }>;
|
|
162
|
+
hover(ref: string): Promise<{ outcome: string }>;
|
|
163
|
+
keyboard(input: KeyboardInput, options?: { ref?: string; timeoutMs?: number }): Promise<{ outcome: string }>;
|
|
164
|
+
type(text: string, options?: { ref?: string; submitKey?: string }): Promise<{ outcome: string }>;
|
|
165
|
+
fill(text: string, options: { ref: string }): Promise<{ outcome: string }>;
|
|
166
|
+
};
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`waitForURL()` string patterns match the complete normalized URL: `*` matches within one path
|
|
170
|
+
segment and `**` crosses `/` separators. Navigation methods return the final normalized URL.
|
|
171
|
+
Reload, back, and forward wait for a loading/URL transition or tab replacement after the action
|
|
172
|
+
starts; they do not accept a stale pre-navigation `complete` tab.
|
|
173
|
+
Navigation and URL waits default to 30 seconds; their per-operation `timeoutMs` accepts 1–120000
|
|
174
|
+
milliseconds. `goto`, reload, back, and forward still wait for load completion. This budget is
|
|
175
|
+
separate from the top-level active-JavaScript budget. If navigation times out, inspect the current
|
|
176
|
+
URL and page before deciding the next action: the page may still be loading after dispatch.
|
|
177
|
+
|
|
178
|
+
Locators support Playwright CSS, XPath, role, text, label, placeholder, test-id, and internal
|
|
179
|
+
selector syntax in the main document and open Shadow DOM. In supported dev/production builds,
|
|
180
|
+
when the default-Off **Advanced page surfaces · Experimental** setting was enabled before this
|
|
181
|
+
Browser Connection was opened, use `frameLocator()`, nested `FrameLocator.frameLocator()`, `contentFrame()`, and
|
|
182
|
+
`closedShadow()` to cross each frame or page-author Closed Shadow Root explicitly. Ordinary
|
|
183
|
+
Locators never cross these boundaries. Frames use their actual non-opaque origins for browser-owned
|
|
184
|
+
policy and may trigger one origin/count subset approval; the setting and approval choices are never inferred
|
|
185
|
+
by the agent. Single-target methods reject ambiguity. For `click()` and `dblclick()`, exactly one
|
|
186
|
+
visible match among multiple matches is selected; otherwise narrow the Locator explicitly.
|
|
187
|
+
Ref and Locator clicks scroll to center/nearest, briefly sample the bounding rectangle, and dispatch at
|
|
188
|
+
its center. `force: true` skips visible/enabled checks, not scrolling or rectangle sampling.
|
|
189
|
+
Both wait for visible/enabled state unless forced. Refs remain bound to the snapshot element;
|
|
190
|
+
Locators may resolve again before input. Neither entry guarantees the intended element receives input:
|
|
191
|
+
an ordinary overlay may receive it instead. Read back the application result before continuing.
|
|
192
|
+
Both retain authorization, document/ref identity, protected-target, new-window and ancestor
|
|
193
|
+
frame-boundary checks, including with force. `ControlOrMeta` selects Control on Windows/Linux
|
|
194
|
+
and Meta on macOS. Other actions do not accept force.
|
|
195
|
+
`scrollIntoViewIfNeeded()` asks Chromium to perform the minimum `nearest` scroll
|
|
196
|
+
through the viewport and every clipping/scrollable ancestor for one already-loaded strict target.
|
|
197
|
+
It does this even when the target's rectangle is inside the viewport, because an overflow ancestor
|
|
198
|
+
may still clip it. It cannot locate a virtual-list item that is not yet in the DOM. Offscreen
|
|
199
|
+
scrolling across multiple frame boundaries is not supported; work from an exposed boundary or hand
|
|
200
|
+
that scroll to the user rather than repeatedly retrying a clipped frame chain. Actions that open a
|
|
201
|
+
new tab or window are rejected.
|
|
202
|
+
|
|
203
|
+
Every terminal Locator action re-resolves and freezes its exact Element before input.
|
|
204
|
+
A successful mutating call confirms that input was dispatched; it does not prove
|
|
205
|
+
that application code accepted the input or changed its data model. Read back the smallest relevant
|
|
206
|
+
state and assert the expected postcondition instead of treating dispatch as application success.
|
|
207
|
+
Password, authentication-code, payment, and file controls cannot be read,
|
|
208
|
+
operated, or observed through Locator wait states. An existing Protected Control is rejected before `attached`,
|
|
209
|
+
`detached`, `visible`, or `hidden` is evaluated. Collection
|
|
210
|
+
text preserves positions with `[PROTECTED CONTROL]`; high-confidence tokens are masked. Result
|
|
211
|
+
omissions report when sensitive content was withheld.
|
|
212
|
+
|
|
213
|
+
## Input semantics
|
|
214
|
+
|
|
215
|
+
| API | Behavior |
|
|
216
|
+
| --- | --- |
|
|
217
|
+
| `Locator.click()` / `Locator.dblclick()` | Dispatch a single or double pointer click on the target. |
|
|
218
|
+
| `Locator.fill(text)` | Replace the contents of a native input, textarea or contenteditable target. |
|
|
219
|
+
| `Locator.type(text)` | Insert text at the target's selection without automatically clearing its contents. |
|
|
220
|
+
| `Locator.press(key)` / `Locator.press({ key })` | Focus the target as needed, then dispatch a key or chord. |
|
|
221
|
+
| `tab.type(text)` | Insert at the current focused editor's selection; selected text is replaced, otherwise text is inserted at the caret. |
|
|
222
|
+
| `tab.type(text, { ref })` | Focus the editable target as needed, then insert at its selection, just like Locator.type. |
|
|
223
|
+
| `tab.fill(text, { ref })` | Replace the complete editable target content, just like Locator.fill; empty text clears it. |
|
|
224
|
+
| `tab.keyboard(key, { ref? })` / `tab.keyboard({ key }, { ref? })` | Dispatch a key or chord; without a ref preserve current focus, otherwise focus the target as needed. |
|
|
225
|
+
| `tab.keyboard({ text }, { ref? })` / `Locator.press({ text })` | Insert characters individually, preserving content outside the selection; an explicit target is focused as needed. |
|
|
226
|
+
|
|
227
|
+
The standalone `keyboard` tool requires exactly one of `key` or `text`; a string passed to a
|
|
228
|
+
code-mode keyboard method always means a key, not literal text. Ref-based and Locator input use
|
|
229
|
+
the same target-input implementation. Without a target, input preserves current focus and selection;
|
|
230
|
+
it does not search for or focus another editor. A ref chooses the target, never the replacement mode.
|
|
231
|
+
The standalone `type` tool inserts with or without a ref; `fill` requires a ref and replaces the target.
|
|
232
|
+
|
|
233
|
+
Ordinary `type` uses plain-text virtual paste; Markdown remains literal text. `fill` first asks
|
|
234
|
+
the injected engine to replace supported native values or select the target content. Only when
|
|
235
|
+
text input is still needed does it paste; empty fill deletes the selection. `type` preserves content
|
|
236
|
+
outside the selection. The synthetic paste
|
|
237
|
+
event allows an editor to handle the insertion; it is not a sequence of trusted character keys.
|
|
238
|
+
Use `keyboard({ text })` or `Locator.press({ text })` when an editor needs
|
|
239
|
+
character key events: printable ASCII and line endings use keydown/keyup, other Unicode and tab
|
|
240
|
+
use single-code-point text insertion. This is not OS keyboard or IME emulation.
|
|
241
|
+
|
|
242
|
+
The standalone `keyboard` and `screenshot` tools, their tab methods, and Locator operation
|
|
243
|
+
options accept `timeoutMs` from 1 to 120000. This is an operation execution budget, not the
|
|
244
|
+
top-level `run_javascript.timeoutMs` active-JavaScript budget; approval and queue waits are
|
|
245
|
+
separate. Screenshot and ordinary operations default to 30 seconds. Sequential text defaults
|
|
246
|
+
to 30 seconds plus its scheduled 50 ms inter-character delays, capped at 120 seconds. An
|
|
247
|
+
explicit timeout replaces this default, including when shorter. Preparation consumes the same
|
|
248
|
+
budget as dispatch; bounded cleanup may run after expiration. Partial input is possible:
|
|
249
|
+
inspect the page after a timeout and do not replay the entire input automatically.
|
|
250
|
+
|
|
251
|
+
Literal input leaves the system clipboard unchanged. Editors requiring trusted paste events may
|
|
252
|
+
ignore its synthetic event. During dispatch, the target document's `navigator.clipboard` reads and writes
|
|
253
|
+
use a temporary virtual text store; the original methods are restored afterwards. Delayed reads
|
|
254
|
+
started after restoration and previously cached native methods are outside that scope.
|
|
255
|
+
No clipboard content is retained for a later Control+V. These input
|
|
256
|
+
methods report dispatch, not application acceptance; observe the result before choosing another
|
|
257
|
+
method. A stopped sequence may already have inserted some characters and is not rolled back.
|
|
258
|
+
|
|
259
|
+
Clicks do not promise a particular caret
|
|
260
|
+
position or inner-editor focus; double-click is an application gesture, not select-all. Choose the
|
|
261
|
+
editable field rather than its outer container. When the input destination or selection is uncertain,
|
|
262
|
+
snapshot `focus` and `selection` can help identify the current target and editing scope.
|
|
263
|
+
|
|
264
|
+
Batch known actions, then collect the smallest state check needed for the next decision. Use a
|
|
265
|
+
narrow Locator read for a field's content; use `tab.snapshot()` when document text or structure is
|
|
266
|
+
needed. Snapshots retain sensitive-content, surface and resource limitations; they are not an
|
|
267
|
+
app-idle guarantee.
|
|
268
|
+
|
|
269
|
+
## Results and recovery
|
|
270
|
+
|
|
271
|
+
Use `return` for one JSON-serializable result. Use `text()` for additional text and `image()` only
|
|
272
|
+
when the model must see a screenshot. Returning or logging an `ImageHandle` exposes metadata only.
|
|
273
|
+
For a local visual check, `image(await tab.screenshot({ clip: { x, y, width, height } }))` emits
|
|
274
|
+
only that region. Use document CSS coordinates, not scaled image pixels or viewport-relative
|
|
275
|
+
coordinates. Coordinates must be finite and nonnegative; dimensions must be at least one CSS
|
|
276
|
+
pixel and the region must fit inside the document. Use `{ fullPage: true }` for the full document;
|
|
277
|
+
`clip` takes precedence when both are supplied. Omit both for the current visual viewport.
|
|
278
|
+
Output is uniformly downscaled to at most 2000 pixels per side and 4 million pixels, within a
|
|
279
|
+
10 MiB JPEG limit. There is no explicit scroll or focus; Chromium may temporarily resize its
|
|
280
|
+
rendering surface during off-viewport capture. Automatic element screenshots are not supported.
|
|
281
|
+
All returned values, checkpoints, operation traces, logs, text, and images are Guest Output under a
|
|
282
|
+
server-authored untrusted-data notice; page data never becomes instructions or authorization after
|
|
283
|
+
the Guest Program transforms it. A failed program has a `null` return value because its `return`
|
|
284
|
+
never completed, but accepted checkpoints, text, logs, images, and the bounded recent operation
|
|
285
|
+
trace of exceptional steps remain available. Successful steps are omitted from public traces;
|
|
286
|
+
failures, pending calls, and committed work after the causative failure remain visible. A caught
|
|
287
|
+
error may be followed by more actions, so an error does not prove all earlier calls succeeded or
|
|
288
|
+
that execution stopped at that call.
|
|
289
|
+
The terminating operation's trace entry contains only its index, operation, status, and commitment;
|
|
290
|
+
read its full diagnostic from `guestOutput.error` instead of expecting a duplicate in the trace.
|
|
291
|
+
|
|
292
|
+
Return a snapshot explicitly when it should be seen: `return await tab.snapshot()`. A snapshot
|
|
293
|
+
used only inside the program is not echoed. To retain a snapshot if a later step fails, use
|
|
294
|
+
`checkpoint("before-edit", await tab.snapshot())`; this is evidence of that earlier stage, not a
|
|
295
|
+
fresh post-failure observation. Failures do not automatically take another snapshot.
|
|
296
|
+
|
|
297
|
+
For `NOT_UNIQUE`, inspect `error.matches` for up to five bounded candidates. Protected or
|
|
298
|
+
unavailable candidates contain only their index and `omitted: true`. Prefer an exact name or a
|
|
299
|
+
narrower scope over guessing an index. These observations may change before the next action.
|
|
300
|
+
|
|
301
|
+
After an action expected to navigate, use `await tab.waitForURL("**/expected-path")` before locating
|
|
302
|
+
new-page controls; this explicit navigation seam revalidates the destination. It is not an
|
|
303
|
+
app-idle or data-persistence check. On an unexpected `PAGE_CHANGED`, observe the current page in a
|
|
304
|
+
new run rather than replaying the preceding click. `CONNECTION_NOT_FOUND` does not identify why a
|
|
305
|
+
connection disappeared: establish an approved connection again and inspect state before deciding
|
|
306
|
+
what remains to be done. The tool cannot silently rebind an expired connection to a tab.
|
|
307
|
+
|
|
308
|
+
Await every `tab` and Locator operation. Finishing with pending browser calls fails with
|
|
309
|
+
`UNAWAITED_OPERATIONS` and cancels calls that have not committed. Browser actions that already
|
|
310
|
+
committed are never rolled back.
|
|
311
|
+
|
|
312
|
+
Nested failures reject a catchable `BrowserError` with `code`, `message`, `operationIndex`,
|
|
313
|
+
`operation`, `source`, `pageUrl`, `committed`, an optional `locator`, and sometimes `retryHint` or
|
|
314
|
+
`reason`.
|
|
315
|
+
The final `guestOutput.error` repeats the diagnostic when the error is not caught. Browser-originated
|
|
316
|
+
errors carry an operation identity in a closure-private WeakMap keyed by the exact Error object, not
|
|
317
|
+
a Guest-visible property. Wrapping a caught browser message or copying its properties into a new
|
|
318
|
+
script error does not misattribute the terminating code or source. `pageUrl` is the
|
|
319
|
+
postflight URL only when its origin is already authorized by the current Run Grant; it is omitted
|
|
320
|
+
rather than disclosing or misreporting an unapproved destination. When navigation has already been
|
|
321
|
+
dispatched but destination approval is denied, the error keeps `APPROVAL_DENIED` and reports
|
|
322
|
+
`committed: "unknown"` without revealing the destination URL. The last 32 operation summaries
|
|
323
|
+
remain in `guestOutput.operations`; source locations are one-based positions in the submitted
|
|
324
|
+
`code`. Use codes such as `PAGE_CHANGED`, `STALE_ELEMENT_REFERENCE`,
|
|
325
|
+
`ELEMENT_NOT_ACTIONABLE`, and `ACTION_OUTCOME_UNKNOWN` instead of parsing messages. Advanced
|
|
326
|
+
boundaries additionally use `ADVANCED_SURFACES_DISABLED`, `DOMAIN_BLOCKED`,
|
|
327
|
+
`UNSUPPORTED_FRAME_ORIGIN`, `APPROVAL_DENIED`, and `RESOURCE_LIMIT_EXCEEDED`. A broad snapshot
|
|
328
|
+
reports only `child-frames`, `closed-shadow-roots`, or `advanced-surface-limit`; do not infer a
|
|
329
|
+
private policy decision or the capability setting from an omission. `ADVANCED_SURFACES_DISABLED`
|
|
330
|
+
can mean an unavailable build or a disabled captured setting: use a supported build, enable the
|
|
331
|
+
Experimental setting when present, and open a new connection. Unconfigured/store builds have no such
|
|
332
|
+
setting to enable. Never immediately replay an action when `committed` is `true` or `"unknown"`;
|
|
333
|
+
inspect current state first. This includes a keyboard continuation that fails after earlier text
|
|
334
|
+
input or part of a chord was already dispatched.
|
|
335
|
+
|
|
336
|
+
An authorized strict-boundary failure may refine `ELEMENT_NOT_ACTIONABLE` with one of these closed
|
|
337
|
+
`reason` values, also retained for an uncaught browser error and its operation trace:
|
|
338
|
+
|
|
339
|
+
| Reason | Next observation |
|
|
340
|
+
| --- | --- |
|
|
341
|
+
| `BOUNDARY_NOT_FOUND` | Check whether the chosen owner selector matches the current DOM. |
|
|
342
|
+
| `BOUNDARY_NOT_UNIQUE` | Narrow the owner Locator deliberately. |
|
|
343
|
+
| `NOT_ATTACHED_FRAME_OWNER` | Check that the chosen element owns an attached frame and observe loading state. |
|
|
344
|
+
| `NO_PAGE_AUTHOR_CLOSED_ROOT` | Check the host choice; ordinary Locators already traverse open Shadow DOM. |
|
|
345
|
+
|
|
346
|
+
An absent reason remains an ordinary actionability failure. These reasons do not expose raw CDP
|
|
347
|
+
identity or replace authorization, Protected Control, or commit-state checks.
|
|
348
|
+
|
|
349
|
+
Hard limits include 64 KiB source, 64 MiB Guest heap, 1 MiB Guest stack, 30 seconds active
|
|
350
|
+
JavaScript, 10 minutes total wall time, 256 browser operations, 8 pending operations, 64 Advanced
|
|
351
|
+
Surfaces per operation and per Run (distinct frame epochs and Closed Shadow Root identities), 4 MiB
|
|
352
|
+
per nested result, 5000 Locator collection entries, 256 KiB result/text/checkpoints, 64 KiB logs, the
|
|
353
|
+
last 32 operation summaries, at most 1024 text items, at most 1024 log items, an 8 KiB final script
|
|
354
|
+
error message, and at most two images totaling 20 MiB. Text and log budgets charge their JSON UTF-8
|
|
355
|
+
serialized size, including escaping and separators. The first operation-admission limit violation
|
|
356
|
+
latches the Run failure even if Guest code catches it; later requests are rejected without growing
|
|
357
|
+
the parent trace or reaching the browser. `OUTPUT_TOO_LARGE` retains previously accepted small
|
|
358
|
+
output and asks for a narrower retry.
|
|
359
|
+
|
|
360
|
+
Run Grant close is attempted once. If revocation cannot be confirmed, an existing execution failure
|
|
361
|
+
remains primary with its partial Guest Output, cleanup is reported separately, and the MCP retains
|
|
362
|
+
exclusive run ownership instead of forwarding direct tools. Explicitly finalize the Browser
|
|
363
|
+
Connection once to revoke the whole connection. If a canceled Run open cannot confirm its
|
|
364
|
+
compensating close, the Native Host also retains a fail-closed peer state and rejects direct tools
|
|
365
|
+
with `RUN_IN_PROGRESS` until that finalization. Authorization remains fail-closed even if closing the
|
|
366
|
+
managed tab fails; tab closure may be retried by normal connection maintenance.
|
|
367
|
+
|
|
368
|
+
## Example
|
|
369
|
+
|
|
370
|
+
```js
|
|
371
|
+
const rows = await tab.getByRole("row").all();
|
|
372
|
+
checkpoint("rows-loaded", { count: rows.length, url: await tab.url() });
|
|
373
|
+
const approved = [];
|
|
374
|
+
for (const row of rows) {
|
|
375
|
+
if ((await row.innerText()).includes("Pending")) {
|
|
376
|
+
await row.scrollIntoViewIfNeeded();
|
|
377
|
+
await row.getByRole("button", { name: "Approve" }).click();
|
|
378
|
+
approved.push(await row.getAttribute("data-id"));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return { approved };
|
|
382
|
+
```
|