@orkestrel/browser 0.0.28 → 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 CHANGED
@@ -2,7 +2,7 @@
2
2
  import { parseBoolean, parseInteger } from "@orkestrel/contract";
3
3
  import { BrowserError, isBrowserError } from "../src/core/index.js";
4
4
  import { createBrowserMCPServer, parseBrowserViewport } from "../src/server/index.js";
5
- //#region src/bin/main.ts
5
+ // src/bin/main.ts
6
6
  process.stderr.on("error", () => {
7
7
  process.exitCode = 1;
8
8
  });
@@ -55,6 +55,5 @@ try {
55
55
  console.error(`browse: ${error.code}: ${error.message.split(/\r\n|\n/u).join(" ")}`);
56
56
  process.exitCode = 1;
57
57
  }
58
- //#endregion
59
58
 
60
59
  //# sourceMappingURL=main.js.map
@@ -1,8 +1,9 @@
1
1
  import type { BrowserCallOptions } from '@orkestrel/browser';
2
+ import type { BrowserContentInput } from '@orkestrel/browser';
3
+ import type { BrowserContentInterface } from '@orkestrel/browser';
2
4
  import type { BrowserElementInterface } from '@orkestrel/browser';
3
5
  import type { BrowserElementManagerInterface } from '@orkestrel/browser';
4
- import type { BrowserReadingInput } from '@orkestrel/browser';
5
- import type { BrowserReadingInterface } from '@orkestrel/browser';
6
+ import type { BrowserOutlineNode } from '@orkestrel/browser';
6
7
  import type { BrowserViewInterface } from '@orkestrel/browser';
7
8
  import type { BrowserWaitOptions } from '@orkestrel/browser';
8
9
  import type { CDPTransportEventMap } from '@orkestrel/browser';
@@ -71,6 +72,47 @@ export declare const BROWSER_SELECTED_ROLES: ReadonlySet<string>;
71
72
  /** Names the `input` type states whose value an untrusted `fill` sets as typed text. */
72
73
  export declare const BROWSER_TYPED_INPUTS: ReadonlySet<string>;
73
74
 
