@parcha/pi-browser 0.1.0-beta.35 → 0.1.0-beta.351

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/NOTICE +6 -1
  3. package/README.md +65 -39
  4. package/dist/core/contract.js +4 -1
  5. package/dist/core/custody.d.ts +6 -0
  6. package/dist/core/custody.js +15 -3
  7. package/dist/core/downloads.d.ts +37 -3
  8. package/dist/core/downloads.js +81 -57
  9. package/dist/core/driving-guard.d.ts +1 -1
  10. package/dist/core/driving-guard.js +1 -1
  11. package/dist/core/files.d.ts +17 -2
  12. package/dist/core/files.js +157 -9
  13. package/dist/core/host.d.ts +20 -14
  14. package/dist/core/images.d.ts +32 -4
  15. package/dist/core/images.js +81 -16
  16. package/dist/core/lease.d.ts +2 -1
  17. package/dist/core/page-scan.d.ts +81 -2
  18. package/dist/core/page-scan.js +487 -13
  19. package/dist/core/public-fetch.d.ts +70 -9
  20. package/dist/core/public-fetch.js +348 -51
  21. package/dist/core/read-page-worker.js +5 -4
  22. package/dist/core/read-page.d.ts +23 -8
  23. package/dist/core/read-page.js +64 -20
  24. package/dist/core/tools.d.ts +23 -1
  25. package/dist/core/tools.js +46 -4
  26. package/dist/core/usage.d.ts +4 -1
  27. package/dist/core/usage.js +5 -2
  28. package/dist/core/vault.d.ts +0 -10
  29. package/dist/core/vault.js +0 -13
  30. package/dist/driver/cdp.js +3 -3
  31. package/dist/driver/page-driver.js +7 -3
  32. package/dist/driver/stagehand.d.ts +3 -1
  33. package/dist/driver/stagehand.js +4 -2
  34. package/dist/durable/store.d.ts +14 -3
  35. package/dist/durable/store.js +204 -51
  36. package/dist/durable.d.ts +31 -4
  37. package/dist/durable.js +61 -16
  38. package/dist/index.d.ts +3 -2
  39. package/dist/index.js +5 -2
  40. package/dist/live-view/index.d.ts +3 -1
  41. package/dist/live-view/index.js +4 -0
  42. package/dist/live-view/protocol.d.ts +1 -1
  43. package/dist/live-view/server.d.ts +30 -0
  44. package/dist/live-view/server.js +152 -25
  45. package/dist/providers/cdp.js +2 -2
  46. package/dist/providers/profiles.d.ts +1 -15
  47. package/dist/providers/profiles.js +1 -64
  48. package/dist/providers/shared.d.ts +1 -47
  49. package/dist/providers/shared.js +1 -82
  50. package/dist/providers/worker-extension.d.ts +14 -1
  51. package/dist/providers/worker-extension.js +69 -3
  52. package/dist/testing/backend.d.ts +4 -3
  53. package/dist/testing/backend.js +6 -5
  54. package/dist/vault-session.d.ts +4 -7
  55. package/dist/vault-session.js +26 -81
  56. package/dist/vendor/browser-use-pi/page.d.ts +3 -12
  57. package/dist/vendor/browser-use-pi/page.js +6 -19
  58. package/package.json +8 -21
  59. package/dist/providers/browserbase-net.d.ts +0 -12
  60. package/dist/providers/browserbase-net.js +0 -95
  61. package/dist/providers/browserbase.d.ts +0 -138
  62. package/dist/providers/browserbase.js +0 -294
  63. package/dist/providers/kernel.d.ts +0 -58
  64. package/dist/providers/kernel.js +0 -291
  65. /package/dist/{providers → core}/cdp-call.d.ts +0 -0
  66. /package/dist/{providers → core}/cdp-call.js +0 -0
@@ -1,5 +1,8 @@
1
1
  export declare const SCREENSHOT_MAX_EDGE_PX = 2000;
2
2
  export declare const SCREENSHOT_MAX_BASE64_BYTES = 900000;
