@orkestrel/browser 0.0.25 → 0.0.27
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 +23 -13
- package/dist/bin/main.js +11 -9
- package/dist/bin/main.js.map +1 -1
- package/dist/src/browser/index.d.ts +6 -184
- package/dist/src/browser/index.js +145 -119
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +2324 -1991
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +672 -1366
- package/dist/src/core/index.d.ts +672 -1366
- package/dist/src/core/index.js +2287 -1941
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +223 -215
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +72 -167
- package/dist/src/server/index.d.ts +72 -167
- package/dist/src/server/index.js +222 -209
- package/dist/src/server/index.js.map +1 -1
- package/package.json +8 -7
package/dist/src/core/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
|
2
2
|
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
3
3
|
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
4
4
|
import type { HTMLInterface } from '@orkestrel/html';
|
|
5
|
+
import type { JSONRecord } from '@orkestrel/contract';
|
|
5
6
|
import type { JSONValue } from '@orkestrel/contract';
|
|
6
7
|
import type { ToolCall } from '@orkestrel/tool';
|
|
7
8
|
import type { ToolContext } from '@orkestrel/tool';
|
|
@@ -10,26 +11,33 @@ import type { ToolInterface } from '@orkestrel/tool';
|
|
|
10
11
|
import type { ToolManagerInterface } from '@orkestrel/tool';
|
|
11
12
|
import type { ToolResult } from '@orkestrel/tool';
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
-
|
|
14
|
+
/** Abbreviates displayed metadata without splitting a Unicode code point.
|
|
15
|
+
* @param text - Metadata text
|
|
16
|
+
* @param limit - Available UTF-16 units
|
|
17
|
+
* @returns Normalized text with an ellipsis when abbreviated
|
|
18
|
+
*/
|
|
19
|
+
export declare function abbreviateBrowserText(text: string, limit: number): string;
|
|
15
20
|
|
|
16
|
-
/**
|
|
17
|
-
|
|
21
|
+
/** Checks whether a node descends from another within one session's captured tree.
|
|
22
|
+
* @param node - Candidate descendant
|
|
23
|
+
* @param ancestor - Owning node
|
|
24
|
+
* @param indexed - Nodes indexed by session and accessibility identity
|
|
25
|
+
* @returns True if the node descends from the ancestor; false otherwise
|
|
26
|
+
*/
|
|
27
|
+
export declare function belongsBrowserOutline(node: BrowserOutlineNode, ancestor: BrowserOutlineNode, indexed: ReadonlyMap<string, BrowserOutlineNode>): boolean;
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
30
|
* Bounds a tool string at a character limit, appending a footer that names the cut and the
|
|
21
31
|
* caller's closing clause.
|
|
22
32
|
*
|
|
23
33
|
* @remarks
|
|
24
|
-
* A string within the limit returns unchanged.
|
|
25
|
-
* units,
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `BROWSER_TOOL_VIEW_FOOTER` for an action or `dialog` receipt that carries a view and
|
|
29
|
-
* `BROWSER_TOOL_CUT_FOOTER` for any other result, including `look` and `read` results.
|
|
34
|
+
* A string within the limit returns unchanged. Otherwise the cut text plus footer fits `limit`
|
|
35
|
+
* UTF-16 code units, without splitting a surrogate pair. When the character-range footer cannot
|
|
36
|
+
* fit, the result ends with an ellipsis instead. The footer has no default: each caller states
|
|
37
|
+
* what the reader does next. Numbered windows select whole rows through `renderBrowserWindow`.
|
|
30
38
|
*
|
|
31
39
|
* @param text - The page-authored or composed string
|
|
32
|
-
* @param limit - The
|
|
40
|
+
* @param limit - The whole-result character limit, a positive integer
|
|
33
41
|
* @param footer - The clause that closes the footer after the character range
|
|
34
42
|
* @returns The string, cut and footed when it exceeds the limit
|
|
35
43
|
* @throws Thrown when `limit` is not a positive integer.
|
|
@@ -38,7 +46,7 @@ export declare const BASE64_LOOKUP: Readonly<Record<string, number>>;
|
|
|
38
46
|
* ```ts
|
|
39
47
|
* import { boundBrowserText } from '@orkestrel/browser'
|
|
40
48
|
*
|
|
41
|
-
* boundBrowserText('abcdef', 4, 'the rest was cut') // '
|
|
49
|
+
* boundBrowserText('abcdef', 4, 'the rest was cut') // 'abc…'
|
|
42
50
|
* boundBrowserText('abc', 4, 'the rest was cut') // 'abc'
|
|
43
51
|
* ```
|
|
44
52
|
*/
|
|
@@ -107,7 +115,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
107
115
|
*/
|
|
108
116
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
109
117
|
name: "@orkestrel/browser";
|
|
110
|
-
version: "0.0.
|
|
118
|
+
version: "0.0.27";
|
|
111
119
|
}>;
|
|
112
120
|
|
|
113
121
|
/** Names accessibility roles that receive actionable outline references. */
|
|
@@ -122,9 +130,18 @@ export declare const BROWSER_INTERACTIVE_ROLES: ReadonlySet<string>;
|
|
|
122
130
|
*/
|
|
123
131
|
export declare const BROWSER_JOURNEY_ACTIONS: readonly BrowserToolName[];
|
|
124
132
|
|
|
133
|
+
/** Holds the refusal `edit` returns without a journey when several journeys are saved. */
|
|
134
|
+
export declare const BROWSER_JOURNEY_EDIT_CHOICE_REFUSAL = "Edit requires journey, one of {names}; call edit with that name beside edits.";
|
|
135
|
+
|
|
136
|
+
/** Holds the refusal `edit` returns without a journey when no journey is saved. */
|
|
137
|
+
export declare const BROWSER_JOURNEY_EDIT_EMPTY_REFUSAL = "No journey is saved, so there is nothing to edit; call record to start one.";
|
|
138
|
+
|
|
125
139
|
/** Holds the result the `journeys` tool returns when no journey is saved. */
|
|
126
140
|
export declare const BROWSER_JOURNEY_EMPTY_LISTING = "No journeys are saved; call record to start one.";
|
|
127
141
|
|
|
142
|
+
/** Holds the refusal `save` returns while the recording has no steps. */
|
|
143
|
+
export declare const BROWSER_JOURNEY_EMPTY_REFUSAL = "Nothing is recorded for {name} yet, and it is still recording. Click and type the flow's steps now, then call save.";
|
|
144
|
+
|
|
128
145
|
/** Holds the journey and run file format this package writes and reads, `1`. */
|
|
129
146
|
export declare const BROWSER_JOURNEY_FORMAT_VERSION: BrowserJourney['format'];
|
|
130
147
|
|
|
@@ -151,8 +168,17 @@ export declare const BROWSER_JOURNEY_PARAMETER_PATTERN: RegExp;
|
|
|
151
168
|
/** Holds the refusal `record`, `save`, `edit`, and `forget` return when the journeys are read-only. */
|
|
152
169
|
export declare const BROWSER_JOURNEY_READONLY_REFUSAL = "The journeys are read-only; call replay.";
|
|
153
170
|
|
|
171
|
+
/** Holds the refusal `record` returns for the same empty recording. */
|
|
172
|
+
export declare const BROWSER_JOURNEY_RECORD_EMPTY_REFUSAL = "{name} is already recording and has no steps yet. Click and type the flow's steps now, then call save.";
|
|
173
|
+
|
|
174
|
+
/** Holds the refusal `record` returns for the same recording with steps. */
|
|
175
|
+
export declare const BROWSER_JOURNEY_RECORD_STEPS_REFUSAL = "{name} is already recording with {count} {steps}; call save when the flow is done.";
|
|
176
|
+
|
|
154
177
|
/** Holds the refusal `record` returns while another journey is recording. */
|
|
155
|
-
export declare const BROWSER_JOURNEY_RECORDING_REFUSAL = "
|
|
178
|
+
export declare const BROWSER_JOURNEY_RECORDING_REFUSAL = "{name} is recording; call save before you record another.";
|
|
179
|
+
|
|
180
|
+
/** Holds the refusal `save` returns after a successful save when no journey is recording. */
|
|
181
|
+
export declare const BROWSER_JOURNEY_SAVE_SAVED_REFUSAL = "Nothing is recording, so there is nothing to save; {name} is already saved. Answer the user.";
|
|
156
182
|
|
|
157
183
|
/** Names native tool arguments represented by journey targets, tabs, or secret bindings. */
|
|
158
184
|
export declare const BROWSER_JOURNEY_STEP_KEYS: readonly string[];
|
|
@@ -184,6 +210,21 @@ export declare const BROWSER_OUTLINE_LIMIT = 150;
|
|
|
184
210
|
/** Names accessibility roles whose own rows add no outline content. */
|
|
185
211
|
export declare const BROWSER_OUTLINE_OMITTED_ROLES: ReadonlySet<string>;
|
|
186
212
|
|
|
213
|
+
/** Reports changed line numbers without restarting a continuation. */
|
|
214
|
+
export declare const BROWSER_READ_CHANGED_NOTE = "The page changed since the last view; line numbers might differ.";
|
|
215
|
+
|
|
216
|
+
/** Opens a search window one line before its first match. */
|
|
217
|
+
export declare const BROWSER_READ_CONTEXT = 1;
|
|
218
|
+
|
|
219
|
+
/** Caps a default reading window at 100 addressed lines. */
|
|
220
|
+
export declare const BROWSER_READ_LINES = 100;
|
|
221
|
+
|
|
222
|
+
/** Caps the displayed search hit list at 50 line numbers. */
|
|
223
|
+
export declare const BROWSER_READ_MATCHES = 50;
|
|
224
|
+
|
|
225
|
+
/** Wraps projection rows at 800 UTF-16 units, leaving room for receipt metadata. */
|
|
226
|
+
export declare const BROWSER_READ_WIDTH = 800;
|
|
227
|
+
|
|
187
228
|
/** Prefixes stable element references within a browser context. */
|
|
188
229
|
export declare const BROWSER_REFERENCE_PREFIX = "e";
|
|
189
230
|
|
|
@@ -302,7 +343,7 @@ export declare const BROWSER_TOOL_CAPTURE_MS = 1000;
|
|
|
302
343
|
* capture twice: once after the action, and again during the one retry that follows the page's
|
|
303
344
|
* readiness.
|
|
304
345
|
*/
|
|
305
|
-
export declare const BROWSER_TOOL_CHANGED_NOTE = "(The page changed before the view could be read; call
|
|
346
|
+
export declare const BROWSER_TOOL_CHANGED_NOTE = "(The page changed before the view could be read; call read.)";
|
|
306
347
|
|
|
307
348
|
/**
|
|
308
349
|
* Holds the advertised definition of each reserved tool: its description, its JSON Schema
|
|
@@ -310,21 +351,25 @@ export declare const BROWSER_TOOL_CHANGED_NOTE = "(The page changed before the v
|
|
|
310
351
|
*
|
|
311
352
|
* @remarks
|
|
312
353
|
* Every tool description is at most 25 words and says what the tool shows or does, and for
|
|
313
|
-
* `
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* `
|
|
318
|
-
*
|
|
354
|
+
* `read` when to call it; every parameter description is at most 100 characters.
|
|
355
|
+
* In the 2026-10-07 measurement, qwen3.5:2b-q4_K_M reads the `click` and `type` tool description
|
|
356
|
+
* bytes as instructions with thinking on, and the `type` tool focusing the field itself removes
|
|
357
|
+
* a click before each entry.
|
|
358
|
+
* `read` requires `from`: making it optional reduced search from 16/16 to 6/16 and paging from
|
|
359
|
+
* 16/16 to 0/6 in the 2026-10-07 qwen3.5:2b-q4_K_M store measurement.
|
|
360
|
+
* `journeys` keeps optional `from` with default 1 for the measured 2B `journeys{}` omission;
|
|
361
|
+
* the page tasks in that measurement never advertise it.
|
|
362
|
+
* Both tools accept optional `to` and `search`; an element's own reading is
|
|
363
|
+
* `BrowserElementInterface.read`. `read` and `journeys` annotate `pure` and
|
|
364
|
+
* `untrusted`, `wait` annotates `pure`, and the rest carry no annotation. `type` takes
|
|
319
365
|
* `secret` beside `ref`, `text`, and `submit`. The journey tools `record`, `save`, `journeys`,
|
|
320
|
-
* `edit`, and `
|
|
366
|
+
* `edit`, `replay`, `forget`, and `capture` are advertised only by a toolset constructed with `journeys`.
|
|
321
367
|
* `wait` takes `absent` beside `text` and `timeout`.
|
|
322
368
|
*/
|
|
323
369
|
export declare const BROWSER_TOOL_COPY: Readonly<Record<BrowserToolName, ToolDefinition>>;
|
|
324
370
|
|
|
325
371
|
/**
|
|
326
|
-
* Holds the clause that ends
|
|
327
|
-
* that carries a view, including `look` and `read` results.
|
|
372
|
+
* Holds the clause that ends a cut result without an addressed page window.
|
|
328
373
|
*/
|
|
329
374
|
export declare const BROWSER_TOOL_CUT_FOOTER = "the rest was cut";
|
|
330
375
|
|
|
@@ -332,16 +377,15 @@ export declare const BROWSER_TOOL_CUT_FOOTER = "the rest was cut";
|
|
|
332
377
|
* Holds the note an action receipt carries in place of the view when the receipt's deadline
|
|
333
378
|
* passed before the view could be captured.
|
|
334
379
|
*/
|
|
335
|
-
export declare const BROWSER_TOOL_DEADLINE_NOTE = "(The view could not be read before the deadline; call
|
|
380
|
+
export declare const BROWSER_TOOL_DEADLINE_NOTE = "(The view could not be read before the deadline; call read.)";
|
|
336
381
|
|
|
337
382
|
/**
|
|
338
|
-
* Holds the status
|
|
339
|
-
* navigation after it, naming `wait` as the next call because the page's outcome can arrive later.
|
|
383
|
+
* Holds the status of a handled submission whose settle observed a change.
|
|
340
384
|
*/
|
|
341
|
-
export declare const BROWSER_TOOL_HANDLED_STATUS = "the page handled the submission
|
|
385
|
+
export declare const BROWSER_TOOL_HANDLED_STATUS = "the page handled the submission and changed";
|
|
342
386
|
|
|
343
387
|
/**
|
|
344
|
-
* Bounds each tool result and error message at `4_000` UTF-16 code units
|
|
388
|
+
* Bounds each tool result and error message at `4_000` UTF-16 code units including its footer.
|
|
345
389
|
*
|
|
346
390
|
* @remarks
|
|
347
391
|
* A page tool's error message and JSON output reach the toolset already cut at
|
|
@@ -365,13 +409,13 @@ export declare const BROWSER_TOOL_LIMIT = 4000;
|
|
|
365
409
|
export declare const BROWSER_TOOL_NAME_PATTERN: RegExp;
|
|
366
410
|
|
|
367
411
|
/**
|
|
368
|
-
* Names
|
|
369
|
-
*
|
|
412
|
+
* Names the eight page tools: `read`, `click`, `type`, `press`, `navigate`, `wait`, `dialog`,
|
|
413
|
+
* and `switch`.
|
|
370
414
|
*/
|
|
371
415
|
export declare const BROWSER_TOOL_NAMES: readonly BrowserToolName[];
|
|
372
416
|
|
|
373
417
|
/** Holds the refusal for a hold requested while an earlier input remains pending. */
|
|
374
|
-
export declare const BROWSER_TOOL_PENDING_NOTE = "An earlier input is still pending; call
|
|
418
|
+
export declare const BROWSER_TOOL_PENDING_NOTE = "An earlier input is still pending; call read.";
|
|
375
419
|
|
|
376
420
|
/** Caps the `wait` tool's `timeout` parameter at `30_000` milliseconds. */
|
|
377
421
|
export declare const BROWSER_TOOL_TIMEOUT_LIMIT_MS = 30000;
|
|
@@ -387,11 +431,8 @@ export declare const BROWSER_TOOL_TIMEOUT_LIMIT_MS = 30000;
|
|
|
387
431
|
*/
|
|
388
432
|
export declare const BROWSER_TOOL_TIMEOUT_MS = 5000;
|
|
389
433
|
|
|
390
|
-
/**
|
|
391
|
-
|
|
392
|
-
* and names `look` as the call that finds an element the cut view leaves out.
|
|
393
|
-
*/
|
|
394
|
-
export declare const BROWSER_TOOL_VIEW_FOOTER = "the rest was cut; call look with words to find";
|
|
434
|
+
/** Holds the status of a handled submission with no rendered change before the deadline. */
|
|
435
|
+
export declare const BROWSER_TOOL_UNCHANGED_STATUS = "the page handled the submission and has not changed yet; do not submit again; call read or wait for the text you expect";
|
|
395
436
|
|
|
396
437
|
/**
|
|
397
438
|
* Names the accessibility roles the `type` tool writes to: `textbox`, `searchbox`, and
|
|
@@ -415,23 +456,6 @@ export declare const BROWSER_TYPED_ROLES: ReadonlySet<string>;
|
|
|
415
456
|
*/
|
|
416
457
|
export declare const BROWSER_WAIT_EVENTS: readonly string[];
|
|
417
458
|
|
|
418
|
-
/**
|
|
419
|
-
* Captures Chromium Accessibility-domain snapshots for one page.
|
|
420
|
-
*
|
|
421
|
-
* @example
|
|
422
|
-
* ```ts
|
|
423
|
-
* import { BrowserAccessibility } from '@orkestrel/browser'
|
|
424
|
-
*
|
|
425
|
-
* const accessibility = new BrowserAccessibility(page)
|
|
426
|
-
* const tree = await accessibility.snapshot({ depth: 3 }) // { roots, nodes }
|
|
427
|
-
* ```
|
|
428
|
-
*/
|
|
429
|
-
export declare class BrowserAccessibility implements BrowserAccessibilityInterface {
|
|
430
|
-
#private;
|
|
431
|
-
constructor(frame: BrowserFrameInterface);
|
|
432
|
-
snapshot(options?: BrowserAccessibilityOptions): Promise<BrowserAccessibilitySnapshot>;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
459
|
/** Inspects the accessibility tree. */
|
|
436
460
|
export declare interface BrowserAccessibilityInterface {
|
|
437
461
|
/** Reads the full accessibility tree, optionally pruned to the interesting nodes. */
|
|
@@ -455,6 +479,7 @@ export declare interface BrowserAccessibilitySnapshot {
|
|
|
455
479
|
*
|
|
456
480
|
* @remarks
|
|
457
481
|
* - `action` — the tool's name
|
|
482
|
+
* - `start` — the view's URL before dispatch, with registered secrets redacted
|
|
458
483
|
* - `arguments` — the call's arguments, without the text of a secret `type`
|
|
459
484
|
* - `target` — the element the call's reference resolved to, captured before the input was
|
|
460
485
|
* dispatched: its role, exact accessible name, reference, and, in the page placement, frame
|
|
@@ -470,6 +495,7 @@ export declare interface BrowserAccessibilitySnapshot {
|
|
|
470
495
|
*/
|
|
471
496
|
export declare interface BrowserAction {
|
|
472
497
|
readonly action: string;
|
|
498
|
+
readonly start?: string;
|
|
473
499
|
readonly arguments: Readonly<Record<string, JSONValue>>;
|
|
474
500
|
readonly target?: {
|
|
475
501
|
readonly role: string;
|
|
@@ -534,6 +560,14 @@ export declare interface BrowserCallOptions {
|
|
|
534
560
|
readonly signal?: AbortSignal;
|
|
535
561
|
}
|
|
536
562
|
|
|
563
|
+
/** Carries a receipt's capture or the bounded reason no capture was available. */
|
|
564
|
+
export declare interface BrowserCaptureResult {
|
|
565
|
+
readonly outline?: BrowserOutline;
|
|
566
|
+
readonly note?: string;
|
|
567
|
+
readonly tabs: readonly BrowserTab[];
|
|
568
|
+
readonly focus: string | undefined;
|
|
569
|
+
}
|
|
570
|
+
|
|
537
571
|
/** Describes a parsed keyboard chord. */
|
|
538
572
|
export declare interface BrowserChord {
|
|
539
573
|
readonly modifiers: readonly string[];
|
|
@@ -552,35 +586,11 @@ export declare interface BrowserClickOptions extends BrowserInputOptions {
|
|
|
552
586
|
readonly count?: number;
|
|
553
587
|
}
|
|
554
588
|
|
|
555
|
-
/**
|
|
556
|
-
* Controls the Chromium virtual-time budget for deterministic page timers.
|
|
557
|
-
*
|
|
558
|
-
* @example
|
|
559
|
-
* ```ts
|
|
560
|
-
* import { BrowserClock } from '@orkestrel/browser'
|
|
561
|
-
*
|
|
562
|
-
* const clock = new BrowserClock(page)
|
|
563
|
-
* await clock.install(Date.UTC(2026, 0, 1))
|
|
564
|
-
* await clock.advance(5_000)
|
|
565
|
-
* await clock.uninstall()
|
|
566
|
-
* ```
|
|
567
|
-
*/
|
|
568
|
-
export declare class BrowserClock implements BrowserClockInterface {
|
|
569
|
-
#private;
|
|
570
|
-
constructor(frame: BrowserFrameInterface);
|
|
571
|
-
get installed(): boolean;
|
|
572
|
-
install(time?: number): Promise<void>;
|
|
573
|
-
pause(): Promise<void>;
|
|
574
|
-
resume(): Promise<void>;
|
|
575
|
-
advance(ms: number): Promise<void>;
|
|
576
|
-
uninstall(): Promise<void>;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
589
|
/** Controls Chromium virtual time for deterministic page timers. */
|
|
580
590
|
export declare interface BrowserClockInterface {
|
|
581
|
-
readonly
|
|
591
|
+
readonly active: boolean;
|
|
582
592
|
/** Takes over the page clock, optionally seeding it with an epoch time. */
|
|
583
|
-
|
|
593
|
+
start(time?: number): Promise<void>;
|
|
584
594
|
/** Suspends virtual time so no page timer advances. */
|
|
585
595
|
pause(): Promise<void>;
|
|
586
596
|
/** Continues virtual time after a pause. */
|
|
@@ -589,42 +599,8 @@ export declare interface BrowserClockInterface {
|
|
|
589
599
|
* Moves virtual time forward by the given milliseconds, firing the timers that fall due.
|
|
590
600
|
*/
|
|
591
601
|
advance(ms: number): Promise<void>;
|
|
592
|
-
/** Returns the page to the real clock, and does nothing when no clock was
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Records semantic page gestures and compiles them into a journey module.
|
|
598
|
-
* @example
|
|
599
|
-
* const recorder = await page.codegen()
|
|
600
|
-
* await recorder.stop()
|
|
601
|
-
* const script = recorder.script({ name: "add-note", description: "Add a note" })
|
|
602
|
-
*/
|
|
603
|
-
export declare class BrowserCodegen implements BrowserCodegenInterface {
|
|
604
|
-
#private;
|
|
605
|
-
constructor(client: CDPClientInterface, session: string, options?: BrowserRecorderOptions, frames?: () => readonly string[]);
|
|
606
|
-
get emitter(): EmitterInterface<BrowserRecorderEventMap>;
|
|
607
|
-
get started(): boolean;
|
|
608
|
-
start(): Promise<void>;
|
|
609
|
-
/**
|
|
610
|
-
* Installs recording on an attached frame before its owner resumes it.
|
|
611
|
-
* @param session - The attached frame session
|
|
612
|
-
* @returns Completion of listener installation
|
|
613
|
-
*/
|
|
614
|
-
attach(session: string): Promise<void>;
|
|
615
|
-
stop(): Promise<readonly BrowserJourneyStep[]>;
|
|
616
|
-
steps(): readonly BrowserJourneyStep[];
|
|
617
|
-
journey(options: {
|
|
618
|
-
readonly name: string;
|
|
619
|
-
readonly description: string;
|
|
620
|
-
}): BrowserJourney;
|
|
621
|
-
script(options: {
|
|
622
|
-
readonly name: string;
|
|
623
|
-
readonly description: string;
|
|
624
|
-
readonly language?: BrowserCodegenLanguage;
|
|
625
|
-
}): BrowserCodegenScript;
|
|
626
|
-
clear(): void;
|
|
627
|
-
destroy(): Promise<void>;
|
|
602
|
+
/** Returns the page to the real clock, and does nothing when no clock was active. */
|
|
603
|
+
stop(): Promise<void>;
|
|
628
604
|
}
|
|
629
605
|
|
|
630
606
|
/** Carries a sanitized gesture from the page listener without password values. */
|
|
@@ -642,18 +618,6 @@ export declare interface BrowserCodegenGesture {
|
|
|
642
618
|
readonly gap?: string;
|
|
643
619
|
}
|
|
644
620
|
|
|
645
|
-
/** Records semantic page gestures and compiles the resulting journey. */
|
|
646
|
-
export declare interface BrowserCodegenInterface extends BrowserRecorderInterface {
|
|
647
|
-
/** Installs recording on an attached frame before its owner resumes it. */
|
|
648
|
-
attach(session: string): Promise<void>;
|
|
649
|
-
/** Compiles the recorded journey into a standalone module and lists its gaps. */
|
|
650
|
-
script(options: {
|
|
651
|
-
readonly name: string;
|
|
652
|
-
readonly description: string;
|
|
653
|
-
readonly language?: BrowserCodegenLanguage;
|
|
654
|
-
}): BrowserCodegenScript;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
621
|
/** Names the target language for a compiled codegen script. */
|
|
658
622
|
export declare type BrowserCodegenLanguage = 'javascript' | 'typescript';
|
|
659
623
|
|
|
@@ -670,14 +634,6 @@ export declare interface BrowserCodegenScript {
|
|
|
670
634
|
readonly gaps: readonly string[];
|
|
671
635
|
}
|
|
672
636
|
|
|
673
|
-
/**
|
|
674
|
-
* Reports that a CDP connection, discovery, or launch attempt failed, under the code
|
|
675
|
-
* `BROWSER_CONNECTION_ERROR`.
|
|
676
|
-
*/
|
|
677
|
-
export declare class BrowserConnectionError extends BrowserError {
|
|
678
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
679
|
-
}
|
|
680
|
-
|
|
681
637
|
/** Represents one console API call. */
|
|
682
638
|
export declare interface BrowserConsoleMessage {
|
|
683
639
|
readonly level: string;
|
|
@@ -699,16 +655,16 @@ export declare interface BrowserConsoleMessage {
|
|
|
699
655
|
*
|
|
700
656
|
* @example
|
|
701
657
|
* ```ts
|
|
702
|
-
* import {
|
|
658
|
+
* import { createBrowserContext } from '@orkestrel/browser'
|
|
703
659
|
*
|
|
704
|
-
* const context =
|
|
660
|
+
* const context = createBrowserContext(client)
|
|
705
661
|
* const page = await context.create({ url: 'https://example.com' })
|
|
706
662
|
* await context.destroy()
|
|
707
663
|
* ```
|
|
708
664
|
*/
|
|
709
665
|
export declare class BrowserContext implements BrowserContextInterface {
|
|
710
666
|
#private;
|
|
711
|
-
constructor(client: CDPClientInterface,
|
|
667
|
+
constructor(client: CDPClientInterface, options?: BrowserContextOptions);
|
|
712
668
|
get emitter(): EmitterInterface<BrowserContextEventMap>;
|
|
713
669
|
get id(): string | undefined;
|
|
714
670
|
get disposal(): BrowserContextDisposal | undefined;
|
|
@@ -786,23 +742,27 @@ export declare interface BrowserContextInterface {
|
|
|
786
742
|
}
|
|
787
743
|
|
|
788
744
|
/**
|
|
789
|
-
*
|
|
745
|
+
* Configures a wrapper around an existing browser context.
|
|
790
746
|
*
|
|
791
747
|
* @remarks
|
|
792
748
|
* - `on` — initial event listeners wired at construction
|
|
793
749
|
* - `error` — observer error handler forwarded to the emitter
|
|
794
|
-
* - `
|
|
795
|
-
* - `
|
|
750
|
+
* - `id` — existing remote context to wrap; omitted for the default context
|
|
751
|
+
* - `viewport` and `writer` — page defaults and persistence for the context
|
|
796
752
|
* - `downloads` — download policy for the context
|
|
797
753
|
* - `emulation` — emulation overrides inherited by every page of the context
|
|
798
754
|
*/
|
|
799
755
|
export declare interface BrowserContextOptions {
|
|
756
|
+
/** Identifies an existing remote context. Omission addresses the default context. */
|
|
757
|
+
readonly id?: string;
|
|
758
|
+
/** Sets the default viewport for pages this context creates. */
|
|
759
|
+
readonly viewport?: BrowserViewport;
|
|
760
|
+
/** Persists captures and downloads requested through the context's pages. */
|
|
761
|
+
readonly writer?: BrowserWriterInterface;
|
|
800
762
|
/** Names each element reference the context's pages issue. Default: a counter the context owns. */
|
|
801
763
|
readonly reference?: BrowserReferenceFunction;
|
|
802
764
|
readonly on?: EmitterHooks<BrowserContextEventMap>;
|
|
803
765
|
readonly error?: EmitterErrorHandler;
|
|
804
|
-
readonly proxy?: BrowserProxy;
|
|
805
|
-
readonly origins?: readonly string[];
|
|
806
766
|
readonly downloads?: BrowserDownloadOptions;
|
|
807
767
|
readonly emulation?: BrowserEmulationOptions;
|
|
808
768
|
}
|
|
@@ -820,7 +780,7 @@ export declare interface BrowserCookie {
|
|
|
820
780
|
readonly partition: BrowserCookiePartition | undefined;
|
|
821
781
|
}
|
|
822
782
|
|
|
823
|
-
/** Describes
|
|
783
|
+
/** Describes narrowing criteria for removing context cookies. */
|
|
824
784
|
export declare interface BrowserCookieFilter {
|
|
825
785
|
readonly name?: string;
|
|
826
786
|
readonly domain?: string;
|
|
@@ -842,34 +802,16 @@ export declare interface BrowserCookieInput {
|
|
|
842
802
|
readonly partition?: BrowserCookiePartition;
|
|
843
803
|
}
|
|
844
804
|
|
|
845
|
-
/**
|
|
846
|
-
* Performs cookie operations isolated to one browser context.
|
|
847
|
-
*
|
|
848
|
-
* @example
|
|
849
|
-
* ```ts
|
|
850
|
-
* import { BrowserCookieManager } from '@orkestrel/browser'
|
|
851
|
-
*
|
|
852
|
-
* const cookies = new BrowserCookieManager(client)
|
|
853
|
-
* await cookies.set([{ name: 'session', value: 'value', url: 'https://example.com/' }])
|
|
854
|
-
* const current = await cookies.cookies(['https://example.com/'])
|
|
855
|
-
* ```
|
|
856
|
-
*/
|
|
857
|
-
export declare class BrowserCookieManager implements BrowserCookieManagerInterface {
|
|
858
|
-
#private;
|
|
859
|
-
constructor(client: CDPClientInterface, context?: string);
|
|
860
|
-
cookies(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
861
|
-
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
862
|
-
clear(filter?: BrowserCookieFilter): Promise<void>;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
805
|
/** Provides cookie operations scoped to one browser context. */
|
|
866
806
|
export declare interface BrowserCookieManagerInterface {
|
|
867
807
|
/** Reads the context cookies, optionally narrowed to the given URLs. */
|
|
868
808
|
cookies(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
869
809
|
/** Writes the given cookies into the context. */
|
|
870
810
|
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
871
|
-
/**
|
|
872
|
-
|
|
811
|
+
/** Removes the context cookies matching the filter; an empty filter is refused with `ARGUMENT`. */
|
|
812
|
+
remove(filter: BrowserCookieFilter): Promise<void>;
|
|
813
|
+
/** Removes every cookie from the context. */
|
|
814
|
+
clear(): Promise<void>;
|
|
873
815
|
}
|
|
874
816
|
|
|
875
817
|
/** Describes a cookie partition key used by CHIPS-partitioned cookies. */
|
|
@@ -878,27 +820,6 @@ export declare interface BrowserCookiePartition {
|
|
|
878
820
|
readonly ancestor?: boolean;
|
|
879
821
|
}
|
|
880
822
|
|
|
881
|
-
/**
|
|
882
|
-
* Collects JavaScript precise coverage and CSS rule usage for one page target.
|
|
883
|
-
*
|
|
884
|
-
* @example
|
|
885
|
-
* ```ts
|
|
886
|
-
* import { BrowserCoverage } from '@orkestrel/browser'
|
|
887
|
-
*
|
|
888
|
-
* const coverage = new BrowserCoverage(page)
|
|
889
|
-
* await coverage.start({ javascript: true, css: true })
|
|
890
|
-
* const usage = await coverage.stop() // { scripts, styles }
|
|
891
|
-
* ```
|
|
892
|
-
*/
|
|
893
|
-
export declare class BrowserCoverage implements BrowserCoverageInterface {
|
|
894
|
-
#private;
|
|
895
|
-
constructor(frame: BrowserFrameInterface);
|
|
896
|
-
get active(): boolean;
|
|
897
|
-
start(options?: BrowserCoverageOptions): Promise<void>;
|
|
898
|
-
stop(): Promise<BrowserCoverageResult>;
|
|
899
|
-
destroy(): Promise<void>;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
823
|
/** Drives the coverage capture lifecycle. */
|
|
903
824
|
export declare interface BrowserCoverageInterface {
|
|
904
825
|
readonly active: boolean;
|
|
@@ -960,28 +881,6 @@ export declare interface BrowserDestination {
|
|
|
960
881
|
*/
|
|
961
882
|
export declare type BrowserDestinationRelationship = 'self' | 'parent' | 'top';
|
|
962
883
|
|
|
963
|
-
/**
|
|
964
|
-
* Groups the tracing, coverage, performance, and profiler classes beneath one page.
|
|
965
|
-
*
|
|
966
|
-
* @example
|
|
967
|
-
* ```ts
|
|
968
|
-
* import { BrowserDiagnostics } from '@orkestrel/browser'
|
|
969
|
-
*
|
|
970
|
-
* const diagnostics = new BrowserDiagnostics(page)
|
|
971
|
-
* const metrics = await diagnostics.performance.metrics()
|
|
972
|
-
* await diagnostics.destroy()
|
|
973
|
-
* ```
|
|
974
|
-
*/
|
|
975
|
-
export declare class BrowserDiagnostics implements BrowserDiagnosticsInterface {
|
|
976
|
-
#private;
|
|
977
|
-
constructor(frame: BrowserFrameInterface, writer?: BrowserWriterInterface);
|
|
978
|
-
get tracing(): BrowserTracingInterface;
|
|
979
|
-
get coverage(): BrowserCoverageInterface;
|
|
980
|
-
get performance(): BrowserPerformanceInterface;
|
|
981
|
-
get profiler(): BrowserProfilerInterface;
|
|
982
|
-
destroy(): Promise<void>;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
884
|
/** Groups the diagnostics by capability. */
|
|
986
885
|
export declare interface BrowserDiagnosticsInterface {
|
|
987
886
|
readonly tracing: BrowserTracingInterface;
|
|
@@ -1033,8 +932,7 @@ export declare type BrowserDownloadEventMap = {
|
|
|
1033
932
|
*
|
|
1034
933
|
* @remarks
|
|
1035
934
|
* Progress arrives from the owning page, which drives the concrete
|
|
1036
|
-
* `BrowserDownload
|
|
1037
|
-
* exactly its interface methods.
|
|
935
|
+
* `BrowserDownload` through private callbacks; consumers observe progress and may abort.
|
|
1038
936
|
*/
|
|
1039
937
|
export declare interface BrowserDownloadInterface {
|
|
1040
938
|
readonly emitter: EmitterInterface<BrowserDownloadEventMap>;
|
|
@@ -1050,8 +948,6 @@ export declare interface BrowserDownloadInterface {
|
|
|
1050
948
|
* status is still pending. The status becomes `'aborted'` and the `abort` event fires.
|
|
1051
949
|
*/
|
|
1052
950
|
abort(): Promise<void>;
|
|
1053
|
-
/** Records one step of the download's progress. The owning page drives it. */
|
|
1054
|
-
update(progress: BrowserDownloadProgress): void;
|
|
1055
951
|
}
|
|
1056
952
|
|
|
1057
953
|
/** Describes the download policy for a browser context. */
|
|
@@ -1091,44 +987,19 @@ export declare interface BrowserDragOptions extends BrowserInputOptions {
|
|
|
1091
987
|
readonly steps?: number;
|
|
1092
988
|
}
|
|
1093
989
|
|
|
1094
|
-
/**
|
|
1095
|
-
* Reports a refused element operation with a reason and, for `GONE`, the refresh directive.
|
|
1096
|
-
*
|
|
1097
|
-
* @remarks
|
|
1098
|
-
* The message names the element and the detail on one line. It ends with
|
|
1099
|
-
* `; call look for fresh refs.` for `GONE` alone, because only a changed page makes a fresh
|
|
1100
|
-
* reference the remedy; every other reason ends the message with a period, and a caller whose
|
|
1101
|
-
* refusal a fresh reference does fix names that remedy in its detail.
|
|
1102
|
-
*/
|
|
1103
|
-
export declare class BrowserElementError extends BrowserError {
|
|
1104
|
-
constructor(reference: string | BrowserElementSubject, reason: BrowserElementReason, detail?: string);
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
990
|
/** Retains both session-local and page-composed element geometry. */
|
|
1108
991
|
export declare interface BrowserElementGeometry {
|
|
1109
992
|
readonly local: BrowserQuad;
|
|
1110
993
|
readonly page: BrowserQuad;
|
|
1111
994
|
}
|
|
1112
995
|
|
|
1113
|
-
/** Binds an element to its document identity and the page's shared protocol resources. */
|
|
1114
|
-
export declare interface BrowserElementInput extends BrowserElementManagerInput {
|
|
1115
|
-
readonly description: () => BrowserOutlineNode;
|
|
1116
|
-
readonly node: BrowserOutlineNode & {
|
|
1117
|
-
readonly reference: string;
|
|
1118
|
-
};
|
|
1119
|
-
readonly backend: number;
|
|
1120
|
-
readonly frame: string;
|
|
1121
|
-
readonly current: () => boolean;
|
|
1122
|
-
readonly point: BrowserElementPointFunction;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
996
|
/** Provides actions and reading through a stable document element reference. */
|
|
1126
997
|
export declare interface BrowserElementInterface {
|
|
1127
998
|
readonly reference: string;
|
|
1128
999
|
readonly role: string;
|
|
1129
1000
|
readonly name: string;
|
|
1130
1001
|
/**
|
|
1131
|
-
* Clicks the element, refusing with a coded `
|
|
1002
|
+
* Clicks the element, refusing with a coded `BrowserError` when it is gone, hidden,
|
|
1132
1003
|
* covered, or disabled.
|
|
1133
1004
|
*/
|
|
1134
1005
|
click(options?: BrowserCallOptions): Promise<void>;
|
|
@@ -1159,35 +1030,11 @@ export declare interface BrowserElementInterface {
|
|
|
1159
1030
|
submit(options?: BrowserCallOptions): Promise<void>;
|
|
1160
1031
|
}
|
|
1161
1032
|
|
|
1162
|
-
/**
|
|
1163
|
-
* Captures accessibility trees and binds stable references to their owning frame sessions.
|
|
1164
|
-
*
|
|
1165
|
-
* @remarks
|
|
1166
|
-
* A reference is dropped when the page reports its frame's document replaced or detached through
|
|
1167
|
-
* `input.steps`, which carries only the steps of each frame's owning session.
|
|
1168
|
-
* @example
|
|
1169
|
-
* ```ts
|
|
1170
|
-
* const outline = await page.elements.outline()
|
|
1171
|
-
* const matches = await page.elements.find({ role: 'button', name: 'save' })
|
|
1172
|
-
* await matches[0]?.click()
|
|
1173
|
-
* ```
|
|
1174
|
-
*/
|
|
1175
|
-
export declare class BrowserElementManager implements BrowserElementManagerInterface<BrowserPageElementInterface> {
|
|
1176
|
-
#private;
|
|
1177
|
-
constructor(input: BrowserElementManagerInput);
|
|
1178
|
-
outline(options?: BrowserOutlineOptions): Promise<BrowserOutline>;
|
|
1179
|
-
/** A CSS query searches the page's main-frame document; use the accessibility outline for in-process child documents. */
|
|
1180
|
-
find(query: BrowserElementQuery, options?: BrowserCallOptions): Promise<readonly BrowserPageElementInterface[]>;
|
|
1181
|
-
wait(query: BrowserElementQuery, options?: BrowserWaitOptions): Promise<readonly BrowserPageElementInterface[]>;
|
|
1182
|
-
element(reference: string): BrowserPageElementInterface | undefined;
|
|
1183
|
-
elements(): readonly BrowserPageElementInterface[];
|
|
1184
|
-
clear(): void;
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
1033
|
/**
|
|
1188
1034
|
* Provides the protocol and ownership boundaries used by a page element manager.
|
|
1189
1035
|
*
|
|
1190
1036
|
* @remarks
|
|
1037
|
+
* Shared by BrowserElementManager and BrowserPageElement.
|
|
1191
1038
|
* - `steps` — the navigation steps the page accepts from the session that owns each frame
|
|
1192
1039
|
*/
|
|
1193
1040
|
export declare interface BrowserElementManagerInput {
|
|
@@ -1208,8 +1055,8 @@ export declare interface BrowserElementManagerInput {
|
|
|
1208
1055
|
export declare interface BrowserElementManagerInterface<TElement extends BrowserElementInterface = BrowserElementInterface> {
|
|
1209
1056
|
/**
|
|
1210
1057
|
* Captures the view's document as a document-order outline, binding a reference to each
|
|
1211
|
-
* interactive element and bounding the referenced rows by `limit`. The outline
|
|
1212
|
-
*
|
|
1058
|
+
* interactive element and bounding the referenced rows by `limit`. The outline carries
|
|
1059
|
+
* wrapped lines and names the focused referenced row even past `limit`.
|
|
1213
1060
|
*/
|
|
1214
1061
|
outline(options?: BrowserOutlineOptions): Promise<BrowserOutline>;
|
|
1215
1062
|
/**
|
|
@@ -1233,9 +1080,6 @@ export declare interface BrowserElementManagerInterface<TElement extends Browser
|
|
|
1233
1080
|
clear(): void;
|
|
1234
1081
|
}
|
|
1235
1082
|
|
|
1236
|
-
/** Composes a frame-local point into page coordinates. */
|
|
1237
|
-
export declare type BrowserElementPointFunction = (frame: string, point: BrowserPoint, options?: BrowserCallOptions) => Promise<BrowserPoint>;
|
|
1238
|
-
|
|
1239
1083
|
/**
|
|
1240
1084
|
* Describes an accessibility or CSS query within an optional element reference.
|
|
1241
1085
|
*
|
|
@@ -1275,28 +1119,10 @@ export declare interface BrowserElementSubject {
|
|
|
1275
1119
|
readonly subject: string;
|
|
1276
1120
|
}
|
|
1277
1121
|
|
|
1278
|
-
/** Resolves the page-owned isolated world for a particular frame and session.
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
/**
|
|
1282
|
-
* Applies rendering, identity, location, and network emulation for context pages.
|
|
1283
|
-
*
|
|
1284
|
-
* @example
|
|
1285
|
-
* ```ts
|
|
1286
|
-
* import { BrowserEmulationManager } from '@orkestrel/browser'
|
|
1287
|
-
*
|
|
1288
|
-
* const emulation = new BrowserEmulationManager(() => context.pages())
|
|
1289
|
-
* await emulation.apply({ locale: 'en-US', media: { scheme: 'dark' } })
|
|
1290
|
-
* await emulation.clear()
|
|
1291
|
-
* ```
|
|
1122
|
+
/** Resolves the page-owned isolated world for a particular frame and session.
|
|
1123
|
+
* @remarks Shared by BrowserElementManager and BrowserPageElement.
|
|
1292
1124
|
*/
|
|
1293
|
-
export declare
|
|
1294
|
-
#private;
|
|
1295
|
-
constructor(pages: BrowserPagesFunction, options?: BrowserEmulationOptions);
|
|
1296
|
-
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
1297
|
-
clear(): Promise<void>;
|
|
1298
|
-
attach(page: BrowserPageInterface): Promise<void>;
|
|
1299
|
-
}
|
|
1125
|
+
export declare type BrowserElementWorldFunction = (frame: string, session: string, options?: BrowserCallOptions) => Promise<number>;
|
|
1300
1126
|
|
|
1301
1127
|
/** Configures context-scoped emulation. */
|
|
1302
1128
|
export declare interface BrowserEmulationManagerInterface {
|
|
@@ -1306,8 +1132,6 @@ export declare interface BrowserEmulationManagerInterface {
|
|
|
1306
1132
|
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
1307
1133
|
/** Removes every override this manager applied. */
|
|
1308
1134
|
clear(): Promise<void>;
|
|
1309
|
-
/** Applies the retained overrides to a newly created page. */
|
|
1310
|
-
attach(page: BrowserPageInterface): Promise<void>;
|
|
1311
1135
|
}
|
|
1312
1136
|
|
|
1313
1137
|
/** Describes network and rendering overrides inherited by context pages. */
|
|
@@ -1331,18 +1155,26 @@ export declare interface BrowserEmulationOptions {
|
|
|
1331
1155
|
export declare type BrowserEpochFunction = () => number;
|
|
1332
1156
|
|
|
1333
1157
|
/**
|
|
1334
|
-
*
|
|
1335
|
-
* `BROWSER_ERROR` and a `context` record.
|
|
1158
|
+
* Reports a browser failure with a typed code and optional JSON context.
|
|
1336
1159
|
*
|
|
1337
1160
|
* @remarks
|
|
1338
|
-
* A caller branches
|
|
1161
|
+
* A caller branches on `code` rather than parsing the message.
|
|
1339
1162
|
*/
|
|
1340
1163
|
export declare class BrowserError extends Error {
|
|
1341
|
-
readonly code:
|
|
1342
|
-
readonly context:
|
|
1343
|
-
constructor(
|
|
1164
|
+
readonly code: BrowserErrorCode;
|
|
1165
|
+
readonly context: JSONRecord | undefined;
|
|
1166
|
+
constructor(code: BrowserErrorCode, message: string, context?: JSONRecord);
|
|
1344
1167
|
}
|
|
1345
1168
|
|
|
1169
|
+
/**
|
|
1170
|
+
* Identifies a browser refusal, lifecycle failure, or protocol failure.
|
|
1171
|
+
*
|
|
1172
|
+
* @remarks
|
|
1173
|
+
* `TOOLSET_SETTLED` and `TOOLSET_RECEIPT` stop internal toolset work.
|
|
1174
|
+
* Callers receive their resulting receipt rather than these internal signals.
|
|
1175
|
+
*/
|
|
1176
|
+
export declare type BrowserErrorCode = 'ARGUMENT' | 'CAPTURE_UNAVAILABLE' | 'CAPTURE_UNTRUSTED' | 'CLOSED' | 'CONNECTION' | 'DISCONNECTED' | 'DOCUMENT' | 'DOCUMENT_DESTROYED' | 'DOCUMENT_OWN' | 'DOCUMENT_SUBMIT' | 'ELEMENT' | 'ELEMENT_QUERY' | 'HAR' | 'STORE_ACCESS' | 'JOURNEY_AMBIGUOUS' | 'JOURNEY_DIALOG' | 'JOURNEY_EDIT' | 'JOURNEY_EMPTY' | 'STORE_FILE' | 'STORE_FORMAT' | 'JOURNEY_GAP' | 'JOURNEY_INPUT' | 'JOURNEY_INVALID' | 'STORE_LOCKED' | 'JOURNEY_MISSING' | 'STORE_PATH' | 'JOURNEY_PLACEMENT' | 'JOURNEY_READONLY' | 'JOURNEY_RECORDING' | 'JOURNEY_SAVED' | 'JOURNEY_STALE' | 'JOURNEY_TARGET' | 'JSON' | 'NAVIGATION' | 'PROTOCOL' | 'REMOTE' | 'RESULT_LIMIT' | 'SERVER_BUSY' | 'SERVER_CRASH' | 'SERVER_ENVIRONMENT' | 'SERVER_EXHAUSTED' | 'SERVER_HOLDER' | 'SERVER_LAUNCH' | 'SERVER_SWEEP' | 'SERVER_TEARDOWN' | 'SERVER_UNAVAILABLE' | 'SERVER_UNRESOLVED' | 'STEP' | 'TARGET_HELD' | 'TIMEOUT' | 'TOOLSET_BUSY' | 'TOOLSET_CAPTURE' | 'TOOLSET_CONTEXT' | 'TOOLSET_DIALOG' | 'TOOLSET_LIMIT' | 'TOOLSET_OBSERVE' | 'TOOLSET_PAGE' | 'TOOLSET_RECEIPT' | 'TOOLSET_RESERVED' | 'TOOLSET_ROLE' | 'TOOLSET_SCHEME' | 'TOOLSET_SETTLED' | 'TOOLSET_TAB';
|
|
1177
|
+
|
|
1346
1178
|
/** Represents one intercepted file chooser. */
|
|
1347
1179
|
export declare interface BrowserFileChooserInterface {
|
|
1348
1180
|
readonly multiple: boolean;
|
|
@@ -1369,44 +1201,6 @@ export declare interface BrowserFollowOptions extends BrowserCallOptions {
|
|
|
1369
1201
|
readonly secret?: boolean;
|
|
1370
1202
|
}
|
|
1371
1203
|
|
|
1372
|
-
/**
|
|
1373
|
-
* Represents one attached document frame, evaluated through its own CDP execution world.
|
|
1374
|
-
*
|
|
1375
|
-
* @remarks
|
|
1376
|
-
* The optional `epoch` constructor parameter reads the frame's navigation counter, which lets
|
|
1377
|
-
* `read()` mark a reading stale after a later navigation. The optional `world` parameter
|
|
1378
|
-
* resolves a cached isolated-world context, which lets a page share one world across reads.
|
|
1379
|
-
* A standalone frame built with neither returns readings whose `stale` stays `false`, because
|
|
1380
|
-
* no navigation counter is available to it, and creates a fresh world for each read.
|
|
1381
|
-
*
|
|
1382
|
-
* @example
|
|
1383
|
-
* ```ts
|
|
1384
|
-
* import { BrowserFrame } from '@orkestrel/browser'
|
|
1385
|
-
*
|
|
1386
|
-
* const frame = new BrowserFrame(client, 'session-1', 'frame-1', 'https://example.com')
|
|
1387
|
-
* const title = await frame.title()
|
|
1388
|
-
* const reading = await frame.read()
|
|
1389
|
-
* ```
|
|
1390
|
-
*/
|
|
1391
|
-
export declare class BrowserFrame implements BrowserFrameInterface {
|
|
1392
|
-
#private;
|
|
1393
|
-
constructor(client: CDPClientInterface, session: string | BrowserSessionFunction, id: string, url: string, parent?: string, name?: string, isolated?: boolean, epoch?: BrowserEpochFunction, world?: BrowserWorldFunction);
|
|
1394
|
-
get id(): string;
|
|
1395
|
-
get parent(): string | undefined;
|
|
1396
|
-
get name(): string | undefined;
|
|
1397
|
-
get url(): string;
|
|
1398
|
-
title(options?: BrowserCallOptions): Promise<string>;
|
|
1399
|
-
read(options?: BrowserCallOptions): Promise<BrowserReadingInterface>;
|
|
1400
|
-
evaluate(expression: string, options?: BrowserCallOptions): Promise<unknown>;
|
|
1401
|
-
handle(expression: string, options?: BrowserCallOptions): Promise<BrowserHandleInterface>;
|
|
1402
|
-
send(method: string, params?: Readonly<Record<string, unknown>>, options?: BrowserCallOptions): Promise<unknown>;
|
|
1403
|
-
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
1404
|
-
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
1405
|
-
save(path: string, _bytes: Uint8Array): Promise<void>;
|
|
1406
|
-
assert(): void;
|
|
1407
|
-
update(url: string): void;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
1204
|
/**
|
|
1411
1205
|
* Describes serializable frame metadata decoded from CDP `Page.getFrameTree`.
|
|
1412
1206
|
*
|
|
@@ -1436,8 +1230,6 @@ export declare interface BrowserFrameInfo {
|
|
|
1436
1230
|
* - `evaluate` — execute a JavaScript expression in the page context
|
|
1437
1231
|
* - `wait` — wait for an element state
|
|
1438
1232
|
* - `send` — issue a raw CDP method in the frame's current target session, with an optional per-call timeout
|
|
1439
|
-
* - `assert` — throw when the frame can no longer accept protocol work
|
|
1440
|
-
* - `update` — record an externally observed URL as the frame's current URL
|
|
1441
1233
|
*/
|
|
1442
1234
|
export declare interface BrowserFrameInterface {
|
|
1443
1235
|
readonly id: string;
|
|
@@ -1449,9 +1241,8 @@ export declare interface BrowserFrameInterface {
|
|
|
1449
1241
|
/**
|
|
1450
1242
|
* Captures the document URL, title, and rendered HTML in one size-guarded evaluation in the frame's
|
|
1451
1243
|
* isolated world and returns them as a reading whose `stale` flag tracks later navigations.
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
* available to it. {@link BrowserReadingInput} defines the rendered markup.
|
|
1244
|
+
* The owning page supplies the navigation counter. {@link BrowserReadingInput} defines
|
|
1245
|
+
* the rendered markup.
|
|
1455
1246
|
*/
|
|
1456
1247
|
read(options?: BrowserCallOptions): Promise<BrowserReadingInterface>;
|
|
1457
1248
|
/** Evaluates an expression in the frame execution world under the result-size guard. */
|
|
@@ -1470,21 +1261,6 @@ export declare interface BrowserFrameInterface {
|
|
|
1470
1261
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
1471
1262
|
/** Removes a frame-session CDP event subscription. */
|
|
1472
1263
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
1473
|
-
/**
|
|
1474
|
-
* Persists bytes through a page writer; a child frame rejects because it owns no writer.
|
|
1475
|
-
*/
|
|
1476
|
-
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
1477
|
-
/**
|
|
1478
|
-
* Throws a coded `BrowserError` when the frame can no longer accept protocol work: a frame
|
|
1479
|
-
* throws after the CDP client disconnects, and a page also throws after it closes. Every
|
|
1480
|
-
* other member here calls it first.
|
|
1481
|
-
*/
|
|
1482
|
-
assert(): void;
|
|
1483
|
-
/**
|
|
1484
|
-
* Records an externally observed URL as the frame's current `url`, which a page calls from
|
|
1485
|
-
* its own `Page.frameNavigated` handler.
|
|
1486
|
-
*/
|
|
1487
|
-
update(url: string): void;
|
|
1488
1264
|
}
|
|
1489
1265
|
|
|
1490
1266
|
/** Describes function coverage inside one script. */
|
|
@@ -1518,7 +1294,7 @@ export declare interface BrowserHandleInterface {
|
|
|
1518
1294
|
/** Reads every own property by value. */
|
|
1519
1295
|
properties(options?: BrowserCallOptions): Promise<Readonly<Record<string, unknown>>>;
|
|
1520
1296
|
/** Releases the retained remote object. Idempotent. */
|
|
1521
|
-
|
|
1297
|
+
destroy(): Promise<void>;
|
|
1522
1298
|
}
|
|
1523
1299
|
|
|
1524
1300
|
/** Describes the standards-shaped HAR 1.2 document produced by the network manager. */
|
|
@@ -1581,31 +1357,9 @@ export declare interface BrowserHARLog {
|
|
|
1581
1357
|
readonly entries: readonly BrowserHAREntry[];
|
|
1582
1358
|
}
|
|
1583
1359
|
|
|
1584
|
-
/**
|
|
1585
|
-
* Records and replays HTTP archives over one page network manager.
|
|
1586
|
-
*
|
|
1587
|
-
* @example
|
|
1588
|
-
* ```ts
|
|
1589
|
-
* import { BrowserHARManager } from '@orkestrel/browser'
|
|
1590
|
-
*
|
|
1591
|
-
* const har = new BrowserHARManager(page.network)
|
|
1592
|
-
* await har.start({ content: true })
|
|
1593
|
-
* const archive = await har.stop() // { log: { version: '1.2', creator, entries } }
|
|
1594
|
-
* ```
|
|
1595
|
-
*/
|
|
1596
|
-
export declare class BrowserHARManager implements BrowserHARManagerInterface {
|
|
1597
|
-
#private;
|
|
1598
|
-
constructor(network: BrowserNetworkManagerInterface, writer?: BrowserWriterInterface);
|
|
1599
|
-
get recording(): boolean;
|
|
1600
|
-
start(options?: BrowserHAROptions): Promise<void>;
|
|
1601
|
-
stop(): Promise<BrowserHAR>;
|
|
1602
|
-
replay(har: BrowserHAR, options?: BrowserHARReplayOptions): Promise<void>;
|
|
1603
|
-
clear(): Promise<void>;
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
1360
|
/** Provides HAR recording and replay operations. */
|
|
1607
1361
|
export declare interface BrowserHARManagerInterface {
|
|
1608
|
-
readonly
|
|
1362
|
+
readonly active: boolean;
|
|
1609
1363
|
/** Begins recording exchanges, optionally capturing response content. */
|
|
1610
1364
|
start(options?: BrowserHAROptions): Promise<void>;
|
|
1611
1365
|
/** Ends recording and returns the archive, writing it when a path was given. */
|
|
@@ -1622,13 +1376,6 @@ export declare interface BrowserHAROptions {
|
|
|
1622
1376
|
readonly content?: boolean;
|
|
1623
1377
|
}
|
|
1624
1378
|
|
|
1625
|
-
/** Holds recording state until a request finishes; a new value replaces it on each update. */
|
|
1626
|
-
export declare interface BrowserHARPending {
|
|
1627
|
-
readonly request: BrowserRequest;
|
|
1628
|
-
readonly started: number;
|
|
1629
|
-
readonly response: BrowserResponse | undefined;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
1379
|
/** Describes request body metadata in an HTTP archive. */
|
|
1633
1380
|
export declare interface BrowserHARPost {
|
|
1634
1381
|
readonly mimeType: string;
|
|
@@ -1731,6 +1478,19 @@ export declare interface BrowserInvocationResult {
|
|
|
1731
1478
|
readonly error: string | undefined;
|
|
1732
1479
|
}
|
|
1733
1480
|
|
|
1481
|
+
/**
|
|
1482
|
+
* Configures a new isolated browser context.
|
|
1483
|
+
* @remarks
|
|
1484
|
+
* Inherits page defaults, downloads, emulation, references, and listeners from the wrapper options.
|
|
1485
|
+
* - `proxy` — proxy server and bypass list for the new context
|
|
1486
|
+
* - `origins` — origins granted universal network access
|
|
1487
|
+
* The browser assigns the remote context id.
|
|
1488
|
+
*/
|
|
1489
|
+
export declare interface BrowserIsolateOptions extends Omit<BrowserContextOptions, 'id'> {
|
|
1490
|
+
readonly proxy?: BrowserProxy;
|
|
1491
|
+
readonly origins?: readonly string[];
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1734
1494
|
/**
|
|
1735
1495
|
* Describes one user intent as data; `next` is the number the next added step takes.
|
|
1736
1496
|
*
|
|
@@ -1738,6 +1498,9 @@ export declare interface BrowserInvocationResult {
|
|
|
1738
1498
|
* - `format` — the file format, `BROWSER_JOURNEY_FORMAT_VERSION`
|
|
1739
1499
|
* - `name` — the journey's name, matching `BROWSER_JOURNEY_NAME_PATTERN`
|
|
1740
1500
|
* - `description` — what the journey achieves, in one sentence
|
|
1501
|
+
* - `start` — the first recorded step's page URL, redacted before storage; absent for an
|
|
1502
|
+
* `about:` page such as `about:blank` or `about:srcdoc`. Edits retain it, including removal
|
|
1503
|
+
* of the first step. Format 1 files without it replay on the current page.
|
|
1741
1504
|
* - `parameters` — the declared parameters by name
|
|
1742
1505
|
* - `next` — the number the next added step takes, persisted so a removed id is never reused
|
|
1743
1506
|
* - `steps` — the steps in order
|
|
@@ -1746,6 +1509,7 @@ export declare interface BrowserJourney {
|
|
|
1746
1509
|
readonly format: 1;
|
|
1747
1510
|
readonly name: string;
|
|
1748
1511
|
readonly description: string;
|
|
1512
|
+
readonly start?: string;
|
|
1749
1513
|
readonly parameters: Readonly<Record<string, BrowserJourneyParameter>>;
|
|
1750
1514
|
readonly next: number;
|
|
1751
1515
|
readonly steps: readonly BrowserJourneyStep[];
|
|
@@ -1763,11 +1527,10 @@ export declare type BrowserJourneyBinding = string | {
|
|
|
1763
1527
|
* @remarks
|
|
1764
1528
|
* - `add` — inserts `step` with the next id, before or after the step `before` or `after` names
|
|
1765
1529
|
* - `remove` — removes the step `id` names
|
|
1766
|
-
* - `update` — merges `arguments` into the step `id` names by key, and replaces its `target` or
|
|
1767
1530
|
* `tab`
|
|
1768
1531
|
* - `declare` — declares the parameter `name` names, which a step binds at the end of the batch
|
|
1769
1532
|
*
|
|
1770
|
-
* A refused batch rejects with `
|
|
1533
|
+
* A refused batch rejects with `JOURNEY_EDIT`, naming the edit's index and the reason.
|
|
1771
1534
|
*/
|
|
1772
1535
|
export declare type BrowserJourneyEdit = {
|
|
1773
1536
|
readonly operation: 'add';
|
|
@@ -1807,12 +1570,18 @@ export declare type BrowserJourneyEditRequest = BrowserJourneyEdit | {
|
|
|
1807
1570
|
readonly arguments?: Readonly<Record<string, BrowserJourneyBinding | JSONValue>>;
|
|
1808
1571
|
};
|
|
1809
1572
|
|
|
1573
|
+
/** Names and describes a journey built from recorded steps. */
|
|
1574
|
+
export declare interface BrowserJourneyInput {
|
|
1575
|
+
readonly name: string;
|
|
1576
|
+
readonly description: string;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1810
1579
|
/**
|
|
1811
1580
|
* Configures the journey toolset a toolset constructs.
|
|
1812
1581
|
*
|
|
1813
1582
|
* @remarks
|
|
1814
1583
|
* - `store` — keeps the journeys the tools record, list, edit, and replay
|
|
1815
|
-
* - `runs` — keeps each replay's run and saves standalone images when it provides `
|
|
1584
|
+
* - `runs` — keeps each replay's run and saves standalone images when it provides `write`
|
|
1816
1585
|
* - `limit` — positive integer listing cap in characters; Default: the owner's `limit`, including direct construction
|
|
1817
1586
|
* - `readonly` — if `true`, refuses `record`, `save`, `edit`, and `forget` before any store access, and
|
|
1818
1587
|
* `replay` still writes runs; if `false` or omitted, every tool runs
|
|
@@ -1882,23 +1651,24 @@ export declare interface BrowserJourneyStepInput {
|
|
|
1882
1651
|
export declare interface BrowserJourneyStoreInterface {
|
|
1883
1652
|
/**
|
|
1884
1653
|
* Returns the journey saved under `name` with its revision, or `undefined` when none is saved.
|
|
1885
|
-
* Rejects with `
|
|
1886
|
-
* unknown format, and `
|
|
1654
|
+
* Rejects with `STORE_FILE` for a malformed entry, `STORE_FORMAT` for an
|
|
1655
|
+
* unknown format, and `STORE_ACCESS` for a permission error, each naming the path.
|
|
1887
1656
|
*/
|
|
1888
1657
|
get(name: string, options?: BrowserStoreOptions): Promise<BrowserJourneyRevision | undefined>;
|
|
1889
1658
|
/**
|
|
1890
1659
|
* Saves the journey under its name with the next revision and returns it.
|
|
1891
1660
|
*
|
|
1892
1661
|
* @remarks
|
|
1893
|
-
* Rejects with `
|
|
1894
|
-
*
|
|
1895
|
-
*
|
|
1896
|
-
*
|
|
1662
|
+
* Rejects with `JOURNEY_STALE` when `revision` does not match a saved journey or
|
|
1663
|
+
* `exclusive: true` finds an existing journey, and with `STORE_LOCKED` when another
|
|
1664
|
+
* write holds the name. Omitting both conditions permits replacement. Supplying both
|
|
1665
|
+
* conditions, or a revision that is not a positive safe integer, rejects with `ARGUMENT`
|
|
1666
|
+
* before writing. Revisions keep advancing across deletion and recreation.
|
|
1897
1667
|
*/
|
|
1898
|
-
set(journey: BrowserJourney,
|
|
1668
|
+
set(journey: BrowserJourney, options?: BrowserJourneyWriteOptions): Promise<BrowserJourneyRevision>;
|
|
1899
1669
|
/**
|
|
1900
1670
|
* Removes the journey saved under `name` and keeps its revision count, so a recreated journey
|
|
1901
|
-
* continues it; a missing name is a no-op. Rejects with `
|
|
1671
|
+
* continues it; a missing name is a no-op. Rejects with `STORE_LOCKED` when another
|
|
1902
1672
|
* write holds the name.
|
|
1903
1673
|
*/
|
|
1904
1674
|
delete(name: string, options?: BrowserStoreOptions): Promise<void>;
|
|
@@ -1906,10 +1676,7 @@ export declare interface BrowserJourneyStoreInterface {
|
|
|
1906
1676
|
* Returns one page of the saved journeys sorted by name, starting at `offset` and holding at
|
|
1907
1677
|
* most `limit` entries, with the entries it could not read in `faults`.
|
|
1908
1678
|
*/
|
|
1909
|
-
list(options?:
|
|
1910
|
-
readonly offset?: number;
|
|
1911
|
-
readonly limit?: number;
|
|
1912
|
-
}): Promise<BrowserStorePage<BrowserJourneyRevision>>;
|
|
1679
|
+
list(options?: BrowserStorePageOptions): Promise<BrowserStorePage<BrowserJourneyRevision>>;
|
|
1913
1680
|
}
|
|
1914
1681
|
|
|
1915
1682
|
/**
|
|
@@ -1940,62 +1707,6 @@ export declare interface BrowserJourneyTarget {
|
|
|
1940
1707
|
readonly reference?: string;
|
|
1941
1708
|
}
|
|
1942
1709
|
|
|
1943
|
-
/**
|
|
1944
|
-
* Registers the journey tools `record`, `save`, `journeys`, `edit`, `replay`, `forget`, and `capture` over a toolset
|
|
1945
|
-
* and owns the recording and the active replay.
|
|
1946
|
-
*
|
|
1947
|
-
* @remarks
|
|
1948
|
-
* The journey toolset composes the toolset's public members: `perform` reads the view a receipt
|
|
1949
|
-
* carries through `look`, `hold` and `emitter` drive the recorder and the replay, `view` converts
|
|
1950
|
-
* an edit's `ref` to a target, and `tools` receives the journey tools at construction, which refuses
|
|
1951
|
-
* with `BROWSER_TOOLSET_RESERVED` when the manager already holds one of the names. Every refusal
|
|
1952
|
-
* is a sentence that names the next call, and a reason inside it is a clause without a directive
|
|
1953
|
-
* or a final period.
|
|
1954
|
-
*
|
|
1955
|
-
* `readonly` refuses `record`, `save`, `edit`, and `forget` before any store access; `replay` still writes
|
|
1956
|
-
* its run. The call's signal reaches every store call and every replayed step, and `destroy()`
|
|
1957
|
-
* aborts it as well. `save` writes a snapshot before it ends the recording, so a failed or
|
|
1958
|
-
* locked write keeps the recorder recording with its steps for the next
|
|
1959
|
-
* `save`. An empty snapshot refuses with `BROWSER_JOURNEY_EMPTY` and keeps recording.
|
|
1960
|
-
* `edit` accepts an array or its JSON string and names a parse error when the string is invalid.
|
|
1961
|
-
* `journeys` joins the listings with one blank line and cuts the result at `limit`
|
|
1962
|
-
* characters with a footer that names the next offset. `replay` returns the run's render followed
|
|
1963
|
-
* by the view after the run.
|
|
1964
|
-
*
|
|
1965
|
-
* `destroy()` aborts the active replay and waits for it to finish, stops a recording without
|
|
1966
|
-
* saving it, and removes the journey tools the manager still holds under the instances it added.
|
|
1967
|
-
*
|
|
1968
|
-
* @example
|
|
1969
|
-
* ```ts
|
|
1970
|
-
* import { BrowserJourneyToolset, createMemoryBrowserJourneyStore } from '@orkestrel/browser'
|
|
1971
|
-
*
|
|
1972
|
-
* const journeys = new BrowserJourneyToolset(toolset, { store: createMemoryBrowserJourneyStore() })
|
|
1973
|
-
* await toolset.tools.execute({ id: '1', name: 'record', arguments: { journey: 'add-kettle' } })
|
|
1974
|
-
* await journeys.destroy()
|
|
1975
|
-
* ```
|
|
1976
|
-
*/
|
|
1977
|
-
export declare class BrowserJourneyToolset implements BrowserJourneyToolsetInterface {
|
|
1978
|
-
#private;
|
|
1979
|
-
constructor(toolset: BrowserToolsetInterface, options: BrowserJourneyOptions);
|
|
1980
|
-
get recording(): string | undefined;
|
|
1981
|
-
get replaying(): string | undefined;
|
|
1982
|
-
destroy(): Promise<void>;
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
/**
|
|
1986
|
-
* Registers the journey tools over a toolset and owns the recording and the active replay.
|
|
1987
|
-
*
|
|
1988
|
-
* @remarks
|
|
1989
|
-
* - `recording` — the name of the journey being recorded, or `undefined` when none is
|
|
1990
|
-
* - `replaying` — the name of the journey being replayed, or `undefined` when none is
|
|
1991
|
-
*/
|
|
1992
|
-
export declare interface BrowserJourneyToolsetInterface {
|
|
1993
|
-
readonly recording: string | undefined;
|
|
1994
|
-
readonly replaying: string | undefined;
|
|
1995
|
-
/** Aborts the active replay and removes the journey tools from the manager. */
|
|
1996
|
-
destroy(): Promise<void>;
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
1710
|
/** Identifies the parameter binding that failed journey validation. */
|
|
2000
1711
|
export declare interface BrowserJourneyValidationContext {
|
|
2001
1712
|
readonly parameter: string;
|
|
@@ -2003,6 +1714,14 @@ export declare interface BrowserJourneyValidationContext {
|
|
|
2003
1714
|
readonly field: string;
|
|
2004
1715
|
}
|
|
2005
1716
|
|
|
1717
|
+
/** Constrains a journey write atomically at the store. */
|
|
1718
|
+
export declare interface BrowserJourneyWriteOptions extends BrowserStoreOptions {
|
|
1719
|
+
/** Requires the saved journey to have this positive revision. */
|
|
1720
|
+
readonly revision?: number;
|
|
1721
|
+
/** If true, requires absence and refuses revision; false is the same as omission. */
|
|
1722
|
+
readonly exclusive?: boolean;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
2006
1725
|
/** Describes normalized CDP keyboard key data. */
|
|
2007
1726
|
export declare interface BrowserKey {
|
|
2008
1727
|
readonly key: string;
|
|
@@ -2011,28 +1730,6 @@ export declare interface BrowserKey {
|
|
|
2011
1730
|
readonly number: number;
|
|
2012
1731
|
}
|
|
2013
1732
|
|
|
2014
|
-
/**
|
|
2015
|
-
* Sends trusted keyboard input through Chromium's CDP Input domain.
|
|
2016
|
-
*
|
|
2017
|
-
* @example
|
|
2018
|
-
* ```ts
|
|
2019
|
-
* import { BrowserKeyboard } from '@orkestrel/browser'
|
|
2020
|
-
*
|
|
2021
|
-
* const keyboard = new BrowserKeyboard(page)
|
|
2022
|
-
* await keyboard.type('orkestrel', { delay: 10 })
|
|
2023
|
-
* await keyboard.press('Control+Enter')
|
|
2024
|
-
* ```
|
|
2025
|
-
*/
|
|
2026
|
-
export declare class BrowserKeyboard implements BrowserKeyboardInterface {
|
|
2027
|
-
#private;
|
|
2028
|
-
constructor(frame: BrowserFrameInterface);
|
|
2029
|
-
down(value: string): Promise<void>;
|
|
2030
|
-
up(value: string): Promise<void>;
|
|
2031
|
-
press(value: string, options?: BrowserInputOptions): Promise<void>;
|
|
2032
|
-
type(value: string, options?: BrowserInputOptions): Promise<void>;
|
|
2033
|
-
insert(value: string): Promise<void>;
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
1733
|
/** Provides keyboard input operations bound to one frame target session. */
|
|
2037
1734
|
export declare interface BrowserKeyboardInterface {
|
|
2038
1735
|
/**
|
|
@@ -2065,8 +1762,16 @@ export declare interface BrowserLayout {
|
|
|
2065
1762
|
readonly client: BrowserRect | undefined;
|
|
2066
1763
|
}
|
|
2067
1764
|
|
|
2068
|
-
/**
|
|
2069
|
-
export declare
|
|
1765
|
+
/** Carries the ordered spans of one addressed document line. */
|
|
1766
|
+
export declare interface BrowserLine {
|
|
1767
|
+
readonly spans: readonly BrowserLineSpan[];
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
/** Distinguishes searchable text from generated syntax and actionable references. */
|
|
1771
|
+
export declare interface BrowserLineSpan {
|
|
1772
|
+
readonly category: 'text' | 'syntax' | 'reference';
|
|
1773
|
+
readonly text: string;
|
|
1774
|
+
}
|
|
2070
1775
|
|
|
2071
1776
|
/** Describes the paper margin lengths accepted by Chromium print-to-PDF. */
|
|
2072
1777
|
export declare interface BrowserMargin {
|
|
@@ -2100,29 +1805,6 @@ export declare interface BrowserMetric {
|
|
|
2100
1805
|
readonly value: number;
|
|
2101
1806
|
}
|
|
2102
1807
|
|
|
2103
|
-
/**
|
|
2104
|
-
* Sends trusted mouse input through Chromium's CDP Input domain.
|
|
2105
|
-
*
|
|
2106
|
-
* @example
|
|
2107
|
-
* ```ts
|
|
2108
|
-
* import { BrowserMouse } from '@orkestrel/browser'
|
|
2109
|
-
*
|
|
2110
|
-
* const mouse = new BrowserMouse(page)
|
|
2111
|
-
* await mouse.click({ x: 50, y: 20 }, { button: 'left', count: 2 })
|
|
2112
|
-
* await mouse.drag({ x: 10, y: 10 }, { x: 90, y: 90 }, { steps: 20 })
|
|
2113
|
-
* ```
|
|
2114
|
-
*/
|
|
2115
|
-
export declare class BrowserMouse implements BrowserMouseInterface {
|
|
2116
|
-
#private;
|
|
2117
|
-
constructor(frame: BrowserFrameInterface);
|
|
2118
|
-
move(point: BrowserPoint): Promise<void>;
|
|
2119
|
-
down(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
2120
|
-
up(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
2121
|
-
click(point: BrowserPoint, options?: BrowserClickOptions): Promise<void>;
|
|
2122
|
-
drag(start: BrowserPoint, end: BrowserPoint, options?: BrowserDragOptions): Promise<void>;
|
|
2123
|
-
wheel(delta: BrowserPoint): Promise<void>;
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
1808
|
/** Names a mouse button understood by Chromium's Input domain. */
|
|
2127
1809
|
export declare type BrowserMouseButton = 'left' | 'middle' | 'right' | 'back' | 'forward';
|
|
2128
1810
|
|
|
@@ -2145,6 +1827,9 @@ export declare interface BrowserMouseInterface {
|
|
|
2145
1827
|
wheel(delta: BrowserPoint): Promise<void>;
|
|
2146
1828
|
}
|
|
2147
1829
|
|
|
1830
|
+
/** Names the page load condition for navigation — the CDP load event awaited by `navigate()`. */
|
|
1831
|
+
export declare type BrowserNavigationCondition = 'commit' | 'load' | 'domcontentloaded' | 'idle';
|
|
1832
|
+
|
|
2148
1833
|
/**
|
|
2149
1834
|
* Maps the navigation steps a page accepts from the session that owns each frame, which it hands to
|
|
2150
1835
|
* its navigation and element managers.
|
|
@@ -2171,34 +1856,6 @@ export declare type BrowserNavigationEventMap = {
|
|
|
2171
1856
|
readonly detach: readonly [frame: string, swapped: boolean];
|
|
2172
1857
|
};
|
|
2173
1858
|
|
|
2174
|
-
/**
|
|
2175
|
-
* Parks URL-pattern and network-idle waits on page events and abort signals, and opens the records
|
|
2176
|
-
* that settle the navigation an input starts.
|
|
2177
|
-
*
|
|
2178
|
-
* @remarks
|
|
2179
|
-
* `steps` carries the navigation steps the page accepts from the session that owns each frame,
|
|
2180
|
-
* and `parent` returns the parent the page last recorded for a frame, or `undefined` when the
|
|
2181
|
-
* page cannot name it. A record opened here rejects its pending waits with the page-closed error
|
|
2182
|
-
* when the page closes.
|
|
2183
|
-
*
|
|
2184
|
-
* @example
|
|
2185
|
-
* ```ts
|
|
2186
|
-
* import { BrowserNavigationManager } from '@orkestrel/browser'
|
|
2187
|
-
*
|
|
2188
|
-
* const navigation = new BrowserNavigationManager(page, client, 'session-1', () => loader, steps, parent)
|
|
2189
|
-
* const url = await navigation.wait('https://example.com/checkout', { timeout: 5_000 })
|
|
2190
|
-
* await navigation.idle({ signal: AbortSignal.timeout(10_000) })
|
|
2191
|
-
* const record = navigation.record(page.id)
|
|
2192
|
-
* ```
|
|
2193
|
-
*/
|
|
2194
|
-
export declare class BrowserNavigationManager implements BrowserNavigationManagerInterface {
|
|
2195
|
-
#private;
|
|
2196
|
-
constructor(page: BrowserPageInterface, client: CDPClientInterface, session: string, loader: BrowserLoaderFunction, steps: EmitterInterface<BrowserNavigationEventMap>, parent: (frame: string) => string | undefined);
|
|
2197
|
-
wait(pattern: string, options?: BrowserCallOptions): Promise<string>;
|
|
2198
|
-
idle(options?: BrowserCallOptions): Promise<void>;
|
|
2199
|
-
record(frame: string): BrowserNavigationRecordInterface;
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
1859
|
/** Provides URL and network-idle waits associated with one page. */
|
|
2203
1860
|
export declare interface BrowserNavigationManagerInterface {
|
|
2204
1861
|
/**
|
|
@@ -2228,7 +1885,7 @@ export declare interface BrowserNavigationManagerInterface {
|
|
|
2228
1885
|
* - `signal` — aborts the `Page.navigate` send
|
|
2229
1886
|
*/
|
|
2230
1887
|
export declare interface BrowserNavigationOptions extends BrowserCallOptions {
|
|
2231
|
-
readonly condition?:
|
|
1888
|
+
readonly condition?: BrowserNavigationCondition;
|
|
2232
1889
|
}
|
|
2233
1890
|
|
|
2234
1891
|
/**
|
|
@@ -2252,7 +1909,7 @@ export declare interface BrowserNavigationRecordInterface {
|
|
|
2252
1909
|
/**
|
|
2253
1910
|
* Resolves when the record's frame or one of its ancestors starts a navigation after the record
|
|
2254
1911
|
* opened; `settle` reports that navigation's reason. Rejects at `timeout` with
|
|
2255
|
-
* `
|
|
1912
|
+
* `TIMEOUT`, with `signal.reason` on abort, and when the record ends or the
|
|
2256
1913
|
* page closes.
|
|
2257
1914
|
*/
|
|
2258
1915
|
wait(options?: BrowserCallOptions): Promise<void>;
|
|
@@ -2279,27 +1936,6 @@ export declare interface BrowserNavigationResult {
|
|
|
2279
1936
|
/** Names how far a settled navigation got: requested, committed, or loaded. */
|
|
2280
1937
|
export declare type BrowserNavigationStage = 'requested' | 'committed' | 'loaded';
|
|
2281
1938
|
|
|
2282
|
-
/**
|
|
2283
|
-
* Represents one pending navigation or network-idle wait.
|
|
2284
|
-
*
|
|
2285
|
-
* @remarks
|
|
2286
|
-
* - `pattern` — the URL glob, undefined for a network-idle wait
|
|
2287
|
-
* - `listener` — the abort listener registered on `signal`, undefined without a signal
|
|
2288
|
-
*/
|
|
2289
|
-
export declare interface BrowserNavigationWait {
|
|
2290
|
-
readonly pattern: string | undefined;
|
|
2291
|
-
readonly timer: ReturnType<typeof setTimeout>;
|
|
2292
|
-
readonly signal: AbortSignal | undefined;
|
|
2293
|
-
readonly listener: (() => void) | undefined;
|
|
2294
|
-
readonly resolve: (url: string) => void;
|
|
2295
|
-
readonly reject: (error: unknown) => void;
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
/** Holds the state retained while correlating navigation with Network events. */
|
|
2299
|
-
export declare interface BrowserNavigationWatch {
|
|
2300
|
-
readonly responses: readonly BrowserResponse[];
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
1939
|
/** Maps the network events a page's network manager emits. */
|
|
2304
1940
|
export declare type BrowserNetworkEventMap = {
|
|
2305
1941
|
readonly request: readonly [request: BrowserRequest];
|
|
@@ -2309,38 +1945,13 @@ export declare type BrowserNetworkEventMap = {
|
|
|
2309
1945
|
readonly socket: readonly [socket: BrowserWebSocketInterface];
|
|
2310
1946
|
};
|
|
2311
1947
|
|
|
2312
|
-
/**
|
|
2313
|
-
* Drives the page-scoped Network and Fetch domain lifecycle.
|
|
2314
|
-
*
|
|
2315
|
-
* @example
|
|
2316
|
-
* ```ts
|
|
2317
|
-
* import { BrowserNetworkManager } from '@orkestrel/browser'
|
|
2318
|
-
*
|
|
2319
|
-
* const network = new BrowserNetworkManager(page)
|
|
2320
|
-
* await network.start()
|
|
2321
|
-
* network.emitter.on('response', (response) => log(response.status))
|
|
2322
|
-
* await network.destroy()
|
|
2323
|
-
* ```
|
|
2324
|
-
*/
|
|
2325
|
-
export declare class BrowserNetworkManager implements BrowserNetworkManagerInterface {
|
|
2326
|
-
#private;
|
|
2327
|
-
constructor(frame: BrowserFrameInterface, writer?: BrowserWriterInterface);
|
|
2328
|
-
get emitter(): EmitterInterface<BrowserNetworkEventMap>;
|
|
2329
|
-
get har(): BrowserHARManagerInterface;
|
|
2330
|
-
start(): Promise<void>;
|
|
2331
|
-
body(id: string): Promise<Uint8Array>;
|
|
2332
|
-
text(id: string): Promise<string>;
|
|
2333
|
-
json(id: string): Promise<unknown>;
|
|
2334
|
-
route(query: BrowserRouteQuery, handler: BrowserRouteHandler): Promise<void>;
|
|
2335
|
-
unroute(handler?: BrowserRouteHandler): Promise<void>;
|
|
2336
|
-
headers(headers: Readonly<Record<string, string>>): Promise<void>;
|
|
2337
|
-
offline(offline: boolean): Promise<void>;
|
|
2338
|
-
credentials(credentials?: BrowserCredentials): Promise<void>;
|
|
2339
|
-
destroy(): Promise<void>;
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
1948
|
/** Provides page-scoped network observation and interception. */
|
|
2343
1949
|
export declare interface BrowserNetworkManagerInterface {
|
|
1950
|
+
/** Clears headers, offline mode, and credentials without removing routes. */
|
|
1951
|
+
clear(): Promise<void>;
|
|
1952
|
+
readonly routes: BrowserRouteManagerInterface;
|
|
1953
|
+
/** Applies the supplied network overrides; omitted keys retain their values. */
|
|
1954
|
+
apply(options: BrowserNetworkOptions): Promise<void>;
|
|
2344
1955
|
readonly emitter: EmitterInterface<BrowserNetworkEventMap>;
|
|
2345
1956
|
readonly har: BrowserHARManagerInterface;
|
|
2346
1957
|
/** Enables the Network domain and subscribes to its events. Idempotent. */
|
|
@@ -2351,20 +1962,18 @@ export declare interface BrowserNetworkManagerInterface {
|
|
|
2351
1962
|
text(id: string): Promise<string>;
|
|
2352
1963
|
/** Reads one observed response body as parsed JSON. */
|
|
2353
1964
|
json(id: string): Promise<unknown>;
|
|
2354
|
-
/** Intercepts requests matching the query and hands each one to the handler. */
|
|
2355
|
-
route(query: BrowserRouteQuery, handler: BrowserRouteHandler): Promise<void>;
|
|
2356
|
-
/** Removes one handler's routes, or every route when given none. */
|
|
2357
|
-
unroute(handler?: BrowserRouteHandler): Promise<void>;
|
|
2358
|
-
/** Applies extra HTTP headers to every request the page makes. */
|
|
2359
|
-
headers(headers: Readonly<Record<string, string>>): Promise<void>;
|
|
2360
|
-
/** Emulates an offline connection, or restores connectivity. */
|
|
2361
|
-
offline(offline: boolean): Promise<void>;
|
|
2362
|
-
/** Applies HTTP basic-auth credentials, or clears them when given none. */
|
|
2363
|
-
credentials(credentials?: BrowserCredentials): Promise<void>;
|
|
2364
1965
|
/** Removes every route, unsubscribes, and disables the domains this manager enabled. */
|
|
2365
1966
|
destroy(): Promise<void>;
|
|
2366
1967
|
}
|
|
2367
1968
|
|
|
1969
|
+
/** Configures the supplied network overrides without changing omitted keys. */
|
|
1970
|
+
export declare interface BrowserNetworkOptions {
|
|
1971
|
+
readonly headers?: Readonly<Record<string, string>> | undefined;
|
|
1972
|
+
readonly offline?: boolean | undefined;
|
|
1973
|
+
/** Supplies credentials; undefined and omission retain the current credentials. */
|
|
1974
|
+
readonly credentials?: BrowserCredentials | undefined;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
2368
1977
|
/**
|
|
2369
1978
|
* Represents one serializable DOM node decoded from a CDP DOM snapshot.
|
|
2370
1979
|
*
|
|
@@ -2424,23 +2033,15 @@ export declare interface BrowserNodeQuery {
|
|
|
2424
2033
|
*/
|
|
2425
2034
|
export declare type BrowserOperationOptions = BrowserClickOptions & BrowserDragOptions;
|
|
2426
2035
|
|
|
2427
|
-
/**
|
|
2428
|
-
* Carries a document-order outline and its included and available element counts.
|
|
2429
|
-
*
|
|
2430
|
-
* @remarks
|
|
2431
|
-
* - `matches` — the rendered rows that best match the options' `search`, in document order and
|
|
2432
|
-
* past `limit` included; empty without a `search` or without a match
|
|
2433
|
-
* - `focus` — the rendered row of the referenced element that has focus, past `limit` included;
|
|
2434
|
-
* the last such row in document order when several do, and `undefined` when focus is on no
|
|
2435
|
-
* referenced element
|
|
2436
|
-
*/
|
|
2036
|
+
/** Carries document-order lines, element counts, and the focused element's row. */
|
|
2437
2037
|
export declare interface BrowserOutline {
|
|
2438
2038
|
readonly url: string;
|
|
2439
2039
|
readonly title: string;
|
|
2440
|
-
readonly
|
|
2441
|
-
|
|
2442
|
-
readonly
|
|
2443
|
-
|
|
2040
|
+
readonly lines: readonly BrowserLine[];
|
|
2041
|
+
/** Referenced rows carried in this outline. */
|
|
2042
|
+
readonly listed: number;
|
|
2043
|
+
/** Referenced nodes in the complete outline tree. */
|
|
2044
|
+
readonly found: number;
|
|
2444
2045
|
readonly focus: string | undefined;
|
|
2445
2046
|
}
|
|
2446
2047
|
|
|
@@ -2451,118 +2052,11 @@ export declare interface BrowserOutlineNode extends BrowserAXNode {
|
|
|
2451
2052
|
readonly tool?: string;
|
|
2452
2053
|
}
|
|
2453
2054
|
|
|
2454
|
-
/**
|
|
2455
|
-
* Configures an outline's element limit, optional subtree, and search.
|
|
2456
|
-
*
|
|
2457
|
-
* @remarks
|
|
2458
|
-
* - `search` — the words that select the outline's `matches`: the text is lowercased and split
|
|
2459
|
-
* into whole words of at least 3 letters or digits (`BROWSER_SEARCH_PATTERN`), each referenced
|
|
2460
|
-
* row's role and accessible name are split the same way, and a row scores the number of distinct
|
|
2461
|
-
* search words equal to one of its words; every referenced row with the highest score above 0
|
|
2462
|
-
* matches
|
|
2463
|
-
*/
|
|
2055
|
+
/** Configures an outline's element limit and optional subtree. */
|
|
2464
2056
|
export declare interface BrowserOutlineOptions extends BrowserCallOptions {
|
|
2465
2057
|
readonly limit?: number;
|
|
2466
2058
|
readonly within?: string;
|
|
2467
|
-
readonly
|
|
2468
|
-
}
|
|
2469
|
-
|
|
2470
|
-
/**
|
|
2471
|
-
* Represents a top-level browser page, including its target lifecycle and child frames.
|
|
2472
|
-
*
|
|
2473
|
-
* @remarks
|
|
2474
|
-
* Only a page constructed with a `reference` function, as `BrowserContext` constructs every page,
|
|
2475
|
-
* takes part in target ownership and discovery. Such a page holds its target on the client's
|
|
2476
|
-
* current connection until it closes, its connection ends, or the `ready` promise its constructing
|
|
2477
|
-
* path passes rejects: constructing a second such page for a target a live page holds throws
|
|
2478
|
-
* `BROWSER_TARGET_HELD`, and the first such page on a connection enables
|
|
2479
|
-
* `Target.setDiscoverTargets` for it. A page constructed without `ready`, with or without an
|
|
2480
|
-
* `opener`, is complete as constructed; `ready` is the constructing path's completion, and a
|
|
2481
|
-
* popup a page constructs is complete when that page emits it.
|
|
2482
|
-
*
|
|
2483
|
-
* A page publishes each page it opens through `popup` once, never a closed one, and only after it
|
|
2484
|
-
* is complete itself. An unattached page target that discovery reports with this page as
|
|
2485
|
-
* `openerId`, live or before this page existed, is attached on the browser session, so the popup
|
|
2486
|
-
* outlives its opener; an attachment on this page's session is taken as it arrives; a target
|
|
2487
|
-
* another page holds is published as that page after its `ready` resolves, while it still holds
|
|
2488
|
-
* the target; and the second session for one target is detached. A page detaches its own session
|
|
2489
|
-
* through the session it was attached through.
|
|
2490
|
-
*
|
|
2491
|
-
* @example
|
|
2492
|
-
* ```ts
|
|
2493
|
-
* import { BrowserPage } from '@orkestrel/browser'
|
|
2494
|
-
*
|
|
2495
|
-
* const page = new BrowserPage(client, 'target-1', 'session-1')
|
|
2496
|
-
* await page.navigate('https://example.com')
|
|
2497
|
-
* const shot = await page.screenshot({ format: 'png' })
|
|
2498
|
-
* await page.close()
|
|
2499
|
-
* ```
|
|
2500
|
-
*/
|
|
2501
|
-
export declare class BrowserPage extends BrowserFrame implements BrowserPageInterface {
|
|
2502
|
-
#private;
|
|
2503
|
-
constructor(client: CDPClientInterface, targetId: string, sessionId: string, writer?: BrowserWriterInterface, url?: string, frameId?: string, contextId?: string, opener?: BrowserPageInterface, options?: BrowserPageOptions, reference?: BrowserReferenceFunction, ready?: Promise<void>);
|
|
2504
|
-
get emitter(): EmitterInterface<BrowserPageEventMap>;
|
|
2505
|
-
get elements(): BrowserElementManagerInterface<BrowserPageElementInterface>;
|
|
2506
|
-
get trusted(): true;
|
|
2507
|
-
get keyboard(): BrowserKeyboardInterface;
|
|
2508
|
-
get mouse(): BrowserMouseInterface;
|
|
2509
|
-
get touch(): BrowserTouchInterface;
|
|
2510
|
-
read(options?: BrowserCallOptions): Promise<BrowserReadingInterface>;
|
|
2511
|
-
wait(text: string, options?: BrowserWaitOptions): Promise<void>;
|
|
2512
|
-
get network(): BrowserNetworkManagerInterface;
|
|
2513
|
-
get registry(): BrowserRegistryInterface;
|
|
2514
|
-
get navigation(): BrowserNavigationManagerInterface;
|
|
2515
|
-
get popups(): BrowserPopupManagerInterface;
|
|
2516
|
-
get scripts(): BrowserScriptManagerInterface;
|
|
2517
|
-
get accessibility(): BrowserAccessibilityInterface;
|
|
2518
|
-
get diagnostics(): BrowserDiagnosticsInterface;
|
|
2519
|
-
get clock(): BrowserClockInterface;
|
|
2520
|
-
get opener(): BrowserPageInterface | undefined;
|
|
2521
|
-
get target(): string;
|
|
2522
|
-
get closed(): boolean;
|
|
2523
|
-
navigate(url: string, options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
2524
|
-
reload(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
2525
|
-
back(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
2526
|
-
forward(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
2527
|
-
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
2528
|
-
pdf(options?: BrowserPDFOptions): Promise<BrowserPDFResult>;
|
|
2529
|
-
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
2530
|
-
frame(name: string): Promise<BrowserFrameInterface | undefined>;
|
|
2531
|
-
frames(): Promise<readonly BrowserFrameInterface[]>;
|
|
2532
|
-
snapshot(options?: BrowserSnapshotOptions): Promise<BrowserSnapshotInterface>;
|
|
2533
|
-
codegen(options?: BrowserRecorderOptions): Promise<BrowserCodegenInterface>;
|
|
2534
|
-
destroy(): Promise<void>;
|
|
2535
|
-
close(): Promise<void>;
|
|
2536
|
-
assert(): void;
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
/**
|
|
2540
|
-
* Drives a referenced DOM element through its document's isolated world and the page input stream.
|
|
2541
|
-
* @example
|
|
2542
|
-
* ```ts
|
|
2543
|
-
* const element = page.elements.element('e1')
|
|
2544
|
-
* await element?.click()
|
|
2545
|
-
* ```
|
|
2546
|
-
*/
|
|
2547
|
-
export declare class BrowserPageElement implements BrowserPageElementInterface {
|
|
2548
|
-
#private;
|
|
2549
|
-
constructor(input: BrowserElementInput);
|
|
2550
|
-
get reference(): string;
|
|
2551
|
-
get frame(): string;
|
|
2552
|
-
get role(): string;
|
|
2553
|
-
get name(): string;
|
|
2554
|
-
click(options?: BrowserCallOptions): Promise<void>;
|
|
2555
|
-
fill(value: string, options?: BrowserCallOptions): Promise<void>;
|
|
2556
|
-
select(values: readonly string[], options?: BrowserCallOptions): Promise<void>;
|
|
2557
|
-
focus(options?: BrowserCallOptions): Promise<void>;
|
|
2558
|
-
read(options?: BrowserCallOptions): Promise<BrowserReadingInterface>;
|
|
2559
|
-
hover(options?: BrowserCallOptions): Promise<void>;
|
|
2560
|
-
press(value: string, options?: BrowserCallOptions): Promise<void>;
|
|
2561
|
-
submit(options?: BrowserCallOptions): Promise<void>;
|
|
2562
|
-
upload(files: readonly string[], options?: BrowserCallOptions): Promise<void>;
|
|
2563
|
-
drag(target: BrowserPageElementInterface, options?: BrowserCallOptions): Promise<void>;
|
|
2564
|
-
quad(options?: BrowserCallOptions): Promise<BrowserQuad>;
|
|
2565
|
-
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
2059
|
+
readonly secrets?: readonly string[];
|
|
2566
2060
|
}
|
|
2567
2061
|
|
|
2568
2062
|
/** Provides trusted page input and capture for a referenced element. */
|
|
@@ -2619,7 +2113,7 @@ export declare type BrowserPageEventMap = {
|
|
|
2619
2113
|
|
|
2620
2114
|
/**
|
|
2621
2115
|
* Abstracts a single top-level browser page, extending `BrowserFrameInterface` with
|
|
2622
|
-
* navigation, screenshots, frame discovery, DOM snapshots,
|
|
2116
|
+
* navigation, screenshots, frame discovery, DOM snapshots, a journey recorder, and target teardown.
|
|
2623
2117
|
*
|
|
2624
2118
|
* @remarks
|
|
2625
2119
|
* Inherits every {@link BrowserFrameInterface} document operation for the
|
|
@@ -2632,7 +2126,7 @@ export declare type BrowserPageEventMap = {
|
|
|
2632
2126
|
* - `frame` — look up a frame by name or URL in the page's flattened frame tree
|
|
2633
2127
|
* - `frames` — list the page's flattened frame tree, main frame first
|
|
2634
2128
|
* - `snapshot` — capture every attached document as serializable DOM data
|
|
2635
|
-
* - `
|
|
2129
|
+
* - `recorder` — the stable page recorder; call `start()` to begin recording
|
|
2636
2130
|
* - `destroy` — release local resources and detach from the target
|
|
2637
2131
|
* - `close` — close the remote target and release local resources
|
|
2638
2132
|
*/
|
|
@@ -2687,8 +2181,8 @@ export declare interface BrowserPageInterface extends BrowserFrameInterface, Bro
|
|
|
2687
2181
|
* and requested computed style.
|
|
2688
2182
|
*/
|
|
2689
2183
|
snapshot(options?: BrowserSnapshotOptions): Promise<BrowserSnapshotInterface>;
|
|
2690
|
-
/**
|
|
2691
|
-
|
|
2184
|
+
/** Returns the page recorder; call start() to begin capturing gestures. */
|
|
2185
|
+
readonly recorder: BrowserRecorderInterface;
|
|
2692
2186
|
/** Releases local resources and detaches without closing the remote target. */
|
|
2693
2187
|
destroy(): Promise<void>;
|
|
2694
2188
|
/** Closes the remote target and releases its resources. */
|
|
@@ -2696,7 +2190,7 @@ export declare interface BrowserPageInterface extends BrowserFrameInterface, Bro
|
|
|
2696
2190
|
}
|
|
2697
2191
|
|
|
2698
2192
|
/**
|
|
2699
|
-
* Describes the options for creating a
|
|
2193
|
+
* Describes the options for creating a page through its context.
|
|
2700
2194
|
*
|
|
2701
2195
|
* @remarks
|
|
2702
2196
|
* - `on` — initial event listeners wired at construction
|
|
@@ -2713,9 +2207,24 @@ export declare interface BrowserPageOptions {
|
|
|
2713
2207
|
readonly timeout?: number;
|
|
2714
2208
|
}
|
|
2715
2209
|
|
|
2716
|
-
/** Returns the context's live pages at call time.
|
|
2210
|
+
/** Returns the context's live pages at call time.
|
|
2211
|
+
* @remarks Shared by BrowserEmulationManager and BrowserStorageManager.
|
|
2212
|
+
*/
|
|
2717
2213
|
export declare type BrowserPagesFunction = () => readonly BrowserPageInterface[];
|
|
2718
2214
|
|
|
2215
|
+
/** Describes the projection and context of one bounded reading window. */
|
|
2216
|
+
export declare interface BrowserPassage {
|
|
2217
|
+
readonly url: string;
|
|
2218
|
+
readonly title: string;
|
|
2219
|
+
readonly lines: readonly BrowserLine[];
|
|
2220
|
+
readonly from: number;
|
|
2221
|
+
readonly to?: number;
|
|
2222
|
+
readonly search?: string;
|
|
2223
|
+
readonly tabs: readonly BrowserTab[];
|
|
2224
|
+
readonly changed: boolean;
|
|
2225
|
+
readonly note?: string;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2719
2228
|
/** Describes the options for printing a Chromium page to PDF. */
|
|
2720
2229
|
export declare interface BrowserPDFOptions {
|
|
2721
2230
|
readonly path?: string;
|
|
@@ -2746,23 +2255,6 @@ export declare interface BrowserPDFResult {
|
|
|
2746
2255
|
*/
|
|
2747
2256
|
export declare function browserPDFToParams(options?: BrowserPDFOptions): Readonly<Record<string, unknown>>;
|
|
2748
2257
|
|
|
2749
|
-
/**
|
|
2750
|
-
* Reads Performance-domain metrics for one frame.
|
|
2751
|
-
*
|
|
2752
|
-
* @example
|
|
2753
|
-
* ```ts
|
|
2754
|
-
* import { BrowserPerformance } from '@orkestrel/browser'
|
|
2755
|
-
*
|
|
2756
|
-
* const performance = new BrowserPerformance(page)
|
|
2757
|
-
* const metrics = await performance.metrics() // readonly BrowserMetric[]
|
|
2758
|
-
* ```
|
|
2759
|
-
*/
|
|
2760
|
-
export declare class BrowserPerformance implements BrowserPerformanceInterface {
|
|
2761
|
-
#private;
|
|
2762
|
-
constructor(frame: BrowserFrameInterface);
|
|
2763
|
-
metrics(): Promise<readonly BrowserMetric[]>;
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
2258
|
/**
|
|
2767
2259
|
* Reads Performance-domain metrics.
|
|
2768
2260
|
*
|
|
@@ -2776,33 +2268,13 @@ export declare interface BrowserPerformanceInterface {
|
|
|
2776
2268
|
metrics(): Promise<readonly BrowserMetric[]>;
|
|
2777
2269
|
}
|
|
2778
2270
|
|
|
2779
|
-
/**
|
|
2780
|
-
* Applies permission overrides isolated to one browser context.
|
|
2781
|
-
*
|
|
2782
|
-
* @example
|
|
2783
|
-
* ```ts
|
|
2784
|
-
* import { BrowserPermissionManager } from '@orkestrel/browser'
|
|
2785
|
-
*
|
|
2786
|
-
* const permissions = new BrowserPermissionManager(client)
|
|
2787
|
-
* await permissions.grant(['geolocation'], 'https://example.com')
|
|
2788
|
-
* await permissions.clear()
|
|
2789
|
-
* ```
|
|
2790
|
-
*/
|
|
2791
|
-
export declare class BrowserPermissionManager implements BrowserPermissionManagerInterface {
|
|
2792
|
-
#private;
|
|
2793
|
-
constructor(client: CDPClientInterface, context?: string);
|
|
2794
|
-
grant(permissions: readonly string[], origin?: string): Promise<void>;
|
|
2795
|
-
deny(permissions: readonly string[], origin?: string): Promise<void>;
|
|
2796
|
-
clear(): Promise<void>;
|
|
2797
|
-
}
|
|
2798
|
-
|
|
2799
2271
|
/** Provides permission override operations scoped to one browser context. */
|
|
2800
2272
|
export declare interface BrowserPermissionManagerInterface {
|
|
2801
2273
|
/** Grants each named permission, optionally for one origin, as its own CDP frame. */
|
|
2802
2274
|
grant(permissions: readonly string[], origin?: string): Promise<void>;
|
|
2803
2275
|
/** Denies each named permission, optionally for one origin, as its own CDP frame. */
|
|
2804
2276
|
deny(permissions: readonly string[], origin?: string): Promise<void>;
|
|
2805
|
-
/**
|
|
2277
|
+
/** Removes every permission override on the context. */
|
|
2806
2278
|
clear(): Promise<void>;
|
|
2807
2279
|
}
|
|
2808
2280
|
|
|
@@ -2874,27 +2346,6 @@ export declare interface BrowserProfileNode {
|
|
|
2874
2346
|
readonly children: readonly number[];
|
|
2875
2347
|
}
|
|
2876
2348
|
|
|
2877
|
-
/**
|
|
2878
|
-
* Records sampled JavaScript CPU profiles over one frame's Profiler domain.
|
|
2879
|
-
*
|
|
2880
|
-
* @example
|
|
2881
|
-
* ```ts
|
|
2882
|
-
* import { BrowserProfiler } from '@orkestrel/browser'
|
|
2883
|
-
*
|
|
2884
|
-
* const profiler = new BrowserProfiler(page)
|
|
2885
|
-
* await profiler.start(100)
|
|
2886
|
-
* const profile = await profiler.stop() // { start, end, nodes, samples, deltas }
|
|
2887
|
-
* ```
|
|
2888
|
-
*/
|
|
2889
|
-
export declare class BrowserProfiler implements BrowserProfilerInterface {
|
|
2890
|
-
#private;
|
|
2891
|
-
constructor(frame: BrowserFrameInterface);
|
|
2892
|
-
get active(): boolean;
|
|
2893
|
-
start(interval?: number): Promise<void>;
|
|
2894
|
-
stop(): Promise<BrowserProfile>;
|
|
2895
|
-
destroy(): Promise<void>;
|
|
2896
|
-
}
|
|
2897
|
-
|
|
2898
2349
|
/** Drives the sampled CPU profile lifecycle. */
|
|
2899
2350
|
export declare interface BrowserProfilerInterface {
|
|
2900
2351
|
readonly active: boolean;
|
|
@@ -2923,18 +2374,11 @@ export declare interface BrowserQuad {
|
|
|
2923
2374
|
readonly center: BrowserPoint;
|
|
2924
2375
|
}
|
|
2925
2376
|
|
|
2926
|
-
/** Waits for the current document's DOM readiness.
|
|
2377
|
+
/** Waits for the current document's DOM readiness.
|
|
2378
|
+
* @remarks Shared by BrowserElementManager and BrowserPageElement.
|
|
2379
|
+
*/
|
|
2927
2380
|
export declare type BrowserReadinessFunction = (options?: BrowserCallOptions) => Promise<void>;
|
|
2928
2381
|
|
|
2929
|
-
/** Holds the resources of one lifecycle-event readiness wait. */
|
|
2930
|
-
export declare interface BrowserReadinessWait {
|
|
2931
|
-
readonly resolve: () => void;
|
|
2932
|
-
readonly reject: (error: unknown) => void;
|
|
2933
|
-
readonly timer: ReturnType<typeof setTimeout>;
|
|
2934
|
-
readonly signal: AbortSignal | undefined;
|
|
2935
|
-
readonly listener: (() => void) | undefined;
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
2382
|
/**
|
|
2939
2383
|
* Represents one captured document, parsed one time and projected to Markdown or plain text in
|
|
2940
2384
|
* bounded slices.
|
|
@@ -3048,17 +2492,6 @@ export declare interface BrowserReadingInterface {
|
|
|
3048
2492
|
text(options?: BrowserReadOptions): BrowserReadResult;
|
|
3049
2493
|
}
|
|
3050
2494
|
|
|
3051
|
-
/**
|
|
3052
|
-
* Describes a matching line and its character offset in a reading's projection.
|
|
3053
|
-
*
|
|
3054
|
-
* @remarks
|
|
3055
|
-
* Offsets count UTF-16 code units in the original text, including preceding line breaks.
|
|
3056
|
-
*/
|
|
3057
|
-
export declare interface BrowserReadMatch {
|
|
3058
|
-
readonly offset: number;
|
|
3059
|
-
readonly text: string;
|
|
3060
|
-
}
|
|
3061
|
-
|
|
3062
2495
|
/**
|
|
3063
2496
|
* Describes the options for one slice of a reading's Markdown or plain-text projection.
|
|
3064
2497
|
*
|
|
@@ -3097,7 +2530,7 @@ export declare interface BrowserReadResult {
|
|
|
3097
2530
|
* Describes one tool receipt before rendering.
|
|
3098
2531
|
*
|
|
3099
2532
|
* @remarks
|
|
3100
|
-
* - `action` — what the tool did, without a closing period, such as `Clicked
|
|
2533
|
+
* - `action` — what the tool did, without a closing period, such as `Clicked button "Save" [ref=e4]`;
|
|
3101
2534
|
* empty when the tool did nothing the receipt names
|
|
3102
2535
|
* - `status` — a clause joined to the action with a semicolon, such as
|
|
3103
2536
|
* `the page is still loading URL`
|
|
@@ -3124,21 +2557,18 @@ export declare interface BrowserReceipt {
|
|
|
3124
2557
|
* @example
|
|
3125
2558
|
* const recorder = new BrowserRecorder(toolset)
|
|
3126
2559
|
* await recorder.start()
|
|
3127
|
-
* await toolset.
|
|
2560
|
+
* await toolset.execute(call)
|
|
3128
2561
|
* const steps = await recorder.stop()
|
|
3129
2562
|
*/
|
|
3130
2563
|
export declare class BrowserRecorder implements BrowserRecorderInterface {
|
|
3131
2564
|
#private;
|
|
3132
2565
|
constructor(toolset: BrowserToolsetInterface, options?: BrowserRecorderOptions);
|
|
3133
2566
|
get emitter(): EmitterInterface<BrowserRecorderEventMap>;
|
|
3134
|
-
get
|
|
2567
|
+
get active(): boolean;
|
|
3135
2568
|
start(): Promise<void>;
|
|
3136
2569
|
stop(): Promise<readonly BrowserJourneyStep[]>;
|
|
3137
2570
|
steps(): readonly BrowserJourneyStep[];
|
|
3138
|
-
journey(options:
|
|
3139
|
-
readonly name: string;
|
|
3140
|
-
readonly description: string;
|
|
3141
|
-
}): BrowserJourney;
|
|
2571
|
+
journey(options: BrowserJourneyInput): BrowserJourney;
|
|
3142
2572
|
clear(): void;
|
|
3143
2573
|
destroy(): Promise<void>;
|
|
3144
2574
|
}
|
|
@@ -3164,11 +2594,11 @@ export declare type BrowserRecorderEventMap = {
|
|
|
3164
2594
|
*
|
|
3165
2595
|
* @remarks
|
|
3166
2596
|
* - `emitter` — emits `start`, `step`, `stop`, and `clear`
|
|
3167
|
-
* - `
|
|
2597
|
+
* - `active` — true while recording; false otherwise
|
|
3168
2598
|
*/
|
|
3169
2599
|
export declare interface BrowserRecorderInterface {
|
|
3170
2600
|
readonly emitter: EmitterInterface<BrowserRecorderEventMap>;
|
|
3171
|
-
readonly
|
|
2601
|
+
readonly active: boolean;
|
|
3172
2602
|
/** Begins recording from the recorder's source. */
|
|
3173
2603
|
start(): Promise<void>;
|
|
3174
2604
|
/** Stops recording and returns the recorded steps. */
|
|
@@ -3185,10 +2615,7 @@ export declare interface BrowserRecorderInterface {
|
|
|
3185
2615
|
* The toolset recorder includes an unanswered interrupted action as a gap in this snapshot
|
|
3186
2616
|
* without stopping the recording or consuming that action's pending dialog continuation.
|
|
3187
2617
|
*/
|
|
3188
|
-
journey(
|
|
3189
|
-
readonly name: string;
|
|
3190
|
-
readonly description: string;
|
|
3191
|
-
}): BrowserJourney;
|
|
2618
|
+
journey(input: BrowserJourneyInput): BrowserJourney;
|
|
3192
2619
|
/** Drops the recorded steps. */
|
|
3193
2620
|
clear(): void;
|
|
3194
2621
|
/** Stops recording and releases the recorder's listeners. */
|
|
@@ -3210,7 +2637,12 @@ export declare interface BrowserRecorderOptions {
|
|
|
3210
2637
|
/** Represents a rectangle in CSS pixels: x, y, width, height. */
|
|
3211
2638
|
export declare type BrowserRect = readonly [x: number, y: number, width: number, height: number];
|
|
3212
2639
|
|
|
3213
|
-
/** Allocates the next reference from the owning browser context.
|
|
2640
|
+
/** Allocates the next reference from the owning browser context.
|
|
2641
|
+
* @remarks
|
|
2642
|
+
* Within a tab, a link retains its previous document's reference when its role, accessible name,
|
|
2643
|
+
* and resolved href match exactly one link in each document. Other elements receive fresh
|
|
2644
|
+
* references after navigation; buttons never carry. Allocation never reuses a number.
|
|
2645
|
+
*/
|
|
3214
2646
|
export declare type BrowserReferenceFunction = () => string;
|
|
3215
2647
|
|
|
3216
2648
|
/** Maps registry changes and observed WebMCP invocation events. */
|
|
@@ -3243,17 +2675,6 @@ export declare interface BrowserRegistryOptions {
|
|
|
3243
2675
|
readonly error?: EmitterErrorHandler;
|
|
3244
2676
|
}
|
|
3245
2677
|
|
|
3246
|
-
/** Holds one unsettled registry execution and its resource cleanup. */
|
|
3247
|
-
export declare interface BrowserRegistryPending {
|
|
3248
|
-
readonly frame: string;
|
|
3249
|
-
readonly session: string;
|
|
3250
|
-
readonly signal: AbortSignal | undefined;
|
|
3251
|
-
readonly controller: AbortController;
|
|
3252
|
-
readonly timer: ReturnType<typeof setTimeout>;
|
|
3253
|
-
readonly resolve: (result: BrowserInvocationResult) => void;
|
|
3254
|
-
readonly reject: (error: unknown) => void;
|
|
3255
|
-
}
|
|
3256
|
-
|
|
3257
2678
|
/**
|
|
3258
2679
|
* Prepares and replays a journey under a toolset hold, retaining its executed prefix.
|
|
3259
2680
|
* @example
|
|
@@ -3289,6 +2710,12 @@ export declare interface BrowserReplayInterface {
|
|
|
3289
2710
|
* Prepares the journey, holds the toolset, performs each step in order, and resolves with the
|
|
3290
2711
|
* run, which stops at the first step that did not complete. Rejects with a coded `BrowserError`
|
|
3291
2712
|
* at preparation, before any side effect, and on a destroyed toolset.
|
|
2713
|
+
*
|
|
2714
|
+
* @remarks
|
|
2715
|
+
* When the journey carries `start`, navigates the current tab there before resolving s1,
|
|
2716
|
+
* using the toolset's schemes and navigation settlement. A refused or unsettled start
|
|
2717
|
+
* stops the run before s1 and retains the navigation failure in `fault`. Without `start`,
|
|
2718
|
+
* resolves steps against the current page.
|
|
3292
2719
|
*/
|
|
3293
2720
|
execute(options?: BrowserCallOptions): Promise<BrowserRun>;
|
|
3294
2721
|
}
|
|
@@ -3352,15 +2779,6 @@ export declare interface BrowserResponse {
|
|
|
3352
2779
|
readonly security: BrowserSecurity | undefined;
|
|
3353
2780
|
}
|
|
3354
2781
|
|
|
3355
|
-
/**
|
|
3356
|
-
* Reports that an `evaluate()`/`read()` result exceeded {@link BROWSER_RESULT_LIMIT} and
|
|
3357
|
-
* was rejected in-page before it could overflow the CDP transport frame, under the code
|
|
3358
|
-
* `BROWSER_RESULT_LIMIT_ERROR`.
|
|
3359
|
-
*/
|
|
3360
|
-
export declare class BrowserResultLimitError extends BrowserError {
|
|
3361
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
3362
|
-
}
|
|
3363
|
-
|
|
3364
2782
|
/** Describes the overrides supplied when continuing an intercepted request. */
|
|
3365
2783
|
export declare interface BrowserRouteContinueOptions {
|
|
3366
2784
|
readonly url?: string;
|
|
@@ -3403,6 +2821,16 @@ export declare interface BrowserRouteInterface {
|
|
|
3403
2821
|
fulfill(options: BrowserRouteFulfillOptions): Promise<void>;
|
|
3404
2822
|
}
|
|
3405
2823
|
|
|
2824
|
+
/** Manages the request handlers installed on a page network. */
|
|
2825
|
+
export declare interface BrowserRouteManagerInterface {
|
|
2826
|
+
/** Intercepts matching requests with this handler. */
|
|
2827
|
+
add(query: BrowserRouteQuery, handler: BrowserRouteHandler): Promise<void>;
|
|
2828
|
+
/** Removes every route belonging to this handler. */
|
|
2829
|
+
remove(handler: BrowserRouteHandler): Promise<void>;
|
|
2830
|
+
/** Removes every route. */
|
|
2831
|
+
clear(): Promise<void>;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
3406
2834
|
/** Describes route matching criteria. Omitted fields match all values. */
|
|
3407
2835
|
export declare interface BrowserRouteQuery {
|
|
3408
2836
|
readonly url?: string;
|
|
@@ -3412,7 +2840,7 @@ export declare interface BrowserRouteQuery {
|
|
|
3412
2840
|
|
|
3413
2841
|
/**
|
|
3414
2842
|
* Describes one run of a journey; `inputs` omits secret values; `fault` carries the run file's
|
|
3415
|
-
* write failure.
|
|
2843
|
+
* write failure or the failure that stopped it before a step ran.
|
|
3416
2844
|
*
|
|
3417
2845
|
* @remarks
|
|
3418
2846
|
* - `format` — the file format, `BROWSER_JOURNEY_FORMAT_VERSION`
|
|
@@ -3424,7 +2852,7 @@ export declare interface BrowserRouteQuery {
|
|
|
3424
2852
|
* - `output` — the `console` and `error` events of a trusted view that declares `emitter`,
|
|
3425
2853
|
* during the run; absent for an untrusted view and for a journey with a secret parameter
|
|
3426
2854
|
* - `elapsed` — the milliseconds the run took
|
|
3427
|
-
* - `fault` — why writing the run file failed
|
|
2855
|
+
* - `fault` — why writing the run file failed or why it stopped before a step ran
|
|
3428
2856
|
*/
|
|
3429
2857
|
export declare interface BrowserRun {
|
|
3430
2858
|
readonly format: 1;
|
|
@@ -3450,7 +2878,7 @@ export declare interface BrowserRun {
|
|
|
3450
2878
|
export declare type BrowserRunOutcome = 'complete' | 'stopped' | 'aborted';
|
|
3451
2879
|
|
|
3452
2880
|
/**
|
|
3453
|
-
* Names the run directory a store
|
|
2881
|
+
* Names the run directory a store created, as data.
|
|
3454
2882
|
*
|
|
3455
2883
|
* @remarks
|
|
3456
2884
|
* - `id` — the run id
|
|
@@ -3501,29 +2929,29 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3501
2929
|
* @returns Absolute path of the saved image
|
|
3502
2930
|
* @remarks Stores without standalone file storage omit this capability.
|
|
3503
2931
|
*/
|
|
3504
|
-
|
|
2932
|
+
write?(bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string>;
|
|
3505
2933
|
/** Mints a run id for the journey and creates its run directory exclusively. */
|
|
3506
|
-
|
|
2934
|
+
create(name: string, options?: BrowserStoreOptions): Promise<BrowserRunSlot>;
|
|
3507
2935
|
/** Returns the run stored under the journey name and id, or `undefined` when none is stored. */
|
|
3508
2936
|
get(name: string, id: string, options?: BrowserStoreOptions): Promise<BrowserRun | undefined>;
|
|
3509
2937
|
/** Writes the run under the journey name and the run id it carries. */
|
|
3510
2938
|
set(run: BrowserRun, options?: BrowserStoreOptions): Promise<void>;
|
|
3511
2939
|
/**
|
|
3512
|
-
* Writes capture bytes under the name into the run directory `
|
|
3513
|
-
* @param slot - Slot
|
|
2940
|
+
* Writes capture bytes under the name into the run directory `create` created for the slot.
|
|
2941
|
+
* @param slot - Slot created by this store
|
|
3514
2942
|
* @param name - Capture file name
|
|
3515
2943
|
* @param bytes - Screenshot bytes to persist
|
|
3516
2944
|
* @param options - Cancellation options
|
|
3517
2945
|
* @returns Name the step records, or `undefined` for a store without directories
|
|
3518
|
-
* @throws {@link BrowserError} Thrown with `
|
|
2946
|
+
* @throws {@link BrowserError} Thrown with `STORE_PATH` when this store did not create the slot.
|
|
3519
2947
|
*/
|
|
3520
2948
|
capture(slot: BrowserRunSlot, name: string, bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string | undefined>;
|
|
3521
2949
|
/** Removes the run stored under the journey name and id; a missing run is a no-op. */
|
|
3522
2950
|
delete(name: string, id: string, options?: BrowserStoreOptions): Promise<void>;
|
|
3523
2951
|
/**
|
|
3524
|
-
* Removes every run and
|
|
2952
|
+
* Removes every run and created slot of a journey and returns their count, including unsaved
|
|
3525
2953
|
* slots; a missing name returns zero. File stores exclude concurrent allocation with the
|
|
3526
|
-
* journey lock and refuse a held lock with `
|
|
2954
|
+
* journey lock and refuse a held lock with `STORE_LOCKED`.
|
|
3527
2955
|
* @param name - Journey name
|
|
3528
2956
|
* @param options - Cancellation options
|
|
3529
2957
|
* @returns Number of removed runs, including unsaved slots
|
|
@@ -3533,10 +2961,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3533
2961
|
* Returns one page of the journey's runs, starting at `offset` and holding at most `limit`
|
|
3534
2962
|
* entries, with the entries it could not read in `faults`.
|
|
3535
2963
|
*/
|
|
3536
|
-
list(name: string, options?:
|
|
3537
|
-
readonly offset?: number;
|
|
3538
|
-
readonly limit?: number;
|
|
3539
|
-
}): Promise<BrowserStorePage<BrowserRun>>;
|
|
2964
|
+
list(name: string, options?: BrowserStorePageOptions): Promise<BrowserStorePage<BrowserRun>>;
|
|
3540
2965
|
}
|
|
3541
2966
|
|
|
3542
2967
|
/** Names a cookie same-site policy understood by Chromium. */
|
|
@@ -3596,34 +3021,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3596
3021
|
readonly functions: readonly BrowserFunctionCoverage[];
|
|
3597
3022
|
}
|
|
3598
3023
|
|
|
3599
|
-
/** Represents one installed new-document script and its optional host binding owner. */
|
|
3600
|
-
export declare interface BrowserScriptEntry {
|
|
3601
|
-
readonly source: string;
|
|
3602
|
-
readonly binding: string | undefined;
|
|
3603
|
-
}
|
|
3604
|
-
|
|
3605
|
-
/**
|
|
3606
|
-
* Installs new-document scripts and promise-based host functions for one page.
|
|
3607
|
-
*
|
|
3608
|
-
* @example
|
|
3609
|
-
* ```ts
|
|
3610
|
-
* import { BrowserScriptManager } from '@orkestrel/browser'
|
|
3611
|
-
*
|
|
3612
|
-
* const scripts = new BrowserScriptManager(page)
|
|
3613
|
-
* const id = await scripts.add('window.__ready = true')
|
|
3614
|
-
* await scripts.remove(id)
|
|
3615
|
-
* ```
|
|
3616
|
-
*/
|
|
3617
|
-
export declare class BrowserScriptManager implements BrowserScriptManagerInterface {
|
|
3618
|
-
#private;
|
|
3619
|
-
constructor(frame: BrowserFrameInterface);
|
|
3620
|
-
add(source: string): Promise<string>;
|
|
3621
|
-
remove(id: string): Promise<void>;
|
|
3622
|
-
expose(name: string, handler: BrowserBindingHandler): Promise<void>;
|
|
3623
|
-
revoke(name: string): Promise<void>;
|
|
3624
|
-
destroy(): Promise<void>;
|
|
3625
|
-
}
|
|
3626
|
-
|
|
3627
3024
|
/** Manages initialization scripts and host bindings for one page. */
|
|
3628
3025
|
export declare interface BrowserScriptManagerInterface {
|
|
3629
3026
|
/** Installs a script evaluated on every new document, and returns its identifier. */
|
|
@@ -3638,6 +3035,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3638
3035
|
destroy(): Promise<void>;
|
|
3639
3036
|
}
|
|
3640
3037
|
|
|
3038
|
+
/** Carries the opening line and optional search text of an addressed window. */
|
|
3039
|
+
export declare interface BrowserSearch {
|
|
3040
|
+
readonly from: number;
|
|
3041
|
+
readonly text?: string;
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3641
3044
|
/** Describes the TLS details supplied with a browser response. */
|
|
3642
3045
|
export declare interface BrowserSecurity {
|
|
3643
3046
|
readonly protocol: string;
|
|
@@ -3646,7 +3049,9 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3646
3049
|
readonly to: number;
|
|
3647
3050
|
}
|
|
3648
3051
|
|
|
3649
|
-
/** Resolves the current CDP session for a frame id.
|
|
3052
|
+
/** Resolves the current CDP session for a frame id.
|
|
3053
|
+
* @remarks Shared by BrowserFrame, BrowserElementManager, and BrowserPageElement.
|
|
3054
|
+
*/
|
|
3650
3055
|
export declare type BrowserSessionFunction = (frame: string) => Promise<string>;
|
|
3651
3056
|
|
|
3652
3057
|
/**
|
|
@@ -3696,7 +3101,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3696
3101
|
readonly documents: readonly BrowserDocument[];
|
|
3697
3102
|
readonly styles: readonly string[];
|
|
3698
3103
|
constructor(input: BrowserSnapshotInput);
|
|
3699
|
-
walk(options?: BrowserWalkOptions): Generator<BrowserNode, void, unknown>;
|
|
3700
3104
|
descendants(node: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
3701
3105
|
document(node: BrowserNode): BrowserDocument | undefined;
|
|
3702
3106
|
children(node: BrowserNode): readonly BrowserNode[];
|
|
@@ -3709,6 +3113,8 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3709
3113
|
filter(query: BrowserNodeQuery | BrowserNodePredicate, limit?: number): readonly BrowserNode[];
|
|
3710
3114
|
closest(node: BrowserNode, query: BrowserNodeQuery | BrowserNodePredicate): BrowserNode | undefined;
|
|
3711
3115
|
path(node: BrowserNode): string;
|
|
3116
|
+
depth(options?: BrowserTraversalOptions): Generator<BrowserNode, void, unknown>;
|
|
3117
|
+
breadth(options?: BrowserTraversalOptions): Generator<BrowserNode, void, unknown>;
|
|
3712
3118
|
}
|
|
3713
3119
|
|
|
3714
3120
|
/**
|
|
@@ -3728,9 +3134,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3728
3134
|
export declare interface BrowserSnapshotInterface extends BrowserSnapshotInput {
|
|
3729
3135
|
/**
|
|
3730
3136
|
* Traverses the whole capture, or one subtree when `root` is given and yielded first, in
|
|
3731
|
-
*
|
|
3137
|
+
* depth-first order. Visits each node exactly once.
|
|
3732
3138
|
*/
|
|
3733
|
-
|
|
3139
|
+
depth(options?: BrowserTraversalOptions): Generator<BrowserNode, void, unknown>;
|
|
3140
|
+
/** Traverses the capture or a subtree breadth-first, yielding its root first. */
|
|
3141
|
+
breadth(options?: BrowserTraversalOptions): Generator<BrowserNode, void, unknown>;
|
|
3734
3142
|
/** Traverses one node's subtree in depth-first order, excluding the node itself. */
|
|
3735
3143
|
descendants(node: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
3736
3144
|
/** Resolves the captured document a node belongs to. */
|
|
@@ -3804,13 +3212,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3804
3212
|
}
|
|
3805
3213
|
|
|
3806
3214
|
/**
|
|
3807
|
-
* Reports
|
|
3808
|
-
* the performed action in `action`.
|
|
3215
|
+
* Reports an incomplete journey step with its action and the code `STEP`.
|
|
3809
3216
|
*
|
|
3810
3217
|
* @remarks
|
|
3811
|
-
* The message is `ID: RECEIPT`,
|
|
3812
|
-
*
|
|
3813
|
-
* elapsed time from `action` rather than from the message.
|
|
3218
|
+
* The message is `ID: RECEIPT`, and `context.step` names the step.
|
|
3219
|
+
* The action carries the outcome, stage, reason, receipt, and elapsed time.
|
|
3814
3220
|
*/
|
|
3815
3221
|
export declare class BrowserStepError extends BrowserError {
|
|
3816
3222
|
readonly action: BrowserAction;
|
|
@@ -3834,30 +3240,10 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3834
3240
|
readonly value: string;
|
|
3835
3241
|
}
|
|
3836
3242
|
|
|
3837
|
-
/**
|
|
3838
|
-
* Imports, exports, and clears cookie and web-storage state for one browser context.
|
|
3839
|
-
*
|
|
3840
|
-
* @example
|
|
3841
|
-
* ```ts
|
|
3842
|
-
* import { BrowserStorageManager } from '@orkestrel/browser'
|
|
3843
|
-
*
|
|
3844
|
-
* const storage = new BrowserStorageManager(context.cookies, () => context.pages())
|
|
3845
|
-
* const state = await storage.state({ origins: ['https://example.com'] })
|
|
3846
|
-
* await storage.restore(state)
|
|
3847
|
-
* ```
|
|
3848
|
-
*/
|
|
3849
|
-
export declare class BrowserStorageManager implements BrowserStorageManagerInterface {
|
|
3850
|
-
#private;
|
|
3851
|
-
constructor(cookies: BrowserCookieManagerInterface, pages: BrowserPagesFunction);
|
|
3852
|
-
state(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
3853
|
-
restore(state: BrowserStorageState): Promise<void>;
|
|
3854
|
-
clear(origin?: string): Promise<void>;
|
|
3855
|
-
}
|
|
3856
|
-
|
|
3857
3243
|
/** Provides storage-state import, export, and clearing operations. */
|
|
3858
3244
|
export declare interface BrowserStorageManagerInterface {
|
|
3859
3245
|
/** Reads the context cookies and the per-origin local and session storage. */
|
|
3860
|
-
|
|
3246
|
+
snapshot(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
3861
3247
|
/** Writes a previously read state back into the context. */
|
|
3862
3248
|
restore(state: BrowserStorageState): Promise<void>;
|
|
3863
3249
|
/** Drops the storage of one origin, or of every origin when given none. */
|
|
@@ -3918,6 +3304,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3918
3304
|
readonly faults: readonly BrowserStoreFault[];
|
|
3919
3305
|
}
|
|
3920
3306
|
|
|
3307
|
+
/** Configures one page of a store listing, with cancellation. */
|
|
3308
|
+
export declare interface BrowserStorePageOptions extends BrowserStoreOptions {
|
|
3309
|
+
readonly offset?: number;
|
|
3310
|
+
readonly limit?: number;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3921
3313
|
/** Represents one decoded IO stream read. */
|
|
3922
3314
|
export declare interface BrowserStreamChunk {
|
|
3923
3315
|
readonly bytes: Uint8Array;
|
|
@@ -3931,7 +3323,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3931
3323
|
}
|
|
3932
3324
|
|
|
3933
3325
|
/**
|
|
3934
|
-
* Describes one open tab of a toolset's context, which the `
|
|
3326
|
+
* Describes one open tab of a toolset's context, which the `read` header lists.
|
|
3935
3327
|
*
|
|
3936
3328
|
* @remarks
|
|
3937
3329
|
* - `id` — `t` followed by the tab's one-based position in the context, which `switch` takes
|
|
@@ -3985,10 +3377,10 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3985
3377
|
|
|
3986
3378
|
/**
|
|
3987
3379
|
* Names a tool the browser toolset reserves: the generic tools, the staged `dialog`, the
|
|
3988
|
-
* opt-in `
|
|
3380
|
+
* opt-in `switch`, and the journey tools `record`, `save`, `journeys`, `edit`,
|
|
3989
3381
|
* `replay`, `forget`, and `capture`, which a toolset constructed with `journeys` reserves.
|
|
3990
3382
|
*/
|
|
3991
|
-
export declare type BrowserToolName = '
|
|
3383
|
+
export declare type BrowserToolName = 'read' | 'click' | 'type' | 'press' | 'navigate' | 'wait' | 'dialog' | 'switch' | 'record' | 'save' | 'journeys' | 'edit' | 'replay' | 'forget' | 'capture';
|
|
3992
3384
|
|
|
3993
3385
|
/** Identifies a removed WebMCP tool by document and name. */
|
|
3994
3386
|
export declare interface BrowserToolRemoval {
|
|
@@ -4001,11 +3393,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4001
3393
|
* view's own tools beside them.
|
|
4002
3394
|
*
|
|
4003
3395
|
* @remarks
|
|
4004
|
-
* Every toolset advertises `
|
|
4005
|
-
* `BrowserViewInterface` it is constructed over.
|
|
3396
|
+
* Every toolset advertises `read`, `click`, `type`, and `wait`, which need only the
|
|
3397
|
+
* `BrowserViewInterface` it is constructed over. When `isBrowserPage(view)` holds it also advertises `press`
|
|
4006
3398
|
* and `navigate`, stages the `dialog` tool while a dialog is open on the current page, follows a
|
|
4007
3399
|
* popup the current page opens and returns to the opener when the popup closes, and adopts
|
|
4008
|
-
* `page.registry` by default; with `options.context` as well it advertises `
|
|
3400
|
+
* `page.registry` by default; with `options.context` as well it advertises `switch` and lists tabs in each window.
|
|
4009
3401
|
* With `options.journeys` the constructor constructs a `BrowserJourneyToolset`, which adds
|
|
4010
3402
|
* `record`, `save`, `journeys`, `edit`, and `replay` to the manager and reserves those names, and
|
|
4011
3403
|
* `destroy()` destroys it first. The result that carries the view after a move names the move.
|
|
@@ -4014,13 +3406,18 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4014
3406
|
* `the browser session ended` after `destroy()`, refuses an aborted signal before the tool runs,
|
|
4015
3407
|
* refuses every tool but `dialog` while a dialog is open, forwards `ToolContext.signal` into every
|
|
4016
3408
|
* protocol call, refuses a call to a toolset tool that carries a parameter the tool does not
|
|
4017
|
-
* advertise, and
|
|
4018
|
-
*
|
|
4019
|
-
*
|
|
4020
|
-
*
|
|
4021
|
-
*
|
|
4022
|
-
*
|
|
4023
|
-
*
|
|
3409
|
+
* advertise, and bounds every complete result and thrown message, including its footer, by
|
|
3410
|
+
* the smaller of the configured limit and 4,000 UTF-16 units. Every read and action window
|
|
3411
|
+
* recaptures numbered accessibility lines. Inclusive ranges use required tool parameter
|
|
3412
|
+
* `from` and optional `to`; search scores text spans and opens near the first best match.
|
|
3413
|
+
* Wrapping precedes numbering, and every continuation names the next complete line. An
|
|
3414
|
+
* unchanged page keeps its addresses; a changed read includes a change note, even from line 1.
|
|
3415
|
+
* A trailing heading opens the next window unless it is the only row or ends the page.
|
|
3416
|
+
* A partial-view line follows the page header when rows remain after the window. A search
|
|
3417
|
+
* missing its range reports the first page-wide best match only when that line carries an
|
|
3418
|
+
* element reference, without moving that window; otherwise it keeps the plain miss.
|
|
3419
|
+
* An unquoted miss appears immediately before the footer, with its space reserved before
|
|
3420
|
+
* fitting rows. Quoted best matches and in-range hits remain under the header.
|
|
4024
3421
|
* A `press` receipt names the referenced element that has focus after the key. A page tool's
|
|
4025
3422
|
* error message and JSON output reach the toolset already cut at `BROWSER_REGISTRY_OUTPUT_LIMIT`
|
|
4026
3423
|
* (4 096) by the registry, so a `limit` over that shows at most 4 096 characters of either; a page
|
|
@@ -4045,20 +3442,21 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4045
3442
|
* navigation record opens, `click` and `type` with `submit` install a `submit` observer in the
|
|
4046
3443
|
* isolated world of the element's document, and `press` in every document one `page.frames()`
|
|
4047
3444
|
* call lists; an action whose input
|
|
4048
|
-
* document cannot be observed is refused with `
|
|
3445
|
+
* document cannot be observed is refused with `TOOLSET_OBSERVE` before any input, and a
|
|
4049
3446
|
* document `press` did not list is not observed. A navigation that starts in the input's frame or
|
|
4050
3447
|
* an ancestor before the input settles is followed; when the input settles first, each observed
|
|
4051
3448
|
* submission that kept its default action names its destination frame, and the receipt waits for
|
|
4052
3449
|
* the navigation the record selects to commit and load under the receipt's deadline; a submission
|
|
4053
|
-
* every listener prevented
|
|
4054
|
-
*
|
|
4055
|
-
*
|
|
3450
|
+
* every listener prevented waits for a rendered change, navigation, dialog, abort, or detachment.
|
|
3451
|
+
* Change observation starts in capture-phase submit before application handlers. Reading its
|
|
3452
|
+
* state preserves it, and every exit releases it. Hidden and bookkeeping mutations do not count.
|
|
3453
|
+
* The status is `BROWSER_TOOL_HANDLED_STATUS` after a change or `BROWSER_TOOL_UNCHANGED_STATUS`
|
|
3454
|
+
* at the deadline. The status is `no form received the submission` when `type`
|
|
4056
3455
|
* with `submit`, or a `press` of Enter that an input a form owns received, recorded none. The
|
|
4057
3456
|
* page placement's `type` with `submit` ends its action with `and submitted the form` when a read
|
|
4058
3457
|
* recorded a submission, or when the navigation the receipt settled names `formSubmissionGet` or
|
|
4059
3458
|
* `formSubmissionPost` as its reason, whatever the read answered, and with `and pressed Enter`
|
|
4060
|
-
* otherwise. A
|
|
4061
|
-
* at an offset at or past its retained reading's end restarts that reading at 0. A receipt that
|
|
3459
|
+
* otherwise. A receipt that
|
|
4062
3460
|
* waits for a requested navigation shares one `BROWSER_TOOL_TIMEOUT_MS` deadline between that
|
|
4063
3461
|
* wait and its view capture, of which `BROWSER_TOOL_CAPTURE_MS` is reserved for the capture. The
|
|
4064
3462
|
* deadline runs from the moment the receipt starts waiting, after any time the action spent
|
|
@@ -4066,7 +3464,8 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4066
3464
|
* receipt aborts the capture. A capture that the page's change makes stale waits for the page's
|
|
4067
3465
|
* readiness and reads the view once more inside the same deadline, and reports
|
|
4068
3466
|
* `BROWSER_TOOL_CHANGED_NOTE` when that read fails too. `type` refuses an element whose role is
|
|
4069
|
-
* not in `BROWSER_TYPED_ROLES` before it sends anything, naming
|
|
3467
|
+
* not in `BROWSER_TYPED_ROLES` before it sends anything, naming the view's text-taking fields,
|
|
3468
|
+
* or `click` when there are none. A `click` on an element whose role is in `BROWSER_TYPED_ROLES`
|
|
4070
3469
|
* adds `; call type with REF to enter text` to its receipt line. A click
|
|
4071
3470
|
* or type over a view whose `trusted` is `false` ends its receipt line with ` (untrusted event)`.
|
|
4072
3471
|
*
|
|
@@ -4078,15 +3477,15 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4078
3477
|
* earlier one. A page tool whose parameters require nothing advertises a required `purpose`, which
|
|
4079
3478
|
* is stripped before the tool runs. Every adopted tool is advertised `untrusted`. `destroy()`
|
|
4080
3479
|
* removes only the tools the manager still holds under the instances the toolset added, never
|
|
4081
|
-
* closes
|
|
3480
|
+
* closes or destroys its caller-owned view.
|
|
4082
3481
|
*
|
|
4083
3482
|
* @example
|
|
4084
3483
|
* ```ts
|
|
4085
3484
|
* import { BrowserToolset } from '@orkestrel/browser'
|
|
4086
3485
|
*
|
|
4087
|
-
* const toolset = new BrowserToolset(page
|
|
3486
|
+
* const toolset = new BrowserToolset(page)
|
|
4088
3487
|
* await toolset.start()
|
|
4089
|
-
* const result = await toolset.tools.execute({ id: '1', name: '
|
|
3488
|
+
* const result = await toolset.tools.execute({ id: '1', name: 'read', arguments: { from: 1, search: 'cart' } })
|
|
4090
3489
|
* await toolset.destroy()
|
|
4091
3490
|
* ```
|
|
4092
3491
|
*/
|
|
@@ -4099,12 +3498,15 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4099
3498
|
get native(): readonly ToolInterface[];
|
|
4100
3499
|
get view(): BrowserViewInterface;
|
|
4101
3500
|
get held(): string | undefined;
|
|
4102
|
-
|
|
3501
|
+
redact(text: string): string;
|
|
3502
|
+
describe(reference: string): string;
|
|
3503
|
+
execute(call: ToolCall, context?: ToolContext): Promise<BrowserToolsetResult>;
|
|
4103
3504
|
hold(name: string, options?: BrowserCallOptions): Promise<BrowserHoldInterface>;
|
|
4104
3505
|
follow(id: string, step: BrowserJourneyStepInput, options?: BrowserFollowOptions): Promise<BrowserAction>;
|
|
4105
3506
|
tabs(options?: BrowserCallOptions): Promise<readonly BrowserTab[]>;
|
|
4106
3507
|
start(options?: BrowserCallOptions): Promise<void>;
|
|
4107
3508
|
destroy(): Promise<void>;
|
|
3509
|
+
read(options?: BrowserToolsetReadOptions): Promise<string>;
|
|
4108
3510
|
}
|
|
4109
3511
|
|
|
4110
3512
|
/**
|
|
@@ -4127,40 +3529,50 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4127
3529
|
readonly release: readonly [name: string];
|
|
4128
3530
|
};
|
|
4129
3531
|
|
|
4130
|
-
/**
|
|
4131
|
-
* Runs one toolset tool inside the toolset's boundary.
|
|
4132
|
-
*
|
|
4133
|
-
* @param args - The arguments the caller supplied
|
|
4134
|
-
* @param context - The call's context, whose signal also aborts when the toolset is destroyed
|
|
4135
|
-
* @returns The result body, which the boundary bounds, and a footer it appends after the bound
|
|
4136
|
-
*/
|
|
4137
|
-
export declare type BrowserToolsetHandler = (args: Readonly<Record<string, unknown>>, context: ToolContext) => Promise<readonly [body: string, footer: string]>;
|
|
4138
|
-
|
|
4139
3532
|
/**
|
|
4140
3533
|
* Publishes the browser vocabulary as tools over one current view and adopts the page's own
|
|
4141
3534
|
* tools beside them.
|
|
4142
3535
|
*
|
|
4143
3536
|
* @remarks
|
|
4144
3537
|
* - `emitter` — emits `adopt`, `skip`, `select`, `action`, `hold`, and `release`
|
|
4145
|
-
* - `tools` — the manager the toolset fills, with execution through the `
|
|
3538
|
+
* - `tools` — the manager the toolset fills, with execution through the `execute` boundary
|
|
4146
3539
|
* - `native` — the generic tools alone, which a consumer publishes to a built-in agent: the
|
|
4147
|
-
* `
|
|
4148
|
-
* toolset, and `
|
|
3540
|
+
* `read`, `click`, `type`, `press`, `navigate`, and `wait` for a page-backed
|
|
3541
|
+
* toolset, and `read`, `click`, `type`, and `wait` for a view-backed one
|
|
4149
3542
|
* - `view` — the view the tools act on
|
|
4150
3543
|
*/
|
|
4151
3544
|
export declare interface BrowserToolsetInterface {
|
|
3545
|
+
/** Describes a missing reference using its last shown role and name, or the unknown-reference refusal.
|
|
3546
|
+
* @param reference - Canonical element reference
|
|
3547
|
+
* @returns The refusal text
|
|
3548
|
+
*/
|
|
3549
|
+
describe(reference: string): string;
|
|
3550
|
+
/** Redacts registered secrets from unnumbered text before composing a result.
|
|
3551
|
+
* @param text - Unbounded, unnumbered text
|
|
3552
|
+
* @returns Text with registered secrets removed
|
|
3553
|
+
*/
|
|
3554
|
+
redact(text: string): string;
|
|
3555
|
+
/** Renders a fresh page window, including pending move notes, within the requested limit.
|
|
3556
|
+
* @remarks
|
|
3557
|
+
* A unique link with the same role, accessible name, and resolved href in consecutive documents
|
|
3558
|
+
* of one tab keeps its reference. A successful action still resets the accepted set; carried
|
|
3559
|
+
* references are accepted again when its result lists them.
|
|
3560
|
+
* @param options - Inclusive range, search, cancellation, and character room
|
|
3561
|
+
* @returns Numbered lines with an exact continuation footer
|
|
3562
|
+
*/
|
|
3563
|
+
read(options?: BrowserToolsetReadOptions): Promise<string>;
|
|
4152
3564
|
readonly emitter: EmitterInterface<BrowserToolsetEventMap>;
|
|
4153
3565
|
readonly tools: ToolManagerInterface;
|
|
4154
3566
|
readonly native: readonly ToolInterface[];
|
|
4155
3567
|
readonly view: BrowserViewInterface;
|
|
4156
|
-
/** Reports the character limit
|
|
3568
|
+
/** Reports the whole-result character limit, including a result or error footer. */
|
|
4157
3569
|
readonly limit: number;
|
|
4158
3570
|
/** Names the acquired hold, or returns undefined while no hold owns the toolset. */
|
|
4159
3571
|
readonly held: string | undefined;
|
|
4160
3572
|
/** Performs a tool call and returns its structured action when a handler ran. */
|
|
4161
|
-
|
|
3573
|
+
execute(call: ToolCall, context?: ToolContext): Promise<BrowserToolsetResult>;
|
|
4162
3574
|
/**
|
|
4163
|
-
* Performs one recorded step on the current view through `
|
|
3575
|
+
* Performs one recorded step on the current view through `execute` and returns its action.
|
|
4164
3576
|
*
|
|
4165
3577
|
* @remarks
|
|
4166
3578
|
* A `click` or `type` step with a target resolves the one element of the current view that
|
|
@@ -4168,8 +3580,8 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4168
3580
|
* `reference` and `css` are evidence only. A `switch` step on a toolset with `context` resolves
|
|
4169
3581
|
* the one tab `tabs()` lists with the step's URL and title, and sends the tab's id as `tab`.
|
|
4170
3582
|
* Every other step sends its arguments unchanged, a page tool's included. A missing target or
|
|
4171
|
-
* tab refuses with `
|
|
4172
|
-
* a target name that binds a parameter refuses with `
|
|
3583
|
+
* tab refuses with `JOURNEY_TARGET`, several refuse with `JOURNEY_AMBIGUOUS`, and
|
|
3584
|
+
* a target name that binds a parameter refuses with `JOURNEY_INPUT`, each naming the
|
|
4173
3585
|
* step before any input. An action that is `done`, or `interrupted` by a dialog a following
|
|
4174
3586
|
* `dialog` step answers, returns; any other outcome, and a navigation that stopped at
|
|
4175
3587
|
* `requested` or `committed`, throws a `BrowserStepError` whose `action` is the performed
|
|
@@ -4177,26 +3589,26 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4177
3589
|
*/
|
|
4178
3590
|
follow(id: string, step: BrowserJourneyStepInput, options?: BrowserFollowOptions): Promise<BrowserAction>;
|
|
4179
3591
|
/**
|
|
4180
|
-
* Lists the open tabs of the toolset's context in the order the `
|
|
3592
|
+
* Lists the open tabs of the toolset's context in the order the `read` header lists them.
|
|
4181
3593
|
*
|
|
4182
3594
|
* @remarks
|
|
4183
3595
|
* A tab whose title does not answer within `BROWSER_TOOL_TIMEOUT_MS` lists an empty title, and a
|
|
4184
3596
|
* toolset without `context` lists none. Rejects with `the browser session ended` after
|
|
4185
3597
|
* `destroy()`, with the signal's reason when `options.signal` aborts, and with
|
|
4186
|
-
* `
|
|
3598
|
+
* `TOOLSET_DIALOG` while a dialog is open on the current tab.
|
|
4187
3599
|
*/
|
|
4188
3600
|
tabs(options?: BrowserCallOptions): Promise<readonly BrowserTab[]>;
|
|
4189
3601
|
/**
|
|
4190
3602
|
* Takes a queue turn and reserves action admission from the call for the returned caller token.
|
|
4191
3603
|
*
|
|
4192
3604
|
* @remarks
|
|
4193
|
-
* An action without the token that arrives after the call is refused with `
|
|
4194
|
-
* and `The toolset is replaying NAME until it finishes; call
|
|
3605
|
+
* An action without the token that arrives after the call is refused with `TOOLSET_BUSY`
|
|
3606
|
+
* and `The toolset is replaying NAME until it finishes; call read.`, while waiting and while held;
|
|
4195
3607
|
* the actions admitted before the call complete first; a wait that aborts or fails releases the
|
|
4196
3608
|
* pending reservation.
|
|
4197
3609
|
* A second hold waits for earlier holds to release and honours its signal while waiting.
|
|
4198
3610
|
* An open dialog or an input left pending by an earlier receipt refuses with
|
|
4199
|
-
* `
|
|
3611
|
+
* `TOOLSET_DIALOG` before admission is reserved. A dialog that opens while the
|
|
4200
3612
|
* queue drains also refuses the hold, leaving its answer admissible.
|
|
4201
3613
|
*/
|
|
4202
3614
|
hold(name: string, options?: BrowserCallOptions): Promise<BrowserHoldInterface>;
|
|
@@ -4209,7 +3621,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4209
3621
|
start(options?: BrowserCallOptions): Promise<void>;
|
|
4210
3622
|
/**
|
|
4211
3623
|
* Stops following the view, rejects queued actions, and removes every tool the toolset added
|
|
4212
|
-
* that the manager still holds
|
|
3624
|
+
* that the manager still holds. The caller retains ownership of the view. A second call
|
|
4213
3625
|
* returns the first call's promise.
|
|
4214
3626
|
*/
|
|
4215
3627
|
destroy(): Promise<void>;
|
|
@@ -4219,37 +3631,52 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4219
3631
|
* Configures a browser toolset.
|
|
4220
3632
|
*
|
|
4221
3633
|
* @remarks
|
|
3634
|
+
* - `notes` — supplies host notices before the result is budgeted
|
|
3635
|
+
* - `on` — initial event listeners
|
|
3636
|
+
* - `error` — observer error handler
|
|
4222
3637
|
* - `tools` — the manager the toolset fills. Default: a manager the toolset creates
|
|
4223
|
-
* - `
|
|
4224
|
-
*
|
|
4225
|
-
* - `
|
|
4226
|
-
*
|
|
4227
|
-
* - `context` — the browser context whose pages the `tabs` and `switch` tools list and select;
|
|
4228
|
-
* it requires `page`, and omitting it leaves both tools unadvertised
|
|
4229
|
-
* - `limit` — the most characters of a result or error message before its footer, a positive
|
|
3638
|
+
* - `source` — fixed page-tool source. Default: the view's registry when `isBrowserPage` holds;
|
|
3639
|
+
* the toolset starts that registry and follows the current page; no source for other views
|
|
3640
|
+
* - `context` — context whose pages `read` lists and `switch` selects; requires a page view
|
|
3641
|
+
* - `limit` — the most characters of a complete result or error message, including its footer, a positive
|
|
4230
3642
|
* integer. Default: `BROWSER_TOOL_LIMIT`
|
|
4231
3643
|
* - `schemes` — the URL schemes `navigate` accepts, each with its colon. Default:
|
|
4232
3644
|
* `BROWSER_SCHEMES`
|
|
4233
|
-
* - `release` — releases a resource the caller hands to the toolset, such as a view created for
|
|
4234
|
-
* it alone; `destroy()` calls it one time, after the toolset's own teardown, and rejects with
|
|
4235
|
-
* its rejection. A view or page supplied without it stays the caller's to end. Default: nothing
|
|
4236
|
-
* is released
|
|
4237
3645
|
* - `journeys` — the stores behind the journey tools, which the toolset registers and reserves
|
|
4238
3646
|
* through a journey toolset it constructs; omitting it leaves the journey tools unadvertised
|
|
3647
|
+
*
|
|
3648
|
+
* The caller owns the view and releases it after the toolset is destroyed.
|
|
4239
3649
|
*/
|
|
4240
3650
|
export declare interface BrowserToolsetOptions {
|
|
3651
|
+
/** Supplies and consumes host notices before the complete result is budgeted. */
|
|
3652
|
+
readonly notes?: () => string;
|
|
4241
3653
|
readonly on?: EmitterHooks<BrowserToolsetEventMap>;
|
|
4242
3654
|
readonly error?: EmitterErrorHandler;
|
|
4243
3655
|
readonly tools?: ToolManagerInterface;
|
|
4244
|
-
readonly page?: BrowserPageInterface;
|
|
4245
3656
|
readonly source?: BrowserToolSourceInterface;
|
|
4246
3657
|
readonly context?: BrowserContextInterface;
|
|
4247
3658
|
readonly limit?: number;
|
|
4248
3659
|
readonly schemes?: readonly string[];
|
|
4249
|
-
readonly release?: () => Promise<void> | void;
|
|
4250
3660
|
readonly journeys?: BrowserJourneyOptions;
|
|
4251
3661
|
}
|
|
4252
3662
|
|
|
3663
|
+
/** Configures a fresh line window within a whole-result character limit.
|
|
3664
|
+
* @remarks
|
|
3665
|
+
* - `from` — first line, inclusive. Default: 1
|
|
3666
|
+
* - `to` — last line, inclusive. Default: as many lines as fit
|
|
3667
|
+
* - `search` — words whose best in-range match opens the window; a range miss reports the
|
|
3668
|
+
* first page-wide best match only when it carries an element reference, without moving
|
|
3669
|
+
* the window; otherwise it keeps the plain miss. Unquoted misses appear before the footer;
|
|
3670
|
+
* quoted best matches and in-range hits stay under the header
|
|
3671
|
+
* - `limit` — character room including the header and footer. Default: the toolset limit
|
|
3672
|
+
*/
|
|
3673
|
+
export declare interface BrowserToolsetReadOptions extends BrowserCallOptions {
|
|
3674
|
+
readonly from?: number;
|
|
3675
|
+
readonly to?: number;
|
|
3676
|
+
readonly search?: string;
|
|
3677
|
+
readonly limit?: number;
|
|
3678
|
+
}
|
|
3679
|
+
|
|
4253
3680
|
/**
|
|
4254
3681
|
* Names why a toolset declined a page tool.
|
|
4255
3682
|
*
|
|
@@ -4280,14 +3707,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4280
3707
|
readonly fault?: unknown;
|
|
4281
3708
|
}
|
|
4282
3709
|
|
|
4283
|
-
/** Holds the listeners a toolset attaches to one followed page. */
|
|
4284
|
-
export declare interface BrowserToolsetWatch {
|
|
4285
|
-
readonly dialog: (dialog: BrowserDialogInterface) => void;
|
|
4286
|
-
readonly popup: (page: BrowserPageInterface) => void;
|
|
4287
|
-
readonly close: () => void;
|
|
4288
|
-
readonly closed: CDPHandler;
|
|
4289
|
-
}
|
|
4290
|
-
|
|
4291
3710
|
/** Maps the signal a tool source emits when its page's tools change. */
|
|
4292
3711
|
export declare type BrowserToolSourceEventMap = {
|
|
4293
3712
|
readonly change: readonly [];
|
|
@@ -4315,23 +3734,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4315
3734
|
tools?(): readonly BrowserTool[];
|
|
4316
3735
|
}
|
|
4317
3736
|
|
|
4318
|
-
/**
|
|
4319
|
-
* Sends trusted touch input through Chromium's CDP Input domain.
|
|
4320
|
-
*
|
|
4321
|
-
* @example
|
|
4322
|
-
* ```ts
|
|
4323
|
-
* import { BrowserTouch } from '@orkestrel/browser'
|
|
4324
|
-
*
|
|
4325
|
-
* const touch = new BrowserTouch(page)
|
|
4326
|
-
* await touch.tap({ x: 120, y: 240 })
|
|
4327
|
-
* ```
|
|
4328
|
-
*/
|
|
4329
|
-
export declare class BrowserTouch implements BrowserTouchInterface {
|
|
4330
|
-
#private;
|
|
4331
|
-
constructor(frame: BrowserFrameInterface);
|
|
4332
|
-
tap(point: BrowserPoint): Promise<void>;
|
|
4333
|
-
}
|
|
4334
|
-
|
|
4335
3737
|
/** Provides touch input operations bound to one frame target session. */
|
|
4336
3738
|
export declare interface BrowserTouchInterface {
|
|
4337
3739
|
/**
|
|
@@ -4340,27 +3742,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4340
3742
|
tap(point: BrowserPoint): Promise<void>;
|
|
4341
3743
|
}
|
|
4342
3744
|
|
|
4343
|
-
/**
|
|
4344
|
-
* Captures Chromium traces streamed through the IO domain.
|
|
4345
|
-
*
|
|
4346
|
-
* @example
|
|
4347
|
-
* ```ts
|
|
4348
|
-
* import { BrowserTracing } from '@orkestrel/browser'
|
|
4349
|
-
*
|
|
4350
|
-
* const tracing = new BrowserTracing(page)
|
|
4351
|
-
* await tracing.start({ screenshots: true })
|
|
4352
|
-
* const trace = await tracing.stop() // { bytes, path }
|
|
4353
|
-
* ```
|
|
4354
|
-
*/
|
|
4355
|
-
export declare class BrowserTracing implements BrowserTracingInterface {
|
|
4356
|
-
#private;
|
|
4357
|
-
constructor(frame: BrowserFrameInterface, writer?: BrowserWriterInterface);
|
|
4358
|
-
get active(): boolean;
|
|
4359
|
-
start(options?: BrowserTracingOptions): Promise<void>;
|
|
4360
|
-
stop(): Promise<BrowserTracingResult>;
|
|
4361
|
-
destroy(): Promise<void>;
|
|
4362
|
-
}
|
|
4363
|
-
|
|
4364
3745
|
/** Drives the trace capture lifecycle. */
|
|
4365
3746
|
export declare interface BrowserTracingInterface {
|
|
4366
3747
|
readonly active: boolean;
|
|
@@ -4443,6 +3824,16 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4443
3824
|
execute(work: BrowserTransitionFunction<T>): Promise<T>;
|
|
4444
3825
|
}
|
|
4445
3826
|
|
|
3827
|
+
/**
|
|
3828
|
+
* Describes the options for traversing a browser snapshot.
|
|
3829
|
+
*
|
|
3830
|
+
* @remarks
|
|
3831
|
+
* - `root` — optional subtree root, included in the walk
|
|
3832
|
+
*/
|
|
3833
|
+
export declare interface BrowserTraversalOptions {
|
|
3834
|
+
readonly root?: BrowserNode;
|
|
3835
|
+
}
|
|
3836
|
+
|
|
4446
3837
|
/** Describes user-agent metadata accepted by Chromium emulation. */
|
|
4447
3838
|
export declare interface BrowserUserAgent {
|
|
4448
3839
|
readonly value: string;
|
|
@@ -4480,7 +3871,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4480
3871
|
read(options?: BrowserCallOptions): Promise<BrowserReadingInterface>;
|
|
4481
3872
|
/**
|
|
4482
3873
|
* Resolves when the main document body’s `innerText` contains `text`, or lacks it with `absent`; rejects with a `BrowserError` coded
|
|
4483
|
-
* `
|
|
3874
|
+
* `TIMEOUT` at the deadline, and with `signal.reason` on abort.
|
|
4484
3875
|
*/
|
|
4485
3876
|
wait(text: string, options?: BrowserWaitOptions): Promise<void>;
|
|
4486
3877
|
}
|
|
@@ -4507,47 +3898,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4507
3898
|
readonly absent?: boolean;
|
|
4508
3899
|
}
|
|
4509
3900
|
|
|
4510
|
-
/** Names the page load condition for navigation — the CDP load event awaited by `navigate()`. */
|
|
4511
|
-
export declare type BrowserWaitUntil = 'commit' | 'load' | 'domcontentloaded' | 'idle';
|
|
4512
|
-
|
|
4513
|
-
/**
|
|
4514
|
-
* Describes the options for walking a browser snapshot.
|
|
4515
|
-
*
|
|
4516
|
-
* @remarks
|
|
4517
|
-
* - `root` — optional subtree root, included in the walk
|
|
4518
|
-
* - `order` — structural traversal order, defaulting to depth-first
|
|
4519
|
-
*/
|
|
4520
|
-
export declare interface BrowserWalkOptions {
|
|
4521
|
-
readonly root?: BrowserNode;
|
|
4522
|
-
readonly order?: BrowserWalkOrder;
|
|
4523
|
-
}
|
|
4524
|
-
|
|
4525
|
-
/** Names the structural ordering for a browser snapshot walk. */
|
|
4526
|
-
export declare type BrowserWalkOrder = 'depth' | 'breadth';
|
|
4527
|
-
|
|
4528
|
-
/**
|
|
4529
|
-
* Represents an observable WebSocket connection reconstructed from Network-domain events.
|
|
4530
|
-
*
|
|
4531
|
-
* @example
|
|
4532
|
-
* ```ts
|
|
4533
|
-
* import { BrowserWebSocket } from '@orkestrel/browser'
|
|
4534
|
-
*
|
|
4535
|
-
* const socket = new BrowserWebSocket('request-1', 'wss://example.com/live')
|
|
4536
|
-
* socket.emitter.on('receive', (frame) => log(frame.data))
|
|
4537
|
-
* ```
|
|
4538
|
-
*/
|
|
4539
|
-
export declare class BrowserWebSocket implements BrowserWebSocketInterface {
|
|
4540
|
-
#private;
|
|
4541
|
-
constructor(id: string, url: string);
|
|
4542
|
-
get emitter(): EmitterInterface<BrowserWebSocketEventMap>;
|
|
4543
|
-
get id(): string;
|
|
4544
|
-
get url(): string;
|
|
4545
|
-
receive(frame: BrowserWebSocketFrame): void;
|
|
4546
|
-
transmit(frame: BrowserWebSocketFrame): void;
|
|
4547
|
-
fail(message: string): void;
|
|
4548
|
-
close(timestamp: number): void;
|
|
4549
|
-
}
|
|
4550
|
-
|
|
4551
3901
|
/** Maps the WebSocket lifecycle events. */
|
|
4552
3902
|
export declare type BrowserWebSocketEventMap = {
|
|
4553
3903
|
readonly receive: readonly [frame: BrowserWebSocketFrame];
|
|
@@ -4569,22 +3919,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4569
3919
|
*
|
|
4570
3920
|
* @remarks
|
|
4571
3921
|
* The connection is an observation: a page's network manager reconstructs it
|
|
4572
|
-
* from
|
|
4573
|
-
* drive methods are on this contract because the class exposes exactly its
|
|
4574
|
-
* interface methods.
|
|
3922
|
+
* from network events through private callbacks; consumers observe its events.
|
|
4575
3923
|
*/
|
|
4576
3924
|
export declare interface BrowserWebSocketInterface {
|
|
4577
3925
|
readonly emitter: EmitterInterface<BrowserWebSocketEventMap>;
|
|
4578
3926
|
readonly id: string;
|
|
4579
3927
|
readonly url: string;
|
|
4580
|
-
/** Reports one received frame. The page's network manager drives it. */
|
|
4581
|
-
receive(frame: BrowserWebSocketFrame): void;
|
|
4582
|
-
/** Reports one sent frame. The page's network manager drives it. */
|
|
4583
|
-
transmit(frame: BrowserWebSocketFrame): void;
|
|
4584
|
-
/** Reports a connection fault. The page's network manager drives it. */
|
|
4585
|
-
fail(message: string): void;
|
|
4586
|
-
/** Reports the connection closing and destroys the emitter. The page's network manager drives it. */
|
|
4587
|
-
close(timestamp: number): void;
|
|
4588
3928
|
}
|
|
4589
3929
|
|
|
4590
3930
|
/** Names a worker target category. */
|
|
@@ -4600,21 +3940,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4600
3940
|
/** Issues one CDP method call on the worker's session. */
|
|
4601
3941
|
send(method: string, params?: Readonly<Record<string, unknown>>, options?: BrowserCallOptions): Promise<unknown>;
|
|
4602
3942
|
/** Stops driving the worker locally without closing its target. */
|
|
4603
|
-
|
|
3943
|
+
destroy(): void;
|
|
4604
3944
|
/** Closes the worker target, tolerating a worker that already terminated. Idempotent. */
|
|
4605
3945
|
close(): Promise<void>;
|
|
4606
3946
|
}
|
|
4607
3947
|
|
|
4608
|
-
/**
|
|
4609
|
-
* Resolves the isolated-world execution context a page caches for one frame document, creating
|
|
4610
|
-
* the world on the given session when none is cached.
|
|
4611
|
-
*
|
|
4612
|
-
* @param session - The CDP session that owns the frame
|
|
4613
|
-
* @param options - The deadline and signal for the creation call
|
|
4614
|
-
* @returns The isolated-world execution context id
|
|
4615
|
-
*/
|
|
4616
|
-
export declare type BrowserWorldFunction = (session: string, options?: BrowserCallOptions) => Promise<number>;
|
|
4617
|
-
|
|
4618
3948
|
/**
|
|
4619
3949
|
* Provides a pluggable sink for persisting captured browser bytes to a path.
|
|
4620
3950
|
*
|
|
@@ -4628,6 +3958,21 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4628
3958
|
write(path: string, data: Uint8Array): Promise<void>;
|
|
4629
3959
|
}
|
|
4630
3960
|
|
|
3961
|
+
/**
|
|
3962
|
+
* Builds a standards-shaped HAR 1.2 entry from one observed exchange.
|
|
3963
|
+
*
|
|
3964
|
+
* @param pending - Request and optional response captured by the recorder
|
|
3965
|
+
* @param duration - Whole exchange duration in milliseconds
|
|
3966
|
+
* @param body - Optional decoded response body
|
|
3967
|
+
* @param error - Optional request failure description
|
|
3968
|
+
* @returns HAR 1.2 entry
|
|
3969
|
+
*/
|
|
3970
|
+
export declare function buildBrowserHAREntry(pending: {
|
|
3971
|
+
readonly request: BrowserRequest;
|
|
3972
|
+
readonly started: number;
|
|
3973
|
+
readonly response: BrowserResponse | undefined;
|
|
3974
|
+
}, duration: number, body?: Uint8Array, error?: string): BrowserHAREntry;
|
|
3975
|
+
|
|
4631
3976
|
/**
|
|
4632
3977
|
* Builds a validated journey from recorded steps and declares their secret bindings.
|
|
4633
3978
|
* @param steps - Recorded steps in order
|
|
@@ -4635,10 +3980,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4635
3980
|
* @returns An owned journey with its next id and secret declarations
|
|
4636
3981
|
* @throws BrowserError - Thrown when the assembled journey fails validation
|
|
4637
3982
|
*/
|
|
4638
|
-
export declare function buildBrowserJourney(steps: readonly BrowserJourneyStep[], options:
|
|
4639
|
-
|
|
4640
|
-
/** Decodes UTF-8 bytes as text. */
|
|
4641
|
-
export declare function bytesToText(value: Uint8Array): string;
|
|
3983
|
+
export declare function buildBrowserJourney(steps: readonly BrowserJourneyStep[], options: BrowserJourneyInput): BrowserJourney;
|
|
4642
3984
|
|
|
4643
3985
|
/**
|
|
4644
3986
|
* Provides a lightweight Chrome DevTools Protocol client over a {@link CDPTransportInterface}.
|
|
@@ -4771,25 +4113,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4771
4113
|
readonly error?: EmitterErrorHandler;
|
|
4772
4114
|
}
|
|
4773
4115
|
|
|
4774
|
-
/**
|
|
4775
|
-
* Reports that a CDP request could not be sent or completed because the client was not connected, closed while connecting, lost its connection, or lost the request's target session, under the code `BROWSER_CDP_CONNECTION_ERROR`.
|
|
4776
|
-
*/
|
|
4777
|
-
export declare class CDPConnectionError extends BrowserError {
|
|
4778
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
4779
|
-
}
|
|
4780
|
-
|
|
4781
|
-
/**
|
|
4782
|
-
* Reports that a CDP request received an error response from the remote endpoint, under the
|
|
4783
|
-
* code `BROWSER_CDP_ERROR`, with the `method`, the CDP `code`, the `message`, and any `data`
|
|
4784
|
-
* in its context.
|
|
4785
|
-
*
|
|
4786
|
-
* @remarks
|
|
4787
|
-
* Branch on the protocol-level error in `context` instead of parsing the message string.
|
|
4788
|
-
*/
|
|
4789
|
-
export declare class CDPError extends BrowserError {
|
|
4790
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
4791
|
-
}
|
|
4792
|
-
|
|
4793
4116
|
/** Receives a subscribed CDP event with its params record. */
|
|
4794
4117
|
export declare type CDPHandler = (params: Readonly<Record<string, unknown>>) => void;
|
|
4795
4118
|
|
|
@@ -4821,14 +4144,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4821
4144
|
readonly url: string;
|
|
4822
4145
|
}
|
|
4823
4146
|
|
|
4824
|
-
/**
|
|
4825
|
-
* Reports that a pending CDP request was not answered within its timeout window, under the
|
|
4826
|
-
* code `BROWSER_CDP_TIMEOUT_ERROR`.
|
|
4827
|
-
*/
|
|
4828
|
-
export declare class CDPTimeoutError extends BrowserError {
|
|
4829
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
4830
|
-
}
|
|
4831
|
-
|
|
4832
4147
|
/**
|
|
4833
4148
|
* Maps the events emitted by a {@link CDPTransportInterface} — the raw text pipe a
|
|
4834
4149
|
* {@link CDPClientInterface} sends and receives JSON-RPC frames over.
|
|
@@ -4859,7 +4174,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4859
4174
|
/** Opens the underlying connection. */
|
|
4860
4175
|
start(): Promise<void>;
|
|
4861
4176
|
/**
|
|
4862
|
-
* Writes one raw text frame to the connection. Throws a coded `
|
|
4177
|
+
* Writes one raw text frame to the connection. Throws a coded `BrowserError`
|
|
4863
4178
|
* carrying the transport `url` when called before the connection opens or after it closes.
|
|
4864
4179
|
*/
|
|
4865
4180
|
send(data: string): Promise<void>;
|
|
@@ -4970,7 +4285,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4970
4285
|
* @param journey - The journey to compile
|
|
4971
4286
|
* @param options - The target language
|
|
4972
4287
|
* @returns The module source and the gap step ids in step order
|
|
4973
|
-
* @throws BrowserError - Thrown with `
|
|
4288
|
+
* @throws BrowserError - Thrown with `STORE_FORMAT` or `JOURNEY_INVALID` when the
|
|
4974
4289
|
* journey fails validation, before any source is compiled
|
|
4975
4290
|
* @example
|
|
4976
4291
|
* ```ts
|
|
@@ -5011,7 +4326,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5011
4326
|
* A result whose `JSON.stringify` length exceeds `limit` throws
|
|
5012
4327
|
* `Error('BROWSER_RESULT_LIMIT: <length>')` inside the page instead of being
|
|
5013
4328
|
* returned — the caller maps that sentinel to a coded
|
|
5014
|
-
* {@link
|
|
4329
|
+
* {@link BrowserError}. A non-serializable result (`undefined`,
|
|
5015
4330
|
* a function, a symbol) makes `JSON.stringify` return `undefined`, so the
|
|
5016
4331
|
* length check is skipped and today's undefined-passthrough behavior is
|
|
5017
4332
|
* unchanged.
|
|
@@ -5110,7 +4425,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5110
4425
|
*
|
|
5111
4426
|
* @remarks
|
|
5112
4427
|
* The observer records every `submit` event the window sees from installation until
|
|
5113
|
-
* {@link compileSubmitReadExpression} with the same `token` reads
|
|
4428
|
+
* {@link compileSubmitReadExpression} with the same `token` reads it without removing it, under
|
|
5114
4429
|
* {@link BROWSER_SUBMIT_KEY}, and replaces an observer an earlier installation left in place,
|
|
5115
4430
|
* whatever its token. A capture-phase `keydown` listener beside it records whether an Enter's
|
|
5116
4431
|
* target is an `input` a form owns, before any handler of the page can move the focus. A listener
|
|
@@ -5124,7 +4439,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5124
4439
|
|
|
5125
4440
|
/**
|
|
5126
4441
|
* Compiles the read of the `submit` observer {@link compileSubmitObserverExpression} installs for
|
|
5127
|
-
* `token`,
|
|
4442
|
+
* `token`, preserving the observer until cleanup.
|
|
5128
4443
|
*
|
|
5129
4444
|
* @remarks
|
|
5130
4445
|
* The read resolves an object of four members:
|
|
@@ -5150,6 +4465,19 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5150
4465
|
*/
|
|
5151
4466
|
export declare function compileSubmitReadExpression(token: number): string;
|
|
5152
4467
|
|
|
4468
|
+
/** Compiles token-scoped cleanup of submission listeners and change observation.
|
|
4469
|
+
* @param token - Action owning the observation
|
|
4470
|
+
* @returns An expression releasing only that action's observation
|
|
4471
|
+
*/
|
|
4472
|
+
export declare function compileSubmitReleaseExpression(token: number): string;
|
|
4473
|
+
|
|
4474
|
+
/** Compiles a bounded wait for the first rendered change after submission.
|
|
4475
|
+
* @param token - Action owning the observation
|
|
4476
|
+
* @param timeout - Remaining settle time in milliseconds
|
|
4477
|
+
* @returns An expression resolving true for a rendered change and false at the deadline
|
|
4478
|
+
*/
|
|
4479
|
+
export declare function compileSubmitWaitExpression(token: number, timeout: number): string;
|
|
4480
|
+
|
|
5153
4481
|
/**
|
|
5154
4482
|
* Compiles a wait for the presence or absence of visible text, coalesced by tasks.
|
|
5155
4483
|
* @param text - Text to find in the main document body
|
|
@@ -5201,15 +4529,23 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5201
4529
|
export declare function cookieToProtocol(cookie: BrowserCookieInput): Readonly<Record<string, unknown>>;
|
|
5202
4530
|
|
|
5203
4531
|
/**
|
|
5204
|
-
*
|
|
4532
|
+
* Creates a wrapper over an existing browser context on a CDP client.
|
|
5205
4533
|
*
|
|
5206
|
-
* @
|
|
5207
|
-
*
|
|
5208
|
-
*
|
|
5209
|
-
*
|
|
5210
|
-
*
|
|
4534
|
+
* @remarks
|
|
4535
|
+
* `id` selects an existing remote context; omission selects the default context.
|
|
4536
|
+
* The caller owns the client. Use `browser.isolate` to create a remote context with
|
|
4537
|
+
* `proxy` or `origins`; this factory refuses those options.
|
|
4538
|
+
*
|
|
4539
|
+
* @param client - The client whose connection carries the context's pages
|
|
4540
|
+
* @param options - Context identity, page defaults, writer, and event hooks
|
|
4541
|
+
* @returns The context wrapper
|
|
4542
|
+
* @throws Thrown with `ARGUMENT` when `proxy` or `origins` is supplied.
|
|
4543
|
+
* @example
|
|
4544
|
+
* const context = createBrowserContext(client, { viewport: { width: 1280, height: 720 } })
|
|
4545
|
+
* const page = await context.create({ url: 'https://example.com/' })
|
|
4546
|
+
* await context.destroy()
|
|
5211
4547
|
*/
|
|
5212
|
-
export declare function
|
|
4548
|
+
export declare function createBrowserContext(client: CDPClientInterface, options?: BrowserContextOptions): BrowserContextInterface;
|
|
5213
4549
|
|
|
5214
4550
|
/**
|
|
5215
4551
|
* Creates a `BrowserReadingInterface` over a captured document, parsing its HTML one time.
|
|
@@ -5274,19 +4610,17 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5274
4610
|
export declare function createBrowserSnapshot(input: BrowserSnapshotInput): BrowserSnapshotInterface;
|
|
5275
4611
|
|
|
5276
4612
|
/**
|
|
5277
|
-
* Creates a
|
|
5278
|
-
* `@orkestrel/tool` manager.
|
|
4613
|
+
* Creates a toolset over a caller-owned view, enabling page tools when the view is a page.
|
|
5279
4614
|
*
|
|
5280
4615
|
* @remarks
|
|
5281
|
-
*
|
|
5282
|
-
*
|
|
5283
|
-
*
|
|
5284
|
-
*
|
|
4616
|
+
* A structural {@link isBrowserPage} guard selects page features, including navigation,
|
|
4617
|
+
* trusted keyboard input, dialogs, and popup following. Other views publish the document
|
|
4618
|
+
* vocabulary. Tools register during `start()`; `destroy()` leaves the view with its caller.
|
|
4619
|
+
* Hand `toolset.tools` to an agent and publish `toolset.native` to a built-in browser agent.
|
|
5285
4620
|
*
|
|
5286
|
-
* @param
|
|
5287
|
-
* @param options -
|
|
5288
|
-
*
|
|
5289
|
-
* @returns A {@link BrowserToolsetInterface}
|
|
4621
|
+
* @param view - The view the tools act on first
|
|
4622
|
+
* @param options - Tool manager, source, context, bounds, schemes, and journey stores
|
|
4623
|
+
* @returns The toolset
|
|
5290
4624
|
*
|
|
5291
4625
|
* @example
|
|
5292
4626
|
* ```ts
|
|
@@ -5294,7 +4628,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5294
4628
|
*
|
|
5295
4629
|
* const toolset = createBrowserToolset(page, { context })
|
|
5296
4630
|
* await toolset.start()
|
|
5297
|
-
* const result = await toolset.tools.execute({ id: '1', name: '
|
|
4631
|
+
* const result = await toolset.tools.execute({ id: '1', name: 'read', arguments: { from: 1, search: 'cart' } })
|
|
5298
4632
|
* ```
|
|
5299
4633
|
*
|
|
5300
4634
|
* @example Drive a page with a small model
|
|
@@ -5307,8 +4641,8 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5307
4641
|
*
|
|
5308
4642
|
* const system =
|
|
5309
4643
|
* 'You control a web browser with tools and must call a tool before you answer. ' +
|
|
5310
|
-
* 'The first message shows
|
|
5311
|
-
* 'To learn a fact, call read with
|
|
4644
|
+
* 'The first message shows numbered page lines; references such as e4 name its elements. ' +
|
|
4645
|
+
* 'To learn a fact, call read with from 1 and search words from your question; follow a footer by calling read with its from line. ' +
|
|
5312
4646
|
* "To use the site's search box, call type with its reference, the words, and submit true. " +
|
|
5313
4647
|
* 'To press a button or follow a link, call click with its reference from the latest result. Never invent a reference. ' +
|
|
5314
4648
|
* 'If text you expect has not appeared, call wait once. ' +
|
|
@@ -5319,11 +4653,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5319
4653
|
* const page = await browser.create({ url: 'https://shop.example.test/' })
|
|
5320
4654
|
* const toolset = createBrowserToolset(page, { tools: createToolManager() })
|
|
5321
4655
|
* await toolset.start()
|
|
5322
|
-
* toolset.tools.tools().map((tool) => tool.name) // ['
|
|
4656
|
+
* toolset.tools.tools().map((tool) => tool.name) // ['read', 'click', 'type', 'press', 'navigate', 'wait']
|
|
5323
4657
|
* const seeded = await toolset.tools.execute({
|
|
5324
4658
|
* id: 'seed',
|
|
5325
|
-
* name: '
|
|
5326
|
-
* arguments: {
|
|
4659
|
+
* name: 'read',
|
|
4660
|
+
* arguments: { from: 1 },
|
|
5327
4661
|
* })
|
|
5328
4662
|
* const view = seeded.success ? String(seeded.value) : seeded.error
|
|
5329
4663
|
* const agent = createAgent(createOllama({ model: 'qwen3.5:2b-q4_K_M' }), {
|
|
@@ -5332,14 +4666,14 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5332
4666
|
* })
|
|
5333
4667
|
* agent.context.messages.add({
|
|
5334
4668
|
* role: 'user',
|
|
5335
|
-
* content: `What does the Alpine Kettle cost?\n\nThe browser
|
|
4669
|
+
* content: `What does the Alpine Kettle cost?\n\nThe browser's first read of the page:\n${view}`,
|
|
5336
4670
|
* })
|
|
5337
4671
|
* const result = await agent.generate()
|
|
5338
4672
|
* await toolset.destroy()
|
|
5339
4673
|
* await browser.destroy()
|
|
5340
4674
|
* ```
|
|
5341
4675
|
*/
|
|
5342
|
-
export declare function createBrowserToolset(
|
|
4676
|
+
export declare function createBrowserToolset(view: BrowserViewInterface, options?: BrowserToolsetOptions): BrowserToolsetInterface;
|
|
5343
4677
|
|
|
5344
4678
|
/**
|
|
5345
4679
|
* Creates a `CDPClientInterface` bound to the given `CDPTransportInterface`.
|
|
@@ -5375,24 +4709,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5375
4709
|
*/
|
|
5376
4710
|
export declare function createMemoryBrowserRunStore(): BrowserRunStoreInterface;
|
|
5377
4711
|
|
|
5378
|
-
/**
|
|
5379
|
-
* Decodes a base64-encoded string into raw bytes.
|
|
5380
|
-
*
|
|
5381
|
-
* @remarks
|
|
5382
|
-
* Pure JS implementation — no `Buffer`, no `atob` (DOM-only) — so it runs
|
|
5383
|
-
* identically in Node and browser environments. Whitespace and `=` padding
|
|
5384
|
-
* are ignored; invalid characters are skipped.
|
|
5385
|
-
*
|
|
5386
|
-
* @param text - Base64-encoded input string
|
|
5387
|
-
* @returns Decoded bytes
|
|
5388
|
-
*
|
|
5389
|
-
* @example
|
|
5390
|
-
* ```ts
|
|
5391
|
-
* decodeBase64('aGVsbG8=') // Uint8Array [104, 101, 108, 108, 111]
|
|
5392
|
-
* ```
|
|
5393
|
-
*/
|
|
5394
|
-
export declare function decodeBase64(text: string): Uint8Array;
|
|
5395
|
-
|
|
5396
4712
|
/**
|
|
5397
4713
|
* Derives an unused lower camel case secret parameter name from an accessible name.
|
|
5398
4714
|
* @param name - Accessible name of the control
|
|
@@ -5417,23 +4733,31 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5417
4733
|
*/
|
|
5418
4734
|
export declare function deriveBrowserToolSchema(schema: Readonly<Record<string, unknown>> | undefined): Readonly<Record<string, unknown>> | undefined;
|
|
5419
4735
|
|
|
4736
|
+
/**
|
|
4737
|
+
* Describes an element refusal, adding a fresh-reference instruction for `GONE`.
|
|
4738
|
+
*
|
|
4739
|
+
* @param subject - Element reference or named subject
|
|
4740
|
+
* @param reason - Reason the operation was refused
|
|
4741
|
+
* @param detail - Specific explanation replacing the default reason text
|
|
4742
|
+
* @returns The refusal message with its final punctuation
|
|
4743
|
+
*
|
|
4744
|
+
* @example
|
|
4745
|
+
* ```ts
|
|
4746
|
+
* describeBrowserRefusal('e4', 'GONE')
|
|
4747
|
+
* // 'Element [ref=e4] is gone because the page changed; call read for fresh refs.'
|
|
4748
|
+
* ```
|
|
4749
|
+
*/
|
|
4750
|
+
export declare function describeBrowserRefusal(subject: string | BrowserElementSubject, reason: BrowserElementReason, detail?: string): string;
|
|
4751
|
+
|
|
5420
4752
|
/**
|
|
5421
4753
|
* Applies an ordered edit batch to a copy and validates its nonempty result and final bindings.
|
|
5422
4754
|
* @param journey - Valid journey to edit
|
|
5423
4755
|
* @param edits - Edits in application order
|
|
5424
4756
|
* @returns The edited journey, with unbound parameters removed
|
|
5425
|
-
* @throws BrowserError - Thrown with
|
|
4757
|
+
* @throws BrowserError - Thrown with JOURNEY_EDIT, a one-based index, and a reason clause when the batch fails
|
|
5426
4758
|
*/
|
|
5427
4759
|
export declare function editBrowserJourney(journey: BrowserJourney, edits: readonly BrowserJourneyEdit[]): BrowserJourney;
|
|
5428
4760
|
|
|
5429
|
-
/**
|
|
5430
|
-
* Encodes raw bytes as base64 without relying on Node or DOM globals.
|
|
5431
|
-
*
|
|
5432
|
-
* @param bytes - Raw input bytes
|
|
5433
|
-
* @returns Base64 text
|
|
5434
|
-
*/
|
|
5435
|
-
export declare function encodeBase64(bytes: Uint8Array): string;
|
|
5436
|
-
|
|
5437
4761
|
/**
|
|
5438
4762
|
* Extracts a keyboard chord such as `Control+Shift+P` into its parts, throwing a
|
|
5439
4763
|
* `BrowserError` on an empty chord or an unsupported modifier.
|
|
@@ -5478,6 +4802,13 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5478
4802
|
*/
|
|
5479
4803
|
export declare function filterBrowserOutline(nodes: readonly BrowserOutlineNode[], query: BrowserElementQuery): readonly BrowserOutlineNode[];
|
|
5480
4804
|
|
|
4805
|
+
/** Finds the first line contributing a whitespace-normalized match across consecutive text spans.
|
|
4806
|
+
* @param lines - Wrapped projection
|
|
4807
|
+
* @param text - Visible text to locate
|
|
4808
|
+
* @returns One-based opening line, or 1 when no match exists
|
|
4809
|
+
*/
|
|
4810
|
+
export declare function findBrowserText(lines: readonly BrowserLine[], text: string): number;
|
|
4811
|
+
|
|
5481
4812
|
/**
|
|
5482
4813
|
* Generates a run id from an ISO timestamp and a cryptographic hexadecimal suffix.
|
|
5483
4814
|
* @returns An ISO timestamp with hyphens replacing colons, followed by four hexadecimal digits
|
|
@@ -5485,25 +4816,9 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5485
4816
|
export declare function generateBrowserRunId(): string;
|
|
5486
4817
|
|
|
5487
4818
|
/**
|
|
5488
|
-
*
|
|
5489
|
-
*
|
|
5490
|
-
* @param value - Value to check
|
|
5491
|
-
* @returns True if value is a BrowserConnectionError instance; false otherwise
|
|
5492
|
-
*/
|
|
5493
|
-
export declare function isBrowserConnectionError(value: unknown): value is BrowserConnectionError;
|
|
5494
|
-
|
|
5495
|
-
/**
|
|
5496
|
-
* Checks whether a value is an element refusal.
|
|
5497
|
-
* @param value - Caught value
|
|
5498
|
-
* @returns True if the value is an element error; false otherwise
|
|
5499
|
-
*/
|
|
5500
|
-
export declare function isBrowserElementError(value: unknown): value is BrowserElementError;
|
|
5501
|
-
|
|
5502
|
-
/**
|
|
5503
|
-
* Narrows an unknown value to a `BrowserError`.
|
|
5504
|
-
*
|
|
4819
|
+
* Checks whether a value is a browser error.
|
|
5505
4820
|
* @param value - Value to check
|
|
5506
|
-
* @returns True if value is a
|
|
4821
|
+
* @returns True if the value is a browser error; false otherwise
|
|
5507
4822
|
*/
|
|
5508
4823
|
export declare function isBrowserError(value: unknown): value is BrowserError;
|
|
5509
4824
|
|
|
@@ -5562,12 +4877,19 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5562
4877
|
export declare function isBrowserNodeVisible(node: BrowserNode): boolean;
|
|
5563
4878
|
|
|
5564
4879
|
/**
|
|
5565
|
-
*
|
|
4880
|
+
* Checks whether a value exposes the page capabilities used by a browser toolset.
|
|
5566
4881
|
*
|
|
5567
|
-
* @
|
|
5568
|
-
*
|
|
4882
|
+
* @remarks
|
|
4883
|
+
* Reads structural members, including inherited accessors, without invoking page operations.
|
|
4884
|
+
* A trusted view alone is insufficient. Hostile getters and revoked proxies return false.
|
|
4885
|
+
*
|
|
4886
|
+
* @param value - The candidate page or view
|
|
4887
|
+
* @returns True if the value exposes the page's protocol and toolset capabilities; false otherwise
|
|
4888
|
+
* @example
|
|
4889
|
+
* isBrowserPage(page) // true
|
|
4890
|
+
* isBrowserPage(view) // false for a DOM document view
|
|
5569
4891
|
*/
|
|
5570
|
-
export declare function
|
|
4892
|
+
export declare function isBrowserPage(value: unknown): value is BrowserPageInterface;
|
|
5571
4893
|
|
|
5572
4894
|
/**
|
|
5573
4895
|
* Checks whether a step binds a declared secret through type.text.
|
|
@@ -5586,35 +4908,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5586
4908
|
|
|
5587
4909
|
/**
|
|
5588
4910
|
* Checks whether a value is a journey step error.
|
|
5589
|
-
* @param value -
|
|
4911
|
+
* @param value - Value to check
|
|
5590
4912
|
* @returns True if the value is a step error; false otherwise
|
|
5591
4913
|
*/
|
|
5592
4914
|
export declare function isBrowserStepError(value: unknown): value is BrowserStepError;
|
|
5593
4915
|
|
|
5594
|
-
/**
|
|
5595
|
-
* Narrows an unknown value to a `CDPConnectionError`.
|
|
5596
|
-
*
|
|
5597
|
-
* @param value - Value to check
|
|
5598
|
-
* @returns True if value is a CDPConnectionError instance; false otherwise
|
|
5599
|
-
*/
|
|
5600
|
-
export declare function isCDPConnectionError(value: unknown): value is CDPConnectionError;
|
|
5601
|
-
|
|
5602
|
-
/**
|
|
5603
|
-
* Narrows an unknown value to a `CDPError`.
|
|
5604
|
-
*
|
|
5605
|
-
* @param value - Value to check
|
|
5606
|
-
* @returns True if value is a CDPError instance; false otherwise
|
|
5607
|
-
*/
|
|
5608
|
-
export declare function isCDPError(value: unknown): value is CDPError;
|
|
5609
|
-
|
|
5610
|
-
/**
|
|
5611
|
-
* Narrows an unknown value to a `CDPTimeoutError`.
|
|
5612
|
-
*
|
|
5613
|
-
* @param value - Value to check
|
|
5614
|
-
* @returns True if value is a CDPTimeoutError instance; false otherwise
|
|
5615
|
-
*/
|
|
5616
|
-
export declare function isCDPTimeoutError(value: unknown): value is CDPTimeoutError;
|
|
5617
|
-
|
|
5618
4916
|
/**
|
|
5619
4917
|
* Normalizes one key to CDP keyboard event data.
|
|
5620
4918
|
*
|
|
@@ -5676,32 +4974,26 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5676
4974
|
export declare class MemoryBrowserJourneyStore implements BrowserJourneyStoreInterface {
|
|
5677
4975
|
#private;
|
|
5678
4976
|
get(name: string, options?: BrowserStoreOptions): Promise<BrowserJourneyRevision | undefined>;
|
|
5679
|
-
set(journey: BrowserJourney,
|
|
4977
|
+
set(journey: BrowserJourney, options?: BrowserJourneyWriteOptions): Promise<BrowserJourneyRevision>;
|
|
5680
4978
|
delete(name: string, options?: BrowserStoreOptions): Promise<void>;
|
|
5681
|
-
list(options?:
|
|
5682
|
-
readonly offset?: number;
|
|
5683
|
-
readonly limit?: number;
|
|
5684
|
-
}): Promise<BrowserStorePage<BrowserJourneyRevision>>;
|
|
4979
|
+
list(options?: BrowserStorePageOptions): Promise<BrowserStorePage<BrowserJourneyRevision>>;
|
|
5685
4980
|
}
|
|
5686
4981
|
|
|
5687
4982
|
/**
|
|
5688
4983
|
* Keeps owned runs under their journey names and producer ids without directories.
|
|
5689
4984
|
* @example
|
|
5690
4985
|
* const store = new MemoryBrowserRunStore()
|
|
5691
|
-
* const slot = await store.
|
|
4986
|
+
* const slot = await store.create('add-kettle')
|
|
5692
4987
|
*/
|
|
5693
4988
|
export declare class MemoryBrowserRunStore implements BrowserRunStoreInterface {
|
|
5694
4989
|
#private;
|
|
5695
|
-
|
|
4990
|
+
create(name: string, options?: BrowserStoreOptions): Promise<BrowserRunSlot>;
|
|
5696
4991
|
get(name: string, id: string, options?: BrowserStoreOptions): Promise<BrowserRun | undefined>;
|
|
5697
4992
|
set(run: BrowserRun, options?: BrowserStoreOptions): Promise<void>;
|
|
5698
4993
|
capture(slot: BrowserRunSlot, _name: string, _bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string | undefined>;
|
|
5699
4994
|
delete(name: string, id: string, options?: BrowserStoreOptions): Promise<void>;
|
|
5700
4995
|
clear(name: string, options?: BrowserStoreOptions): Promise<number>;
|
|
5701
|
-
list(name: string, options?:
|
|
5702
|
-
readonly offset?: number;
|
|
5703
|
-
readonly limit?: number;
|
|
5704
|
-
}): Promise<BrowserStorePage<BrowserRun>>;
|
|
4996
|
+
list(name: string, options?: BrowserStorePageOptions): Promise<BrowserStorePage<BrowserRun>>;
|
|
5705
4997
|
}
|
|
5706
4998
|
|
|
5707
4999
|
/**
|
|
@@ -5924,6 +5216,13 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5924
5216
|
*/
|
|
5925
5217
|
export declare function parseBrowserTool(value: unknown): BrowserTool | undefined;
|
|
5926
5218
|
|
|
5219
|
+
/**
|
|
5220
|
+
* Parses an integer or a canonical unsigned decimal string for a tool coordinate.
|
|
5221
|
+
* @param value - The supplied coordinate
|
|
5222
|
+
* @returns The integer, or undefined when the value or spelling is invalid
|
|
5223
|
+
*/
|
|
5224
|
+
export declare function parseBrowserToolInteger(value: unknown): number | undefined;
|
|
5225
|
+
|
|
5927
5226
|
/**
|
|
5928
5227
|
* Coerces one WebSocket frame event to a `BrowserWebSocketFrame`, or
|
|
5929
5228
|
* `undefined` off-shape.
|
|
@@ -6094,7 +5393,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6094
5393
|
|
|
6095
5394
|
/**
|
|
6096
5395
|
* Decodes a CDP `DOMSnapshot.captureSnapshot` result into a serializable
|
|
6097
|
-
* `BrowserSnapshotInput`, throwing a `BrowserError` off-shape and a `
|
|
5396
|
+
* `BrowserSnapshotInput`, throwing a `BrowserError` off-shape and a `BrowserError`
|
|
6098
5397
|
* past the configured node limit.
|
|
6099
5398
|
*
|
|
6100
5399
|
* @param value - Unknown CDP result
|
|
@@ -6153,7 +5452,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6153
5452
|
* @param args - The arguments a model supplied
|
|
6154
5453
|
* @param key - The parameter name
|
|
6155
5454
|
* @returns The string the argument holds
|
|
6156
|
-
* @throws Thrown as a `BrowserError` coded `
|
|
5455
|
+
* @throws Thrown as a `BrowserError` coded `ARGUMENT` when the argument is not a
|
|
6157
5456
|
* string.
|
|
6158
5457
|
*
|
|
6159
5458
|
* @example
|
|
@@ -6177,7 +5476,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6177
5476
|
|
|
6178
5477
|
/**
|
|
6179
5478
|
* Decodes one CDP `Runtime.evaluate` result, throwing a `BrowserError` on a failed evaluation
|
|
6180
|
-
* and a `
|
|
5479
|
+
* and a `BrowserError` past the guarded result size.
|
|
6181
5480
|
*
|
|
6182
5481
|
* @param value - Unknown CDP result
|
|
6183
5482
|
* @returns The returned by-value payload, or undefined
|
|
@@ -6212,22 +5511,38 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6212
5511
|
*/
|
|
6213
5512
|
export declare function readRareStringData(value: unknown, strings: readonly string[]): ReadonlyMap<number, string>;
|
|
6214
5513
|
|
|
5514
|
+
/** Redacts registered secrets before projection wrapping or output clipping.
|
|
5515
|
+
* @param text - Unbounded text
|
|
5516
|
+
* @param secrets - Registered secret values
|
|
5517
|
+
* @returns Text with literal and JSON-escaped secret occurrences replaced
|
|
5518
|
+
*/
|
|
5519
|
+
export declare function redactBrowserText(text: string, secrets: readonly string[]): string;
|
|
5520
|
+
|
|
6215
5521
|
/**
|
|
6216
|
-
* Renders an element as its outline row reads:
|
|
5522
|
+
* Renders an element as its outline row reads: role, quoted name, and reference.
|
|
6217
5523
|
*
|
|
6218
5524
|
* @param element - The referenced element
|
|
6219
|
-
* @returns The
|
|
5525
|
+
* @returns The role, optional JSON-quoted name, and `[ref=eN]` reference
|
|
6220
5526
|
*
|
|
6221
5527
|
* @example
|
|
6222
5528
|
* ```ts
|
|
6223
5529
|
* import { renderBrowserElement } from '@orkestrel/browser'
|
|
6224
5530
|
*
|
|
6225
5531
|
* const element = page.elements.element('e4')
|
|
6226
|
-
* if (element !== undefined) renderBrowserElement(element) // '
|
|
5532
|
+
* if (element !== undefined) renderBrowserElement(element) // 'button "Place order" [ref=e4]'
|
|
6227
5533
|
* ```
|
|
6228
5534
|
*/
|
|
6229
5535
|
export declare function renderBrowserElement(element: BrowserElementInterface): string;
|
|
6230
5536
|
|
|
5537
|
+
/** Renders an exact addressed-range footer, including the next line when content remains.
|
|
5538
|
+
* @param from - First returned line
|
|
5539
|
+
* @param to - Last returned line
|
|
5540
|
+
* @param total - Total projected lines
|
|
5541
|
+
* @param tool - Tool that serves the continuation. Default: read
|
|
5542
|
+
* @returns Complete footer
|
|
5543
|
+
*/
|
|
5544
|
+
export declare function renderBrowserFooter(from: number, to: number, total: number, tool?: string): string;
|
|
5545
|
+
|
|
6231
5546
|
/**
|
|
6232
5547
|
* Renders a journey with its parameter declarations and stable step ids.
|
|
6233
5548
|
* @param journey - Valid journey
|
|
@@ -6244,82 +5559,33 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6244
5559
|
*/
|
|
6245
5560
|
export declare function renderBrowserJourneyFault(fault: BrowserStoreFault): string;
|
|
6246
5561
|
|
|
6247
|
-
/**
|
|
6248
|
-
*
|
|
6249
|
-
*
|
|
6250
|
-
* @remarks
|
|
6251
|
-
* An oversized first row is cut with an ellipsis without splitting a surrogate pair, reserving
|
|
6252
|
-
* room for the first later row that can fit beside it only when the cut keeps the leading token
|
|
6253
|
-
* through its first space. Otherwise it cuts without reserving. Later rows that do not fit are
|
|
6254
|
-
* skipped. An empty collection or a cut with no character before the ellipsis produces no block.
|
|
6255
|
-
*
|
|
6256
|
-
* @param heading - The match count and search, ending with a colon
|
|
6257
|
-
* @param rows - Matching rows in document order
|
|
6258
|
-
* @param room - Characters available in the reply
|
|
6259
|
-
* @returns The bounded block with a trailing blank line, or an empty string
|
|
6260
|
-
*
|
|
6261
|
-
* @example
|
|
6262
|
-
* ```ts
|
|
6263
|
-
* import { renderBrowserMatches } from '@orkestrel/browser'
|
|
6264
|
-
* renderBrowserMatches('Matches:', ['[5] Cart'], 100) // 'Matches:\n[5] Cart\n\n'
|
|
6265
|
-
* ```
|
|
5562
|
+
/** Joins a projected line's spans without adding an address.
|
|
5563
|
+
* @param line - Projected line
|
|
5564
|
+
* @returns Rendered content
|
|
6266
5565
|
*/
|
|
6267
|
-
export declare function
|
|
5566
|
+
export declare function renderBrowserLine(line: BrowserLine): string;
|
|
6268
5567
|
|
|
6269
|
-
/**
|
|
6270
|
-
* Renders document-order text and referenced elements with a bounded element count.
|
|
6271
|
-
*
|
|
6272
|
-
* @remarks
|
|
6273
|
-
* Each referenced row renders through `renderBrowserOutlineRow`, and the closing
|
|
6274
|
-
* `(COUNT of TOTAL elements)` line counts the rows included and available. `matches` holds the
|
|
6275
|
-
* rows `scanBrowserOutline` returns for `search`, and `focus` the last referenced row whose node
|
|
6276
|
-
* carries a `focused` property of `true`; both reach past `limit`.
|
|
6277
|
-
*
|
|
5568
|
+
/** Renders document-order accessibility lines with a bounded element count.
|
|
6278
5569
|
* @param url - Document address
|
|
6279
5570
|
* @param title - Document title
|
|
6280
|
-
* @param nodes - Ordered accessibility
|
|
6281
|
-
* @param limit - Maximum referenced
|
|
6282
|
-
* @param
|
|
6283
|
-
*
|
|
6284
|
-
* @returns Outline text, element counts, matching rows, and the focused row
|
|
6285
|
-
*
|
|
5571
|
+
* @param nodes - Ordered accessibility nodes from one capture
|
|
5572
|
+
* @param limit - Maximum referenced elements
|
|
5573
|
+
* @param secrets - Registered text to redact before wrapping
|
|
5574
|
+
* @returns Wrapped lines, element counts, and the focused element
|
|
6286
5575
|
* @example
|
|
6287
5576
|
* ```ts
|
|
6288
|
-
*
|
|
6289
|
-
*
|
|
6290
|
-
* const node = {
|
|
6291
|
-
* parent: undefined,
|
|
6292
|
-
* children: [],
|
|
6293
|
-
* backend: undefined,
|
|
6294
|
-
* frame: undefined,
|
|
6295
|
-
* ignored: false,
|
|
6296
|
-
* description: undefined,
|
|
6297
|
-
* value: undefined,
|
|
6298
|
-
* session: 'main',
|
|
6299
|
-
* }
|
|
6300
|
-
* const outline = renderBrowserOutline(
|
|
6301
|
-
* 'https://shop.example/cart',
|
|
6302
|
-
* 'Cart',
|
|
6303
|
-
* [
|
|
6304
|
-
* { ...node, id: '1', role: 'button', name: 'Close', properties: {}, reference: 'e1' },
|
|
6305
|
-
* { ...node, id: '2', role: 'button', name: 'Archive', properties: { focused: true }, reference: 'e2' },
|
|
6306
|
-
* ],
|
|
6307
|
-
* 1,
|
|
6308
|
-
* 'archive button',
|
|
6309
|
-
* )
|
|
6310
|
-
* outline.text // 'page "Cart" https://shop.example/cart\ne1 button "Close"\n(1 of 2 elements)'
|
|
6311
|
-
* outline.matches // ['e2 button "Archive"']
|
|
6312
|
-
* outline.focus // 'e2 button "Archive"'
|
|
5577
|
+
* const outline = renderBrowserOutline('https://shop.example/', 'Shop', [], 150)
|
|
5578
|
+
* outline.lines // []
|
|
6313
5579
|
* ```
|
|
6314
5580
|
*/
|
|
6315
|
-
export declare function renderBrowserOutline(url: string, title: string,
|
|
5581
|
+
export declare function renderBrowserOutline(url: string, title: string, source: readonly BrowserOutlineNode[], limit: number, secrets?: readonly string[]): BrowserOutline;
|
|
6316
5582
|
|
|
6317
5583
|
/**
|
|
6318
|
-
* Renders one outline row: the node's
|
|
6319
|
-
* states it carries.
|
|
5584
|
+
* Renders one outline row: the node's role, quoted accessible name, reference, and states.
|
|
6320
5585
|
*
|
|
6321
5586
|
* @remarks
|
|
6322
|
-
*
|
|
5587
|
+
* The reference renders as `[ref=eN]` after the name, or after the role when the name is empty.
|
|
5588
|
+
* After the reference the row appends `value="V"` when the node carries a non-empty value,
|
|
6323
5589
|
* `pressed=true|false|mixed`, `expanded=true|false`, and `selected=true|false` when present,
|
|
6324
5590
|
* `[checked]` when checked, `[disabled]` when disabled, and `[tool=NAME]` for a page tool's form,
|
|
6325
5591
|
* in that order. A node without a reference renders without one.
|
|
@@ -6345,11 +5611,27 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6345
5611
|
* properties: { checked: 'true' },
|
|
6346
5612
|
* session: 'main',
|
|
6347
5613
|
* reference: 'e4',
|
|
6348
|
-
* }) // '
|
|
5614
|
+
* }) // 'checkbox "Gift wrap" [ref=e4] [checked]'
|
|
6349
5615
|
* ```
|
|
6350
5616
|
*/
|
|
6351
5617
|
export declare function renderBrowserOutlineRow(node: BrowserOutlineNode): string;
|
|
6352
5618
|
|
|
5619
|
+
/** Renders a bounded window with numbered rows and an exact continuation.
|
|
5620
|
+
* @remarks A partial-view line follows the page header when rows remain after the window.
|
|
5621
|
+
* A changed projection carries its change note even from line 1. A search missing its range
|
|
5622
|
+
* reports the first page-wide best match only when that line carries an element reference,
|
|
5623
|
+
* without moving the window; otherwise it keeps the plain miss. Its query is abbreviated
|
|
5624
|
+
* to 120 UTF-16 units. The miss sentence is reserved with the minimum window; when the whole
|
|
5625
|
+
* quoted row cannot also fit, only the sentence is shown, ending with a period.
|
|
5626
|
+
* An unquoted miss is reserved before fitting and appears immediately before the footer.
|
|
5627
|
+
* Quoted best matches and in-range hits remain under the header.
|
|
5628
|
+
* @param passage - Projection and contextual metadata
|
|
5629
|
+
* @param limit - Whole-result character room
|
|
5630
|
+
* @returns A complete window
|
|
5631
|
+
* @throws Thrown when the range is invalid or room cannot hold metadata and a complete row
|
|
5632
|
+
*/
|
|
5633
|
+
export declare function renderBrowserPassage(passage: BrowserPassage, limit: number): string;
|
|
5634
|
+
|
|
6353
5635
|
/**
|
|
6354
5636
|
* Renders a tool receipt: the action and its status on one line, the interrupting dialog, then
|
|
6355
5637
|
* a blank line and the fresh view.
|
|
@@ -6368,14 +5650,22 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6368
5650
|
* import { renderBrowserReceipt } from '@orkestrel/browser'
|
|
6369
5651
|
*
|
|
6370
5652
|
* renderBrowserReceipt({
|
|
6371
|
-
* action: 'Clicked
|
|
5653
|
+
* action: 'Clicked button "Delete" [ref=e7]',
|
|
6372
5654
|
* dialog: { category: 'confirm', message: 'Delete the draft?' },
|
|
6373
5655
|
* })
|
|
6374
|
-
* // 'Clicked
|
|
5656
|
+
* // 'Clicked button "Delete" [ref=e7]. A confirm dialog is open: "Delete the draft?"; call dialog.'
|
|
6375
5657
|
* ```
|
|
6376
5658
|
*/
|
|
6377
5659
|
export declare function renderBrowserReceipt(receipt: BrowserReceipt): string;
|
|
6378
5660
|
|
|
5661
|
+
/** Fits an unnumbered receipt and a complete page window inside one result limit.
|
|
5662
|
+
* @param passage - Redacted projection and metadata, with the opening line already selected
|
|
5663
|
+
* @param receipt - Redacted unnumbered status
|
|
5664
|
+
* @param limit - Whole-result character room
|
|
5665
|
+
* @returns Receipt followed by complete addressed rows and their exact footer
|
|
5666
|
+
*/
|
|
5667
|
+
export declare function renderBrowserReceiptWindow(passage: BrowserPassage, receipt: string, limit: number): string;
|
|
5668
|
+
|
|
6379
5669
|
/**
|
|
6380
5670
|
* Renders a run heading and its receipts, followed by the supplied final view.
|
|
6381
5671
|
* @param run - Run to render
|
|
@@ -6391,6 +5681,23 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6391
5681
|
*/
|
|
6392
5682
|
export declare function renderBrowserRunResult(result: string): string;
|
|
6393
5683
|
|
|
5684
|
+
/** Renders shared search text and chooses its context line within the requested range.
|
|
5685
|
+
* @remarks A miss names `to` when it ends before the last line; an unbounded miss keeps its usual wording.
|
|
5686
|
+
* @param lines - Wrapped projection
|
|
5687
|
+
* @param from - Inclusive first candidate line
|
|
5688
|
+
* @param to - Inclusive last candidate line
|
|
5689
|
+
* @param search - Optional words to find
|
|
5690
|
+
* @returns Opening line and optional match or miss text
|
|
5691
|
+
*/
|
|
5692
|
+
export declare function renderBrowserSearch(lines: readonly BrowserLine[], from: number, to?: number, search?: string): BrowserSearch;
|
|
5693
|
+
|
|
5694
|
+
/** Renders an element as searchable text separated from references and syntax.
|
|
5695
|
+
* @param node - Captured element
|
|
5696
|
+
* @param url - Owning document address
|
|
5697
|
+
* @returns Ordered row spans
|
|
5698
|
+
*/
|
|
5699
|
+
export declare function renderBrowserSpans(node: BrowserOutlineNode, url: string): readonly BrowserLineSpan[];
|
|
5700
|
+
|
|
6394
5701
|
/**
|
|
6395
5702
|
* Renders tool strings unchanged, content-array text blocks joined, and other values as bounded JSON.
|
|
6396
5703
|
* @param value - Untrusted tool output
|
|
@@ -6398,14 +5705,28 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6398
5705
|
*/
|
|
6399
5706
|
export declare function renderBrowserToolOutput(value: unknown): string;
|
|
6400
5707
|
|
|
5708
|
+
/** Selects whole addressed rows after reserving the header and exact footer.
|
|
5709
|
+
* @remarks The partial switch reserves a partial-view line before selecting rows, independently of header text.
|
|
5710
|
+
* A trailing heading opens the next window unless it is the only row or ends the page.
|
|
5711
|
+
* @param lines - Complete projection
|
|
5712
|
+
* @param from - Inclusive first line
|
|
5713
|
+
* @param to - Inclusive last line, or the default window
|
|
5714
|
+
* @param header - Bounded preceding text
|
|
5715
|
+
* @param limit - Whole-result room
|
|
5716
|
+
* @param tool - Continuation tool. Default: read
|
|
5717
|
+
* @param partial - Whether to show a partial-view line after the first header line. Default: false
|
|
5718
|
+
* @returns A complete bounded result
|
|
5719
|
+
*/
|
|
5720
|
+
export declare function renderBrowserWindow(lines: readonly BrowserLine[], from: number, to: number | undefined, header: string, limit: number, tool?: string, partial?: boolean): string;
|
|
5721
|
+
|
|
6401
5722
|
/**
|
|
6402
5723
|
* Requires a tool argument to be an element reference in any spelling `parseBrowserReference`
|
|
6403
5724
|
* accepts, and returns its canonical form.
|
|
6404
5725
|
*
|
|
6405
5726
|
* @param value - The argument a model supplied
|
|
6406
5727
|
* @returns The canonical reference, such as `e12`
|
|
6407
|
-
* @throws Thrown as a `
|
|
6408
|
-
* reference, naming `
|
|
5728
|
+
* @throws Thrown as a `BrowserError` with reason `UNKNOWN` when the value is not a
|
|
5729
|
+
* reference, naming `read` as the next call.
|
|
6409
5730
|
*
|
|
6410
5731
|
* @example
|
|
6411
5732
|
* ```ts
|
|
@@ -6434,60 +5755,14 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6434
5755
|
*/
|
|
6435
5756
|
export declare function resolveBrowserJourneyBinding(value: unknown, inputs: Readonly<Record<string, string>>): string;
|
|
6436
5757
|
|
|
6437
|
-
/**
|
|
6438
|
-
*
|
|
6439
|
-
* search
|
|
6440
|
-
*
|
|
6441
|
-
* @
|
|
6442
|
-
*
|
|
6443
|
-
* `BROWSER_SEARCH_PATTERN`, so a word shorter than 3 letters or digits never counts, and words
|
|
6444
|
-
* compare whole, with no substring or prefix match. A node scores the number of distinct search
|
|
6445
|
-
* words equal to one of its words, and every node with the highest score above 0 matches. Only a
|
|
6446
|
-
* node an outline renders as a referenced row takes part: one that is not ignored, carries a
|
|
6447
|
-
* reference, and whose role is not omitted, a heading, or text.
|
|
6448
|
-
*
|
|
6449
|
-
* @param nodes - Ordered accessibility rows
|
|
6450
|
-
* @param search - The words to match
|
|
6451
|
-
* @returns The best-matching nodes in document order; empty when no node shares a word
|
|
6452
|
-
*
|
|
6453
|
-
* @example
|
|
6454
|
-
* ```ts
|
|
6455
|
-
* import { scanBrowserOutline } from '@orkestrel/browser'
|
|
6456
|
-
*
|
|
6457
|
-
* const node = {
|
|
6458
|
-
* parent: undefined,
|
|
6459
|
-
* children: [],
|
|
6460
|
-
* backend: undefined,
|
|
6461
|
-
* frame: undefined,
|
|
6462
|
-
* ignored: false,
|
|
6463
|
-
* description: undefined,
|
|
6464
|
-
* value: undefined,
|
|
6465
|
-
* properties: {},
|
|
6466
|
-
* session: 'main',
|
|
6467
|
-
* }
|
|
6468
|
-
* const nodes = [
|
|
6469
|
-
* { ...node, id: '1', role: 'button', name: 'Close', reference: 'e1' },
|
|
6470
|
-
* { ...node, id: '2', role: 'button', name: 'Archive', reference: 'e2' },
|
|
6471
|
-
* ]
|
|
6472
|
-
* scanBrowserOutline(nodes, 'archive dialog button').map((match) => match.reference) // ['e2']
|
|
6473
|
-
* ```
|
|
6474
|
-
*/
|
|
6475
|
-
export declare function scanBrowserOutline(nodes: readonly BrowserOutlineNode[], search: string): readonly BrowserOutlineNode[];
|
|
6476
|
-
|
|
6477
|
-
/**
|
|
6478
|
-
* Matches the lines sharing the most distinct search words, in document order.
|
|
6479
|
-
*
|
|
6480
|
-
* @param text - The complete projection
|
|
6481
|
-
* @param search - Words to match, using the outline's word rule
|
|
6482
|
-
* @returns The best-scoring lines and their original UTF-16 offsets; empty without a shared word
|
|
6483
|
-
*
|
|
6484
|
-
* @example
|
|
6485
|
-
* ```ts
|
|
6486
|
-
* import { scanBrowserText } from '@orkestrel/browser'
|
|
6487
|
-
* scanBrowserText('Cart\nBlue kettle', 'kettle') // [{ offset: 5, text: 'Blue kettle' }]
|
|
6488
|
-
* ```
|
|
5758
|
+
/** Finds the highest-scoring text lines within an inclusive range using whole words and prefixes.
|
|
5759
|
+
* @param lines - Complete wrapped projection
|
|
5760
|
+
* @param search - Words to find
|
|
5761
|
+
* @param from - First candidate line. Default: 1
|
|
5762
|
+
* @param to - Last candidate line. Default: the end
|
|
5763
|
+
* @returns One-based best-scoring line numbers
|
|
6489
5764
|
*/
|
|
6490
|
-
export declare function
|
|
5765
|
+
export declare function scanBrowserLines(lines: readonly BrowserLine[], search: string, from?: number, to?: number): readonly number[];
|
|
6491
5766
|
|
|
6492
5767
|
/**
|
|
6493
5768
|
* Awaits every teardown step in order and returns the first failure.
|
|
@@ -6517,9 +5792,6 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6517
5792
|
*/
|
|
6518
5793
|
export declare function settleBrowserTeardown(...steps: readonly BrowserTeardownFunction[]): Promise<unknown>;
|
|
6519
5794
|
|
|
6520
|
-
/** Encodes UTF-8 text as bytes. */
|
|
6521
|
-
export declare function textToBytes(value: string): Uint8Array;
|
|
6522
|
-
|
|
6523
5795
|
/**
|
|
6524
5796
|
* Validates Accessibility-domain snapshot bounds.
|
|
6525
5797
|
*
|
|
@@ -6532,7 +5804,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6532
5804
|
*
|
|
6533
5805
|
* @param options - Public context configuration
|
|
6534
5806
|
*/
|
|
6535
|
-
export declare function validateBrowserContextOptions(options?:
|
|
5807
|
+
export declare function validateBrowserContextOptions(options?: BrowserIsolateOptions): void;
|
|
6536
5808
|
|
|
6537
5809
|
/**
|
|
6538
5810
|
* Validates context emulation boundaries before partial application.
|
|
@@ -6562,7 +5834,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6562
5834
|
/**
|
|
6563
5835
|
* Validates the journey format and its name, nonempty steps, ids, bindings, secrets, JSON, and actions.
|
|
6564
5836
|
* @param value - Candidate journey
|
|
6565
|
-
* @throws BrowserError - Thrown with
|
|
5837
|
+
* @throws BrowserError - Thrown with STORE_FORMAT for an unknown format, or JOURNEY_INVALID naming the failed invariant
|
|
6566
5838
|
*/
|
|
6567
5839
|
export declare function validateBrowserJourney(value: unknown): asserts value is BrowserJourney;
|
|
6568
5840
|
|
|
@@ -6576,7 +5848,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6576
5848
|
/**
|
|
6577
5849
|
* Checks a journey name before store access.
|
|
6578
5850
|
* @param name - Journey name
|
|
6579
|
-
* @throws BrowserError - Thrown with
|
|
5851
|
+
* @throws BrowserError - Thrown with STORE_PATH when the name is invalid
|
|
6580
5852
|
* @example
|
|
6581
5853
|
* validateBrowserJourneyName('add-kettle')
|
|
6582
5854
|
*/
|
|
@@ -6596,6 +5868,33 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6596
5868
|
*/
|
|
6597
5869
|
export declare function validateBrowserJourneyStep(value: unknown): asserts value is BrowserJourneyStepInput;
|
|
6598
5870
|
|
|
5871
|
+
/**
|
|
5872
|
+
* Validates the mutually exclusive conditions of a journey write before side effects.
|
|
5873
|
+
* @param options - Conditional write and cancellation options
|
|
5874
|
+
* @throws Thrown with ARGUMENT for conflicting conditions or an invalid revision.
|
|
5875
|
+
* @example
|
|
5876
|
+
* validateBrowserJourneyWriteOptions({ exclusive: true })
|
|
5877
|
+
*/
|
|
5878
|
+
export declare function validateBrowserJourneyWriteOptions(options?: BrowserJourneyWriteOptions): void;
|
|
5879
|
+
|
|
5880
|
+
/** Refuses invalid line coordinates before selecting content.
|
|
5881
|
+
* @param from - Inclusive first line
|
|
5882
|
+
* @param to - Optional inclusive last line
|
|
5883
|
+
* @param total - Available lines, when captured
|
|
5884
|
+
* @returns Nothing
|
|
5885
|
+
*/
|
|
5886
|
+
export declare function validateBrowserLines(from: number, to?: number, total?: number): void;
|
|
5887
|
+
|
|
5888
|
+
/**
|
|
5889
|
+
* Refuses work on a disconnected or closed page.
|
|
5890
|
+
* @param page - The page whose lifecycle permits the operation
|
|
5891
|
+
* @param client - The client's connection carrying the page
|
|
5892
|
+
* @throws Thrown with CLOSED when the client disconnected or the page closed.
|
|
5893
|
+
* @example
|
|
5894
|
+
* validateBrowserPageOpen(page, client)
|
|
5895
|
+
*/
|
|
5896
|
+
export declare function validateBrowserPageOpen(page: BrowserPageInterface, client: CDPClientInterface): void;
|
|
5897
|
+
|
|
6599
5898
|
/**
|
|
6600
5899
|
* Validates viewport input coordinates.
|
|
6601
5900
|
*
|
|
@@ -6625,7 +5924,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6625
5924
|
* Checks the offset and limit of a store page.
|
|
6626
5925
|
* @param offset - Nonnegative safe integer offset
|
|
6627
5926
|
* @param limit - Positive safe integer limit
|
|
6628
|
-
* @throws BrowserError - Thrown with
|
|
5927
|
+
* @throws BrowserError - Thrown with ARGUMENT when either bound is invalid
|
|
6629
5928
|
* @example
|
|
6630
5929
|
* validateBrowserStorePage(0, 10)
|
|
6631
5930
|
*/
|
|
@@ -6645,15 +5944,15 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6645
5944
|
* @param definition - The advertised tool definition whose `parameters.properties` names the
|
|
6646
5945
|
* accepted keys
|
|
6647
5946
|
* @param args - The arguments a model supplied
|
|
6648
|
-
* @throws Thrown as a `BrowserError` coded `
|
|
5947
|
+
* @throws Thrown as a `BrowserError` coded `ARGUMENT`, with the refused key in its
|
|
6649
5948
|
* context, when an argument key is not an advertised parameter.
|
|
6650
5949
|
*
|
|
6651
5950
|
* @example
|
|
6652
5951
|
* ```ts
|
|
6653
5952
|
* import { BROWSER_TOOL_COPY, validateBrowserToolArguments } from '@orkestrel/browser'
|
|
6654
5953
|
*
|
|
6655
|
-
* validateBrowserToolArguments(BROWSER_TOOL_COPY.
|
|
6656
|
-
* // throws 'The
|
|
5954
|
+
* validateBrowserToolArguments(BROWSER_TOOL_COPY.read, { search: 'cart', ref: 'e1' })
|
|
5955
|
+
* // throws 'The read tool takes no ref parameter; call read with from, to, and search.'
|
|
6657
5956
|
* ```
|
|
6658
5957
|
*/
|
|
6659
5958
|
export declare function validateBrowserToolArguments(definition: ToolDefinition, args: Readonly<Record<string, unknown>>): void;
|
|
@@ -6665,4 +5964,11 @@ export declare interface BrowserRunStoreInterface {
|
|
|
6665
5964
|
*/
|
|
6666
5965
|
export declare function validateBrowserViewport(viewport: BrowserViewport): void;
|
|
6667
5966
|
|
|
5967
|
+
/** Wraps spans before numbering, marking hard continuations with a leading ↳.
|
|
5968
|
+
* @remarks A soft wrap breaks before the end of a name rather than before its reference span.
|
|
5969
|
+
* @param line - Unwrapped semantic row
|
|
5970
|
+
* @returns Lines no wider than the projection width, preserving code points and reference tokens
|
|
5971
|
+
*/
|
|
5972
|
+
export declare function wrapBrowserLine(line: BrowserLine): readonly BrowserLine[];
|
|
5973
|
+
|
|
6668
5974
|
export { }
|