@radheim/plugin-browser 0.0.0-stage → 2.4.3

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/README.md CHANGED
@@ -1,3 +1,144 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Browser plugin
2
+
3
+ `@radheim/plugin-browser` exposes the desktop browser through Code Mode.
4
+ The server owns tools, invocation scope, and permissions; the desktop owns tabs,
5
+ CDP, captured traffic, evaluations, and capture files. Core only registers the
6
+ plugin. Neither endpoint imports the other's implementation.
7
+
8
+ ```js
9
+ const tab = await tools.browser.tabs.open({ url: "https://example.com" })
10
+ return await tools.browser.snapshot({ tabID: tab.id })
11
+ ```
12
+
13
+ All page operations require a `tabID` returned by `browser.tabs.open/list`.
14
+ Focus selects the visible Review tab, not an implicit command target. Discover
15
+ current signatures with `search({ namespace: "browser" })`.
16
+ Screenshots, clicks and hovers work while the tab is hidden; only a full-page screenshot needs the tab on screen in the Review pane.
17
+
18
+ ## Tools
19
+
20
+ - Tabs: `tabs.list`, `tabs.open`, `tabs.focus`, `tabs.close`.
21
+ - Navigation: `navigate`, `back`, `forward`, `reload`, `stop`, `frames`.
22
+ - Observation: `snapshot`, `find`, `evaluate`, `wait`, `screenshot`.
23
+ - Input: `click`, `hover`, `drag`, `fill`, `fill_form`, `select`, `check`, `press`, `scroll`, `dialog`.
24
+ - Files: `files.upload`, `files.drop`, `files.list`, `files.get`.
25
+ - Diagnostics: `console`, `network.list`, `network.get`.
26
+ - Performance: `trace.start`, `trace.stop`, `trace.analyze`, `cpu.start`, `cpu.stop`, `cpu.analyze`.
27
+ - Memory: `heap.snapshot`, `heap.summary`, `heap.query`, `heap.object`, `heap.compare`.
28
+ - Audits: `lighthouse` (accessibility, SEO, best practices).
29
+
30
+ The source of truth for inputs, descriptions, and outputs is
31
+ `Browser.Operations` in `@radheim/plugin-browser/rpc`.
32
+
33
+ `tabs.open` and `navigate` take a web address in `url` or a workspace file in
34
+ `path`, never both. The server checks that a path is a readable file inside the
35
+ workspace, then sends the desktop a file action: `preview` for `tabs.open`
36
+ (older desktops and servers already exchange it under that name) and
37
+ `navigate.path` for `navigate`. No tool is named after either. The permission
38
+ check for a path names the called operation and `preview`, so a rule, policy or
39
+ hook that denies `browser: preview` still stops it.
40
+
41
+ The built-in `browser` skill (`skill.ts`) teaches the workflow: explicit tab
42
+ IDs, snapshots and refs, showing results to the user, recipes for debugging,
43
+ performance and memory, and recovery after failures. It lists every operation
44
+ from `Browser.Operations`. Like the tools, it is hidden until a desktop browser
45
+ attaches to the session. An attached session lists both to every agent. An agent
46
+ whose configured rules deny the browser, or some of its operations, has each
47
+ such call refused; an `ask` makes each call prompt.
48
+
49
+ The plugin entrypoint only composes its two owners: `connection.ts` manages
50
+ desktop attachments and pending RPC requests; `tools.ts` runs the tool workflow.
51
+ Server-local file IO stays in `files.ts`. The public `rpc.ts` entrypoint remains
52
+ pure and does not load any of these runtime modules.
53
+
54
+ ## Tests
55
+
56
+ Run `bun test` and `bun typecheck` from this package for its contract checks.
57
+ The desktop implementation is the built-in `browser` GUI plugin
58
+ (`packages/gui-plugins/src/browser`); its URL policy tests live there, not in this package.
59
+
60
+ ## RPC
61
+
62
+ The plugin-owned contract is `@radheim/plugin-browser/rpc`. This entrypoint
63
+ contains only schemas and descriptions; it does not load the server plugin or
64
+ filesystem code. The desktop subscribes
65
+ to control events before starting `attach` with `version: 4`. The attachment call
66
+ stays pending for its lifetime. A matching `attached` event is the readiness barrier.
67
+
68
+ - `state` publishes the authoritative tab inventory. Tab lookups read only this
69
+ inventory, so the desktop must publish `state` and wait for its acknowledgment
70
+ before sending `result` for `tabs.open` or `tabs.close`.
71
+ - `control` announces a request ID or cancellation; it never broadcasts arguments,
72
+ script source, file bytes, or browser results on the server-wide event feed.
73
+ - `command` retrieves the pending request through authenticated RPC.
74
+ - `result` completes it. The plugin validates the selected operation's output.
75
+ - Inspection commands return only target/source metadata. Execution checks that
76
+ the approved target has not changed while permission was pending.
77
+ - `attach` returns `replaced` when another desktop takes ownership. That is not
78
+ a retryable disconnect; the old desktop must not reclaim the session automatically.
79
+
80
+ The connection ID is correlation, not separate client authentication. Requests
81
+ are bound to their attachment and tab. Disconnect, replacement, session movement,
82
+ and unload fail outstanding work. Calls are not replayed automatically: a lost
83
+ response does not prove that a click or evaluation never happened.
84
+
85
+ ## Files and remote servers
86
+
87
+ Upload paths are **server-local**. File bytes cross RPC and the desktop writes its
88
+ own temporary copy. Captures/downloads travel back as bounded bytes and are saved
89
+ to server-local temporary files. Returned `files[].path` values refer to that
90
+ server; bytes are not included in the model's structured output. Images are also
91
+ attached for the model to inspect. Temporary exports are not deleted on plugin
92
+ reload, so a returned path remains usable; they follow the host's temporary-file
93
+ lifetime.
94
+
95
+ Each transfer is limited to 5 MiB total. There is no shared filesystem assumption,
96
+ resumable file-transfer service or object store. Browsing uses the connected
97
+ server's network: `localhost:8000` reaches that server's port 8000, while Chromium
98
+ and page JavaScript still run on the desktop. Dev-server ports need not be public.
99
+
100
+ `tunnel.open/read/write/close` relay bounded TCP chunks through the existing
101
+ authenticated plugin RPC route. The desktop-only `/proxy` entrypoint adapts
102
+ Chromium's HTTP/CONNECT proxy traffic, including WebSockets, to those methods.
103
+ Network bytes never go onto the global event stream. Attachment closure releases
104
+ the sockets; failed writes are not replayed and there is no direct-network fallback.
105
+ The tunnel relays whatever a loaded page requests and is not filtered per request:
106
+ page traffic has the server host's network reach, including its loopback and LAN.
107
+
108
+ Remote endpoints can use HTTPS and the existing server credentials. A reverse
109
+ proxy must allow long-lived event and attachment requests; the attachment RPC
110
+ stays open rather than sending response-body heartbeats.
111
+
112
+ Lighthouse audits use snapshot mode without changing device emulation or adding
113
+ an embedded report screenshot; use `browser.screenshot` for images. Trace exports
114
+ contain the target renderer process, not the whole desktop application. A tab
115
+ process change or trace-buffer loss is reported as an incomplete capture. Heap
116
+ summaries report shallow size, not computed retained size, and do not prove leaks.
117
+
118
+ All page-derived data is untrusted, including structured outputs. Schema
119
+ validation does not make page text an instruction or grant it authority.
120
+
121
+ ## Recovering from errors
122
+
123
+ Errors name the failed operation and the next supported action. Refresh tab IDs
124
+ with `browser.tabs.list`, element refs with `browser.snapshot`, and frame IDs with
125
+ `browser.frames`. File and network request IDs must come from the same tab's
126
+ current listing. Trace, CPU, and heap files are not interchangeable.
127
+
128
+ A timeout, cancellation, or disconnection does not prove the action never ran.
129
+ Inspect the tab and completed files before repeating clicks, uploads, submissions,
130
+ or evaluations. Do not retry a permission denial through another tool or weaken
131
+ browser security to work around a TLS or unsupported-operation error.
132
+
133
+ File errors distinguish server-local upload paths from desktop capture files.
134
+ Pending/failed downloads and unavailable response bodies are not empty files.
135
+ Oversized output requires a smaller request or capture, not an identical retry.
136
+
137
+ Per-URL and server-file permission checks belong to the final permission layer
138
+ (#46530). This base plugin layer intentionally does not enforce those rules.
139
+
140
+ Disable through normal configuration:
141
+
142
+ ```jsonc
143
+ { "plugins": ["-opencode.browser"] }
144
+ ```
@@ -0,0 +1,516 @@
1
+ export * as BrowserConnection from "./connection.js";
2
+ import type { Context } from "@radheim/plugin/effect/plugin";
3
+ import { Tool } from "@radheim/schema/tool";
4
+ import { Effect, Scope } from "effect";
5
+ import { Browser } from "./rpc.js";
6
+ export type Connection = Effect.Success<ReturnType<typeof make>>;
7
+ /**
8
+ * A crash or SIGKILL skips the revokes, so a session keeps its grant with no attachment behind it. Revokes the grants
9
+ * this location's servers recorded, except those of a process that still runs: several servers can share one
10
+ * database, and another one's attachment may be live. Runs before the RPC registers, so no attach here can race it.
11
+ */
12
+ export declare const reconcileStaleGrants: (ctx: {
13
+ readonly session: Pick<Context["session"], "get" | "update">;
14
+ readonly storage: Pick<Context["storage"], "scan" | "remove">;
15
+ readonly location: Pick<Context["location"], "directory" | "workspaceID">;
16
+ }) => Effect.Effect<void, never, never>;
17
+ export declare const make: (ctx: Pick<Context, "agent" | "event" | "location" | "permission" | "rpc" | "session" | "storage">) => Effect.Effect<{
18
+ /**
19
+ * Refuses a call that config, the agent's definition or the session's own rules deny. It reads rules only and never
20
+ * prompts, so it runs before the tool reads a file, looks up a tab or says whether a desktop is attached: a denied
21
+ * call reveals nothing but the denial. Without a desktop the session has no grant, and core would deny the call
22
+ * with its own message before any hook ran.
23
+ */
24
+ refuse: (tool: Tool.Context, operations: readonly string[]) => Effect.Effect<undefined, Tool.Error, never>;
25
+ /**
26
+ * The permission check for one call, with the operation as its resource. Its `permission.evaluate` hooks decide it:
27
+ * this plugin's (configured denies win over the grant) and others such as `tool.use` policies.
28
+ */
29
+ authorize: (tool: Tool.Context, action: {
30
+ readonly type: "tabs.list";
31
+ } | {
32
+ readonly type: "preview";
33
+ readonly path: string;
34
+ } | {
35
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
36
+ readonly type: "navigate.path";
37
+ readonly path: string;
38
+ } | {
39
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
40
+ readonly type: "back";
41
+ } | {
42
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
43
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
44
+ readonly type: "check";
45
+ readonly checked: boolean;
46
+ } | {
47
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
48
+ readonly type: "cpu.start";
49
+ } | {
50
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
51
+ readonly type: "cpu.stop";
52
+ } | {
53
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
54
+ readonly type: "drag";
55
+ readonly from: string & import("effect/Brand").Brand<"Browser.Ref">;
56
+ readonly to: string & import("effect/Brand").Brand<"Browser.Ref">;
57
+ } | {
58
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
59
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
60
+ readonly type: "files.drop";
61
+ readonly paths: readonly string[];
62
+ } | {
63
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
64
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
65
+ readonly type: "files.get";
66
+ } | {
67
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
68
+ readonly type: "files.list";
69
+ } | {
70
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
71
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
72
+ readonly type: "files.upload";
73
+ readonly paths: readonly string[];
74
+ } | {
75
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
76
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
77
+ readonly type: "fill";
78
+ readonly text: string;
79
+ } | {
80
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
81
+ readonly type: "fill_form";
82
+ readonly fields: readonly ({
83
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
84
+ readonly type: "text";
85
+ readonly value: string;
86
+ } | {
87
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
88
+ readonly type: "select";
89
+ readonly values: readonly string[];
90
+ } | {
91
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
92
+ readonly type: "check";
93
+ readonly checked: boolean;
94
+ })[];
95
+ } | {
96
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
97
+ readonly type: "forward";
98
+ } | {
99
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
100
+ readonly type: "frames";
101
+ } | {
102
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
103
+ readonly type: "heap.snapshot";
104
+ } | {
105
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
106
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
107
+ readonly type: "hover";
108
+ } | {
109
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
110
+ readonly type: "lighthouse";
111
+ } | {
112
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
113
+ readonly type: "navigate";
114
+ readonly url: string;
115
+ } | {
116
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
117
+ readonly type: "press";
118
+ readonly key: string;
119
+ } | {
120
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
121
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
122
+ readonly type: "select";
123
+ readonly values: readonly string[];
124
+ } | {
125
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
126
+ readonly type: "stop";
127
+ } | {
128
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
129
+ readonly type: "tabs.close";
130
+ } | {
131
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
132
+ readonly type: "tabs.focus";
133
+ } | {
134
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
135
+ readonly type: "trace.stop";
136
+ } | {
137
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
138
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
139
+ readonly type: "click";
140
+ readonly button?: "left" | "middle" | "right" | undefined;
141
+ readonly count?: 1 | 2 | undefined;
142
+ readonly modifiers?: readonly ("Alt" | "Control" | "Meta" | "Shift")[] | undefined;
143
+ } | {
144
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
145
+ readonly type: "console";
146
+ readonly level?: "debug" | "error" | "info" | "warning" | undefined;
147
+ readonly limit?: number | undefined;
148
+ } | {
149
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
150
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
151
+ readonly type: "cpu.analyze";
152
+ readonly limit?: number | undefined;
153
+ } | {
154
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
155
+ readonly type: "dialog";
156
+ readonly action: "accept" | "dismiss" | "get";
157
+ readonly promptText?: string | undefined;
158
+ } | {
159
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
160
+ readonly frameID?: string | undefined;
161
+ readonly type: "evaluate";
162
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
163
+ readonly script: string;
164
+ } | {
165
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
166
+ readonly frameID?: string | undefined;
167
+ readonly maxChars?: number | undefined;
168
+ readonly interactive?: boolean | undefined;
169
+ readonly maxLines?: number | undefined;
170
+ readonly type: "find";
171
+ readonly text: string;
172
+ } | {
173
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
174
+ readonly type: "heap.compare";
175
+ readonly before: string & import("effect/Brand").Brand<"Browser.FileID">;
176
+ readonly after: string & import("effect/Brand").Brand<"Browser.FileID">;
177
+ readonly limit?: number | undefined;
178
+ } | {
179
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
180
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
181
+ readonly type: "heap.object";
182
+ readonly id: number;
183
+ readonly limit?: number | undefined;
184
+ } | {
185
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
186
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
187
+ readonly type: "heap.query";
188
+ readonly name?: string | undefined;
189
+ readonly limit?: number | undefined;
190
+ } | {
191
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
192
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
193
+ readonly type: "heap.summary";
194
+ readonly limit?: number | undefined;
195
+ } | {
196
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
197
+ readonly includeBody?: boolean | undefined;
198
+ readonly includeResponseBody?: boolean | undefined;
199
+ readonly maxBodyChars?: number | undefined;
200
+ readonly type: "network.get";
201
+ readonly id: string;
202
+ } | {
203
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
204
+ readonly type: "network.list";
205
+ readonly urlContains?: string | undefined;
206
+ readonly resourceType?: "document" | "eventsource" | "fetch" | "font" | "image" | "manifest" | "media" | "other" | "script" | "stylesheet" | "websocket" | "xhr" | undefined;
207
+ readonly limit?: number | undefined;
208
+ } | {
209
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
210
+ readonly type: "reload";
211
+ readonly ignoreCache?: boolean | undefined;
212
+ } | {
213
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
214
+ readonly type: "screenshot";
215
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
216
+ readonly fullPage?: boolean | undefined;
217
+ readonly format?: "jpeg" | "png" | "webp" | undefined;
218
+ readonly quality?: number | undefined;
219
+ readonly maxWidth?: number | undefined;
220
+ } | {
221
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
222
+ readonly type: "scroll";
223
+ readonly deltaX?: number | undefined;
224
+ readonly deltaY: number;
225
+ } | {
226
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
227
+ readonly frameID?: string | undefined;
228
+ readonly maxChars?: number | undefined;
229
+ readonly interactive?: boolean | undefined;
230
+ readonly maxLines?: number | undefined;
231
+ readonly type: "snapshot";
232
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
233
+ readonly depth?: number | undefined;
234
+ readonly boxes?: boolean | undefined;
235
+ } | {
236
+ readonly type: "tabs.open";
237
+ readonly url?: string | undefined;
238
+ readonly focus?: boolean | undefined;
239
+ } | {
240
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
241
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
242
+ readonly type: "trace.analyze";
243
+ readonly limit?: number | undefined;
244
+ } | {
245
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
246
+ readonly type: "trace.start";
247
+ readonly durationMs?: number | undefined;
248
+ } | {
249
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
250
+ readonly frameID?: string | undefined;
251
+ readonly type: "wait";
252
+ readonly condition: "delay" | "load" | "text" | "textGone" | "url";
253
+ readonly text?: string | undefined;
254
+ readonly url?: string | undefined;
255
+ readonly timeoutMs?: number | undefined;
256
+ } | ({
257
+ readonly [x: string]: unknown;
258
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
259
+ readonly frameID?: string | undefined;
260
+ readonly condition?: "delay" | "element" | "elementGone" | "load" | "text" | "textGone" | "url" | undefined;
261
+ readonly text?: string | undefined;
262
+ readonly textGone?: string | undefined;
263
+ readonly selector?: string | undefined;
264
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
265
+ readonly state?: "attached" | "detached" | "domcontentloaded" | "hidden" | "load" | "networkidle" | "visible" | undefined;
266
+ readonly url?: string | undefined;
267
+ readonly delayMs?: number | undefined;
268
+ readonly time?: number | undefined;
269
+ readonly ms?: number | undefined;
270
+ readonly timeoutMs?: number | undefined;
271
+ readonly timeout?: number | undefined;
272
+ } & {
273
+ readonly type: "wait";
274
+ }), operations?: readonly string[] | undefined) => Effect.Effect<{
275
+ connected: false;
276
+ message: string;
277
+ } | {
278
+ message?: undefined;
279
+ connected: true;
280
+ }, Tool.Error, never>;
281
+ target: (sessionID: string & import("effect/Brand").Brand<"SessionID">, action: {
282
+ readonly type: "tabs.list";
283
+ } | {
284
+ readonly type: "preview";
285
+ readonly path: string;
286
+ } | {
287
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
288
+ readonly type: "navigate.path";
289
+ readonly path: string;
290
+ } | {
291
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
292
+ readonly type: "back";
293
+ } | {
294
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
295
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
296
+ readonly type: "check";
297
+ readonly checked: boolean;
298
+ } | {
299
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
300
+ readonly type: "cpu.start";
301
+ } | {
302
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
303
+ readonly type: "cpu.stop";
304
+ } | {
305
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
306
+ readonly type: "drag";
307
+ readonly from: string & import("effect/Brand").Brand<"Browser.Ref">;
308
+ readonly to: string & import("effect/Brand").Brand<"Browser.Ref">;
309
+ } | {
310
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
311
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
312
+ readonly type: "files.drop";
313
+ readonly paths: readonly string[];
314
+ } | {
315
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
316
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
317
+ readonly type: "files.get";
318
+ } | {
319
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
320
+ readonly type: "files.list";
321
+ } | {
322
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
323
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
324
+ readonly type: "files.upload";
325
+ readonly paths: readonly string[];
326
+ } | {
327
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
328
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
329
+ readonly type: "fill";
330
+ readonly text: string;
331
+ } | {
332
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
333
+ readonly type: "fill_form";
334
+ readonly fields: readonly ({
335
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
336
+ readonly type: "text";
337
+ readonly value: string;
338
+ } | {
339
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
340
+ readonly type: "select";
341
+ readonly values: readonly string[];
342
+ } | {
343
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
344
+ readonly type: "check";
345
+ readonly checked: boolean;
346
+ })[];
347
+ } | {
348
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
349
+ readonly type: "forward";
350
+ } | {
351
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
352
+ readonly type: "frames";
353
+ } | {
354
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
355
+ readonly type: "heap.snapshot";
356
+ } | {
357
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
358
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
359
+ readonly type: "hover";
360
+ } | {
361
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
362
+ readonly type: "lighthouse";
363
+ } | {
364
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
365
+ readonly type: "navigate";
366
+ readonly url: string;
367
+ } | {
368
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
369
+ readonly type: "press";
370
+ readonly key: string;
371
+ } | {
372
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
373
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
374
+ readonly type: "select";
375
+ readonly values: readonly string[];
376
+ } | {
377
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
378
+ readonly type: "stop";
379
+ } | {
380
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
381
+ readonly type: "tabs.close";
382
+ } | {
383
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
384
+ readonly type: "tabs.focus";
385
+ } | {
386
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
387
+ readonly type: "trace.stop";
388
+ } | {
389
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
390
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
391
+ readonly type: "click";
392
+ readonly button?: "left" | "middle" | "right" | undefined;
393
+ readonly count?: 1 | 2 | undefined;
394
+ readonly modifiers?: readonly ("Alt" | "Control" | "Meta" | "Shift")[] | undefined;
395
+ } | {
396
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
397
+ readonly type: "console";
398
+ readonly level?: "debug" | "error" | "info" | "warning" | undefined;
399
+ readonly limit?: number | undefined;
400
+ } | {
401
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
402
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
403
+ readonly type: "cpu.analyze";
404
+ readonly limit?: number | undefined;
405
+ } | {
406
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
407
+ readonly type: "dialog";
408
+ readonly action: "accept" | "dismiss" | "get";
409
+ readonly promptText?: string | undefined;
410
+ } | {
411
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
412
+ readonly frameID?: string | undefined;
413
+ readonly type: "evaluate";
414
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
415
+ readonly script: string;
416
+ } | {
417
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
418
+ readonly frameID?: string | undefined;
419
+ readonly maxChars?: number | undefined;
420
+ readonly interactive?: boolean | undefined;
421
+ readonly maxLines?: number | undefined;
422
+ readonly type: "find";
423
+ readonly text: string;
424
+ } | {
425
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
426
+ readonly type: "heap.compare";
427
+ readonly before: string & import("effect/Brand").Brand<"Browser.FileID">;
428
+ readonly after: string & import("effect/Brand").Brand<"Browser.FileID">;
429
+ readonly limit?: number | undefined;
430
+ } | {
431
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
432
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
433
+ readonly type: "heap.object";
434
+ readonly id: number;
435
+ readonly limit?: number | undefined;
436
+ } | {
437
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
438
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
439
+ readonly type: "heap.query";
440
+ readonly name?: string | undefined;
441
+ readonly limit?: number | undefined;
442
+ } | {
443
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
444
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
445
+ readonly type: "heap.summary";
446
+ readonly limit?: number | undefined;
447
+ } | {
448
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
449
+ readonly includeBody?: boolean | undefined;
450
+ readonly includeResponseBody?: boolean | undefined;
451
+ readonly maxBodyChars?: number | undefined;
452
+ readonly type: "network.get";
453
+ readonly id: string;
454
+ } | {
455
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
456
+ readonly type: "network.list";
457
+ readonly urlContains?: string | undefined;
458
+ readonly resourceType?: "document" | "eventsource" | "fetch" | "font" | "image" | "manifest" | "media" | "other" | "script" | "stylesheet" | "websocket" | "xhr" | undefined;
459
+ readonly limit?: number | undefined;
460
+ } | {
461
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
462
+ readonly type: "reload";
463
+ readonly ignoreCache?: boolean | undefined;
464
+ } | {
465
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
466
+ readonly type: "screenshot";
467
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
468
+ readonly fullPage?: boolean | undefined;
469
+ readonly format?: "jpeg" | "png" | "webp" | undefined;
470
+ readonly quality?: number | undefined;
471
+ readonly maxWidth?: number | undefined;
472
+ } | {
473
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
474
+ readonly type: "scroll";
475
+ readonly deltaX?: number | undefined;
476
+ readonly deltaY: number;
477
+ } | {
478
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
479
+ readonly frameID?: string | undefined;
480
+ readonly maxChars?: number | undefined;
481
+ readonly interactive?: boolean | undefined;
482
+ readonly maxLines?: number | undefined;
483
+ readonly type: "snapshot";
484
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
485
+ readonly depth?: number | undefined;
486
+ readonly boxes?: boolean | undefined;
487
+ } | {
488
+ readonly type: "tabs.open";
489
+ readonly url?: string | undefined;
490
+ readonly focus?: boolean | undefined;
491
+ } | {
492
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
493
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
494
+ readonly type: "trace.analyze";
495
+ readonly limit?: number | undefined;
496
+ } | {
497
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
498
+ readonly type: "trace.start";
499
+ readonly durationMs?: number | undefined;
500
+ } | {
501
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
502
+ readonly frameID?: string | undefined;
503
+ readonly type: "wait";
504
+ readonly condition: "delay" | "load" | "text" | "textGone" | "url";
505
+ readonly text?: string | undefined;
506
+ readonly url?: string | undefined;
507
+ readonly timeoutMs?: number | undefined;
508
+ }) => Effect.Effect<{
509
+ tab: Browser.Tab | undefined;
510
+ inspect: () => Effect.Effect<{
511
+ readonly resources: readonly string[];
512
+ readonly key: string;
513
+ }, Tool.Error, never>;
514
+ request: (files: readonly Browser.File[], target?: Browser.Target) => Effect.Effect<Browser.Result, Tool.Error, never>;
515
+ }, Tool.Error, never>;
516
+ }, never, Scope.Scope>;