@parcha/pi-browser 0.1.0-beta.18 → 0.1.0-beta.20

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 (87) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +177 -39
  3. package/dist/coding-agent-local.js +2 -1
  4. package/dist/coding-agent.d.ts +42 -2
  5. package/dist/coding-agent.js +159 -21
  6. package/dist/core/clip.d.ts +31 -0
  7. package/dist/core/clip.js +49 -0
  8. package/dist/core/contract.d.ts +4 -1
  9. package/dist/core/contract.js +40 -7
  10. package/dist/core/custody.d.ts +79 -5
  11. package/dist/core/custody.js +66 -5
  12. package/dist/core/decisions.d.ts +4 -0
  13. package/dist/core/dial.d.ts +7 -0
  14. package/dist/core/dial.js +41 -0
  15. package/dist/core/downloads.d.ts +1 -0
  16. package/dist/core/downloads.js +17 -5
  17. package/dist/core/driving-guard.d.ts +13 -0
  18. package/dist/core/driving-guard.js +61 -0
  19. package/dist/core/driving.d.ts +61 -0
  20. package/dist/core/driving.js +156 -0
  21. package/dist/core/effects.js +33 -13
  22. package/dist/core/evidence.d.ts +3 -1
  23. package/dist/core/failures.d.ts +5 -1
  24. package/dist/core/failures.js +20 -4
  25. package/dist/core/files.d.ts +8 -0
  26. package/dist/core/files.js +74 -0
  27. package/dist/core/find.d.ts +3 -1
  28. package/dist/core/find.js +2 -1
  29. package/dist/core/guard.d.ts +9 -1
  30. package/dist/core/guard.js +7 -2
  31. package/dist/core/host.d.ts +49 -1
  32. package/dist/core/images.d.ts +10 -2
  33. package/dist/core/images.js +4 -4
  34. package/dist/core/lease.d.ts +1 -1
  35. package/dist/core/lease.js +2 -1
  36. package/dist/core/session-control.d.ts +2 -0
  37. package/dist/core/session-control.js +5 -0
  38. package/dist/core/tools.d.ts +70 -4
  39. package/dist/core/tools.js +288 -45
  40. package/dist/core/unanswered.d.ts +3 -0
  41. package/dist/core/unanswered.js +17 -0
  42. package/dist/core/usage.d.ts +2 -0
  43. package/dist/core/usage.js +6 -0
  44. package/dist/core/web.d.ts +1 -1
  45. package/dist/core/web.js +9 -7
  46. package/dist/driver/extension-worker.d.ts +4 -2
  47. package/dist/driver/extension-worker.js +16 -10
  48. package/dist/driver/page-driver.d.ts +8 -0
  49. package/dist/driver/page-driver.js +128 -0
  50. package/dist/driver/stagehand.d.ts +3 -1
  51. package/dist/driver/stagehand.js +40 -66
  52. package/dist/durable.d.ts +16 -4
  53. package/dist/durable.js +415 -82
  54. package/dist/index.d.ts +2 -0
  55. package/dist/index.js +2 -0
  56. package/dist/live-view/index.d.ts +4 -0
  57. package/dist/live-view/index.js +4 -0
  58. package/dist/live-view/protocol.d.ts +152 -0
  59. package/dist/live-view/protocol.js +84 -0
  60. package/dist/live-view/provider.d.ts +6 -0
  61. package/dist/live-view/provider.js +23 -0
  62. package/dist/live-view/server.d.ts +50 -0
  63. package/dist/live-view/server.js +342 -0
  64. package/dist/live-view/stream.d.ts +7 -0
  65. package/dist/live-view/stream.js +388 -0
  66. package/dist/live-view/token.d.ts +6 -0
  67. package/dist/live-view/token.js +13 -0
  68. package/dist/live-view/viewer.d.ts +6 -0
  69. package/dist/live-view/viewer.js +350 -0
  70. package/dist/live-view/ws.d.ts +19 -0
  71. package/dist/live-view/ws.js +176 -0
  72. package/dist/providers/assigned.d.ts +18 -0
  73. package/dist/providers/assigned.js +76 -0
  74. package/dist/providers/cdp-call.js +12 -2
  75. package/dist/providers/cdp.js +37 -11
  76. package/dist/recorder/follow.d.ts +10 -0
  77. package/dist/recorder/follow.js +27 -2
  78. package/dist/recorder/frames.d.ts +7 -0
  79. package/dist/recorder/frames.js +73 -5
  80. package/dist/store.d.ts +22 -3
  81. package/dist/store.js +75 -4
  82. package/dist/testing/backend.d.ts +26 -0
  83. package/dist/testing/backend.js +21 -3
  84. package/dist/testing/driver.d.ts +18 -1
  85. package/dist/testing/driver.js +4 -0
  86. package/dist/web.js +2 -2
  87. package/package.json +10 -2
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  export * from "./core/contract.js";
2
2
  export { BrowserFailureError, type AttachedSession, type BrowserDriver, type CustodyPort, type DriverFactory, type DriverOptions, type Overrides, type ToolOutput } from "./core/custody.js";