75
+ /** Reads the next ancestor, ending at the platform's null boundary. */
76
+ export declare type BrowserAncestorReader<T> = (node: T) => T | null;
77
+
78
+ /** Traverses ancestors lazily while retaining the previously yielded node. */
79
+ export declare class BrowserAncestors<T> extends Iterator<T, undefined> {
80
+ #private;
81
+ constructor(node: T | null, parent: BrowserAncestorReader<T>);
82
+ next(): IteratorResult<T, undefined>;
83
+ get previous(): T | null;
84
+ }
85
+
86
+ /** Retains the sibling pointers read before a capture prunes its copy. */
87
+ export declare interface BrowserCaptureCursor {
88
+ readonly child: Node | null;
89
+ readonly mirror: Node | null;
90
+ readonly element: Element | null;
91
+ readonly counterpart: Element | null;
92
+ }
93
+
94
+ /** Pairs the current live and inert nodes during sibling traversal. */
95
+ export declare interface BrowserCaptureSibling {
96
+ readonly child: Node;
97
+ readonly mirror: Node;
98
+ readonly element: Element | null;
99
+ readonly counterpart: Element | null;
100
+ }
101
+
102
+ /** Traverses paired live and inert siblings while preserving pointers across pruning. */
103
+ export declare class BrowserCaptureSiblings extends Iterator<BrowserCaptureSibling, undefined> {
104
+ #private;
105
+ constructor(live: Element, twin: Element);
106
+ next(): IteratorResult<BrowserCaptureSibling, undefined>;
107
+ }
108
+
109
+ /** Carries rendered lines, fragments, or a container retained by a capture. */
110
+ export declare interface BrowserCaptureValue {
111
+ readonly fragments?: readonly Node[];
112
+ readonly lines?: readonly string[];
113
+ readonly container?: boolean;
114
+ }
115
+
74
116
  /**
75
117
  * Provides DOM actions through a stable element reference, without trusted input.
76
118
  *
@@ -83,6 +125,38 @@ export declare const BROWSER_TYPED_INPUTS: ReadonlySet<string>;
83
125
  export declare interface BrowserDOMElementInterface extends BrowserElementInterface {
84
126
  }
85
127
 
128
+ /** Captures one flat-tree subtree while retaining its text and visibility state. */
129
+ export declare class BrowserDOMOutline implements BrowserDOMOutlineInterface {
130
+ #private;
131
+ constructor(input: BrowserDOMOutlineInput);
132
+ capture(): void;
133
+ }
134
+
135
+ /** Supplies the document subtree, row sinks, and traversal operations for an outline. */
136
+ export declare interface BrowserDOMOutlineInput {
137
+ readonly root: Element | ShadowRoot;
138
+ readonly rows: BrowserOutlineNode[];
139
+ readonly muted: boolean;
140
+ readonly positions: WeakMap<Node, string>;
141
+ readonly watch: (document: Document) => void;
142
+ readonly walk: (root: Element | ShadowRoot, rows: BrowserOutlineNode[], muted: boolean) => void;
143
+ readonly text: (rows: BrowserOutlineNode[], text: string, parent?: Node) => void;
144
+ readonly row: (element: Element, role: string, view: Window & typeof globalThis, id: string) => BrowserOutlineNode;
145
+ }
146
+
147
+ /** Captures the rows of one document subtree. */
148
+ export declare interface BrowserDOMOutlineInterface {
149
+ /** Appends the captured rows through the supplied outline operations. */
150
+ capture(): void;
151
+ }
152
+
153
+ /** Observes whether one form submission dispatches its submit event. */
154
+ export declare class BrowserDOMSubmission implements EventListenerObject {
155
+ #private;
156
+ get submitted(): boolean;
157
+ handleEvent(): void;
158
+ }
159
+
86
160
  /**
87
161
  * Reads and drives a DOM document from a realm that can reach it, without trusted input.
88
162
  *
@@ -116,7 +190,7 @@ export declare class BrowserDOMView implements BrowserDOMViewInterface {
116
190
  get trusted(): boolean;
117
191
  get elements(): BrowserElementManagerInterface<BrowserDOMElementInterface>;
118
192
  title(options?: BrowserCallOptions): Promise<string>;
119
- read(options?: BrowserCallOptions): Promise<BrowserReadingInterface>;
193
+ read(options?: BrowserCallOptions): Promise<BrowserContentInterface>;
120
194
  wait(text: string, options?: BrowserWaitOptions): Promise<void>;
121
195
  destroy(): void;
122
196
  }
@@ -568,8 +642,8 @@ export declare function readBrowserBlock(element: Element | null, root: Node): N
568
642
  * @remarks
569
643
  * The measure is the length of `JSON.stringify({ url, title, html })`, the form the CDP capture
570
644
  * guard compares with `BROWSER_RESULT_LIMIT`, so a character JSON escapes counts as its escape
571
- * sequence. A reading a caller builds with `createBrowserReading` passes through no limit.
572
- * {@link BrowserReadingInput} defines the inert capture, lowering, redaction, and limits.
645
+ * sequence. A reading a caller builds with `createBrowserContent` passes through no limit.
646
+ * {@link BrowserContentInput} defines the inert capture, lowering, redaction, and limits.
573
647
  *
574
648
  * @param node - The root whose rendered markup is captured; its owner document supplies `URL`
575
649
  * and `title`
@@ -577,7 +651,13 @@ export declare function readBrowserBlock(element: Element | null, root: Node): N
577
651
  * @throws Thrown as a `BrowserError` when the serialized capture is longer than
578
652
  * `BROWSER_RESULT_LIMIT` characters, with `length` and `limit` in its context.
579
653
  */
580
- export declare function readBrowserCapture(node: Element): BrowserReadingInput;
654
+ export declare function readBrowserCapture(node: Element): BrowserContentInput;
655
+
656
+ /** Checks shadow-slot ancestors for capture omission without skipping style reads. */
657
+ export declare function readBrowserCaptureOmission(live: Element, child: Node, view: (Window & typeof globalThis) | null, rendered: boolean, excluded: boolean): boolean;
658
+
659
+ /** Derives rendered form values and SVG fragments for an inert capture. */
660
+ export declare function readBrowserCaptureValue(live: Element, twin: Element, view: Window & typeof globalThis, inert: Document, invisible: boolean, tag: string): BrowserCaptureValue | undefined;
581
661
 
582
662
  /**
583
663
  * Reads the untrimmed text an element's content contributes to an accessible name, in the flat