@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.
@@ -0,0 +1,534 @@
1
+ export * as BrowserTools from "./tools.js";
2
+ import type { Context } from "@radheim/plugin/effect/plugin";
3
+ import { Tool } from "@radheim/schema/tool";
4
+ import { Effect } from "effect";
5
+ import { Browser } from "./rpc.js";
6
+ export declare const register: (ctx: Pick<Context, "location" | "permission" | "skill" | "tool">, connection: {
7
+ refuse: (tool: Tool.Context, operations: readonly string[]) => Effect.Effect<undefined, Tool.Error, never>;
8
+ authorize: (tool: Tool.Context, action: {
9
+ readonly type: "tabs.list";
10
+ } | {
11
+ readonly type: "preview";
12
+ readonly path: string;
13
+ } | {
14
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
15
+ readonly type: "navigate.path";
16
+ readonly path: string;
17
+ } | {
18
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
19
+ readonly type: "back";
20
+ } | {
21
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
22
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
23
+ readonly type: "check";
24
+ readonly checked: boolean;
25
+ } | {
26
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
27
+ readonly type: "cpu.start";
28
+ } | {
29
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
30
+ readonly type: "cpu.stop";
31
+ } | {
32
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
33
+ readonly type: "drag";
34
+ readonly from: string & import("effect/Brand").Brand<"Browser.Ref">;
35
+ readonly to: string & import("effect/Brand").Brand<"Browser.Ref">;
36
+ } | {
37
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
38
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
39
+ readonly type: "files.drop";
40
+ readonly paths: readonly string[];
41
+ } | {
42
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
43
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
44
+ readonly type: "files.get";
45
+ } | {
46
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
47
+ readonly type: "files.list";
48
+ } | {
49
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
50
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
51
+ readonly type: "files.upload";
52
+ readonly paths: readonly string[];
53
+ } | {
54
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
55
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
56
+ readonly type: "fill";
57
+ readonly text: string;
58
+ } | {
59
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
60
+ readonly type: "fill_form";
61
+ readonly fields: readonly ({
62
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
63
+ readonly type: "text";
64
+ readonly value: string;
65
+ } | {
66
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
67
+ readonly type: "select";
68
+ readonly values: readonly string[];
69
+ } | {
70
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
71
+ readonly type: "check";
72
+ readonly checked: boolean;
73
+ })[];
74
+ } | {
75
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
76
+ readonly type: "forward";
77
+ } | {
78
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
79
+ readonly type: "frames";
80
+ } | {
81
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
82
+ readonly type: "heap.snapshot";
83
+ } | {
84
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
85
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
86
+ readonly type: "hover";
87
+ } | {
88
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
89
+ readonly type: "lighthouse";
90
+ } | {
91
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
92
+ readonly type: "navigate";
93
+ readonly url: string;
94
+ } | {
95
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
96
+ readonly type: "press";
97
+ readonly key: string;
98
+ } | {
99
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
100
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
101
+ readonly type: "select";
102
+ readonly values: readonly string[];
103
+ } | {
104
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
105
+ readonly type: "stop";
106
+ } | {
107
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
108
+ readonly type: "tabs.close";
109
+ } | {
110
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
111
+ readonly type: "tabs.focus";
112
+ } | {
113
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
114
+ readonly type: "trace.stop";
115
+ } | {
116
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
117
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
118
+ readonly type: "click";
119
+ readonly button?: "left" | "middle" | "right" | undefined;
120
+ readonly count?: 1 | 2 | undefined;
121
+ readonly modifiers?: readonly ("Alt" | "Control" | "Meta" | "Shift")[] | undefined;
122
+ } | {
123
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
124
+ readonly type: "console";
125
+ readonly level?: "debug" | "error" | "info" | "warning" | undefined;
126
+ readonly limit?: number | undefined;
127
+ } | {
128
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
129
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
130
+ readonly type: "cpu.analyze";
131
+ readonly limit?: number | undefined;
132
+ } | {
133
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
134
+ readonly type: "dialog";
135
+ readonly action: "accept" | "dismiss" | "get";
136
+ readonly promptText?: string | undefined;
137
+ } | {
138
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
139
+ readonly frameID?: string | undefined;
140
+ readonly type: "evaluate";
141
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
142
+ readonly script: string;
143
+ } | {
144
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
145
+ readonly frameID?: string | undefined;
146
+ readonly maxChars?: number | undefined;
147
+ readonly interactive?: boolean | undefined;
148
+ readonly maxLines?: number | undefined;
149
+ readonly type: "find";
150
+ readonly text: string;
151
+ } | {
152
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
153
+ readonly type: "heap.compare";
154
+ readonly before: string & import("effect/Brand").Brand<"Browser.FileID">;
155
+ readonly after: string & import("effect/Brand").Brand<"Browser.FileID">;
156
+ readonly limit?: number | undefined;
157
+ } | {
158
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
159
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
160
+ readonly type: "heap.object";
161
+ readonly id: number;
162
+ readonly limit?: number | undefined;
163
+ } | {
164
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
165
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
166
+ readonly type: "heap.query";
167
+ readonly name?: string | undefined;
168
+ readonly limit?: number | undefined;
169
+ } | {
170
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
171
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
172
+ readonly type: "heap.summary";
173
+ readonly limit?: number | undefined;
174
+ } | {
175
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
176
+ readonly includeBody?: boolean | undefined;
177
+ readonly includeResponseBody?: boolean | undefined;
178
+ readonly maxBodyChars?: number | undefined;
179
+ readonly type: "network.get";
180
+ readonly id: string;
181
+ } | {
182
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
183
+ readonly type: "network.list";
184
+ readonly urlContains?: string | undefined;
185
+ readonly resourceType?: "document" | "eventsource" | "fetch" | "font" | "image" | "manifest" | "media" | "other" | "script" | "stylesheet" | "websocket" | "xhr" | undefined;
186
+ readonly limit?: number | undefined;
187
+ } | {
188
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
189
+ readonly type: "reload";
190
+ readonly ignoreCache?: boolean | undefined;
191
+ } | {
192
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
193
+ readonly type: "screenshot";
194
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
195
+ readonly fullPage?: boolean | undefined;
196
+ readonly format?: "jpeg" | "png" | "webp" | undefined;
197
+ readonly quality?: number | undefined;
198
+ readonly maxWidth?: number | undefined;
199
+ } | {
200
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
201
+ readonly type: "scroll";
202
+ readonly deltaX?: number | undefined;
203
+ readonly deltaY: number;
204
+ } | {
205
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
206
+ readonly frameID?: string | undefined;
207
+ readonly maxChars?: number | undefined;
208
+ readonly interactive?: boolean | undefined;
209
+ readonly maxLines?: number | undefined;
210
+ readonly type: "snapshot";
211
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
212
+ readonly depth?: number | undefined;
213
+ readonly boxes?: boolean | undefined;
214
+ } | {
215
+ readonly type: "tabs.open";
216
+ readonly url?: string | undefined;
217
+ readonly focus?: boolean | undefined;
218
+ } | {
219
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
220
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
221
+ readonly type: "trace.analyze";
222
+ readonly limit?: number | undefined;
223
+ } | {
224
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
225
+ readonly type: "trace.start";
226
+ readonly durationMs?: number | undefined;
227
+ } | {
228
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
229
+ readonly frameID?: string | undefined;
230
+ readonly type: "wait";
231
+ readonly condition: "delay" | "load" | "text" | "textGone" | "url";
232
+ readonly text?: string | undefined;
233
+ readonly url?: string | undefined;
234
+ readonly timeoutMs?: number | undefined;
235
+ } | ({
236
+ readonly [x: string]: unknown;
237
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
238
+ readonly frameID?: string | undefined;
239
+ readonly condition?: "delay" | "element" | "elementGone" | "load" | "text" | "textGone" | "url" | undefined;
240
+ readonly text?: string | undefined;
241
+ readonly textGone?: string | undefined;
242
+ readonly selector?: string | undefined;
243
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
244
+ readonly state?: "attached" | "detached" | "domcontentloaded" | "hidden" | "load" | "networkidle" | "visible" | undefined;
245
+ readonly url?: string | undefined;
246
+ readonly delayMs?: number | undefined;
247
+ readonly time?: number | undefined;
248
+ readonly ms?: number | undefined;
249
+ readonly timeoutMs?: number | undefined;
250
+ readonly timeout?: number | undefined;
251
+ } & {
252
+ readonly type: "wait";
253
+ }), operations?: readonly string[] | undefined) => Effect.Effect<{
254
+ connected: false;
255
+ message: string;
256
+ } | {
257
+ message?: undefined;
258
+ connected: true;
259
+ }, Tool.Error, never>;
260
+ target: (sessionID: string & import("effect/Brand").Brand<"SessionID">, action: {
261
+ readonly type: "tabs.list";
262
+ } | {
263
+ readonly type: "preview";
264
+ readonly path: string;
265
+ } | {
266
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
267
+ readonly type: "navigate.path";
268
+ readonly path: string;
269
+ } | {
270
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
271
+ readonly type: "back";
272
+ } | {
273
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
274
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
275
+ readonly type: "check";
276
+ readonly checked: boolean;
277
+ } | {
278
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
279
+ readonly type: "cpu.start";
280
+ } | {
281
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
282
+ readonly type: "cpu.stop";
283
+ } | {
284
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
285
+ readonly type: "drag";
286
+ readonly from: string & import("effect/Brand").Brand<"Browser.Ref">;
287
+ readonly to: string & import("effect/Brand").Brand<"Browser.Ref">;
288
+ } | {
289
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
290
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
291
+ readonly type: "files.drop";
292
+ readonly paths: readonly string[];
293
+ } | {
294
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
295
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
296
+ readonly type: "files.get";
297
+ } | {
298
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
299
+ readonly type: "files.list";
300
+ } | {
301
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
302
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
303
+ readonly type: "files.upload";
304
+ readonly paths: readonly string[];
305
+ } | {
306
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
307
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
308
+ readonly type: "fill";
309
+ readonly text: string;
310
+ } | {
311
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
312
+ readonly type: "fill_form";
313
+ readonly fields: readonly ({
314
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
315
+ readonly type: "text";
316
+ readonly value: string;
317
+ } | {
318
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
319
+ readonly type: "select";
320
+ readonly values: readonly string[];
321
+ } | {
322
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
323
+ readonly type: "check";
324
+ readonly checked: boolean;
325
+ })[];
326
+ } | {
327
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
328
+ readonly type: "forward";
329
+ } | {
330
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
331
+ readonly type: "frames";
332
+ } | {
333
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
334
+ readonly type: "heap.snapshot";
335
+ } | {
336
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
337
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
338
+ readonly type: "hover";
339
+ } | {
340
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
341
+ readonly type: "lighthouse";
342
+ } | {
343
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
344
+ readonly type: "navigate";
345
+ readonly url: string;
346
+ } | {
347
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
348
+ readonly type: "press";
349
+ readonly key: string;
350
+ } | {
351
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
352
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
353
+ readonly type: "select";
354
+ readonly values: readonly string[];
355
+ } | {
356
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
357
+ readonly type: "stop";
358
+ } | {
359
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
360
+ readonly type: "tabs.close";
361
+ } | {
362
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
363
+ readonly type: "tabs.focus";
364
+ } | {
365
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
366
+ readonly type: "trace.stop";
367
+ } | {
368
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
369
+ readonly ref: string & import("effect/Brand").Brand<"Browser.Ref">;
370
+ readonly type: "click";
371
+ readonly button?: "left" | "middle" | "right" | undefined;
372
+ readonly count?: 1 | 2 | undefined;
373
+ readonly modifiers?: readonly ("Alt" | "Control" | "Meta" | "Shift")[] | undefined;
374
+ } | {
375
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
376
+ readonly type: "console";
377
+ readonly level?: "debug" | "error" | "info" | "warning" | undefined;
378
+ readonly limit?: number | undefined;
379
+ } | {
380
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
381
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
382
+ readonly type: "cpu.analyze";
383
+ readonly limit?: number | undefined;
384
+ } | {
385
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
386
+ readonly type: "dialog";
387
+ readonly action: "accept" | "dismiss" | "get";
388
+ readonly promptText?: string | undefined;
389
+ } | {
390
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
391
+ readonly frameID?: string | undefined;
392
+ readonly type: "evaluate";
393
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
394
+ readonly script: string;
395
+ } | {
396
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
397
+ readonly frameID?: string | undefined;
398
+ readonly maxChars?: number | undefined;
399
+ readonly interactive?: boolean | undefined;
400
+ readonly maxLines?: number | undefined;
401
+ readonly type: "find";
402
+ readonly text: string;
403
+ } | {
404
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
405
+ readonly type: "heap.compare";
406
+ readonly before: string & import("effect/Brand").Brand<"Browser.FileID">;
407
+ readonly after: string & import("effect/Brand").Brand<"Browser.FileID">;
408
+ readonly limit?: number | undefined;
409
+ } | {
410
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
411
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
412
+ readonly type: "heap.object";
413
+ readonly id: number;
414
+ readonly limit?: number | undefined;
415
+ } | {
416
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
417
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
418
+ readonly type: "heap.query";
419
+ readonly name?: string | undefined;
420
+ readonly limit?: number | undefined;
421
+ } | {
422
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
423
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
424
+ readonly type: "heap.summary";
425
+ readonly limit?: number | undefined;
426
+ } | {
427
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
428
+ readonly includeBody?: boolean | undefined;
429
+ readonly includeResponseBody?: boolean | undefined;
430
+ readonly maxBodyChars?: number | undefined;
431
+ readonly type: "network.get";
432
+ readonly id: string;
433
+ } | {
434
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
435
+ readonly type: "network.list";
436
+ readonly urlContains?: string | undefined;
437
+ readonly resourceType?: "document" | "eventsource" | "fetch" | "font" | "image" | "manifest" | "media" | "other" | "script" | "stylesheet" | "websocket" | "xhr" | undefined;
438
+ readonly limit?: number | undefined;
439
+ } | {
440
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
441
+ readonly type: "reload";
442
+ readonly ignoreCache?: boolean | undefined;
443
+ } | {
444
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
445
+ readonly type: "screenshot";
446
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
447
+ readonly fullPage?: boolean | undefined;
448
+ readonly format?: "jpeg" | "png" | "webp" | undefined;
449
+ readonly quality?: number | undefined;
450
+ readonly maxWidth?: number | undefined;
451
+ } | {
452
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
453
+ readonly type: "scroll";
454
+ readonly deltaX?: number | undefined;
455
+ readonly deltaY: number;
456
+ } | {
457
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
458
+ readonly frameID?: string | undefined;
459
+ readonly maxChars?: number | undefined;
460
+ readonly interactive?: boolean | undefined;
461
+ readonly maxLines?: number | undefined;
462
+ readonly type: "snapshot";
463
+ readonly ref?: (string & import("effect/Brand").Brand<"Browser.Ref">) | undefined;
464
+ readonly depth?: number | undefined;
465
+ readonly boxes?: boolean | undefined;
466
+ } | {
467
+ readonly type: "tabs.open";
468
+ readonly url?: string | undefined;
469
+ readonly focus?: boolean | undefined;
470
+ } | {
471
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
472
+ readonly fileID: string & import("effect/Brand").Brand<"Browser.FileID">;
473
+ readonly type: "trace.analyze";
474
+ readonly limit?: number | undefined;
475
+ } | {
476
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
477
+ readonly type: "trace.start";
478
+ readonly durationMs?: number | undefined;
479
+ } | {
480
+ readonly tabID: string & import("effect/Brand").Brand<"Browser.TabID">;
481
+ readonly frameID?: string | undefined;
482
+ readonly type: "wait";
483
+ readonly condition: "delay" | "load" | "text" | "textGone" | "url";
484
+ readonly text?: string | undefined;
485
+ readonly url?: string | undefined;
486
+ readonly timeoutMs?: number | undefined;
487
+ }) => Effect.Effect<{
488
+ tab: Browser.Tab | undefined;
489
+ inspect: () => Effect.Effect<{
490
+ readonly resources: readonly string[];
491
+ readonly key: string;
492
+ }, Tool.Error, never>;
493
+ request: (files: readonly Browser.File[], target?: Browser.Target) => Effect.Effect<Browser.Result, Tool.Error, never>;
494
+ }, Tool.Error, never>;
495
+ }) => Effect.Effect<void, never, import("effect/Scope").Scope>;
496
+ export declare function normalizeAction(action: Exclude<Browser.Input, {
497
+ readonly type: "wait";
498
+ }>): Exclude<Browser.Action, {
499
+ type: "wait";
500
+ }>;
501
+ type WaitInput = Extract<Browser.Input, {
502
+ readonly type: "wait";
503
+ }>;
504
+ type WaitAction = Extract<Browser.Action, {
505
+ readonly type: "wait";
506
+ }>;
507
+ export type WaitPlan = {
508
+ readonly timeoutMs: number;
509
+ readonly waited: Browser.Waited["waited"];
510
+ } & ({
511
+ readonly kind: "desktop";
512
+ readonly action: WaitAction;
513
+ } | {
514
+ readonly kind: "delay";
515
+ } | {
516
+ readonly kind: "url";
517
+ readonly url: string;
518
+ } | {
519
+ readonly kind: "element";
520
+ readonly element: {
521
+ readonly selector: string;
522
+ } | {
523
+ readonly ref: Browser.Ref;
524
+ };
525
+ readonly gone: boolean;
526
+ readonly frameID?: string;
527
+ });
528
+ /**
529
+ * What a wait call asks for. Models write Playwright-style keys (text with timeout, state, selector, url, time, ms), so
530
+ * the condition is read from whichever one is present. A call with only a duration pauses; one with nothing waits for
531
+ * loading.
532
+ */
533
+ export declare function waitPlan(input: WaitInput): WaitPlan;
534
+ export declare function asyncBody(script: string): string;