@orkestrel/browser 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/main.js +1 -2
- package/dist/src/browser/index.d.ts +86 -6
- package/dist/src/browser/index.js +359 -271
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +2281 -1745
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +342 -156
- package/dist/src/core/index.d.ts +342 -156
- package/dist/src/core/index.js +2261 -1744
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +377 -344
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +47 -9
- package/dist/src/server/index.d.ts +47 -9
- package/dist/src/server/index.js +376 -344
- package/dist/src/server/index.js.map +1 -1
- package/package.json +27 -26
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Emitter } from '@orkestrel/emitter';
|
|
1
2
|
import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
2
3
|
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
3
4
|
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
@@ -26,6 +27,9 @@ export declare function abbreviateBrowserText(text: string, limit: number): stri
|
|
|
26
27
|
*/
|
|
27
28
|
export declare function belongsBrowserOutline(node: BrowserOutlineNode, ancestor: BrowserOutlineNode, indexed: ReadonlyMap<string, BrowserOutlineNode>): boolean;
|
|
28
29
|
|
|
30
|
+
/** Fits a character-range footer by narrowing a UTF-16 slice boundary. */
|
|
31
|
+
export declare function boundBrowserTail(text: string, limit: number, footer: string, end: number): string;
|
|
32
|
+
|
|
29
33
|
/**
|
|
30
34
|
* Bounds a tool string at a character limit, appending a footer that names the cut and the
|
|
31
35
|
* caller's closing clause.
|
|
@@ -74,7 +78,7 @@ export declare const BROWSER_CODEGEN_BINDING_NAME = "__orkestrelBrowserCodegen";
|
|
|
74
78
|
* Holds the self-contained document listener installed before a frame resumes.
|
|
75
79
|
* Password input carries a marker; only Enter carries a key. Node indices are local to a document.
|
|
76
80
|
*/
|
|
77
|
-
export declare const BROWSER_CODEGEN_SOURCE = "(() => {\n\tconst binding = '__orkestrelBrowserCodegen'\n\twindow[binding + '__state']?.controller.abort()\n\tconst state = { controller: new AbortController(), nodes: [], indices: new WeakMap() }\n\twindow[binding + '__state'] = state\n\tfor (const event of ['click', 'input', 'change', 'keydown', 'focusout', 'submit', 'contextmenu', 'drop']) {\n\t\tdocument.addEventListener(event, (event) => {\n\t\t\tif (!event.isTrusted || typeof window[binding] !== 'function') return\n\t\t\tif (event.type === 'keydown' && event.key !== 'Enter') return\n\t\t\tconst element = event.composedPath()[0]\n\t\t\tif (!(element instanceof Element)) return\n\t\t\
|
|
81
|
+
export declare const BROWSER_CODEGEN_SOURCE = "(() => {\n\tconst binding = '__orkestrelBrowserCodegen'\n\twindow[binding + '__state']?.controller.abort()\n\tconst state = { controller: new AbortController(), nodes: [], indices: new WeakMap() }\n\twindow[binding + '__state'] = state\n\tfor (const event of ['click', 'input', 'change', 'keydown', 'focusout', 'submit', 'contextmenu', 'drop']) {\n\t\tdocument.addEventListener(event, (event) => {\n\t\t\tif (!event.isTrusted || typeof window[binding] !== 'function') return\n\t\t\tif (event.type === 'keydown' && event.key !== 'Enter') return\n\t\t\tconst element = event.composedPath()[0]\n\t\t\tif (!(element instanceof Element)) return\n\t\t\tconst known = state.indices.get(element)\n\t\t\tconst index = known === undefined ? state.nodes.push(element) - 1 : known\n\t\t\tif (known === undefined) {\n\t\t\t\tstate.indices.set(element, index)\n\t\t\t}\n\t\t\tconst control = element.tagName === 'SELECT' ? (element.multiple ? 'multiple' : 'select')\n\t\t\t\t: element.tagName === 'OPTION' ? 'option'\n\t\t\t\t: element.tagName === 'INPUT' && element.type === 'password' ? 'password'\n\t\t\t\t: element.tagName === 'TEXTAREA' || element.isContentEditable ||\n\t\t\t\t\t(element.tagName === 'INPUT' && ['text', 'search', 'url', 'tel', 'email', 'number'].includes(element.type)) ? 'text' : 'other'\n\t\t\tconst payload = { event: event.type, index, top: window === window.top && element.ownerDocument === document, control, form: !!element.form }\n\t\t\tif (event.type === 'click') payload.detail = event.detail\n\t\t\tif (event.type === 'keydown') payload.key = 'Enter'\n\t\t\tif (event.type === 'input' && control === 'password') payload.secret = true\n\t\t\tif (event.type === 'input' && control === 'text') payload.value = element.isContentEditable ? element.textContent || '' : element.value\n\t\t\tif (event.type === 'change' && control === 'select') {\n\t\t\t\tpayload.value = element.value\n\t\t\t\tpayload.roundtrip = Array.from(element.options).find(option => option.value === element.value) === element.selectedOptions[0]\n\t\t\t}\n\t\t\tif (element.getRootNode() !== document) {\n\t\t\t\tpayload.event = 'unsupported'\n\t\t\t\tpayload.gap = 'the element is in a shadow root'\n\t\t\t} else if (event.type === 'contextmenu' || event.type === 'drop' || (event.type === 'click' && (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) && !['select', 'multiple', 'option'].includes(control))) {\n\t\t\t\tpayload.event = 'unsupported'\n\t\t\t\tpayload.gap = 'an unsupported gesture'\n\t\t\t}\n\t\t\twindow[binding](JSON.stringify(payload.event === 'unsupported' ? { event: payload.event, index, top: payload.top, control, form: payload.form, gap: payload.gap } : payload))\n\t\t}, { capture: true, signal: state.controller.signal })\n\t}\n})()";
|
|
78
82
|
|
|
79
83
|
/** Matches protocol errors caused by replacement or closure of an execution context. */
|
|
80
84
|
export declare const BROWSER_CONTEXT_LOSS_PATTERN: RegExp;
|
|
@@ -102,6 +106,12 @@ export declare const BROWSER_DEFAULT_VIEWPORT_WIDTH = 1280;
|
|
|
102
106
|
*/
|
|
103
107
|
export declare const BROWSER_ELEMENT_REFUSALS: ReadonlyMap<string, BrowserElementRefusal>;
|
|
104
108
|
|
|
109
|
+
/** Identifies browser errors across installed copies and module formats. */
|
|
110
|
+
export declare const BROWSER_ERROR_BRAND: unique symbol;
|
|
111
|
+
|
|
112
|
+
/** Holds the declared codes accepted by the browser error guard. */
|
|
113
|
+
export declare const BROWSER_ERROR_CODES: readonly BrowserErrorCode[];
|
|
114
|
+
|
|
105
115
|
/** Names the isolated world used for iframe evaluation, `'__orkestrelBrowserFrame'`. */
|
|
106
116
|
export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
107
117
|
|
|
@@ -115,7 +125,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
115
125
|
*/
|
|
116
126
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
117
127
|
name: "@orkestrel/browser";
|
|
118
|
-
version: "0.0.
|
|
128
|
+
version: "0.0.30";
|
|
119
129
|
}>;
|
|
120
130
|
|
|
121
131
|
/** Names accessibility roles that receive actionable outline references. */
|
|
@@ -137,7 +147,7 @@ export declare const BROWSER_JOURNEY_EDIT_CHOICE_REFUSAL = "Edit requires journe
|
|
|
137
147
|
export declare const BROWSER_JOURNEY_EDIT_EMPTY_REFUSAL = "No journey is saved, so there is nothing to edit; call record to start one.";
|
|
138
148
|
|
|
139
149
|
/** Holds the result the `journeys` tool returns when no journey is saved. */
|
|
140
|
-
export declare const
|
|
150
|
+
export declare const BROWSER_JOURNEY_EMPTY_LIST = "No journeys are saved; call record to start one.";
|
|
141
151
|
|
|
142
152
|
/** Holds the refusal `save` returns while the recording has no steps. */
|
|
143
153
|
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.";
|
|
@@ -311,6 +321,9 @@ export declare const BROWSER_SNAPSHOT_NODE_LIMIT = 100000;
|
|
|
311
321
|
/** Sets the number of animation frames whose element bounds must agree before trusted input. */
|
|
312
322
|
export declare const BROWSER_STABLE_FRAME_COUNT = 2;
|
|
313
323
|
|
|
324
|
+
/** Identifies journey step errors across installed copies and module formats. */
|
|
325
|
+
export declare const BROWSER_STEP_ERROR_BRAND: unique symbol;
|
|
326
|
+
|
|
314
327
|
/**
|
|
315
328
|
* Bounds the best-effort `Page.stopLoading` call issued after a failed `navigate()` at `1_000`
|
|
316
329
|
* milliseconds.
|
|
@@ -643,6 +656,119 @@ export declare interface BrowserConsoleMessage {
|
|
|
643
656
|
readonly stack: readonly BrowserStackFrame[];
|
|
644
657
|
}
|
|
645
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Represents one captured document, parsed one time and projected to Markdown or plain text in
|
|
661
|
+
* bounded slices.
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* ```ts
|
|
665
|
+
* import { BrowserContent } from '@orkestrel/browser'
|
|
666
|
+
*
|
|
667
|
+
* const reading = new BrowserContent({
|
|
668
|
+
* url: 'https://example.com/',
|
|
669
|
+
* title: 'Example',
|
|
670
|
+
* html: '<nav>Menu</nav><main><p>Body</p></main>',
|
|
671
|
+
* })
|
|
672
|
+
* reading.markdown({ distill: true }) // { text: 'Body', offset: 0, total: 4 }
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
export declare class BrowserContent implements BrowserContentInterface {
|
|
676
|
+
#private;
|
|
677
|
+
constructor(input: BrowserContentInput);
|
|
678
|
+
get url(): string;
|
|
679
|
+
get title(): string;
|
|
680
|
+
get html(): HTMLInterface;
|
|
681
|
+
get stale(): boolean;
|
|
682
|
+
markdown(options?: BrowserReadOptions): BrowserReadResult;
|
|
683
|
+
text(options?: BrowserReadOptions): BrowserReadResult;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Describes the captured document a reading is built from.
|
|
688
|
+
*
|
|
689
|
+
* @remarks
|
|
690
|
+
* - `url` — the document URL, which each projection resolves relative links against
|
|
691
|
+
* - `title` — the document title
|
|
692
|
+
* - `html` — the serialized document HTML
|
|
693
|
+
* - `epoch` — the navigation epoch recorded when the capture was issued. Default: the value
|
|
694
|
+
* `navigation` returns at construction
|
|
695
|
+
* - `navigation` — reads the source's navigation epoch at the moment of the call; a reading
|
|
696
|
+
* built without it never reports stale
|
|
697
|
+
*
|
|
698
|
+
* A view, frame, or element captures rendered markup by importing its root into an HTML
|
|
699
|
+
* document without a window, so that nothing in the copy loads or runs, and pruning the copy
|
|
700
|
+
* against the live document's computed styles. The live document is never written.
|
|
701
|
+
* - A root or flat-tree ancestor in its own document with `display: none` yields empty HTML.
|
|
702
|
+
* - Descendants with `display: none` are removed.
|
|
703
|
+
* - Text under `visibility: hidden` or `collapse`, and invisible elements without children,
|
|
704
|
+
* are removed; visible descendants of invisible elements remain.
|
|
705
|
+
* - A child node of an element with an open shadow root is removed when no slot takes it or
|
|
706
|
+
* when its slot sits under an element whose computed `display` is `none`.
|
|
707
|
+
* - Closed `details` keeps only its first `summary` child. Elements with `content-visibility:
|
|
708
|
+
* hidden`, and `canvas`, `video`, and `audio` elements, lose their child nodes.
|
|
709
|
+
* - SVG `switch` keeps the child element with client rects, or its first child element when
|
|
710
|
+
* none has rects, including definitions referenced by `use`. Other branches are removed.
|
|
711
|
+
* Forms, rendered dialogs, and buttons become neutral carriers. Text fields and textareas
|
|
712
|
+
* carry live values; empty text fields and textareas carry visible placeholders. Selects carry the selected
|
|
713
|
+
* label, or displayed option and group labels in a listbox's client area. Named graphics carry
|
|
714
|
+
* one explicit alternative; printed button text takes precedence over its accessible name.
|
|
715
|
+
* Links carry resolved live addresses. Region elements remain available to distillation.
|
|
716
|
+
* Carriers and block `div`, `summary`, and `details` elements receive `br` separators around their
|
|
717
|
+
* contents. The `html` handle is this normalized capture, not the original DOM serialization.
|
|
718
|
+
* Direct element reads apply the same ancestor visibility and child-pruning rules.
|
|
719
|
+
* Password and hidden inputs are removed entirely, including in the data-only fallback for
|
|
720
|
+
* detached roots and documents without a window. Active floor elements are dropped.
|
|
721
|
+
* Checkbox, radio, range, and color values aren't printed text. Native control captions,
|
|
722
|
+
* localized dates, invalid or intermediate number edits, and MathML are omitted rather than
|
|
723
|
+
* guessed. A file input carries its sole filename; native multiple-file summaries are omitted.
|
|
724
|
+
* Valid committed numbers carry their live value.
|
|
725
|
+
* Opacity, clipping outside listboxes, size, position, and `content-visibility: auto` remove
|
|
726
|
+
* nothing. Shadow-root text, generated content, text transformations, localized number
|
|
727
|
+
* formatting, textarea clipping, and significant spaces are outside the capture's fidelity.
|
|
728
|
+
* Caller-supplied HTML is parsed as given; projection options and their safety floors apply.
|
|
729
|
+
*/
|
|
730
|
+
export declare interface BrowserContentInput {
|
|
731
|
+
readonly url: string;
|
|
732
|
+
readonly title: string;
|
|
733
|
+
readonly html: string;
|
|
734
|
+
readonly epoch?: number;
|
|
735
|
+
readonly navigation?: BrowserEpochFunction;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Represents one captured document, parsed one time and projected to Markdown or plain text in
|
|
740
|
+
* bounded slices.
|
|
741
|
+
*
|
|
742
|
+
* @remarks
|
|
743
|
+
* - `url` — the document URL at capture
|
|
744
|
+
* - `title` — the document title at capture
|
|
745
|
+
* - `html` — the parsed captured and normalized document handle every projection reads;
|
|
746
|
+
* caller-supplied HTML remains as supplied
|
|
747
|
+
* - `stale` — true when the source frame has navigated or detached since the capture; false
|
|
748
|
+
* otherwise
|
|
749
|
+
*
|
|
750
|
+
* Each projection runs over the whole document by default and over
|
|
751
|
+
* `html.distill({ base: url })` with `distill: true`. A reading computes each projection one time and cuts every slice from
|
|
752
|
+
* it, so successive slices of one reading and mode share one `total`.
|
|
753
|
+
*/
|
|
754
|
+
export declare interface BrowserContentInterface {
|
|
755
|
+
readonly url: string;
|
|
756
|
+
readonly title: string;
|
|
757
|
+
readonly html: HTMLInterface;
|
|
758
|
+
readonly stale: boolean;
|
|
759
|
+
/**
|
|
760
|
+
* Returns a slice of the document rendered as Markdown. A bounded slice ends after the
|
|
761
|
+
* last line break in its window when one lies past `offset`, and at `limit` characters
|
|
762
|
+
* otherwise.
|
|
763
|
+
*/
|
|
764
|
+
markdown(options?: BrowserReadOptions): BrowserReadResult;
|
|
765
|
+
/**
|
|
766
|
+
* Returns a slice of the document rendered as structural plain text, cut by the rule
|
|
767
|
+
* `markdown` applies.
|
|
768
|
+
*/
|
|
769
|
+
text(options?: BrowserReadOptions): BrowserReadResult;
|
|
770
|
+
}
|
|
771
|
+
|
|
646
772
|
/**
|
|
647
773
|
* Owns pages and shared state inside one Chromium browser context.
|
|
648
774
|
*
|
|
@@ -883,7 +1009,7 @@ export declare type BrowserDestinationRelationship = 'self' | 'parent' | 'top';
|
|
|
883
1009
|
|
|
884
1010
|
/** Groups the diagnostics by capability. */
|
|
885
1011
|
export declare interface BrowserDiagnosticsInterface {
|
|
886
|
-
readonly
|
|
1012
|
+
readonly trace: BrowserTraceInterface;
|
|
887
1013
|
readonly coverage: BrowserCoverageInterface;
|
|
888
1014
|
readonly performance: BrowserPerformanceInterface;
|
|
889
1015
|
readonly profiler: BrowserProfilerInterface;
|
|
@@ -1017,10 +1143,10 @@ export declare interface BrowserElementInterface {
|
|
|
1017
1143
|
focus(options?: BrowserCallOptions): Promise<void>;
|
|
1018
1144
|
/**
|
|
1019
1145
|
* Captures the element's rendered markup with its document's URL and title as a reading whose
|
|
1020
|
-
* `stale` flag tracks later navigations of that document; {@link
|
|
1146
|
+
* `stale` flag tracks later navigations of that document; {@link BrowserContentInput} defines
|
|
1021
1147
|
* the rendered markup.
|
|
1022
1148
|
*/
|
|
1023
|
-
read(options?: BrowserCallOptions): Promise<
|
|
1149
|
+
read(options?: BrowserCallOptions): Promise<BrowserContentInterface>;
|
|
1024
1150
|
/**
|
|
1025
1151
|
* Submits the form the element belongs to. The CDP placement focuses the element and presses
|
|
1026
1152
|
* Enter through a trusted key pair, sending the release even after an abort; the DOM
|
|
@@ -1241,10 +1367,10 @@ export declare interface BrowserFrameInterface {
|
|
|
1241
1367
|
/**
|
|
1242
1368
|
* Captures the document URL, title, and rendered HTML in one size-guarded evaluation in the frame's
|
|
1243
1369
|
* isolated world and returns them as a reading whose `stale` flag tracks later navigations.
|
|
1244
|
-
* The owning page supplies the navigation counter. {@link
|
|
1370
|
+
* The owning page supplies the navigation counter. {@link BrowserContentInput} defines
|
|
1245
1371
|
* the rendered markup.
|
|
1246
1372
|
*/
|
|
1247
|
-
read(options?: BrowserCallOptions): Promise<
|
|
1373
|
+
read(options?: BrowserCallOptions): Promise<BrowserContentInterface>;
|
|
1248
1374
|
/** Evaluates an expression in the frame execution world under the result-size guard. */
|
|
1249
1375
|
evaluate(expression: string, options?: BrowserCallOptions): Promise<unknown>;
|
|
1250
1376
|
/**
|
|
@@ -1552,6 +1678,18 @@ export declare type BrowserJourneyEdit = {
|
|
|
1552
1678
|
readonly parameter: BrowserJourneyParameter;
|
|
1553
1679
|
};
|
|
1554
1680
|
|
|
1681
|
+
/** Applies one journey edit batch and retains the edit responsible for a refusal. */
|
|
1682
|
+
export declare class BrowserJourneyEditor implements BrowserJourneyEditorInterface {
|
|
1683
|
+
#private;
|
|
1684
|
+
readonly journey: BrowserJourney;
|
|
1685
|
+
constructor(journey: BrowserJourney, edits: readonly BrowserJourneyEdit[]);
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/** Exposes the result of one atomic journey edit batch. */
|
|
1689
|
+
export declare interface BrowserJourneyEditorInterface {
|
|
1690
|
+
readonly journey: BrowserJourney;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1555
1693
|
/**
|
|
1556
1694
|
* Describes an edit as the `edit` tool receives it over the wire: an added or updated step can name
|
|
1557
1695
|
* `ref` instead of a target, converted from the current view before the pure editor runs.
|
|
@@ -1593,6 +1731,17 @@ export declare interface BrowserJourneyOptions {
|
|
|
1593
1731
|
readonly readonly?: boolean;
|
|
1594
1732
|
}
|
|
1595
1733
|
|
|
1734
|
+
/** Iterates a store listing while retaining its offset between page requests. */
|
|
1735
|
+
export declare class BrowserJourneyPages implements BrowserJourneyPagesInterface {
|
|
1736
|
+
#private;
|
|
1737
|
+
constructor(store: BrowserJourneyStoreInterface, signal: AbortSignal, empty: boolean);
|
|
1738
|
+
[Symbol.asyncIterator](): this;
|
|
1739
|
+
next(): Promise<IteratorResult<BrowserStorePage<BrowserJourneyRevision>, undefined>>;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
/** Iterates pages of journey revisions from a store. */
|
|
1743
|
+
export declare type BrowserJourneyPagesInterface = AsyncIterableIterator<BrowserStorePage<BrowserJourneyRevision>>;
|
|
1744
|
+
|
|
1596
1745
|
/**
|
|
1597
1746
|
* Declares one parameter a journey takes: its default, or none when it is a secret.
|
|
1598
1747
|
*
|
|
@@ -1773,6 +1922,13 @@ export declare interface BrowserLineSpan {
|
|
|
1773
1922
|
readonly text: string;
|
|
1774
1923
|
}
|
|
1775
1924
|
|
|
1925
|
+
/** Wraps one semantic line while retaining its continuation and reference boundaries. */
|
|
1926
|
+
export declare class BrowserLineWrap extends Iterator<BrowserLine, undefined> {
|
|
1927
|
+
#private;
|
|
1928
|
+
constructor(line: BrowserLine);
|
|
1929
|
+
next(): IteratorResult<BrowserLine, undefined>;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1776
1932
|
/** Describes the paper margin lengths accepted by Chromium print-to-PDF. */
|
|
1777
1933
|
export declare interface BrowserMargin {
|
|
1778
1934
|
readonly top?: number;
|
|
@@ -1933,9 +2089,45 @@ export declare interface BrowserNavigationResult {
|
|
|
1933
2089
|
readonly same: boolean;
|
|
1934
2090
|
}
|
|
1935
2091
|
|
|
2092
|
+
/** Yields the settlement selected after each navigation step. */
|
|
2093
|
+
export declare class BrowserNavigationScan extends Iterator<BrowserNavigationSelection, undefined> {
|
|
2094
|
+
#private;
|
|
2095
|
+
constructor(steps: Iterable<BrowserNavigationStep>, frames: ReadonlySet<string>, any: boolean);
|
|
2096
|
+
next(): IteratorResult<BrowserNavigationSelection, undefined>;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
/** Carries the settlement selected after a navigation event. */
|
|
2100
|
+
export declare interface BrowserNavigationSelection {
|
|
2101
|
+
readonly done: boolean;
|
|
2102
|
+
readonly result: BrowserSettlementResult | undefined;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
1936
2105
|
/** Names how far a settled navigation got: requested, committed, or loaded. */
|
|
1937
2106
|
export declare type BrowserNavigationStage = 'requested' | 'committed' | 'loaded';
|
|
1938
2107
|
|
|
2108
|
+
/** Carries one recorded navigation event and its frame identity. */
|
|
2109
|
+
export declare type BrowserNavigationStep = {
|
|
2110
|
+
readonly event: 'request';
|
|
2111
|
+
readonly frame: string;
|
|
2112
|
+
readonly url: string;
|
|
2113
|
+
readonly loader: string | undefined;
|
|
2114
|
+
readonly reason: BrowserNavigationReason | undefined;
|
|
2115
|
+
} | {
|
|
2116
|
+
readonly event: 'commit';
|
|
2117
|
+
readonly frame: string;
|
|
2118
|
+
readonly url: string;
|
|
2119
|
+
readonly loader: string | undefined;
|
|
2120
|
+
readonly same: boolean;
|
|
2121
|
+
} | {
|
|
2122
|
+
readonly event: 'load';
|
|
2123
|
+
readonly frame: string;
|
|
2124
|
+
readonly loader: string | undefined;
|
|
2125
|
+
} | {
|
|
2126
|
+
readonly event: 'detach';
|
|
2127
|
+
readonly frame: string;
|
|
2128
|
+
readonly swapped: boolean;
|
|
2129
|
+
};
|
|
2130
|
+
|
|
1939
2131
|
/** Maps the network events a page's network manager emits. */
|
|
1940
2132
|
export declare type BrowserNetworkEventMap = {
|
|
1941
2133
|
readonly request: readonly [request: BrowserRequest];
|
|
@@ -2033,6 +2225,12 @@ export declare interface BrowserNodeQuery {
|
|
|
2033
2225
|
*/
|
|
2034
2226
|
export declare type BrowserOperationOptions = BrowserClickOptions & BrowserDragOptions;
|
|
2035
2227
|
|
|
2228
|
+
/** Yields positive ordinals for fallback secret parameter names. */
|
|
2229
|
+
export declare class BrowserOrdinals extends Iterator<number, undefined> {
|
|
2230
|
+
#private;
|
|
2231
|
+
next(): IteratorYieldResult<number>;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2036
2234
|
/** Carries document-order lines, element counts, and the focused element's row. */
|
|
2037
2235
|
export declare interface BrowserOutline {
|
|
2038
2236
|
readonly url: string;
|
|
@@ -2045,6 +2243,13 @@ export declare interface BrowserOutline {
|
|
|
2045
2243
|
readonly focus: string | undefined;
|
|
2046
2244
|
}
|
|
2047
2245
|
|
|
2246
|
+
/** Traverses outline parents lazily through the supplied index. */
|
|
2247
|
+
export declare class BrowserOutlineAncestors extends Iterator<BrowserOutlineNode, undefined> {
|
|
2248
|
+
#private;
|
|
2249
|
+
constructor(node: BrowserOutlineNode | undefined, indexed: ReadonlyMap<string, BrowserOutlineNode>);
|
|
2250
|
+
next(): IteratorResult<BrowserOutlineNode, undefined>;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2048
2253
|
/** Associates an outline row with its frame, session, and optional actionable reference. */
|
|
2049
2254
|
export declare interface BrowserOutlineNode extends BrowserAXNode {
|
|
2050
2255
|
readonly session: string;
|
|
@@ -2059,6 +2264,24 @@ export declare interface BrowserOutlineOptions extends BrowserCallOptions {
|
|
|
2059
2264
|
readonly secrets?: readonly string[];
|
|
2060
2265
|
}
|
|
2061
2266
|
|
|
2267
|
+
/** Projects outline nodes into wrapped lines while retaining listing totals and focus. */
|
|
2268
|
+
export declare class BrowserOutlineRows extends Iterator<BrowserLine, undefined> {
|
|
2269
|
+
#private;
|
|
2270
|
+
constructor(input: BrowserOutlineRowsInput);
|
|
2271
|
+
get listed(): number;
|
|
2272
|
+
get found(): number;
|
|
2273
|
+
get focus(): string | undefined;
|
|
2274
|
+
next(): IteratorResult<BrowserLine, undefined>;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
/** Supplies the nodes, location, limits, and secrets for an outline projection. */
|
|
2278
|
+
export declare interface BrowserOutlineRowsInput {
|
|
2279
|
+
readonly nodes: readonly BrowserOutlineNode[];
|
|
2280
|
+
readonly url: string;
|
|
2281
|
+
readonly limit: number;
|
|
2282
|
+
readonly secrets: readonly string[];
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2062
2285
|
/** Provides trusted page input and capture for a referenced element. */
|
|
2063
2286
|
export declare interface BrowserPageElementInterface extends BrowserElementInterface {
|
|
2064
2287
|
/** The id of the frame whose document holds the element. */
|
|
@@ -2379,119 +2602,6 @@ export declare interface BrowserQuad {
|
|
|
2379
2602
|
*/
|
|
2380
2603
|
export declare type BrowserReadinessFunction = (options?: BrowserCallOptions) => Promise<void>;
|
|
2381
2604
|
|
|
2382
|
-
/**
|
|
2383
|
-
* Represents one captured document, parsed one time and projected to Markdown or plain text in
|
|
2384
|
-
* bounded slices.
|
|
2385
|
-
*
|
|
2386
|
-
* @example
|
|
2387
|
-
* ```ts
|
|
2388
|
-
* import { BrowserReading } from '@orkestrel/browser'
|
|
2389
|
-
*
|
|
2390
|
-
* const reading = new BrowserReading({
|
|
2391
|
-
* url: 'https://example.com/',
|
|
2392
|
-
* title: 'Example',
|
|
2393
|
-
* html: '<nav>Menu</nav><main><p>Body</p></main>',
|
|
2394
|
-
* })
|
|
2395
|
-
* reading.markdown({ distill: true }) // { text: 'Body', offset: 0, total: 4 }
|
|
2396
|
-
* ```
|
|
2397
|
-
*/
|
|
2398
|
-
export declare class BrowserReading implements BrowserReadingInterface {
|
|
2399
|
-
#private;
|
|
2400
|
-
constructor(input: BrowserReadingInput);
|
|
2401
|
-
get url(): string;
|
|
2402
|
-
get title(): string;
|
|
2403
|
-
get html(): HTMLInterface;
|
|
2404
|
-
get stale(): boolean;
|
|
2405
|
-
markdown(options?: BrowserReadOptions): BrowserReadResult;
|
|
2406
|
-
text(options?: BrowserReadOptions): BrowserReadResult;
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
/**
|
|
2410
|
-
* Describes the captured document a reading is built from.
|
|
2411
|
-
*
|
|
2412
|
-
* @remarks
|
|
2413
|
-
* - `url` — the document URL, which each projection resolves relative links against
|
|
2414
|
-
* - `title` — the document title
|
|
2415
|
-
* - `html` — the serialized document HTML
|
|
2416
|
-
* - `epoch` — the navigation epoch recorded when the capture was issued. Default: the value
|
|
2417
|
-
* `navigation` returns at construction
|
|
2418
|
-
* - `navigation` — reads the source's navigation epoch at the moment of the call; a reading
|
|
2419
|
-
* built without it never reports stale
|
|
2420
|
-
*
|
|
2421
|
-
* A view, frame, or element captures rendered markup by importing its root into an HTML
|
|
2422
|
-
* document without a window, so that nothing in the copy loads or runs, and pruning the copy
|
|
2423
|
-
* against the live document's computed styles. The live document is never written.
|
|
2424
|
-
* - A root or flat-tree ancestor in its own document with `display: none` yields empty HTML.
|
|
2425
|
-
* - Descendants with `display: none` are removed.
|
|
2426
|
-
* - Text under `visibility: hidden` or `collapse`, and invisible elements without children,
|
|
2427
|
-
* are removed; visible descendants of invisible elements remain.
|
|
2428
|
-
* - A child node of an element with an open shadow root is removed when no slot takes it or
|
|
2429
|
-
* when its slot sits under an element whose computed `display` is `none`.
|
|
2430
|
-
* - Closed `details` keeps only its first `summary` child. Elements with `content-visibility:
|
|
2431
|
-
* hidden`, and `canvas`, `video`, and `audio` elements, lose their child nodes.
|
|
2432
|
-
* - SVG `switch` keeps the child element with client rects, or its first child element when
|
|
2433
|
-
* none has rects, including definitions referenced by `use`. Other branches are removed.
|
|
2434
|
-
* Forms, rendered dialogs, and buttons become neutral carriers. Text fields and textareas
|
|
2435
|
-
* carry live values; empty text fields and textareas carry visible placeholders. Selects carry the selected
|
|
2436
|
-
* label, or displayed option and group labels in a listbox's client area. Named graphics carry
|
|
2437
|
-
* one explicit alternative; printed button text takes precedence over its accessible name.
|
|
2438
|
-
* Links carry resolved live addresses. Region elements remain available to distillation.
|
|
2439
|
-
* Carriers and block `div`, `summary`, and `details` elements receive `br` separators around their
|
|
2440
|
-
* contents. The `html` handle is this normalized capture, not the original DOM serialization.
|
|
2441
|
-
* Direct element reads apply the same ancestor visibility and child-pruning rules.
|
|
2442
|
-
* Password and hidden inputs are removed entirely, including in the data-only fallback for
|
|
2443
|
-
* detached roots and documents without a window. Active floor elements are dropped.
|
|
2444
|
-
* Checkbox, radio, range, and color values aren't printed text. Native control captions,
|
|
2445
|
-
* localized dates, invalid or intermediate number edits, and MathML are omitted rather than
|
|
2446
|
-
* guessed. A file input carries its sole filename; native multiple-file summaries are omitted.
|
|
2447
|
-
* Valid committed numbers carry their live value.
|
|
2448
|
-
* Opacity, clipping outside listboxes, size, position, and `content-visibility: auto` remove
|
|
2449
|
-
* nothing. Shadow-root text, generated content, text transformations, localized number
|
|
2450
|
-
* formatting, textarea clipping, and significant spaces are outside the capture's fidelity.
|
|
2451
|
-
* Caller-supplied HTML is parsed as given; projection options and their safety floors apply.
|
|
2452
|
-
*/
|
|
2453
|
-
export declare interface BrowserReadingInput {
|
|
2454
|
-
readonly url: string;
|
|
2455
|
-
readonly title: string;
|
|
2456
|
-
readonly html: string;
|
|
2457
|
-
readonly epoch?: number;
|
|
2458
|
-
readonly navigation?: BrowserEpochFunction;
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
/**
|
|
2462
|
-
* Represents one captured document, parsed one time and projected to Markdown or plain text in
|
|
2463
|
-
* bounded slices.
|
|
2464
|
-
*
|
|
2465
|
-
* @remarks
|
|
2466
|
-
* - `url` — the document URL at capture
|
|
2467
|
-
* - `title` — the document title at capture
|
|
2468
|
-
* - `html` — the parsed captured and normalized document handle every projection reads;
|
|
2469
|
-
* caller-supplied HTML remains as supplied
|
|
2470
|
-
* - `stale` — true when the source frame has navigated or detached since the capture; false
|
|
2471
|
-
* otherwise
|
|
2472
|
-
*
|
|
2473
|
-
* Each projection runs over the whole document by default and over
|
|
2474
|
-
* `html.distill({ base: url })` with `distill: true`. A reading computes each projection one time and cuts every slice from
|
|
2475
|
-
* it, so successive slices of one reading and mode share one `total`.
|
|
2476
|
-
*/
|
|
2477
|
-
export declare interface BrowserReadingInterface {
|
|
2478
|
-
readonly url: string;
|
|
2479
|
-
readonly title: string;
|
|
2480
|
-
readonly html: HTMLInterface;
|
|
2481
|
-
readonly stale: boolean;
|
|
2482
|
-
/**
|
|
2483
|
-
* Returns a slice of the document rendered as Markdown. A bounded slice ends after the
|
|
2484
|
-
* last line break in its window when one lies past `offset`, and at `limit` characters
|
|
2485
|
-
* otherwise.
|
|
2486
|
-
*/
|
|
2487
|
-
markdown(options?: BrowserReadOptions): BrowserReadResult;
|
|
2488
|
-
/**
|
|
2489
|
-
* Returns a slice of the document rendered as structural plain text, cut by the rule
|
|
2490
|
-
* `markdown` applies.
|
|
2491
|
-
*/
|
|
2492
|
-
text(options?: BrowserReadOptions): BrowserReadResult;
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
2605
|
/**
|
|
2496
2606
|
* Describes the options for one slice of a reading's Markdown or plain-text projection.
|
|
2497
2607
|
*
|
|
@@ -2698,6 +2808,18 @@ export declare type BrowserReplayEventMap = {
|
|
|
2698
2808
|
readonly step: readonly [step: BrowserRunStep];
|
|
2699
2809
|
};
|
|
2700
2810
|
|
|
2811
|
+
/** Owns the hold, captures, and completion of one prepared replay call. */
|
|
2812
|
+
export declare class BrowserReplayExecution implements BrowserReplayExecutionInterface {
|
|
2813
|
+
#private;
|
|
2814
|
+
constructor(toolset: BrowserToolsetInterface, revision: BrowserJourneyRevision, inputs: Readonly<Record<string, string>>, emitter: Emitter<BrowserReplayEventMap>, options?: BrowserReplayOptions, call?: BrowserCallOptions);
|
|
2815
|
+
get result(): Promise<BrowserRun>;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
/** Exposes the result of one prepared replay execution. */
|
|
2819
|
+
export declare interface BrowserReplayExecutionInterface {
|
|
2820
|
+
readonly result: Promise<BrowserRun>;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2701
2823
|
/**
|
|
2702
2824
|
* Replays one journey over a toolset.
|
|
2703
2825
|
*
|
|
@@ -3203,6 +3325,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3203
3325
|
readonly limit?: number;
|
|
3204
3326
|
}
|
|
3205
3327
|
|
|
3328
|
+
/** Names the undecoded tables supplied by a CDP snapshot response. */
|
|
3329
|
+
export declare interface BrowserSnapshotTables {
|
|
3330
|
+
readonly strings: readonly unknown[];
|
|
3331
|
+
readonly documents: readonly unknown[];
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3206
3334
|
/** Represents one browser-side stack frame. */
|
|
3207
3335
|
export declare interface BrowserStackFrame {
|
|
3208
3336
|
readonly url: string;
|
|
@@ -3336,9 +3464,24 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3336
3464
|
readonly current: boolean;
|
|
3337
3465
|
}
|
|
3338
3466
|
|
|
3467
|
+
/** Runs teardown steps in order while retaining the first failure, including undefined. */
|
|
3468
|
+
export declare class BrowserTeardown implements BrowserTeardownInterface {
|
|
3469
|
+
#private;
|
|
3470
|
+
readonly result: Promise<unknown>;
|
|
3471
|
+
constructor(steps: readonly BrowserTeardownFunction[]);
|
|
3472
|
+
}
|
|
3473
|
+
|
|
3339
3474
|
/** Runs one teardown step to settlement while the first failure is retained. */
|
|
3340
3475
|
export declare type BrowserTeardownFunction = () => Promise<unknown>;
|
|
3341
3476
|
|
|
3477
|
+
/** Exposes completion after every teardown step has run. */
|
|
3478
|
+
export declare interface BrowserTeardownInterface {
|
|
3479
|
+
readonly result: Promise<unknown>;
|
|
3480
|
+
}
|
|
3481
|
+
|
|
3482
|
+
/** Names the UTF-16 boundaries of a reference span. */
|
|
3483
|
+
export declare type BrowserTextRange = readonly [start: number, end: number];
|
|
3484
|
+
|
|
3342
3485
|
/** Holds network timing values in milliseconds relative to request time. */
|
|
3343
3486
|
export declare interface BrowserTiming {
|
|
3344
3487
|
readonly request: number;
|
|
@@ -3375,6 +3518,9 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3375
3518
|
readonly autosubmit?: boolean;
|
|
3376
3519
|
}
|
|
3377
3520
|
|
|
3521
|
+
/** Executes a tool action and returns its body and footer. */
|
|
3522
|
+
export declare type BrowserToolHandler = (args: Readonly<Record<string, unknown>>, context: ToolContext) => Promise<readonly [body: string, footer: string]>;
|
|
3523
|
+
|
|
3378
3524
|
/**
|
|
3379
3525
|
* Names a tool the browser toolset reserves: the generic tools, the staged `dialog`, the
|
|
3380
3526
|
* opt-in `switch`, and the journey tools `record`, `save`, `journeys`, `edit`,
|
|
@@ -3382,6 +3528,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3382
3528
|
*/
|
|
3383
3529
|
export declare type BrowserToolName = 'read' | 'click' | 'type' | 'press' | 'navigate' | 'wait' | 'dialog' | 'switch' | 'record' | 'save' | 'journeys' | 'edit' | 'replay' | 'forget' | 'capture';
|
|
3384
3530
|
|
|
3531
|
+
/** Identifies one form-submission observation and the frames it watches. */
|
|
3532
|
+
export declare interface BrowserToolObservation {
|
|
3533
|
+
readonly token: number;
|
|
3534
|
+
readonly frames: Set<BrowserFrameInterface>;
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3385
3537
|
/** Identifies a removed WebMCP tool by document and name. */
|
|
3386
3538
|
export declare interface BrowserToolRemoval {
|
|
3387
3539
|
readonly frame: string;
|
|
@@ -3707,6 +3859,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3707
3859
|
readonly fault?: unknown;
|
|
3708
3860
|
}
|
|
3709
3861
|
|
|
3862
|
+
/** Carries the initial command outcome and the receipt deadline. */
|
|
3863
|
+
export declare interface BrowserToolSettlement {
|
|
3864
|
+
readonly first: boolean;
|
|
3865
|
+
readonly deadline: number;
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3710
3868
|
/** Maps the signal a tool source emits when its page's tools change. */
|
|
3711
3869
|
export declare type BrowserToolSourceEventMap = {
|
|
3712
3870
|
readonly change: readonly [];
|
|
@@ -3743,18 +3901,18 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3743
3901
|
}
|
|
3744
3902
|
|
|
3745
3903
|
/** Drives the trace capture lifecycle. */
|
|
3746
|
-
export declare interface
|
|
3904
|
+
export declare interface BrowserTraceInterface {
|
|
3747
3905
|
readonly active: boolean;
|
|
3748
3906
|
/**
|
|
3749
3907
|
* Begins tracing with the given categories. Throws a `BrowserError` when a trace is
|
|
3750
3908
|
* already active.
|
|
3751
3909
|
*/
|
|
3752
|
-
start(options?:
|
|
3910
|
+
start(options?: BrowserTraceOptions): Promise<void>;
|
|
3753
3911
|
/**
|
|
3754
3912
|
* Ends tracing, drains the IO stream, and writes it through the page writer when a path
|
|
3755
3913
|
* was set.
|
|
3756
3914
|
*/
|
|
3757
|
-
stop(): Promise<
|
|
3915
|
+
stop(): Promise<BrowserTraceResult>;
|
|
3758
3916
|
/**
|
|
3759
3917
|
* Stops an active trace, discarding any failure, and does nothing when no trace is
|
|
3760
3918
|
* running.
|
|
@@ -3763,15 +3921,15 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3763
3921
|
}
|
|
3764
3922
|
|
|
3765
3923
|
/** Describes the options for a Chromium trace capture. */
|
|
3766
|
-
export declare interface
|
|
3924
|
+
export declare interface BrowserTraceOptions {
|
|
3767
3925
|
readonly path?: string;
|
|
3768
3926
|
readonly categories?: readonly string[];
|
|
3769
3927
|
readonly screenshots?: boolean;
|
|
3770
|
-
readonly
|
|
3928
|
+
readonly samples?: boolean;
|
|
3771
3929
|
}
|
|
3772
3930
|
|
|
3773
3931
|
/** Describes the result of a trace capture. */
|
|
3774
|
-
export declare interface
|
|
3932
|
+
export declare interface BrowserTraceResult {
|
|
3775
3933
|
readonly bytes: Uint8Array;
|
|
3776
3934
|
readonly path: string | undefined;
|
|
3777
3935
|
}
|
|
@@ -3866,9 +4024,9 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3866
4024
|
title(options?: BrowserCallOptions): Promise<string>;
|
|
3867
4025
|
/**
|
|
3868
4026
|
* Captures the document URL, title, and rendered markup as a reading whose `stale` flag tracks
|
|
3869
|
-
* later navigations; {@link
|
|
4027
|
+
* later navigations; {@link BrowserContentInput} defines the rendered markup.
|
|
3870
4028
|
*/
|
|
3871
|
-
read(options?: BrowserCallOptions): Promise<
|
|
4029
|
+
read(options?: BrowserCallOptions): Promise<BrowserContentInterface>;
|
|
3872
4030
|
/**
|
|
3873
4031
|
* Resolves when the main document body’s `innerText` contains `text`, or lacks it with `absent`; rejects with a `BrowserError` coded
|
|
3874
4032
|
* `TIMEOUT` at the deadline, and with `signal.reason` on abort.
|
|
@@ -3927,6 +4085,14 @@ export declare interface BrowserRunStoreInterface {
|
|
|
3927
4085
|
readonly url: string;
|
|
3928
4086
|
}
|
|
3929
4087
|
|
|
4088
|
+
/** Retains an accepted projection row and its footer eligibility. */
|
|
4089
|
+
export declare interface BrowserWindowRow {
|
|
4090
|
+
readonly index: number;
|
|
4091
|
+
readonly row: string;
|
|
4092
|
+
readonly heading: readonly string[];
|
|
4093
|
+
readonly eligible: boolean;
|
|
4094
|
+
}
|
|
4095
|
+
|
|
3930
4096
|
/** Names a worker target category. */
|
|
3931
4097
|
export declare type BrowserWorkerCategory = 'worker' | 'service_worker' | 'shared_worker';
|
|
3932
4098
|
|
|
@@ -4364,7 +4530,7 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4364
4530
|
* Compiles the in-page function that reads the document's URL, title, and rendered HTML.
|
|
4365
4531
|
*
|
|
4366
4532
|
* @remarks
|
|
4367
|
-
* The optional root defaults to `document.documentElement`. {@link
|
|
4533
|
+
* The optional root defaults to `document.documentElement`. {@link BrowserContentInput}
|
|
4368
4534
|
* defines its inert capture, lowering, redaction, and limits. A missing root yields empty HTML.
|
|
4369
4535
|
* Call it inside {@link compileGuardedEvaluateExpression} to bound the final serialized result
|
|
4370
4536
|
* under {@link BROWSER_RESULT_LIMIT}.
|
|
@@ -4529,39 +4695,20 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4529
4695
|
export declare function cookieToProtocol(cookie: BrowserCookieInput): Readonly<Record<string, unknown>>;
|
|
4530
4696
|
|
|
4531
4697
|
/**
|
|
4532
|
-
* Creates a
|
|
4533
|
-
*
|
|
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()
|
|
4547
|
-
*/
|
|
4548
|
-
export declare function createBrowserContext(client: CDPClientInterface, options?: BrowserContextOptions): BrowserContextInterface;
|
|
4549
|
-
|
|
4550
|
-
/**
|
|
4551
|
-
* Creates a `BrowserReadingInterface` over a captured document, parsing its HTML one time.
|
|
4698
|
+
* Creates a `BrowserContentInterface` over a captured document, parsing its HTML one time.
|
|
4552
4699
|
*
|
|
4553
4700
|
* @remarks
|
|
4554
4701
|
* A reading built with a `navigation` source reports `stale` when that source's epoch differs
|
|
4555
4702
|
* from the `epoch` recorded at capture; a reading built without one never does.
|
|
4556
4703
|
*
|
|
4557
4704
|
* @param input - The document URL, title, and HTML, and the optional navigation epoch
|
|
4558
|
-
* @returns A {@link
|
|
4705
|
+
* @returns A {@link BrowserContentInterface}
|
|
4559
4706
|
*
|
|
4560
4707
|
* @example
|
|
4561
4708
|
* ```ts
|
|
4562
|
-
* import {
|
|
4709
|
+
* import { createBrowserContent } from '@orkestrel/browser'
|
|
4563
4710
|
*
|
|
4564
|
-
* const reading =
|
|
4711
|
+
* const reading = createBrowserContent({
|
|
4565
4712
|
* url: 'https://example.com/',
|
|
4566
4713
|
* title: 'Example',
|
|
4567
4714
|
* html: '<nav>Menu</nav><main><p>Body</p></main>',
|
|
@@ -4569,7 +4716,26 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4569
4716
|
* reading.text({ distill: false }) // { text: 'Menu\nBody', offset: 0, total: 9 }
|
|
4570
4717
|
* ```
|
|
4571
4718
|
*/
|
|
4572
|
-
export declare function
|
|
4719
|
+
export declare function createBrowserContent(input: BrowserContentInput): BrowserContentInterface;
|
|
4720
|
+
|
|
4721
|
+
/**
|
|
4722
|
+
* Creates a wrapper over an existing browser context on a CDP client.
|
|
4723
|
+
*
|
|
4724
|
+
* @remarks
|
|
4725
|
+
* `id` selects an existing remote context; omission selects the default context.
|
|
4726
|
+
* The caller owns the client. Use `browser.isolate` to create a remote context with
|
|
4727
|
+
* `proxy` or `origins`; this factory refuses those options.
|
|
4728
|
+
*
|
|
4729
|
+
* @param client - The client whose connection carries the context's pages
|
|
4730
|
+
* @param options - Context identity, page defaults, writer, and event hooks
|
|
4731
|
+
* @returns The context wrapper
|
|
4732
|
+
* @throws Thrown with `ARGUMENT` when `proxy` or `origins` is supplied.
|
|
4733
|
+
* @example
|
|
4734
|
+
* const context = createBrowserContext(client, { viewport: { width: 1280, height: 720 } })
|
|
4735
|
+
* const page = await context.create({ url: 'https://example.com/' })
|
|
4736
|
+
* await context.destroy()
|
|
4737
|
+
*/
|
|
4738
|
+
export declare function createBrowserContext(client: CDPClientInterface, options?: BrowserContextOptions): BrowserContextInterface;
|
|
4573
4739
|
|
|
4574
4740
|
/**
|
|
4575
4741
|
* Creates a recorder over toolset actions.
|
|
@@ -4809,19 +4975,29 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4809
4975
|
*/
|
|
4810
4976
|
export declare function findBrowserText(lines: readonly BrowserLine[], text: string): number;
|
|
4811
4977
|
|
|
4978
|
+
/** Finds a soft wrap before a reference token without splitting its preceding name. */
|
|
4979
|
+
export declare function findBrowserWrapSpace(text: string, offset: number, whitespace: number, references: readonly BrowserTextRange[]): number;
|
|
4980
|
+
|
|
4812
4981
|
/**
|
|
4813
4982
|
* Generates a run id from an ISO timestamp and a cryptographic hexadecimal suffix.
|
|
4814
4983
|
* @returns An ISO timestamp with hyphens replacing colons, followed by four hexadecimal digits
|
|
4815
4984
|
*/
|
|
4816
4985
|
export declare function generateBrowserRunId(): string;
|
|
4817
4986
|
|
|
4987
|
+
/** Checks whether a step error carries the declared action members. */
|
|
4988
|
+
export declare function isBrowserAction(value: unknown): value is BrowserAction;
|
|
4989
|
+
|
|
4818
4990
|
/**
|
|
4819
|
-
* Checks whether
|
|
4991
|
+
* Checks whether an error carries the browser brand and declared members across package copies.
|
|
4992
|
+
* @remarks Subclasses are accepted without requiring their name; transparent proxies are refused.
|
|
4820
4993
|
* @param value - Value to check
|
|
4821
4994
|
* @returns True if the value is a browser error; false otherwise
|
|
4822
4995
|
*/
|
|
4823
4996
|
export declare function isBrowserError(value: unknown): value is BrowserError;
|
|
4824
4997
|
|
|
4998
|
+
/** Checks error metadata, including non-finite numbers that describe refused input values. */
|
|
4999
|
+
export declare function isBrowserErrorContext(value: unknown): value is JSONRecord;
|
|
5000
|
+
|
|
4825
5001
|
/**
|
|
4826
5002
|
* Checks whether a native string argument is a literal or a parameter binding.
|
|
4827
5003
|
* @param value - Candidate argument
|
|
@@ -4906,8 +5082,12 @@ export declare interface BrowserRunStoreInterface {
|
|
|
4906
5082
|
};
|
|
4907
5083
|
};
|
|
4908
5084
|
|
|
5085
|
+
/** Checks the outer tables of a CDP snapshot without decoding their entries. */
|
|
5086
|
+
export declare function isBrowserSnapshotTables(value: unknown): value is BrowserSnapshotTables;
|
|
5087
|
+
|
|
4909
5088
|
/**
|
|
4910
|
-
* Checks whether a
|
|
5089
|
+
* Checks whether a branded browser error carries the step brand and declared action members.
|
|
5090
|
+
* @remarks Subclasses are accepted without requiring their name; transparent proxies are refused.
|
|
4911
5091
|
* @param value - Value to check
|
|
4912
5092
|
* @returns True if the value is a step error; false otherwise
|
|
4913
5093
|
*/
|
|
@@ -5691,6 +5871,9 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5691
5871
|
*/
|
|
5692
5872
|
export declare function renderBrowserSearch(lines: readonly BrowserLine[], from: number, to?: number, search?: string): BrowserSearch;
|
|
5693
5873
|
|
|
5874
|
+
/** Chooses a bounded reference-bearing quote for a search outside the requested range. */
|
|
5875
|
+
export declare function renderBrowserSearchQuote(passage: BrowserPassage, found: BrowserSearch, header: readonly string[], limit: number, total: number): string | undefined;
|
|
5876
|
+
|
|
5694
5877
|
/** Renders an element as searchable text separated from references and syntax.
|
|
5695
5878
|
* @param node - Captured element
|
|
5696
5879
|
* @param url - Owning document address
|
|
@@ -5792,6 +5975,9 @@ export declare interface BrowserRunStoreInterface {
|
|
|
5792
5975
|
*/
|
|
5793
5976
|
export declare function settleBrowserTeardown(...steps: readonly BrowserTeardownFunction[]): Promise<unknown>;
|
|
5794
5977
|
|
|
5978
|
+
/** Finds the next non-whitespace offset after a soft line break. */
|
|
5979
|
+
export declare function skipBrowserWhitespace(text: string, offset: number): number;
|
|
5980
|
+
|
|
5795
5981
|
/**
|
|
5796
5982
|
* Validates Accessibility-domain snapshot bounds.
|
|
5797
5983
|
*
|