3
+ /** A full page shrunk to the long edge that would be narrower than this (its short edge) is unreadable: the viewport is
4
+ * taken in its place. */
5
+ export declare const SCREENSHOT_MIN_SHORT_EDGE_PX = 600;
3
6
  export type ImageSize = {
4
7
  type: "png" | "jpeg";
5
8
  width: number;
@@ -13,12 +16,13 @@ export type Clip = {
13
16
  width: number;
14
17
  height: number;
15
18
  };
16
- /** `scale: "css"` takes one image pixel per CSS pixel, so a high-density display does not double the size. `clip` captures that region alone. */
19
+ /** `clip` captures that region alone, `fullPage` the whole document. `scale` is the image's size as a share of the
20
+ * browser's own capture of the same region (its device pixels): 0.5 is half as wide and half as high; absent, 1. */
17
21
  export type ScreenshotOptions = {
18
22
  fullPage?: boolean;
19
23
  type?: "png" | "jpeg";
20
24
  quality?: number;
21
- scale?: "css" | "device";
25
+ scale?: number;
22
26
  clip?: Clip;
23
27
  };
24
28
  export type Capture = (options: ScreenshotOptions) => Promise<{
@@ -31,14 +35,38 @@ export type BudgetedScreenshot = {
31
35
  size: ImageSize;
32
36
  options: ScreenshotOptions;
33
37
  adjusted: {
34
- why: "long_edge" | "base64_bytes";
38
+ why: "long_edge" | "base64_bytes" | "unreadable";
35
39
  first: ImageSize | null;
36
40
  } | null;
37
41
  };
42
+ /** What CDP's Page.getLayoutMetrics says of a page, in CSS pixels: where the viewport is scrolled to and its size, and
43
+ * the whole document's size. */
44
+ export type Layout = {
45
+ cssVisualViewport: {
46
+ pageX: number;
47
+ pageY: number;
48
+ clientWidth: number;
49
+ clientHeight: number;
50
+ };
51
+ cssContentSize: {
52
+ width: number;
53
+ height: number;
54
+ };
55
+ };
56
+ /** CDP's Page.captureScreenshot parameters for `options` on a page laid out as `layout`. Chrome scales a clip alone, its
57
+ * image `clip.scale` times its device pixels: a clip (from the viewport) is moved to the document, a full page is the
58
+ * document's clip captured beyond the viewport, and a scaled viewport is the viewport's own clip. */
59
+ export declare function captureParams(options: ScreenshotOptions, layout: Layout): Record<string, unknown>;
38
60
  export declare class ScreenshotBudgetError extends Error {
39
61
  name: string;
40
62
  }
41
- /** Over budget, retakes as a viewport JPEG at CSS scale, quality 40, 25, 10 (of the same clip, when there is one); throws ScreenshotBudgetError. */
63
+ /**
64
+ * A capture as requested, held to the budget. Over the long edge, the same region is retaken scaled to fit it (a full
65
+ * page that would come out narrower than SCREENSHOT_MIN_SHORT_EDGE_PX is the viewport instead, itself scaled to fit);
66
+ * over the byte budget, as a JPEG at quality 40, 25 and 10 (at most the requested quality), then smaller still. A capture
67
+ * whose size cannot be read is retaken once as a viewport JPEG. Throws ScreenshotBudgetError only when no capture it can
68
+ * measure is made, or none fits within MAX_CAPTURES.
69
+ */
42
70
  export declare function captureWithinBudget(capture: Capture, requested: ScreenshotOptions, budget?: {
43
71
  maxEdgePx: number;
44
72
  maxBase64Bytes: number;
@@ -1,7 +1,11 @@
1
1
  // Tool images are stored verbatim and resent on every later request, and routes reject oversize ones: a capture is held
2
- // to a long edge and a base64 size.
2
+ // to a long edge and a base64 size, by shrinking its pixels and then its JPEG quality, never by failing while a capture
3
+ // can be made.
3
4
  export const SCREENSHOT_MAX_EDGE_PX = 2_000;
4
5
  export const SCREENSHOT_MAX_BASE64_BYTES = 900_000;
6
+ /** A full page shrunk to the long edge that would be narrower than this (its short edge) is unreadable: the viewport is
7
+ * taken in its place. */
8
+ export const SCREENSHOT_MIN_SHORT_EDGE_PX = 600;
5
9
  const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
6
10
  /** JPEG start-of-frame markers; C4 (DHT), C8 (JPG) and CC (DAC) are not frames. */
7
11
  const JPEG_SOF = new Set([0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf]);
@@ -34,27 +38,88 @@ export function imageSize(bytes) {
34
38
  }
35
39
  return null;
36
40
  }
41
+ /** CDP's Page.captureScreenshot parameters for `options` on a page laid out as `layout`. Chrome scales a clip alone, its
42
+ * image `clip.scale` times its device pixels: a clip (from the viewport) is moved to the document, a full page is the
43
+ * document's clip captured beyond the viewport, and a scaled viewport is the viewport's own clip. */
44
+ export function captureParams(options, layout) {
45
+ const format = options.type ?? "png";
46
+ const scale = options.scale ?? 1;
47
+ const view = layout.cssVisualViewport;
48
+ const region = options.clip ? { ...options.clip, x: options.clip.x + view.pageX, y: options.clip.y + view.pageY }
49
+ : options.fullPage ? { x: 0, y: 0, width: Math.ceil(layout.cssContentSize.width), height: Math.ceil(layout.cssContentSize.height) }
50
+ : scale !== 1 ? { x: view.pageX, y: view.pageY, width: view.clientWidth, height: view.clientHeight }
51
+ : null;
52
+ return {
53
+ format,
54
+ // CDP takes a quality for jpeg only, and only as an integer.
55
+ ...(format === "jpeg" && options.quality !== undefined ? { quality: Math.round(options.quality) } : {}),
56
+ ...(options.fullPage && !options.clip ? { captureBeyondViewport: true } : {}),
57
+ ...(region ? { clip: { ...region, scale } } : {}),
58
+ };
59
+ }
37
60
  export class ScreenshotBudgetError extends Error {
38
61
  name = "ScreenshotBudgetError";
39
62
  }
40
- /** Over budget, retakes as a viewport JPEG at CSS scale, quality 40, 25, 10 (of the same clip, when there is one); throws ScreenshotBudgetError. */
63
+ /** The most captures one screenshot takes before it gives up. */
64
+ const MAX_CAPTURES = 12;
65
+ const QUALITIES = [40, 25, 10];
66
+ /**
67
+ * A capture as requested, held to the budget. Over the long edge, the same region is retaken scaled to fit it (a full
68
+ * page that would come out narrower than SCREENSHOT_MIN_SHORT_EDGE_PX is the viewport instead, itself scaled to fit);
69
+ * over the byte budget, as a JPEG at quality 40, 25 and 10 (at most the requested quality), then smaller still. A capture
70
+ * whose size cannot be read is retaken once as a viewport JPEG. Throws ScreenshotBudgetError only when no capture it can
71
+ * measure is made, or none fits within MAX_CAPTURES.
72
+ */
41
73
  export async function captureWithinBudget(capture, requested, budget = { maxEdgePx: SCREENSHOT_MAX_EDGE_PX, maxBase64Bytes: SCREENSHOT_MAX_BASE64_BYTES }) {
42
74
  const ceiling = requested.type === "png" ? 40 : (requested.quality ?? 40);
43
- const ladder = [
44
- { fullPage: requested.fullPage ?? false, type: requested.type ?? "jpeg", ...(requested.type === "png" ? {} : { quality: requested.quality ?? 40 }), ...(requested.scale ? { scale: requested.scale } : {}), ...(requested.clip ? { clip: requested.clip } : {}) },
45
- ...[40, 25, 10].map((quality) => ({ fullPage: false, type: "jpeg", quality: Math.min(ceiling, quality), scale: "css", ...(requested.clip ? { clip: requested.clip } : {}) })),
46
- ];
47
- const key = (o) => `${o.fullPage}:${o.type}:${o.quality}:${o.scale}:${o.clip ? `${o.clip.x},${o.clip.y},${o.clip.width},${o.clip.height}` : ""}`;
48
- const attempts = ladder.filter((o, i) => ladder.findIndex((other) => key(other) === key(o)) === i);
49
- let adjusted = null;
50
- for (const options of attempts) {
75
+ // The clip and the scale asked are kept on every capture; a retake only scales further down.
76
+ const clip = { ...(requested.clip ? { clip: requested.clip } : {}), ...(requested.scale === undefined ? {} : { scale: requested.scale }) };
77
+ let taken = 0;
78
+ const take = async (options) => {
79
+ taken += 1;
51
80
  const image = await capture(options);
52
81
  const size = imageSize(Buffer.from(image.data, "base64"));
53
- const why = size === null || Math.max(size.width, size.height) > budget.maxEdgePx ? "long_edge"
54
- : Buffer.byteLength(image.data, "utf8") > budget.maxBase64Bytes ? "base64_bytes" : null;
55
- if (why === null && size)
56
- return { data: image.data, mimeType: image.mimeType, size, options, adjusted };
57
- adjusted ??= { why: why ?? "long_edge", first: size };
82
+ const why = size === null ? "unreadable"
83
+ : Math.max(size.width, size.height) > budget.maxEdgePx ? "long_edge"
84
+ : Buffer.byteLength(image.data, "utf8") > budget.maxBase64Bytes ? "base64_bytes" : null;
85
+ return { image, size, why, options };
86
+ };
87
+ const fit = (size) => budget.maxEdgePx / Math.max(size.width, size.height);
88
+ const viewport = (options) => ({ fullPage: false, type: "jpeg", quality: Math.min(ceiling, options.type === "jpeg" ? options.quality ?? 40 : 40), ...clip });
89
+ let shot = await take({ fullPage: requested.fullPage ?? false, type: requested.type ?? "jpeg", ...(requested.type === "png" ? {} : { quality: ceiling }), ...clip });
90
+ const adjusted = shot.why === null ? null : { why: shot.why, first: shot.size };
91
+ if (shot.why === "unreadable")
92
+ shot = await take(viewport(shot.options));
93
+ // A full page that fits only narrower than a page can be read: the viewport, which the steps below fit.
94
+ if (shot.why === "long_edge" && shot.options.fullPage && shot.size && Math.min(shot.size.width, shot.size.height) * fit(shot.size) < SCREENSHOT_MIN_SHORT_EDGE_PX) {
95
+ shot = await take(viewport(shot.options));
96
+ }
97
+ while (shot.why !== null) {
98
+ if (shot.why === "unreadable" || !shot.size)
99
+ throw new ScreenshotBudgetError("The browser's capture is not a PNG or JPEG whose size can be read, and a viewport JPEG retake is not either.");
100
+ if (taken >= MAX_CAPTURES)
101
+ throw new ScreenshotBudgetError(`No capture fits ${budget.maxEdgePx} px on its long edge and ${budget.maxBase64Bytes} base64 bytes after ${taken} captures; the last was ${shot.size.width}x${shot.size.height}.`);
102
+ const { options, size } = shot;
103
+ const scale = options.scale ?? 1;
104
+ let next;
105
+ if (shot.why === "long_edge") {
106
+ next = { ...options, scale: scale * fit(size) };
107
+ }
108
+ else {
109
+ const quality = options.type === "png" ? undefined : options.quality ?? 40;
110
+ const lower = QUALITIES.map((q) => Math.min(ceiling, q)).find((q) => quality === undefined || q < quality);
111
+ // Its bytes go roughly with its area: a scale that takes them to nine tenths of the budget.
112
+ const smaller = scale * Math.min(0.9, 0.9 * Math.sqrt(budget.maxBase64Bytes / Buffer.byteLength(shot.image.data, "utf8")));
113
+ next = lower !== undefined ? { ...options, type: "jpeg", quality: lower } : { ...options, scale: smaller };
114
+ }
115
+ shot = await take(next);
116
+ // A driver that does not take the scale asked (Stagehand's, past one image pixel per CSS pixel): a full page is the
117
+ // viewport instead, and anything else is as small as this browser makes it.
118
+ if ((next.scale ?? 1) < scale && shot.size && Math.max(shot.size.width, shot.size.height) >= Math.max(size.width, size.height)) {
119
+ if (!options.fullPage)
120
+ throw new ScreenshotBudgetError(`The browser does not take this capture smaller than ${shot.size.width}x${shot.size.height}, which is over ${budget.maxEdgePx} px on its long edge or ${budget.maxBase64Bytes} base64 bytes.`);
121
+ shot = await take(viewport(options));
122
+ }
58
123
  }
59
- throw new ScreenshotBudgetError(`The screenshot stays over ${budget.maxEdgePx} px on its long edge or ${budget.maxBase64Bytes} base64 bytes after viewport JPEG retakes at CSS scale and quality 40, 25 and 10.`);
124
+ return { data: shot.image.data, mimeType: shot.image.mimeType, size: shot.size, options: shot.options, adjusted };
60
125
  }
@@ -5,7 +5,8 @@ export type ResourceStatus = "pending" | "running" | "stopped" | "gone";
5
5
  * `id`. */
6
6
  export type LeaseRef = {
7
7
  readonly id: string;
8
- readonly tag: string;
8
+ readonly tag: string; /** When the provider made the session (an ISO time), where its tag lookup (findByTag) says. */
9
+ readonly madeAt?: string;
9
10
  };
10
11
  /** Each change is one commit, and a provider call sits between two commits, never inside one. `lost` ends custody of a
11
12
  * resource the provider no longer answers for and that was never confirmed released. */
@@ -1,6 +1,11 @@
1
1
  /** An entity decoder for a run of text or an attribute value: node-html-parser's in the worker, entities.ts's on the
2
2
  * event loop. */
3
3
  export type Decode = (text: string) => string;
4
+ /** A style element of a page: what its start tag holds between its name and its ">" (insideOf), and its text. */
5
+ export type Style = {
6
+ inside: string;
7
+ css: string;
8
+ };
4
9
  /** A page without its script, style, svg, noscript and template elements and its comments, in steps so a caller on the
5
10
  * event loop can yield between them (dropInert, all at once). One whose end is missing runs to the end of the page, as
6
11
  * a browser reads it; but an svg's start tag goes alone, since a browser lets the HTML that follows out of an unclosed
@@ -19,9 +24,72 @@ export declare class InertDrop {
19
24
  step(chars: number): boolean;
20
25
  /** The page as dropped so far (the whole of it once step has answered true). */
21
26
  result(): string;
27
+ /** The page's own style elements dropped so far, in page order: what each start tag holds (insideOf) and its text. */
28
+ styles(): readonly Style[];
22
29
  }
23
30
  /** `html` without its inert blocks, all at once (see InertDrop). */
24
31
  export declare function dropInert(html: string): string;
32
+ /**
33
+ * The classes common frameworks hide an element from everyone with, whatever the page's own style says (it is often an
34
+ * external stylesheet a page read never fetches): mfp-hide (Magnific Popup: a pop-up's content until it opens, as on
35
+ * Canada.ca's record pages), modal (Bootstrap: a modal until it opens), d-none (Bootstrap 4+), hidden (Tailwind, Bootstrap
36
+ * 3), hide (Bootstrap 2), invisible (Tailwind, Bootstrap: visibility), is-hidden (Bulma), u-hidden (SUIT utilities). The
37
+ * classes that hide text from the screen only (sr-only, visually-hidden, wb-inv, screen-reader-text) are not here: a
38
+ * screen reader reads them, and they are often a record's field labels and table captions, the words its values hang
39
+ * on. aria-hidden is read for the same reason the other way: it hides from a screen reader only, and is usually shown.
40
+ */
41
+ export declare const HIDING_CLASSES: ReadonlySet<string>;
42
+ /** The two properties that hide an element from everyone. */
43
+ type Showing = "display" | "visibility";
44
+ /** What a property comes to: "hide" (display none, visibility hidden or collapse), "show" (any other value that
45
+ * decides it), or "doubt" (a value that hands it elsewhere, or declarations whose winner is unclear). */
46
+ type Outcome = "hide" | "show" | "doubt";
47
+ /** A property's last declaration: its outcome, and whether it was !important. */
48
+ type Declared = {
49
+ outcome: Outcome;
50
+ important: boolean;
51
+ };
52
+ /** What a declaration list, a class or an element declares of each property it sets. */
53
+ export type Declarations = Partial<Record<Showing, Declared>>;
54
+ /** What a page's own live styles declare of each class, by its one-class rules in page order. */
55
+ export type PageHiding = ReadonlyMap<string, Declarations>;
56
+ /**
57
+ * What `styles` (a page's own live style elements, InertDrop's styles) declare of each class's display and visibility:
58
+ * a rule at the top level whose selector is that one class (`.x` in `.x, .y { … }`) declares for it, a later rule's
59
+ * declaration after an earlier one's (after); a class a selector names otherwise (`.open .x`, `.x:hover`, `div.x`) is in
60
+ * doubt for each property that rule sets, since when it applies is not known here. A rule inside an at-rule (`@media`)
61
+ * is passed, and a style element not for the screen (forScreen) counts for nothing. Its style text is read once, at
62
+ * most STYLE_READ_CHARS of it, each character a bounded number of times.
63
+ */
64
+ export declare function pageHidingOf(styles: readonly Style[]): PageHiding;
65
+ /**
66
+ * A page without the elements it hides from everyone (hides), in steps so a caller on the event loop can yield between
67
+ * them (dropHidden, all at once). Run on a page its inert blocks are dropped from (InertDrop), with what its own live
68
+ * styles declare (pageHidingOf). A hidden element goes from its start tag to the end tag that closes it, a same-name
69
+ * element inside it counted; one that no end tag closes hides nothing, since where it ends is not known without a full
70
+ * tree. A hidden element that holds no content (VOID) goes alone. Visibility is inherited and a descendant can set it
71
+ * back: an element hidden by visibility alone goes only if nothing inside it shows itself again (hides' `shows`), and is
72
+ * kept whole otherwise. Only a descendant that is shown counts: one display-hidden itself, or inside a display-hidden
73
+ * element within the visibility-hidden one, shows nothing. display:none is not undone by a descendant, so its element
74
+ * always goes. Linear: one pass pairs each start tag with its end tag (an open-tag stack per name), marking the
75
+ * innermost open visibility-hidden element when a shown start tag inside it shows itself, and handing the mark to the
76
+ * element around it (its `outer`) as each closes; each tag costs a bounded amount of work, however the page nests or
77
+ * fails to (an element closed out of order is kept, and its stack entry left to be popped when it reaches the top).
78
+ * Then the hidden ranges are cut, the outermost of each nest.
79
+ */
80
+ export declare class HiddenDrop {
81
+ #private;
82
+ readonly html: string;
83
+ readonly page: PageHiding;
84
+ readonly decode: Decode;
85
+ constructor(html: string, page: PageHiding, decode: Decode);
86
+ /** Pairs the tags found in the next `chars` characters or so; true once the whole page is read. */
87
+ step(chars: number): boolean;
88
+ /** The page without its hidden ranges (once step has answered true; the page as it is before that). */
89
+ result(): string;
90
+ }
91
+ /** `html` without the elements it hides from everyone, all at once (see HiddenDrop); `page` and `decode` as there. */
92
+ export declare function dropHidden(html: string, page: PageHiding, decode: Decode): string;
25
93
  /** `html` cut to at most `max` characters, after the last tag that ends before the cut, so no tag is left half; at
26
94
  * `max` itself when that tag ends more than 64 KiB before it (a page of one long text), or one before it when `max`
27
95
  * falls between the two halves of a character written as a surrogate pair, so no half of one is left. */
@@ -71,9 +139,17 @@ export declare class FrameScan {
71
139
  base: string | null;
72
140
  };
73
141
  }
142
+ /** The most links one page's read gives: a page's links past them are not resolved (`links_truncated`). */
143
+ export declare const READ_LINKS_MAX = 20000;
144
+ /** The most characters one page's links are resolved from: each href read, kept or not, costs its own length and its
145
+ * base's. A relative href resolves to its base and itself, so without a bound a long base and many short hrefs (a
146
+ * `<base href>` of 100,000 characters and 50,000 anchors, in under a million characters of HTML) resolve to billions
147
+ * of characters. The links held stay within a small multiple of it (percent-encoding grows a character to at most 9). */
148
+ export declare const READ_LINKS_MAX_CHARS = 4000000;
74
149
  /** One pass over a page's tags, in steps so a caller on the event loop can yield between them: its title (the first
75
150
  * title element's), the http(s) URLs its `a` elements link to (each resolved against the page's first `<base href>`,
76
- * or `url`, without its fragment, once, in page order) and, when asked for, its plain text: the text between its tags,
151
+ * or `url`, without its fragment, once, in page order, within READ_LINKS_MAX and READ_LINKS_MAX_CHARS, `linksCut` when
152
+ * they stopped the resolution) and, when asked for, its plain text: the text between its tags,
77
153
  * entities decoded and whitespace collapsed, a block's start and end a paragraph, a row's start or a `br` a line, and a
78
154
  * row's cells joined with " | ". A "<" that starts no tag is text (tagsOf); one with no ">" after it ends the page. */
79
155
  export declare class PageScan {
@@ -86,10 +162,13 @@ export declare class PageScan {
86
162
  get done(): boolean;
87
163
  /** Scans the tags that start in the next `chars` characters (a tag that starts in them is read whole). */
88
164
  step(chars: number): boolean;
89
- /** The title, the links and the plain text ("" when it was not asked for) of what was scanned. */
165
+ /** The title, the links and the plain text ("" when it was not asked for) of what was scanned; `linksCut` when
166
+ * READ_LINKS_MAX or READ_LINKS_MAX_CHARS stopped the links' resolution before the last href. */
90
167
  result(): {
91
168
  title: string;
92
169
  links: string[];
93
170
  text: string;
171
+ linksCut?: true;
94
172
  };
95
173
  }
174
+ export {};