3
3
  export * from "./core/decisions.js";
4
+ export * from "./core/dial.js";
4
5
  export * from "./core/downloads.js";
5
6
  export * from "./core/effects.js";
6
7
  export * from "./core/evidence.js";
7
8
  export * from "./core/failures.js";
9
+ export * from "./core/files.js";
8
10
  export * from "./core/find.js";
9
11
  export * from "./core/guard.js";
10
12
  export * from "./core/host.js";
package/dist/index.js CHANGED
@@ -2,10 +2,12 @@
2
2
  export * from "./core/contract.js";
3
3
  export { BrowserFailureError } from "./core/custody.js";
4
4
  export * from "./core/decisions.js";
5
+ export * from "./core/dial.js";
5
6
  export * from "./core/downloads.js";
6
7
  export * from "./core/effects.js";
7
8
  export * from "./core/evidence.js";
8
9
  export * from "./core/failures.js";
10
+ export * from "./core/files.js";
9
11
  export * from "./core/find.js";
10
12
  export * from "./core/guard.js";
11
13
  export * from "./core/host.js";
@@ -0,0 +1,4 @@
1
+ export { createLiveView, type LiveViewHost, type LiveViewOptions } from "./server.js";
2
+ export { liveViewProvider } from "./provider.js";
3
+ export * from "./protocol.js";
4
+ export { createDrivingGates, drivingGates, personDrivingFailure, PERSON_DRIVING, withModelCall, type DrivingOptions } from "../core/driving.js";
@@ -0,0 +1,4 @@
1
+ export { createLiveView } from "./server.js";
2
+ export { liveViewProvider } from "./provider.js";
3
+ export * from "./protocol.js";
4
+ export { createDrivingGates, drivingGates, personDrivingFailure, PERSON_DRIVING, withModelCall } from "../core/driving.js";
@@ -0,0 +1,152 @@
1
+ import type { DriveState, DrivingGate, DrivingGates } from "../core/driving.js";
2
+ export type { DriveState, DrivingGate, DrivingGates };
3
+ /** The viewer's first message, and nothing else is accepted before it. The token is read from the URL fragment by the viewer's script and
4
+ * never travels in a path, a query or a header. */
5
+ export type Hello = {
6
+ type: "hello";
7
+ token: string;
8
+ };
9
+ export type MouseButton = "left" | "middle" | "right";
10
+ /** CDP's modifier bitmask: Alt 1, Control 2, Meta 4, Shift 8. */
11
+ export type Modifiers = number;
12
+ export type InputMessage = {
13
+ type: "mouse";
14
+ action: "move" | "down" | "up";
15
+ x: number;
16
+ y: number;
17
+ button?: MouseButton; /** The buttons held, as MouseEvent.buttons and CDP count them: left 1, right 2, middle 4 (an integer 0..31). A plain hover is 0; absent means the viewer does not say (a press then holds its own button, a move and a release hold none). */
18
+ buttons?: number;
19
+ clickCount?: number;
20
+ modifiers?: Modifiers;
21
+ } | {
22
+ type: "wheel";
23
+ x: number;
24
+ y: number;
25
+ deltaX: number;
26
+ deltaY: number;
27
+ modifiers?: Modifiers;
28
+ } | {
29
+ type: "key";
30
+ action: "down" | "up";
31
+ key: string;
32
+ code: string;
33
+ text?: string;
34
+ windowsVirtualKeyCode?: number;
35
+ modifiers?: Modifiers;
36
+ }
37
+ /** Typed or pasted text, inserted as it is (Input.insertText). */
38
+ | {
39
+ type: "text";
40
+ text: string;
41
+ };
42
+ export type NavMessage = {
43
+ type: "nav";
44
+ action: "url";
45
+ url: string;
46
+ } | {
47
+ type: "nav";
48
+ action: "back";
49
+ } | {
50
+ type: "nav";
51
+ action: "reload";
52
+ };
53
+ /** Answers the JS dialog the page is showing (alert, confirm, prompt, beforeunload). */
54
+ export type DialogAnswer = {
55
+ type: "dialog";
56
+ accept: boolean;
57
+ promptText?: string;
58
+ };
59
+ export type ClientMessage = Hello | InputMessage | NavMessage | DialogAnswer;
60
+ export type ServerMessage =
61
+ /** Sent once, after a valid hello. */
62
+ {
63
+ type: "ready";
64
+ drive: DriveState;
65
+ } | {
66
+ type: "status";
67
+ drive: DriveState;
68
+ }
69
+ /** The page shown: its address and title, sent when either changes and at every followed-page change. */
70
+ | {
71
+ type: "page";
72
+ url: string;
73
+ title: string;
74
+ } | {
75
+ type: "dialog";
76
+ kind: "alert" | "confirm" | "prompt" | "beforeunload";
77
+ message: string;
78
+ defaultPrompt?: string;
79
+ } | {
80
+ type: "dialog_closed";
81
+ }
82
+ /** One input or nav message was not delivered, and why. */
83
+ | {
84
+ type: "held";
85
+ reason: "agent_acting" | "no_page" | "bad_message" | "busy";
86
+ } | {
87
+ type: "refused";
88
+ reason: RefusalReason;
89
+ } | {
90
+ type: "ended";
91
+ reason: "released" | "browser_closed";
92
+ };
93
+ export type RefusalReason = "unauthorized" | "viewer_in_use" | "released" | "bad_message";
94
+ /** The WebSocket close code that goes with each refusal (4000-4999 is the range for applications). The reason text is the same word. */
95
+ export declare const CLOSE_CODES: Record<RefusalReason | "browser_closed", number>;
96
+ /** The viewer page, as three strings (viewer.ts): the server serves `html` at the page's path and `js` and `css` beside it, because the page's CSP
97
+ * is `default-src 'self'` and so allows no inline script or style. */
98
+ export type ViewerAssets = {
99
+ html: string;
100
+ js: string;
101
+ css: string;
102
+ };
103
+ /** A frame is one binary message: the page's width and height in CSS pixels (two big-endian uint16), then the JPEG. */
104
+ export declare const FRAME_HEADER_BYTES = 4;
105
+ export declare function encodeFrame(jpeg: Uint8Array, w: number, h: number): Buffer;
106
+ export declare function decodeFrame(message: Uint8Array): {
107
+ w: number;
108
+ h: number;
109
+ jpeg: Uint8Array;
110
+ } | null;
111
+ /** What stream.ts gives the server: one session's page, shown and driven over its browser's DevTools socket. */
112
+ export type StreamHandlers = {
113
+ /** The latest frame only. `ack` tells the browser to send the next: call it after the frame was sent to the viewer, or at once to drop it
114
+ * (the viewer is slow). No frame is kept after the handler returns, and none is ever written anywhere. */
115
+ frame(jpeg: Buffer, page: {
116
+ w: number;
117
+ h: number;
118
+ }, ack: () => void): void;
119
+ page(page: {
120
+ url: string;
121
+ title: string;
122
+ }): void;
123
+ dialog(dialog: {
124
+ kind: "alert" | "confirm" | "prompt" | "beforeunload";
125
+ message: string;
126
+ defaultPrompt?: string;
127
+ } | null): void;
128
+ /** The browser's socket ended and was not asked to. */
129
+ closed(): void;
130
+ };
131
+ export type Stream = {
132
+ input(message: InputMessage): Promise<void>;
133
+ nav(message: NavMessage): Promise<void>;
134
+ dialog(answer: DialogAnswer): Promise<void>;
135
+ close(): void;
136
+ };
137
+ /** Starts a stream on the browser at `cdpUrl` (its browser-level DevTools WebSocket). It follows the active page. */
138
+ export type StreamFactory = (cdpUrl: string, handlers: StreamHandlers) => Stream;
139
+ /** Caps on what a viewer may send, so a token holder cannot make the server or the page do unbounded work. */
140
+ /** Counted in characters, and chosen so that a message at its limit still fits the 64 KiB a connection allows (UTF-8 is at most 4 bytes a character). */
141
+ export declare const LIMITS: {
142
+ readonly text: number;
143
+ readonly url: number;
144
+ readonly coordinate: 65535;
145
+ readonly wheel: 100000;
146
+ readonly key: 64;
147
+ readonly promptText: number;
148
+ };
149
+ /** The address a viewer may send a page to: http(s) and about:blank. Never file:, chrome:, javascript:, data: or any other scheme. */
150
+ export declare function viewerMayOpen(raw: string): boolean;
151
+ /** One text message from a viewer, checked field by field; null for anything that is not exactly a message of this protocol. */
152
+ export declare function parseClientMessage(raw: string): ClientMessage | null;
@@ -0,0 +1,84 @@
1
+ /** The WebSocket close code that goes with each refusal (4000-4999 is the range for applications). The reason text is the same word. */
2
+ export const CLOSE_CODES = { unauthorized: 4401, viewer_in_use: 4409, released: 4410, bad_message: 4400, browser_closed: 4411 };
3
+ /** A frame is one binary message: the page's width and height in CSS pixels (two big-endian uint16), then the JPEG. */
4
+ export const FRAME_HEADER_BYTES = 4;
5
+ export function encodeFrame(jpeg, w, h) {
6
+ const out = Buffer.allocUnsafe(FRAME_HEADER_BYTES + jpeg.byteLength);
7
+ out.writeUInt16BE(Math.min(w, 0xffff), 0);
8
+ out.writeUInt16BE(Math.min(h, 0xffff), 2);
9
+ out.set(jpeg, FRAME_HEADER_BYTES);
10
+ return out;
11
+ }
12
+ export function decodeFrame(message) {
13
+ if (message.byteLength <= FRAME_HEADER_BYTES)
14
+ return null;
15
+ const view = new DataView(message.buffer, message.byteOffset, message.byteLength);
16
+ return { w: view.getUint16(0), h: view.getUint16(2), jpeg: message.subarray(FRAME_HEADER_BYTES) };
17
+ }
18
+ /** Caps on what a viewer may send, so a token holder cannot make the server or the page do unbounded work. */
19
+ /** Counted in characters, and chosen so that a message at its limit still fits the 64 KiB a connection allows (UTF-8 is at most 4 bytes a character). */
20
+ export const LIMITS = { text: 12 * 1024, url: 4 * 1024, coordinate: 65_535, wheel: 100_000, key: 64, promptText: 4 * 1024 };
21
+ const finite = (v, max) => typeof v === "number" && Number.isFinite(v) && Math.abs(v) <= max;
22
+ const word = (v, max) => typeof v === "string" && v.length > 0 && v.length <= max;
23
+ /** A string that may be empty: a key's `code` is, from a bare CDP key, a virtual keyboard or an IME. */
24
+ const bounded = (v, max) => typeof v === "string" && v.length <= max;
25
+ const mods = (v) => v === undefined || (Number.isInteger(v) && v >= 0 && v <= 15);
26
+ /** The address a viewer may send a page to: http(s) and about:blank. Never file:, chrome:, javascript:, data: or any other scheme. */
27
+ export function viewerMayOpen(raw) {
28
+ if (raw === "about:blank")
29
+ return true;
30
+ try {
31
+ const u = new URL(raw);
32
+ return u.protocol === "https:" || u.protocol === "http:";
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ /** One text message from a viewer, checked field by field; null for anything that is not exactly a message of this protocol. */
39
+ export function parseClientMessage(raw) {
40
+ let m;
41
+ try {
42
+ m = JSON.parse(raw);
43
+ }
44
+ catch {
45
+ return null;
46
+ }
47
+ if (!m || typeof m !== "object" || Array.isArray(m))
48
+ return null;
49
+ switch (m.type) {
50
+ case "hello": return word(m.token, 256) ? { type: "hello", token: m.token } : null;
51
+ case "mouse":
52
+ if (!["move", "down", "up"].includes(m.action) || !finite(m.x, LIMITS.coordinate) || !finite(m.y, LIMITS.coordinate) || !mods(m.modifiers))
53
+ return null;
54
+ if (m.button !== undefined && !["left", "middle", "right"].includes(m.button))
55
+ return null;
56
+ if (m.buttons !== undefined && !(Number.isInteger(m.buttons) && m.buttons >= 0 && m.buttons <= 31))
57
+ return null;
58
+ if (m.clickCount !== undefined && !(Number.isInteger(m.clickCount) && m.clickCount >= 0 && m.clickCount <= 3))
59
+ return null;
60
+ return { type: "mouse", action: m.action, x: m.x, y: m.y, ...(m.button ? { button: m.button } : {}), ...(m.buttons !== undefined ? { buttons: m.buttons } : {}), ...(m.clickCount !== undefined ? { clickCount: m.clickCount } : {}), ...(m.modifiers !== undefined ? { modifiers: m.modifiers } : {}) };
61
+ case "wheel":
62
+ if (!finite(m.x, LIMITS.coordinate) || !finite(m.y, LIMITS.coordinate) || !finite(m.deltaX, LIMITS.wheel) || !finite(m.deltaY, LIMITS.wheel) || !mods(m.modifiers))
63
+ return null;
64
+ return { type: "wheel", x: m.x, y: m.y, deltaX: m.deltaX, deltaY: m.deltaY, ...(m.modifiers !== undefined ? { modifiers: m.modifiers } : {}) };
65
+ case "key":
66
+ if (!["down", "up"].includes(m.action) || !word(m.key, LIMITS.key) || !bounded(m.code, LIMITS.key) || !mods(m.modifiers))
67
+ return null;
68
+ if (m.text !== undefined && (typeof m.text !== "string" || m.text.length > LIMITS.key))
69
+ return null;
70
+ if (m.windowsVirtualKeyCode !== undefined && !(Number.isInteger(m.windowsVirtualKeyCode) && m.windowsVirtualKeyCode >= 0 && m.windowsVirtualKeyCode <= 0xffff))
71
+ return null;
72
+ return { type: "key", action: m.action, key: m.key, code: m.code, ...(m.text !== undefined ? { text: m.text } : {}), ...(m.windowsVirtualKeyCode !== undefined ? { windowsVirtualKeyCode: m.windowsVirtualKeyCode } : {}), ...(m.modifiers !== undefined ? { modifiers: m.modifiers } : {}) };
73
+ case "text": return typeof m.text === "string" && m.text.length > 0 && m.text.length <= LIMITS.text ? { type: "text", text: m.text } : null;
74
+ case "nav":
75
+ if (m.action === "back" || m.action === "reload")
76
+ return { type: "nav", action: m.action };
77
+ return m.action === "url" && word(m.url, LIMITS.url) && viewerMayOpen(m.url) ? { type: "nav", action: "url", url: m.url } : null;
78
+ case "dialog":
79
+ if (typeof m.accept !== "boolean" || (m.promptText !== undefined && (typeof m.promptText !== "string" || m.promptText.length > LIMITS.promptText)))
80
+ return null;
81
+ return { type: "dialog", accept: m.accept, ...(m.promptText !== undefined ? { promptText: m.promptText } : {}) };
82
+ default: return null;
83
+ }
84
+ }
@@ -0,0 +1,6 @@
1
+ import type { BrowserProvider } from "../core/host.js";
2
+ import type { LiveViewHost } from "./server.js";
3
+ /** The provider with a live view: `liveView(ref)` reports the viewer's URL (to the host's `onSession`, the one place it goes), and a release kills the
4
+ * token before the provider's own release runs, so a session that is going away cannot be driven. Wrap the cdp provider with it, as the frame recorder
5
+ * wraps a provider with `watch`; the provider's own methods are untouched. */
6
+ export declare function liveViewProvider(provider: BrowserProvider, host: LiveViewHost): BrowserProvider;
@@ -0,0 +1,23 @@
1
+ /** The provider with a live view: `liveView(ref)` reports the viewer's URL (to the host's `onSession`, the one place it goes), and a release kills the
2
+ * token before the provider's own release runs, so a session that is going away cannot be driven. Wrap the cdp provider with it, as the frame recorder
3
+ * wraps a provider with `watch`; the provider's own methods are untouched. */
4
+ export function liveViewProvider(provider, host) {
5
+ const wrapped = Object.create(provider);
6
+ wrapped.liveView = async (ref) => {
7
+ const known = host.known(ref.tag);
8
+ if (known)
9
+ return known;
10
+ // A browser that cannot be reached has no view to give; the session's row still reaches the host without one.
11
+ try {
12
+ return await host.open(ref.tag, (await provider.attach(ref)).sdkCdpUrl);
13
+ }
14
+ catch {
15
+ return null;
16
+ }
17
+ };
18
+ wrapped.release = async (ref, signal) => {
19
+ await host.release(ref.tag);
20
+ await provider.release(ref, signal);
21
+ };
22
+ return wrapped;
23
+ }
@@ -0,0 +1,50 @@
1
+ import { type IncomingMessage, type ServerResponse } from "node:http";
2
+ import type { Duplex } from "node:stream";
3
+ import type { LiveView } from "../core/host.js";
4
+ import { type DrivingGates, type StreamFactory, type ViewerAssets } from "./protocol.js";
5
+ export type LiveViewOptions = {
6
+ /** The one origin allowed to frame the viewer (`frame-ancestors`). Null: none. Required, so the choice is never a default. */
7
+ hostOrigin: string | null;
8
+ /** Where the host mounts `handle` and `upgrade`, e.g. `https://host.example/live`. Its origin is the viewer's own origin, which an upgrade's Origin
9
+ * header must equal. Absent: the live view starts its own server on 127.0.0.1 (never 0.0.0.0), on an ephemeral port, at the first `open`. */
10
+ baseUrl?: string;
11
+ /** The screencast and input (stream.ts); the default is the package's own. A test passes a fake. */
12
+ stream?: StreamFactory;
13
+ /** The person/model mutex. Absent, the package's own process-wide registry (`drivingGates`, core/driving.ts), the one the toolset's model calls use, so a
14
+ * host passes nothing and person and model still never interleave. An override must be the SAME registry the toolset is given (`gates` on
15
+ * `createBrowserExtension`), or the two sides do not see each other:
16
+ * ```ts
17
+ * const gates = createDrivingGates({ idleMs: 5_000 });
18
+ * createLiveView({ hostOrigin, gates });
19
+ * createBrowserExtension({ ..., gates });
20
+ * ``` */
21
+ gates?: DrivingGates;
22
+ /** The viewer page (viewer.ts); the default is the package's own. */
23
+ viewer?: ViewerAssets;
24
+ /** How long a connection may stay silent before its hello, and how many may wait for one. */
25
+ helloTimeoutMs?: number;
26
+ maxPending?: number;
27
+ };
28
+ export type LiveViewHost = {
29
+ /** Serves the viewer page and its two static files; true when the request was this host's (mounted at `baseUrl`'s path), false when it was not. */
30
+ handle(req: IncomingMessage, res: ServerResponse): boolean;
31
+ /** Takes a WebSocket upgrade for a viewer; true when the request was this host's. A bad Origin or an unknown path id is refused here. */
32
+ upgrade(req: IncomingMessage, socket: Duplex, head: Buffer): boolean;
33
+ /** The viewer's URL for one session, with its token in the fragment. Idempotent per tag: the same URL until `release`. Only the host's `onSession`
34
+ * ever receives it. Nothing starts until a viewer authenticates. */
35
+ open(tag: string, cdpUrl: string): Promise<LiveView>;
36
+ /** The view `open` gave for a tag, or null: for a caller that must not start anything (`liveViewProvider` asks before it attaches). */
37
+ known(tag: string): LiveView | null;
38
+ /** True while a person is driving this session (viewer input within the gate's idle window): the frame recorder holds its capture meanwhile. */
39
+ driving(tag: string): boolean;
40
+ /** The token is dead, the viewer's socket closed, the stream and the gate ended. Idempotent. */
41
+ release(tag: string): Promise<void>;
42
+ /** What the host holds, for diagnostics and tests: the sessions with a viewer URL and the opens in flight. Neither grows with the sessions it once released. */
43
+ tracked(): {
44
+ sessions: number;
45
+ opening: number;
46
+ };
47
+ /** Releases every session and stops the server it started, if any. */
48
+ close(): Promise<void>;
49
+ };
50
+ export declare function createLiveView(options: LiveViewOptions): LiveViewHost;