@orkestrel/browser 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -13
- package/dist/bin/main.js +11 -9
- package/dist/bin/main.js.map +1 -1
- package/dist/src/browser/index.d.ts +6 -184
- package/dist/src/browser/index.js +145 -119
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/core/index.cjs +2324 -1991
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +672 -1366
- package/dist/src/core/index.d.ts +672 -1366
- package/dist/src/core/index.js +2287 -1941
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +202 -211
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +65 -166
- package/dist/src/server/index.d.ts +65 -166
- package/dist/src/server/index.js +201 -205
- package/dist/src/server/index.js.map +1 -1
- package/package.json +7 -6
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { BrowserCallOptions } from '@orkestrel/browser';
|
|
2
2
|
import type { BrowserContextInterface } from '@orkestrel/browser';
|
|
3
|
-
import type { BrowserContextOptions } from '@orkestrel/browser';
|
|
4
3
|
import { BrowserError } from '@orkestrel/browser';
|
|
4
|
+
import type { BrowserIsolateOptions } from '@orkestrel/browser';
|
|
5
5
|
import type { BrowserJourney } from '@orkestrel/browser';
|
|
6
6
|
import type { BrowserJourneyRevision } from '@orkestrel/browser';
|
|
7
7
|
import type { BrowserJourneyStoreInterface } from '@orkestrel/browser';
|
|
8
|
+
import type { BrowserJourneyWriteOptions } from '@orkestrel/browser';
|
|
8
9
|
import type { BrowserPageInterface } from '@orkestrel/browser';
|
|
9
10
|
import type { BrowserPageOptions } from '@orkestrel/browser';
|
|
10
11
|
import type { BrowserRun } from '@orkestrel/browser';
|
|
@@ -12,7 +13,7 @@ import type { BrowserRunSlot } from '@orkestrel/browser';
|
|
|
12
13
|
import type { BrowserRunStoreInterface } from '@orkestrel/browser';
|
|
13
14
|
import type { BrowserStoreOptions } from '@orkestrel/browser';
|
|
14
15
|
import type { BrowserStorePage } from '@orkestrel/browser';
|
|
15
|
-
import type {
|
|
16
|
+
import type { BrowserStorePageOptions } from '@orkestrel/browser';
|
|
16
17
|
import type { BrowserViewport } from '@orkestrel/browser';
|
|
17
18
|
import type { BrowserWriterInterface } from '@orkestrel/browser';
|
|
18
19
|
import type { CDPTarget } from '@orkestrel/browser';
|
|
@@ -22,12 +23,10 @@ import type { ChildProcess } from 'node:child_process';
|
|
|
22
23
|
import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
23
24
|
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
24
25
|
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
25
|
-
import type { PoolToken } from '@orkestrel/pool';
|
|
26
26
|
import type { Readable } from 'node:stream';
|
|
27
27
|
import type { Result } from '@orkestrel/contract';
|
|
28
28
|
import type { StdioServerOptions } from '@orkestrel/mcp/server';
|
|
29
29
|
import type { ToolDefinition } from '@orkestrel/tool';
|
|
30
|
-
import type { ToolInterface } from '@orkestrel/tool';
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* Discovers, launches, connects to, and owns Chromium-family browser sessions.
|
|
@@ -59,7 +58,7 @@ export declare class Browser implements BrowserInterface {
|
|
|
59
58
|
disconnect(): Promise<void>;
|
|
60
59
|
context(index?: number): BrowserContextInterface | undefined;
|
|
61
60
|
contexts(): readonly BrowserContextInterface[];
|
|
62
|
-
isolate(options?:
|
|
61
|
+
isolate(options?: BrowserIsolateOptions): Promise<BrowserContextInterface>;
|
|
63
62
|
create(options?: BrowserPageOptions): Promise<BrowserPageInterface>;
|
|
64
63
|
destroy(): Promise<void>;
|
|
65
64
|
close(): Promise<void>;
|
|
@@ -197,7 +196,7 @@ export declare const BROWSER_RUN_DIRECTORY = "runs";
|
|
|
197
196
|
export declare const BROWSER_RUN_FILE = "run.json";
|
|
198
197
|
|
|
199
198
|
/** Names the refusal when every browser is admitted to a holder. */
|
|
200
|
-
export declare const BROWSER_SERVER_BUSY = "
|
|
199
|
+
export declare const BROWSER_SERVER_BUSY = "SERVER_BUSY";
|
|
201
200
|
|
|
202
201
|
/** Sets the default context capacity per browser, including the shared holder. */
|
|
203
202
|
export declare const BROWSER_SERVER_CONTEXTS = 2;
|
|
@@ -209,19 +208,19 @@ export declare const BROWSER_SERVER_CONTEXTS_LIMIT = 4;
|
|
|
209
208
|
export declare const BROWSER_SERVER_COPY: Readonly<Record<BrowserServerToolName, ToolDefinition>>;
|
|
210
209
|
|
|
211
210
|
/** Names the notice that a browser and its session state were lost. */
|
|
212
|
-
export declare const BROWSER_SERVER_CRASH = "
|
|
211
|
+
export declare const BROWSER_SERVER_CRASH = "SERVER_CRASH";
|
|
213
212
|
|
|
214
213
|
/** Names the diagnostic when the warm floor spends its restart bound. */
|
|
215
|
-
export declare const BROWSER_SERVER_EXHAUSTED = "
|
|
214
|
+
export declare const BROWSER_SERVER_EXHAUSTED = "SERVER_EXHAUSTED";
|
|
216
215
|
|
|
217
216
|
/** Names the refusal for an unknown or ended holder. */
|
|
218
|
-
export declare const BROWSER_SERVER_HOLDER = "
|
|
217
|
+
export declare const BROWSER_SERVER_HOLDER = "SERVER_HOLDER";
|
|
219
218
|
|
|
220
219
|
/** Names a failed attempt to warm a browser. */
|
|
221
|
-
export declare const BROWSER_SERVER_LAUNCH = "
|
|
220
|
+
export declare const BROWSER_SERVER_LAUNCH = "SERVER_LAUNCH";
|
|
222
221
|
|
|
223
222
|
/** Names a refused browser server option. */
|
|
224
|
-
export declare const BROWSER_SERVER_OPTIONS = "
|
|
223
|
+
export declare const BROWSER_SERVER_OPTIONS = "ARGUMENT";
|
|
225
224
|
|
|
226
225
|
/** Limits the number of warm browsers to 3. */
|
|
227
226
|
export declare const BROWSER_SERVER_POOL_LIMIT = 3;
|
|
@@ -236,16 +235,16 @@ export declare const BROWSER_SERVER_RECORD = "browse.json";
|
|
|
236
235
|
export declare const BROWSER_SERVER_RESTARTS = 1;
|
|
237
236
|
|
|
238
237
|
/** Names a failed profile sweep. */
|
|
239
|
-
export declare const BROWSER_SERVER_SWEEP = "
|
|
238
|
+
export declare const BROWSER_SERVER_SWEEP = "SERVER_SWEEP";
|
|
240
239
|
|
|
241
240
|
/** Names a failed browser server teardown. */
|
|
242
|
-
export declare const BROWSER_SERVER_TEARDOWN = "
|
|
241
|
+
export declare const BROWSER_SERVER_TEARDOWN = "SERVER_TEARDOWN";
|
|
243
242
|
|
|
244
243
|
/** Names the refusal when no browser can serve a call. */
|
|
245
|
-
export declare const BROWSER_SERVER_UNAVAILABLE = "
|
|
244
|
+
export declare const BROWSER_SERVER_UNAVAILABLE = "SERVER_UNAVAILABLE";
|
|
246
245
|
|
|
247
246
|
/** Names an interrupted call whose outcome is unknown. */
|
|
248
|
-
export declare const BROWSER_SERVER_UNRESOLVED = "
|
|
247
|
+
export declare const BROWSER_SERVER_UNRESOLVED = "SERVER_UNRESOLVED";
|
|
249
248
|
|
|
250
249
|
/** Names the per-OS default Playwright browser cache directory, relative to the home directory (win32 uses `LOCALAPPDATA` directly). */
|
|
251
250
|
export declare const BROWSER_STORE_CACHE_DIRS: Readonly<Record<string, string>>;
|
|
@@ -318,14 +317,6 @@ export declare interface BrowserCDPOptions {
|
|
|
318
317
|
/** Names how the browser connection was established. */
|
|
319
318
|
export declare type BrowserConnection = 'cdp' | 'launch' | 'persistent';
|
|
320
319
|
|
|
321
|
-
/**
|
|
322
|
-
* Reports that an operation was attempted after the browser wrapper was destroyed, under the
|
|
323
|
-
* code `BROWSER_DESTROYED_ERROR`.
|
|
324
|
-
*/
|
|
325
|
-
export declare class BrowserDestroyedError extends BrowserError {
|
|
326
|
-
constructor(context?: Readonly<Record<string, unknown>>);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
320
|
/**
|
|
330
321
|
* Describes the result of passive browser discovery.
|
|
331
322
|
*
|
|
@@ -479,7 +470,7 @@ export declare interface BrowserInterface {
|
|
|
479
470
|
* Creates and registers an isolated CDP context with validated proxy, download, origin,
|
|
480
471
|
* and emulation options.
|
|
481
472
|
*/
|
|
482
|
-
isolate(options?:
|
|
473
|
+
isolate(options?: BrowserIsolateOptions): Promise<BrowserContextInterface>;
|
|
483
474
|
/** Opens a page in the default context. */
|
|
484
475
|
create(options?: BrowserPageOptions): Promise<BrowserPageInterface>;
|
|
485
476
|
/**
|
|
@@ -518,9 +509,9 @@ export declare type BrowserLaunchFunction = (options: BrowserOptions) => Browser
|
|
|
518
509
|
* the Model Context Protocol on stdio, and warms Chromium at server start.
|
|
519
510
|
*
|
|
520
511
|
* @remarks
|
|
521
|
-
* The server's own manager holds one dispatcher per name of the vocabulary — `
|
|
522
|
-
* `
|
|
523
|
-
* `
|
|
512
|
+
* The server's own manager holds one dispatcher per name of the vocabulary — `read`, `click`,
|
|
513
|
+
* `type`, `press`, `navigate`, `wait`, `dialog`, `switch`, `record`, `save`, `journeys`, `edit`,
|
|
514
|
+
* `replay`, `forget`, and `capture` — each carrying the description, parameters, and annotations
|
|
524
515
|
* `BROWSER_TOOL_COPY` gives, so `tools/list` answers before Chromium starts and with Chromium
|
|
525
516
|
* absent. After the launch, a tool the toolset's manager adds under another name, such as a page
|
|
526
517
|
* tool it adopts, is mirrored as a dispatcher with that tool's definition, and the mirror is
|
|
@@ -557,7 +548,7 @@ export declare type BrowserLaunchFunction = (options: BrowserOptions) => Browser
|
|
|
557
548
|
* ```ts
|
|
558
549
|
* import { BrowserMCPServer } from '@orkestrel/browser/server'
|
|
559
550
|
*
|
|
560
|
-
* const server = new BrowserMCPServer({ root: 'tmp/browsers', readonly: true })
|
|
551
|
+
* const server = new BrowserMCPServer({ root: 'tmp/browsers', journeys: { readonly: true } })
|
|
561
552
|
* await server.start()
|
|
562
553
|
* await server.destroy()
|
|
563
554
|
* ```
|
|
@@ -580,7 +571,7 @@ export declare interface BrowserMCPServerInterface {
|
|
|
580
571
|
* Serves stdio, sweeps the profiles ended servers left, warms the pool, and resolves after the
|
|
581
572
|
* shared holder consumes a prepared context on a warm browser; the legacy handshake and every tool call await the same setup.
|
|
582
573
|
* Rejects with `BROWSER_SERVER_UNAVAILABLE` when no browser can serve and with
|
|
583
|
-
* `
|
|
574
|
+
* `CLOSED` after `destroy()`, and resolves when `destroy()` interrupts setup.
|
|
584
575
|
*/
|
|
585
576
|
start(): Promise<void>;
|
|
586
577
|
/**
|
|
@@ -595,15 +586,15 @@ export declare interface BrowserMCPServerInterface {
|
|
|
595
586
|
* @remarks
|
|
596
587
|
* - `root` — the directory the journeys, the runs, and the browser profiles live under, resolved
|
|
597
588
|
* against the working directory at construction. Default: `tmp/browsers`
|
|
598
|
-
* - `headless` — if `true`, launches Chromium without a window; if `false`, with one. Default:
|
|
589
|
+
* - `browser.headless` — if `true`, launches Chromium without a window; if `false`, with one. Default:
|
|
599
590
|
* `true`
|
|
600
|
-
* - `executable` — the path of the Chromium executable the server launches. Default: the browser
|
|
601
|
-
* `
|
|
602
|
-
* - `viewport` — the default viewport for every page in each browser's isolated context;
|
|
591
|
+
* - `browser.executable` — the path of the Chromium executable the server launches. Default: the first browser
|
|
592
|
+
* `findSystemBrowsers` finds
|
|
593
|
+
* - `browser.viewport` — the default viewport for every page in each browser's isolated context;
|
|
603
594
|
* omission keeps the browser's launch default
|
|
604
|
-
* - `readonly` — if `true`, refuses `record`, `save`, `edit`, and `forget`, and `replay` still writes runs;
|
|
595
|
+
* - `journeys.readonly` — if `true`, refuses `record`, `save`, `edit`, and `forget`, and `replay` still writes runs;
|
|
605
596
|
* if `false` or omitted, every tool runs
|
|
606
|
-
* - `launch` — creates each browser the pool warms. Default: `createBrowser`
|
|
597
|
+
* - `pool.launch` — creates each browser the pool warms. Default: `createBrowser`
|
|
607
598
|
* - `stdio` — the streams the server reads requests from and writes answers to; the end of
|
|
608
599
|
* `input` destroys the server. Default: `process.stdin` and `process.stdout`
|
|
609
600
|
* - `pool.size` — the integer number of browsers kept warm, from 1 through
|
|
@@ -611,31 +602,27 @@ export declare interface BrowserMCPServerInterface {
|
|
|
611
602
|
* - `pool.contexts` — the integer context capacity per browser, shared holder included, from 1
|
|
612
603
|
* through `BROWSER_SERVER_CONTEXTS_LIMIT`. Default: `BROWSER_SERVER_CONTEXTS`.
|
|
613
604
|
* - `log` — receives diagnostic lines. Default: `process.stderr`
|
|
614
|
-
* @throws Thrown when `pool.size` or `pool.contexts` is outside its range or is not an integer, with `
|
|
605
|
+
* @throws Thrown when `pool.size` or `pool.contexts` is outside its range or is not an integer, with `ARGUMENT`
|
|
615
606
|
*/
|
|
616
607
|
export declare interface BrowserMCPServerOptions {
|
|
617
608
|
readonly root?: string;
|
|
618
|
-
readonly
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
609
|
+
readonly browser?: {
|
|
610
|
+
readonly headless?: boolean;
|
|
611
|
+
readonly executable?: string;
|
|
612
|
+
readonly viewport?: BrowserViewport;
|
|
613
|
+
};
|
|
614
|
+
readonly journeys?: {
|
|
615
|
+
readonly readonly?: boolean;
|
|
616
|
+
};
|
|
623
617
|
readonly stdio?: StdioServerOptions;
|
|
624
618
|
readonly pool?: {
|
|
625
619
|
readonly size?: number;
|
|
626
620
|
readonly contexts?: number;
|
|
621
|
+
readonly launch?: BrowserLaunchFunction;
|
|
627
622
|
};
|
|
628
623
|
readonly log?: NodeJS.WritableStream;
|
|
629
624
|
}
|
|
630
625
|
|
|
631
|
-
/**
|
|
632
|
-
* Reports that an operation requiring an active connection was attempted while disconnected,
|
|
633
|
-
* under the code `BROWSER_NOT_CONNECTED_ERROR`.
|
|
634
|
-
*/
|
|
635
|
-
export declare class BrowserNotConnectedError extends BrowserError {
|
|
636
|
-
constructor(context?: Readonly<Record<string, unknown>>);
|
|
637
|
-
}
|
|
638
|
-
|
|
639
626
|
/**
|
|
640
627
|
* Describes the options for creating a `Browser` instance.
|
|
641
628
|
*
|
|
@@ -651,11 +638,8 @@ export declare class BrowserNotConnectedError extends BrowserError {
|
|
|
651
638
|
* - `viewport` — default viewport dimensions for new pages
|
|
652
639
|
* - `signal` — external AbortSignal for cancelling the connection attempt
|
|
653
640
|
* - `args` — additional command-line flags passed to the launched browser process
|
|
654
|
-
* - `engine` — preferred browser engine to launch; narrows system browser
|
|
655
|
-
* discovery to this engine (ignored when `executable` is given); takes
|
|
656
|
-
* precedence over `browsers.engine`
|
|
657
641
|
* - `browsers` — candidate-source overrides consulted when `connect()` needs
|
|
658
|
-
* to launch
|
|
642
|
+
* to launch, with `browsers.engine` selecting the engine; ignored when
|
|
659
643
|
* `executable` is given, which bypasses discovery entirely
|
|
660
644
|
*/
|
|
661
645
|
export declare interface BrowserOptions {
|
|
@@ -669,7 +653,6 @@ export declare interface BrowserOptions {
|
|
|
669
653
|
readonly viewport?: BrowserViewport;
|
|
670
654
|
readonly signal?: AbortSignal;
|
|
671
655
|
readonly args?: readonly string[];
|
|
672
|
-
readonly engine?: BrowserEngine;
|
|
673
656
|
readonly browsers?: SystemBrowserOptions;
|
|
674
657
|
}
|
|
675
658
|
|
|
@@ -698,62 +681,9 @@ export declare interface BrowserServerCatalog {
|
|
|
698
681
|
readonly tools: readonly ToolDefinition[];
|
|
699
682
|
}
|
|
700
683
|
|
|
701
|
-
/** Holds one prepared or assigned context generation and its downloads directory. */
|
|
702
|
-
export declare interface BrowserServerContext {
|
|
703
|
-
readonly context: BrowserContextInterface;
|
|
704
|
-
readonly toolset: BrowserToolsetInterface;
|
|
705
|
-
readonly directory: string;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/** Identifies one admitted browser lifetime independently of its current pool token. */
|
|
709
|
-
export declare interface BrowserServerHolder {
|
|
710
|
-
readonly id: string;
|
|
711
|
-
readonly purpose: string;
|
|
712
|
-
readonly abort: AbortController;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
/** Binds a holder generation to the exact browser lease reserved for its lifetime. */
|
|
716
|
-
export declare interface BrowserServerLease {
|
|
717
|
-
readonly token: PoolToken<BrowserSlot>;
|
|
718
|
-
readonly generation: BrowserServerContext;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/** Records a lost generation's cause and its own last URL. */
|
|
722
|
-
export declare interface BrowserServerLoss {
|
|
723
|
-
readonly cause: unknown;
|
|
724
|
-
readonly url: string;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/** Binds shared catalog subscriptions to the exact generation that published them. */
|
|
728
|
-
export declare interface BrowserServerMirror {
|
|
729
|
-
readonly lease: BrowserServerLease;
|
|
730
|
-
readonly added: (tool: ToolInterface) => void;
|
|
731
|
-
readonly removed: (tool: ToolInterface) => void;
|
|
732
|
-
readonly cleared: (tools: readonly ToolInterface[]) => void;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
684
|
/** Names the server tools that manage independent browser holders. */
|
|
736
685
|
export declare type BrowserServerToolName = 'acquire' | 'execute' | 'tools' | 'destroy';
|
|
737
686
|
|
|
738
|
-
/** Holds page subscriptions for one prepared or assigned context generation. */
|
|
739
|
-
export declare interface BrowserServerWatch {
|
|
740
|
-
readonly page: (page: BrowserPageInterface) => void;
|
|
741
|
-
readonly crashes: ReadonlyMap<BrowserPageInterface, () => void>;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
/** Holds one pooled browser and its exclusively owned profile. */
|
|
745
|
-
export declare interface BrowserSlot {
|
|
746
|
-
readonly browser: BrowserInterface;
|
|
747
|
-
readonly profile: string;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/** Holds the listeners and resolver of one browser slot's loss watch. */
|
|
751
|
-
export declare interface BrowserSlotWatch {
|
|
752
|
-
readonly resolve: (cause: unknown) => void;
|
|
753
|
-
readonly disconnect: () => void;
|
|
754
|
-
readonly subscription: Disposable;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
687
|
/** Names the lifecycle status of a browser wrapper. */
|
|
758
688
|
export declare type BrowserStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
759
689
|
|
|
@@ -801,7 +731,7 @@ export declare function createBrowser(options?: BrowserOptions): BrowserInterfac
|
|
|
801
731
|
* ```ts
|
|
802
732
|
* import { createBrowserMCPServer } from '@orkestrel/browser/server'
|
|
803
733
|
*
|
|
804
|
-
* const server = createBrowserMCPServer({ root: 'tmp/browsers', headless: true })
|
|
734
|
+
* const server = createBrowserMCPServer({ root: 'tmp/browsers', browser: { headless: true } })
|
|
805
735
|
* await server.start() // resolves after leasing a connected browser
|
|
806
736
|
* await server.destroy()
|
|
807
737
|
* ```
|
|
@@ -816,22 +746,6 @@ export declare function createBrowserMCPServer(options?: BrowserMCPServerOptions
|
|
|
816
746
|
*/
|
|
817
747
|
export declare function createBrowserProfile(path?: string): Promise<BrowserProfileResult>;
|
|
818
748
|
|
|
819
|
-
/**
|
|
820
|
-
* Creates a filesystem-backed `BrowserWriterInterface` that persists bytes through
|
|
821
|
-
* `node:fs/promises`.
|
|
822
|
-
*
|
|
823
|
-
* @returns A {@link BrowserWriterInterface} that persists bytes through `node:fs/promises`
|
|
824
|
-
*/
|
|
825
|
-
export declare function createBrowserWriter(): BrowserWriterInterface;
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* Creates a Node `WebSocket`-backed `CDPTransportInterface` for the given CDP debugger URL.
|
|
829
|
-
*
|
|
830
|
-
* @param options - The CDP WebSocket debugger URL (and optional timeout)
|
|
831
|
-
* @returns A {@link CDPTransportInterface}
|
|
832
|
-
*/
|
|
833
|
-
export declare function createCDPTransport(options: WebSocketCDPTransportOptions): CDPTransportInterface;
|
|
834
|
-
|
|
835
749
|
/**
|
|
836
750
|
* Creates a journey store over an existing filesystem root.
|
|
837
751
|
* @param options - Root and listing cap
|
|
@@ -850,6 +764,22 @@ export declare function createFileBrowserJourneyStore(options: FileBrowserStoreO
|
|
|
850
764
|
*/
|
|
851
765
|
export declare function createFileBrowserRunStore(options: FileBrowserStoreOptions): BrowserRunStoreInterface;
|
|
852
766
|
|
|
767
|
+
/**
|
|
768
|
+
* Creates a filesystem-backed `BrowserWriterInterface` that persists bytes through
|
|
769
|
+
* `node:fs/promises`.
|
|
770
|
+
*
|
|
771
|
+
* @returns A {@link BrowserWriterInterface} that persists bytes through `node:fs/promises`
|
|
772
|
+
*/
|
|
773
|
+
export declare function createFileBrowserWriter(): BrowserWriterInterface;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Creates a Node `WebSocket`-backed `CDPTransportInterface` for the given CDP debugger URL.
|
|
777
|
+
*
|
|
778
|
+
* @param options - The CDP WebSocket debugger URL (and optional timeout)
|
|
779
|
+
* @returns A {@link CDPTransportInterface}
|
|
780
|
+
*/
|
|
781
|
+
export declare function createWebSocketCDPTransport(options: WebSocketCDPTransportOptions): CDPTransportInterface;
|
|
782
|
+
|
|
853
783
|
/**
|
|
854
784
|
* Describes a browser loss with its code, cause, and the session state it invalidates.
|
|
855
785
|
* @param code - Browser server diagnostic code
|
|
@@ -857,18 +787,18 @@ export declare function createFileBrowserRunStore(options: FileBrowserStoreOptio
|
|
|
857
787
|
* @param url - The lost page's last URL, when known
|
|
858
788
|
* @returns The coded diagnostic and any operation-lifecycle guidance
|
|
859
789
|
* @example
|
|
860
|
-
* describeBrowserServerLoss('
|
|
790
|
+
* describeBrowserServerLoss('SERVER_UNAVAILABLE', new Error('Browser exited'))
|
|
861
791
|
*/
|
|
862
792
|
export declare function describeBrowserServerLoss(code: string, cause: unknown, url?: string): string;
|
|
863
793
|
|
|
864
794
|
/**
|
|
865
795
|
* Fetches the current CDP target list from a browser's `/json/list` endpoint, as a `Result`
|
|
866
|
-
* carrying either the targets or a coded `
|
|
796
|
+
* carrying either the targets or a coded `BrowserError`.
|
|
867
797
|
*
|
|
868
798
|
* @remarks
|
|
869
799
|
* The endpoint is a network boundary, so an unreachable host, a non-2xx
|
|
870
800
|
* response, and a body that is not a JSON array each come back as a failed
|
|
871
|
-
* `Result` carrying a coded `
|
|
801
|
+
* `Result` carrying a coded `BrowserError`. An entry missing a
|
|
872
802
|
* required string field is skipped rather than failing the whole list.
|
|
873
803
|
*
|
|
874
804
|
* @param port - Port the browser exposes its CDP endpoint on
|
|
@@ -898,12 +828,9 @@ export declare class FileBrowserJourneyStore implements BrowserJourneyStoreInter
|
|
|
898
828
|
#private;
|
|
899
829
|
constructor(options: FileBrowserStoreOptions);
|
|
900
830
|
get(name: string, options?: BrowserStoreOptions): Promise<BrowserJourneyRevision | undefined>;
|
|
901
|
-
set(journey: BrowserJourney,
|
|
831
|
+
set(journey: BrowserJourney, options?: BrowserJourneyWriteOptions): Promise<BrowserJourneyRevision>;
|
|
902
832
|
delete(name: string, options?: BrowserStoreOptions): Promise<void>;
|
|
903
|
-
list(options?:
|
|
904
|
-
readonly offset?: number;
|
|
905
|
-
readonly limit?: number;
|
|
906
|
-
}): Promise<BrowserStorePage<BrowserJourneyRevision>>;
|
|
833
|
+
list(options?: BrowserStorePageOptions): Promise<BrowserStorePage<BrowserJourneyRevision>>;
|
|
907
834
|
}
|
|
908
835
|
|
|
909
836
|
/**
|
|
@@ -913,22 +840,19 @@ export declare class FileBrowserJourneyStore implements BrowserJourneyStoreInter
|
|
|
913
840
|
* still refuses conflicting mutations and allocations from another process.
|
|
914
841
|
* @example
|
|
915
842
|
* const store = new FileBrowserRunStore({ root: directory })
|
|
916
|
-
* const slot = await store.
|
|
843
|
+
* const slot = await store.create('check-ready')
|
|
917
844
|
*/
|
|
918
845
|
export declare class FileBrowserRunStore implements BrowserRunStoreInterface {
|
|
919
846
|
#private;
|
|
920
847
|
constructor(options: FileBrowserStoreOptions);
|
|
921
|
-
|
|
922
|
-
|
|
848
|
+
write(bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string>;
|
|
849
|
+
create(name: string, options?: BrowserStoreOptions): Promise<BrowserRunSlot>;
|
|
923
850
|
get(name: string, id: string, options?: BrowserStoreOptions): Promise<BrowserRun | undefined>;
|
|
924
851
|
set(run: BrowserRun, options?: BrowserStoreOptions): Promise<void>;
|
|
925
852
|
capture(slot: BrowserRunSlot, name: string, bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string>;
|
|
926
853
|
delete(name: string, id: string, options?: BrowserStoreOptions): Promise<void>;
|
|
927
854
|
clear(name: string, options?: BrowserStoreOptions): Promise<number>;
|
|
928
|
-
list(name: string, options?:
|
|
929
|
-
readonly offset?: number;
|
|
930
|
-
readonly limit?: number;
|
|
931
|
-
}): Promise<BrowserStorePage<BrowserRun>>;
|
|
855
|
+
list(name: string, options?: BrowserStorePageOptions): Promise<BrowserStorePage<BrowserRun>>;
|
|
932
856
|
}
|
|
933
857
|
|
|
934
858
|
/**
|
|
@@ -979,15 +903,6 @@ export declare function findInstallPaths(paths: readonly string[]): readonly str
|
|
|
979
903
|
/** Searches one store base for the top-level `chromium` link and every `chromium-*` install, highest revision first. */
|
|
980
904
|
export declare function findStorePaths(base: string, platform: string): readonly string[];
|
|
981
905
|
|
|
982
|
-
/**
|
|
983
|
-
* Locates a Chrome/Chromium/Edge executable on this machine — the first entry
|
|
984
|
-
* of {@link findSystemBrowsers}.
|
|
985
|
-
*
|
|
986
|
-
* @param options - Overrides for the candidate sources; see {@link SystemBrowserOptions}
|
|
987
|
-
* @returns The first discovered browser, or undefined
|
|
988
|
-
*/
|
|
989
|
-
export declare function findSystemBrowser(options?: SystemBrowserOptions): SystemBrowser | undefined;
|
|
990
|
-
|
|
991
906
|
/**
|
|
992
907
|
* Enumerates every Chrome/Chromium/Edge executable discoverable on this
|
|
993
908
|
* machine, deduplicated by normalized absolute path.
|
|
@@ -1022,22 +937,6 @@ export declare function findSystemBrowsers(options?: SystemBrowserOptions): read
|
|
|
1022
937
|
*/
|
|
1023
938
|
export declare function formatBrowserLockEntry(pid: number, token: string): string;
|
|
1024
939
|
|
|
1025
|
-
/**
|
|
1026
|
-
* Narrows an unknown value to a `BrowserDestroyedError`.
|
|
1027
|
-
*
|
|
1028
|
-
* @param value - Value to check
|
|
1029
|
-
* @returns True if value is a BrowserDestroyedError instance; false otherwise
|
|
1030
|
-
*/
|
|
1031
|
-
export declare function isBrowserDestroyedError(value: unknown): value is BrowserDestroyedError;
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
* Narrows an unknown value to a `BrowserNotConnectedError`.
|
|
1035
|
-
*
|
|
1036
|
-
* @param value - Value to check
|
|
1037
|
-
* @returns True if value is a BrowserNotConnectedError instance; false otherwise
|
|
1038
|
-
*/
|
|
1039
|
-
export declare function isBrowserNotConnectedError(value: unknown): value is BrowserNotConnectedError;
|
|
1040
|
-
|
|
1041
940
|
/**
|
|
1042
941
|
* Launches a browser process with raw-CDP debugging flags.
|
|
1043
942
|
*
|
|
@@ -1167,7 +1066,7 @@ export declare function removeBrowserProfile(profile: BrowserProfileResult): Pro
|
|
|
1167
1066
|
* Represents one discovered browser executable on this machine.
|
|
1168
1067
|
*
|
|
1169
1068
|
* @remarks
|
|
1170
|
-
* Returned by `findSystemBrowsers
|
|
1069
|
+
* Returned by `findSystemBrowsers` — pairs the resolved
|
|
1171
1070
|
* absolute executable path with its classified engine.
|
|
1172
1071
|
*/
|
|
1173
1072
|
export declare type SystemBrowser = {
|
|
@@ -1176,7 +1075,7 @@ export declare type SystemBrowser = {
|
|
|
1176
1075
|
};
|
|
1177
1076
|
|
|
1178
1077
|
/**
|
|
1179
|
-
* Describes the options overriding
|
|
1078
|
+
* Describes the options overriding the candidate sources for `findSystemBrowsers`.
|
|
1180
1079
|
*
|
|
1181
1080
|
* @remarks
|
|
1182
1081
|
* Each field replaces the default candidate list for its category — a field
|