@orkestrel/browser 0.0.23 → 0.0.25

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.
@@ -22,9 +22,12 @@ import type { ChildProcess } from 'node:child_process';
22
22
  import type { EmitterErrorHandler } from '@orkestrel/emitter';
23
23
  import type { EmitterHooks } from '@orkestrel/emitter';
24
24
  import type { EmitterInterface } from '@orkestrel/emitter';
25
+ import type { PoolToken } from '@orkestrel/pool';
25
26
  import type { Readable } from 'node:stream';
26
27
  import type { Result } from '@orkestrel/contract';
27
28
  import type { StdioServerOptions } from '@orkestrel/mcp/server';
29
+ import type { ToolDefinition } from '@orkestrel/tool';
30
+ import type { ToolInterface } from '@orkestrel/tool';
28
31
 
29
32
  /**
30
33
  * Discovers, launches, connects to, and owns Chromium-family browser sessions.
@@ -157,7 +160,13 @@ export declare const BROWSER_JOURNEY_SNAPSHOT_FILE = "journey.json";
157
160
  */
158
161
  export declare const BROWSER_KILL_GRACE_MS = 3000;
159
162
 
160
- /** Lists the flags always passed to a launched browser process, alongside the caller's own. */
163
+ /**
164
+ * Lists the flags always passed to a launched browser process, alongside the caller's own.
165
+ *
166
+ * @remarks
167
+ * Disables account sync so extension installs cannot reset URL loader factories during page imports.
168
+ * Edge can still sign a fresh Windows profile in to the operating-system account.
169
+ */
161
170
  export declare const BROWSER_LAUNCH_ARGS: readonly string[];
162
171
 
163
172
  /**
@@ -185,12 +194,27 @@ export declare const BROWSER_RUN_DIRECTORY = "runs";
185
194
  /** Names the persisted run snapshot. */
186
195
  export declare const BROWSER_RUN_FILE = "run.json";
187
196
 
197
+ /** Names the refusal when every browser is admitted to a holder. */
198
+ export declare const BROWSER_SERVER_BUSY = "BROWSER_SERVER_BUSY";
199
+
200
+ /** Sets the default context capacity per browser, including the shared holder. */
201
+ export declare const BROWSER_SERVER_CONTEXTS = 2;
202
+
203
+ /** Limits context capacity to the largest measured per-browser count. */
204
+ export declare const BROWSER_SERVER_CONTEXTS_LIMIT = 4;
205
+
206
+ /** Defines the holder tools independently of the shared browser's vocabulary. */
207
+ export declare const BROWSER_SERVER_COPY: Readonly<Record<BrowserServerToolName, ToolDefinition>>;
208
+
188
209
  /** Names the notice that a browser and its session state were lost. */
189
210
  export declare const BROWSER_SERVER_CRASH = "BROWSER_SERVER_CRASH";
190
211
 
191
212
  /** Names the diagnostic when the warm floor spends its restart bound. */
192
213
  export declare const BROWSER_SERVER_EXHAUSTED = "BROWSER_SERVER_EXHAUSTED";
193
214
 
215
+ /** Names the refusal for an unknown or ended holder. */
216
+ export declare const BROWSER_SERVER_HOLDER = "BROWSER_SERVER_HOLDER";
217
+
194
218
  /** Names a failed attempt to warm a browser. */
195
219
  export declare const BROWSER_SERVER_LAUNCH = "BROWSER_SERVER_LAUNCH";
196
220
 
@@ -482,7 +506,7 @@ export declare interface BrowserInterface {
482
506
  * Creates a browser a browse server connects while warming its pool.
483
507
  *
484
508
  * @param options - The launch the server composes: `headless`, `executable`, the profile it
485
- * owns, `cdp.discover` set to `false`, and the signal its `destroy()` aborts
509
+ * owns, the optional `viewport`, `cdp.discover` set to `false`, and the signal its `destroy()` aborts
486
510
  * @returns A browser whose `connect()` launches it
487
511
  */
488
512
  export declare type BrowserLaunchFunction = (options: BrowserOptions) => BrowserInterface;
@@ -499,21 +523,28 @@ export declare type BrowserLaunchFunction = (options: BrowserOptions) => Browser
499
523
  * absent. After the launch, a tool the toolset's manager adds under another name, such as a page
500
524
  * tool it adopts, is mirrored as a dispatcher with that tool's definition, and the mirror is
501
525
  * removed when the toolset withdraws the tool, so the server's tool list changes and a subscribed
502
- * client is notified. Startup warms the pool and leases one validated browser. The legacy
503
- * handshake and every tool call await that setup; concurrent callers share a replacement lease.
526
+ * client is notified. The server also advertises `acquire`, `execute`, `tools`, and `destroy` with
527
+ * `BROWSER_SERVER_COPY`. Startup warms the pool and assigns a prepared context to the shared holder. The legacy
528
+ * handshake and browser calls await that setup. Named holders each own a lease, a pending grant,
529
+ * and loss notices; concurrent calls on a holder share its replacement grant. Ending a holder
530
+ * closes its context and releases its lease, and admission counts that holder until disposal settles.
504
531
  * A launch creates `ROOT/.profiles/PID-UUID/` exclusively, connects a browser that never attaches to an
505
532
  * existing endpoint, opens one page in an isolated context, and constructs the page toolset with
506
533
  * that context and the file journey and run stores under the root, on a manager the toolset owns.
507
534
  * A dispatcher forwards its arguments and the call's context, signal included, to the toolset's
508
535
  * manager and returns that manager's value, or rejects with its failure message; a text value
509
536
  * reaches the client as one text block rather than as its JSON text.
510
- * A disconnect or current-page crash retires its slot. A failed call receives a liveness ping;
537
+ * A disconnect retires its browser and every hosted generation. A current-page crash retires only
538
+ * that holder's context. A failed call receives a liveness ping;
511
539
  * loss makes its outcome unresolved, while a known success remains successful. Pending losses
512
540
  * prefix the next outcome on a successor, or a refusal, and calls are never repeated.
541
+ * Concurrent checks share one ping per slot. Cancelling a call ends only its wait; the ping keeps
542
+ * its deadline and records loss for the next call.
513
543
  *
514
544
  * `start()` serves stdio and destroys the server at the end of its input, on `SIGINT`, and on
515
545
  * `SIGTERM`. `destroy()` stops reading requests and removes every dispatcher, then destroys every
516
- * slot through the pool — its toolset, which aborts the active replay, then its browser, then its
546
+ * slot through the pool — each toolset, which aborts its active replay, then its context and downloads,
547
+ * then its browser and its
517
548
  * profile — and rechecks the profile folders this server made or kept.
518
549
  *
519
550
  * Chromium on Linux refuses to start as the root user unless its sandbox is disabled, so a server
@@ -545,7 +576,7 @@ export declare class BrowserMCPServer implements BrowserMCPServerInterface {
545
576
  export declare interface BrowserMCPServerInterface {
546
577
  /**
547
578
  * Serves stdio, sweeps the profiles ended servers left, warms the pool, and resolves after the
548
- * session leases a warm browser; the legacy handshake and every tool call await the same setup.
579
+ * shared holder consumes a prepared context on a warm browser; the legacy handshake and every tool call await the same setup.
549
580
  * Rejects with `BROWSER_SERVER_UNAVAILABLE` when no browser can serve and with
550
581
  * `BROWSER_TOOLSET_ENDED` after `destroy()`, and resolves when `destroy()` interrupts setup.
551
582
  */
@@ -566,6 +597,8 @@ export declare interface BrowserMCPServerInterface {
566
597
  * `true`
567
598
  * - `executable` — the path of the Chromium executable the server launches. Default: the browser
568
599
  * `findSystemBrowser` finds
600
+ * - `viewport` — the default viewport for every page in each browser's isolated context;
601
+ * omission keeps the browser's launch default
569
602
  * - `readonly` — if `true`, refuses `record`, `save`, `edit`, and `forget`, and `replay` still writes runs;
570
603
  * if `false` or omitted, every tool runs
571
604
  * - `launch` — creates each browser the pool warms. Default: `createBrowser`
@@ -573,18 +606,22 @@ export declare interface BrowserMCPServerInterface {
573
606
  * `input` destroys the server. Default: `process.stdin` and `process.stdout`
574
607
  * - `pool.size` — the integer number of browsers kept warm, from 1 through
575
608
  * `BROWSER_SERVER_POOL_LIMIT`. Default: `BROWSER_SERVER_POOL_SIZE`.
609
+ * - `pool.contexts` — the integer context capacity per browser, shared holder included, from 1
610
+ * through `BROWSER_SERVER_CONTEXTS_LIMIT`. Default: `BROWSER_SERVER_CONTEXTS`.
576
611
  * - `log` — receives diagnostic lines. Default: `process.stderr`
577
- * @throws Thrown when `pool.size` is outside that range or is not an integer, with `BROWSER_SERVER_OPTIONS`
612
+ * @throws Thrown when `pool.size` or `pool.contexts` is outside its range or is not an integer, with `BROWSER_SERVER_OPTIONS`
578
613
  */
579
614
  export declare interface BrowserMCPServerOptions {
580
615
  readonly root?: string;
581
616
  readonly headless?: boolean;
582
617
  readonly executable?: string;
618
+ readonly viewport?: BrowserViewport;
583
619
  readonly readonly?: boolean;
584
620
  readonly launch?: BrowserLaunchFunction;
585
621
  readonly stdio?: StdioServerOptions;
586
622
  readonly pool?: {
587
623
  readonly size?: number;
624
+ readonly contexts?: number;
588
625
  };
589
626
  readonly log?: NodeJS.WritableStream;
590
627
  }
@@ -653,20 +690,65 @@ export declare interface BrowserProfileResult {
653
690
  readonly temporary: boolean;
654
691
  }
655
692
 
656
- /** Holds one warm browser a browse server owns: the browser, its profile, its isolated context, and its started toolset. */
693
+ /** Describes the JSON catalog returned by the holder tools. */
694
+ export declare interface BrowserServerCatalog {
695
+ readonly holder: string;
696
+ readonly tools: readonly ToolDefinition[];
697
+ }
698
+
699
+ /** Holds one prepared or assigned context generation and its downloads directory. */
700
+ export declare interface BrowserServerContext {
701
+ readonly context: BrowserContextInterface;
702
+ readonly toolset: BrowserToolsetInterface;
703
+ readonly directory: string;
704
+ }
705
+
706
+ /** Identifies one admitted browser lifetime independently of its current pool token. */
707
+ export declare interface BrowserServerHolder {
708
+ readonly id: string;
709
+ readonly purpose: string;
710
+ readonly abort: AbortController;
711
+ }
712
+
713
+ /** Binds a holder generation to the exact browser lease reserved for its lifetime. */
714
+ export declare interface BrowserServerLease {
715
+ readonly token: PoolToken<BrowserSlot>;
716
+ readonly generation: BrowserServerContext;
717
+ }
718
+
719
+ /** Records a lost generation's cause and its own last URL. */
720
+ export declare interface BrowserServerLoss {
721
+ readonly cause: unknown;
722
+ readonly url: string;
723
+ }
724
+
725
+ /** Binds shared catalog subscriptions to the exact generation that published them. */
726
+ export declare interface BrowserServerMirror {
727
+ readonly lease: BrowserServerLease;
728
+ readonly added: (tool: ToolInterface) => void;
729
+ readonly removed: (tool: ToolInterface) => void;
730
+ readonly cleared: (tools: readonly ToolInterface[]) => void;
731
+ }
732
+
733
+ /** Names the server tools that manage independent browser holders. */
734
+ export declare type BrowserServerToolName = 'acquire' | 'execute' | 'tools' | 'destroy';
735
+
736
+ /** Holds page subscriptions for one prepared or assigned context generation. */
737
+ export declare interface BrowserServerWatch {
738
+ readonly page: (page: BrowserPageInterface) => void;
739
+ readonly crashes: ReadonlyMap<BrowserPageInterface, () => void>;
740
+ }
741
+
742
+ /** Holds one pooled browser and its exclusively owned profile. */
657
743
  export declare interface BrowserSlot {
658
744
  readonly browser: BrowserInterface;
659
745
  readonly profile: string;
660
- readonly context: BrowserContextInterface;
661
- readonly toolset: BrowserToolsetInterface;
662
746
  }
663
747
 
664
748
  /** Holds the listeners and resolver of one browser slot's loss watch. */
665
749
  export declare interface BrowserSlotWatch {
666
750
  readonly resolve: (cause: unknown) => void;
667
751
  readonly disconnect: () => void;
668
- readonly page: (page: BrowserPageInterface) => void;
669
- readonly crashes: ReadonlyMap<BrowserPageInterface, () => void>;
670
752
  readonly subscription: Disposable;
671
753
  }
672
754
 
@@ -825,6 +907,8 @@ export declare class FileBrowserJourneyStore implements BrowserJourneyStoreInter
825
907
  /**
826
908
  * Persists runs and captures only in directories allocated by this instance.
827
909
  * @remarks Requires an existing root. Reopened stores can read and delete saved runs.
910
+ * Allocations of one journey share a process-local queue across instances; the filesystem lock
911
+ * still refuses conflicting mutations and allocations from another process.
828
912
  * @example
829
913
  * const store = new FileBrowserRunStore({ root: directory })
830
914
  * const slot = await store.open('check-ready')
@@ -832,6 +916,7 @@ export declare class FileBrowserJourneyStore implements BrowserJourneyStoreInter
832
916
  export declare class FileBrowserRunStore implements BrowserRunStoreInterface {
833
917
  #private;
834
918
  constructor(options: FileBrowserStoreOptions);
919
+ snapshot(bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string>;
835
920
  open(name: string, options?: BrowserStoreOptions): Promise<BrowserRunSlot>;
836
921
  get(name: string, id: string, options?: BrowserStoreOptions): Promise<BrowserRun | undefined>;
837
922
  set(run: BrowserRun, options?: BrowserStoreOptions): Promise<void>;
@@ -1003,6 +1088,15 @@ export declare function parseBrowserLockEntry(name: string): number | undefined;
1003
1088
  */
1004
1089
  export declare function parseBrowserProfileRecord(text: string): BrowserProfileRecord | undefined;
1005
1090
 
1091
+ /**
1092
+ * Parses positive integer viewport dimensions in WIDTHxHEIGHT form.
1093
+ * @param value - The viewport environment variable, or undefined when unset
1094
+ * @returns The viewport, or undefined when absent or malformed
1095
+ * @example
1096
+ * parseBrowserViewport('1280x720') // { width: 1280, height: 720 }
1097
+ */
1098
+ export declare function parseBrowserViewport(value: string | undefined): BrowserViewport | undefined;
1099
+
1006
1100
  /** Probes PATH (`which`/`where`) for every resolvable command name, in the given order. */
1007
1101
  export declare function probePathNames(names: readonly string[], platform: string): readonly string[];
1008
1102
 
@@ -22,9 +22,12 @@ import type { ChildProcess } from 'node:child_process';
22
22
  import type { EmitterErrorHandler } from '@orkestrel/emitter';
23
23
  import type { EmitterHooks } from '@orkestrel/emitter';
24
24
  import type { EmitterInterface } from '@orkestrel/emitter';
25
+ import type { PoolToken } from '@orkestrel/pool';
25
26
  import type { Readable } from 'node:stream';
26
27
  import type { Result } from '@orkestrel/contract';
27
28
  import type { StdioServerOptions } from '@orkestrel/mcp/server';
29
+ import type { ToolDefinition } from '@orkestrel/tool';
30
+ import type { ToolInterface } from '@orkestrel/tool';
28
31
 
29
32
  /**
30
33
  * Discovers, launches, connects to, and owns Chromium-family browser sessions.
@@ -157,7 +160,13 @@ export declare const BROWSER_JOURNEY_SNAPSHOT_FILE = "journey.json";
157
160
  */
158
161
  export declare const BROWSER_KILL_GRACE_MS = 3000;
159
162
 
160
- /** Lists the flags always passed to a launched browser process, alongside the caller's own. */
163
+ /**
164
+ * Lists the flags always passed to a launched browser process, alongside the caller's own.
165
+ *
166
+ * @remarks
167
+ * Disables account sync so extension installs cannot reset URL loader factories during page imports.
168
+ * Edge can still sign a fresh Windows profile in to the operating-system account.
169
+ */
161
170
  export declare const BROWSER_LAUNCH_ARGS: readonly string[];
162
171
 
163
172
  /**
@@ -185,12 +194,27 @@ export declare const BROWSER_RUN_DIRECTORY = "runs";
185
194
  /** Names the persisted run snapshot. */
186
195
  export declare const BROWSER_RUN_FILE = "run.json";
187
196
 
197
+ /** Names the refusal when every browser is admitted to a holder. */
198
+ export declare const BROWSER_SERVER_BUSY = "BROWSER_SERVER_BUSY";
199
+
200
+ /** Sets the default context capacity per browser, including the shared holder. */
201
+ export declare const BROWSER_SERVER_CONTEXTS = 2;
202
+
203
+ /** Limits context capacity to the largest measured per-browser count. */
204
+ export declare const BROWSER_SERVER_CONTEXTS_LIMIT = 4;
205
+
206
+ /** Defines the holder tools independently of the shared browser's vocabulary. */
207
+ export declare const BROWSER_SERVER_COPY: Readonly<Record<BrowserServerToolName, ToolDefinition>>;
208
+
188
209
  /** Names the notice that a browser and its session state were lost. */
189
210
  export declare const BROWSER_SERVER_CRASH = "BROWSER_SERVER_CRASH";
190
211
 
191
212
  /** Names the diagnostic when the warm floor spends its restart bound. */
192
213
  export declare const BROWSER_SERVER_EXHAUSTED = "BROWSER_SERVER_EXHAUSTED";
193
214
 
215
+ /** Names the refusal for an unknown or ended holder. */
216
+ export declare const BROWSER_SERVER_HOLDER = "BROWSER_SERVER_HOLDER";
217
+
194
218
  /** Names a failed attempt to warm a browser. */
195
219
  export declare const BROWSER_SERVER_LAUNCH = "BROWSER_SERVER_LAUNCH";
196
220
 
@@ -482,7 +506,7 @@ export declare interface BrowserInterface {
482
506
  * Creates a browser a browse server connects while warming its pool.
483
507
  *
484
508
  * @param options - The launch the server composes: `headless`, `executable`, the profile it
485
- * owns, `cdp.discover` set to `false`, and the signal its `destroy()` aborts
509
+ * owns, the optional `viewport`, `cdp.discover` set to `false`, and the signal its `destroy()` aborts
486
510
  * @returns A browser whose `connect()` launches it
487
511
  */
488
512
  export declare type BrowserLaunchFunction = (options: BrowserOptions) => BrowserInterface;
@@ -499,21 +523,28 @@ export declare type BrowserLaunchFunction = (options: BrowserOptions) => Browser
499
523
  * absent. After the launch, a tool the toolset's manager adds under another name, such as a page
500
524
  * tool it adopts, is mirrored as a dispatcher with that tool's definition, and the mirror is
501
525
  * removed when the toolset withdraws the tool, so the server's tool list changes and a subscribed
502
- * client is notified. Startup warms the pool and leases one validated browser. The legacy
503
- * handshake and every tool call await that setup; concurrent callers share a replacement lease.
526
+ * client is notified. The server also advertises `acquire`, `execute`, `tools`, and `destroy` with
527
+ * `BROWSER_SERVER_COPY`. Startup warms the pool and assigns a prepared context to the shared holder. The legacy
528
+ * handshake and browser calls await that setup. Named holders each own a lease, a pending grant,
529
+ * and loss notices; concurrent calls on a holder share its replacement grant. Ending a holder
530
+ * closes its context and releases its lease, and admission counts that holder until disposal settles.
504
531
  * A launch creates `ROOT/.profiles/PID-UUID/` exclusively, connects a browser that never attaches to an
505
532
  * existing endpoint, opens one page in an isolated context, and constructs the page toolset with
506
533
  * that context and the file journey and run stores under the root, on a manager the toolset owns.
507
534
  * A dispatcher forwards its arguments and the call's context, signal included, to the toolset's
508
535
  * manager and returns that manager's value, or rejects with its failure message; a text value
509
536
  * reaches the client as one text block rather than as its JSON text.
510
- * A disconnect or current-page crash retires its slot. A failed call receives a liveness ping;
537
+ * A disconnect retires its browser and every hosted generation. A current-page crash retires only
538
+ * that holder's context. A failed call receives a liveness ping;
511
539
  * loss makes its outcome unresolved, while a known success remains successful. Pending losses
512
540
  * prefix the next outcome on a successor, or a refusal, and calls are never repeated.
541
+ * Concurrent checks share one ping per slot. Cancelling a call ends only its wait; the ping keeps
542
+ * its deadline and records loss for the next call.
513
543
  *
514
544
  * `start()` serves stdio and destroys the server at the end of its input, on `SIGINT`, and on
515
545
  * `SIGTERM`. `destroy()` stops reading requests and removes every dispatcher, then destroys every
516
- * slot through the pool — its toolset, which aborts the active replay, then its browser, then its
546
+ * slot through the pool — each toolset, which aborts its active replay, then its context and downloads,
547
+ * then its browser and its
517
548
  * profile — and rechecks the profile folders this server made or kept.
518
549
  *
519
550
  * Chromium on Linux refuses to start as the root user unless its sandbox is disabled, so a server
@@ -545,7 +576,7 @@ export declare class BrowserMCPServer implements BrowserMCPServerInterface {
545
576
  export declare interface BrowserMCPServerInterface {
546
577
  /**
547
578
  * Serves stdio, sweeps the profiles ended servers left, warms the pool, and resolves after the
548
- * session leases a warm browser; the legacy handshake and every tool call await the same setup.
579
+ * shared holder consumes a prepared context on a warm browser; the legacy handshake and every tool call await the same setup.
549
580
  * Rejects with `BROWSER_SERVER_UNAVAILABLE` when no browser can serve and with
550
581
  * `BROWSER_TOOLSET_ENDED` after `destroy()`, and resolves when `destroy()` interrupts setup.
551
582
  */
@@ -566,6 +597,8 @@ export declare interface BrowserMCPServerInterface {
566
597
  * `true`
567
598
  * - `executable` — the path of the Chromium executable the server launches. Default: the browser
568
599
  * `findSystemBrowser` finds
600
+ * - `viewport` — the default viewport for every page in each browser's isolated context;
601
+ * omission keeps the browser's launch default
569
602
  * - `readonly` — if `true`, refuses `record`, `save`, `edit`, and `forget`, and `replay` still writes runs;
570
603
  * if `false` or omitted, every tool runs
571
604
  * - `launch` — creates each browser the pool warms. Default: `createBrowser`
@@ -573,18 +606,22 @@ export declare interface BrowserMCPServerInterface {
573
606
  * `input` destroys the server. Default: `process.stdin` and `process.stdout`
574
607
  * - `pool.size` — the integer number of browsers kept warm, from 1 through
575
608
  * `BROWSER_SERVER_POOL_LIMIT`. Default: `BROWSER_SERVER_POOL_SIZE`.
609
+ * - `pool.contexts` — the integer context capacity per browser, shared holder included, from 1
610
+ * through `BROWSER_SERVER_CONTEXTS_LIMIT`. Default: `BROWSER_SERVER_CONTEXTS`.
576
611
  * - `log` — receives diagnostic lines. Default: `process.stderr`
577
- * @throws Thrown when `pool.size` is outside that range or is not an integer, with `BROWSER_SERVER_OPTIONS`
612
+ * @throws Thrown when `pool.size` or `pool.contexts` is outside its range or is not an integer, with `BROWSER_SERVER_OPTIONS`
578
613
  */
579
614
  export declare interface BrowserMCPServerOptions {
580
615
  readonly root?: string;
581
616
  readonly headless?: boolean;
582
617
  readonly executable?: string;
618
+ readonly viewport?: BrowserViewport;
583
619
  readonly readonly?: boolean;
584
620
  readonly launch?: BrowserLaunchFunction;
585
621
  readonly stdio?: StdioServerOptions;
586
622
  readonly pool?: {
587
623
  readonly size?: number;
624
+ readonly contexts?: number;
588
625
  };
589
626
  readonly log?: NodeJS.WritableStream;
590
627
  }
@@ -653,20 +690,65 @@ export declare interface BrowserProfileResult {
653
690
  readonly temporary: boolean;
654
691
  }
655
692
 
656
- /** Holds one warm browser a browse server owns: the browser, its profile, its isolated context, and its started toolset. */
693
+ /** Describes the JSON catalog returned by the holder tools. */
694
+ export declare interface BrowserServerCatalog {
695
+ readonly holder: string;
696
+ readonly tools: readonly ToolDefinition[];
697
+ }
698
+
699
+ /** Holds one prepared or assigned context generation and its downloads directory. */
700
+ export declare interface BrowserServerContext {
701
+ readonly context: BrowserContextInterface;
702
+ readonly toolset: BrowserToolsetInterface;
703
+ readonly directory: string;
704
+ }
705
+
706
+ /** Identifies one admitted browser lifetime independently of its current pool token. */
707
+ export declare interface BrowserServerHolder {
708
+ readonly id: string;
709
+ readonly purpose: string;
710
+ readonly abort: AbortController;
711
+ }
712
+
713
+ /** Binds a holder generation to the exact browser lease reserved for its lifetime. */
714
+ export declare interface BrowserServerLease {
715
+ readonly token: PoolToken<BrowserSlot>;
716
+ readonly generation: BrowserServerContext;
717
+ }
718
+
719
+ /** Records a lost generation's cause and its own last URL. */
720
+ export declare interface BrowserServerLoss {
721
+ readonly cause: unknown;
722
+ readonly url: string;
723
+ }
724
+
725
+ /** Binds shared catalog subscriptions to the exact generation that published them. */
726
+ export declare interface BrowserServerMirror {
727
+ readonly lease: BrowserServerLease;
728
+ readonly added: (tool: ToolInterface) => void;
729
+ readonly removed: (tool: ToolInterface) => void;
730
+ readonly cleared: (tools: readonly ToolInterface[]) => void;
731
+ }
732
+
733
+ /** Names the server tools that manage independent browser holders. */
734
+ export declare type BrowserServerToolName = 'acquire' | 'execute' | 'tools' | 'destroy';
735
+
736
+ /** Holds page subscriptions for one prepared or assigned context generation. */
737
+ export declare interface BrowserServerWatch {
738
+ readonly page: (page: BrowserPageInterface) => void;
739
+ readonly crashes: ReadonlyMap<BrowserPageInterface, () => void>;
740
+ }
741
+
742
+ /** Holds one pooled browser and its exclusively owned profile. */
657
743
  export declare interface BrowserSlot {
658
744
  readonly browser: BrowserInterface;
659
745
  readonly profile: string;
660
- readonly context: BrowserContextInterface;
661
- readonly toolset: BrowserToolsetInterface;
662
746
  }
663
747
 
664
748
  /** Holds the listeners and resolver of one browser slot's loss watch. */
665
749
  export declare interface BrowserSlotWatch {
666
750
  readonly resolve: (cause: unknown) => void;
667
751
  readonly disconnect: () => void;
668
- readonly page: (page: BrowserPageInterface) => void;
669
- readonly crashes: ReadonlyMap<BrowserPageInterface, () => void>;
670
752
  readonly subscription: Disposable;
671
753
  }
672
754
 
@@ -825,6 +907,8 @@ export declare class FileBrowserJourneyStore implements BrowserJourneyStoreInter
825
907
  /**
826
908
  * Persists runs and captures only in directories allocated by this instance.
827
909
  * @remarks Requires an existing root. Reopened stores can read and delete saved runs.
910
+ * Allocations of one journey share a process-local queue across instances; the filesystem lock
911
+ * still refuses conflicting mutations and allocations from another process.
828
912
  * @example
829
913
  * const store = new FileBrowserRunStore({ root: directory })
830
914
  * const slot = await store.open('check-ready')
@@ -832,6 +916,7 @@ export declare class FileBrowserJourneyStore implements BrowserJourneyStoreInter
832
916
  export declare class FileBrowserRunStore implements BrowserRunStoreInterface {
833
917
  #private;
834
918
  constructor(options: FileBrowserStoreOptions);
919
+ snapshot(bytes: Uint8Array, options?: BrowserStoreOptions): Promise<string>;
835
920
  open(name: string, options?: BrowserStoreOptions): Promise<BrowserRunSlot>;
836
921
  get(name: string, id: string, options?: BrowserStoreOptions): Promise<BrowserRun | undefined>;
837
922
  set(run: BrowserRun, options?: BrowserStoreOptions): Promise<void>;
@@ -1003,6 +1088,15 @@ export declare function parseBrowserLockEntry(name: string): number | undefined;
1003
1088
  */
1004
1089
  export declare function parseBrowserProfileRecord(text: string): BrowserProfileRecord | undefined;
1005
1090
 
1091
+ /**
1092
+ * Parses positive integer viewport dimensions in WIDTHxHEIGHT form.
1093
+ * @param value - The viewport environment variable, or undefined when unset
1094
+ * @returns The viewport, or undefined when absent or malformed
1095
+ * @example
1096
+ * parseBrowserViewport('1280x720') // { width: 1280, height: 720 }
1097
+ */
1098
+ export declare function parseBrowserViewport(value: string | undefined): BrowserViewport | undefined;
1099
+
1006
1100
  /** Probes PATH (`which`/`where`) for every resolvable command name, in the given order. */
1007
1101
  export declare function probePathNames(names: readonly string[], platform: string): readonly string[];
1008
1102