@mearl/browser-core 3.1.0 → 3.1.2

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.
@@ -269,8 +269,9 @@ export interface ControlSessionInfo {
269
269
  reason?: string;
270
270
  }
271
271
  export interface BrowserReleaseParams {
272
- /** Close only session-created pages; attached user pages are protected. */
272
+ /** Defaults to closing session-created pages. Attached pages are always kept. */
273
273
  closeCreatedTabs?: boolean;
274
+ /** Exempt these session-created pages from closing. */
274
275
  keepTabIds?: number[];
275
276
  /** Preserve the browser environment by default for a scoped release. */
276
277
  preserveEnvironment?: boolean;
@@ -331,6 +331,15 @@ export function clickElementViaJS(expectedText) {
331
331
  let ancestor = node.parentElement;
332
332
  while (ancestor && ancestor !== document.documentElement) {
333
333
  const style = getComputedStyle(ancestor);
334
+ if (ancestor === document.body) {
335
+ // The body's overflow can apply to the viewport instead of its own box.
336
+ const root = getComputedStyle(document.documentElement);
337
+ if ((!root.overflowX || root.overflowX === 'visible') &&
338
+ (!root.overflowY || root.overflowY === 'visible') &&
339
+ (!root.contain || root.contain === 'none') &&
340
+ (!style.contain || style.contain === 'none'))
341
+ break;
342
+ }
334
343
  const clipsX = /^(auto|scroll|hidden|clip)$/.test(style.overflowX || '');
335
344
  const clipsY = /^(auto|scroll|hidden|clip)$/.test(style.overflowY || '');
336
345
  if (clipsX || clipsY) {
@@ -678,6 +687,15 @@ export function clickElementBySelector(selector, invalidSelectorHint) {
678
687
  let ancestor = node.parentElement;
679
688
  while (ancestor && ancestor !== document.documentElement) {
680
689
  const style = getComputedStyle(ancestor);
690
+ if (ancestor === document.body) {
691
+ // The body's overflow can apply to the viewport instead of its own box.
692
+ const root = getComputedStyle(document.documentElement);
693
+ if ((!root.overflowX || root.overflowX === 'visible') &&
694
+ (!root.overflowY || root.overflowY === 'visible') &&
695
+ (!root.contain || root.contain === 'none') &&
696
+ (!style.contain || style.contain === 'none'))
697
+ break;
698
+ }
681
699
  const clipsX = /^(auto|scroll|hidden|clip)$/.test(style.overflowX || '');
682
700
  const clipsY = /^(auto|scroll|hidden|clip)$/.test(style.overflowY || '');
683
701
  if (clipsX || clipsY) {
@@ -1012,6 +1030,15 @@ export function getClickCoordsFromSelector(selector, invalidSelectorHint) {
1012
1030
  let ancestor = node.parentElement;
1013
1031
  while (ancestor && ancestor !== document.documentElement) {
1014
1032
  const style = getComputedStyle(ancestor);
1033
+ if (ancestor === document.body) {
1034
+ // The body's overflow can apply to the viewport instead of its own box.
1035
+ const root = getComputedStyle(document.documentElement);
1036
+ if ((!root.overflowX || root.overflowX === 'visible') &&
1037
+ (!root.overflowY || root.overflowY === 'visible') &&
1038
+ (!root.contain || root.contain === 'none') &&
1039
+ (!style.contain || style.contain === 'none'))
1040
+ break;
1041
+ }
1015
1042
  const clipsX = /^(auto|scroll|hidden|clip)$/.test(style.overflowX || '');
1016
1043
  const clipsY = /^(auto|scroll|hidden|clip)$/.test(style.overflowY || '');
1017
1044
  if (clipsX || clipsY) {
@@ -1261,6 +1288,15 @@ export function getClickCoordsFromNode(expectedText) {
1261
1288
  let ancestor = node.parentElement;
1262
1289
  while (ancestor && ancestor !== document.documentElement) {
1263
1290
  const style = getComputedStyle(ancestor);
1291
+ if (ancestor === document.body) {
1292
+ // The body's overflow can apply to the viewport instead of its own box.
1293
+ const root = getComputedStyle(document.documentElement);
1294
+ if ((!root.overflowX || root.overflowX === 'visible') &&
1295
+ (!root.overflowY || root.overflowY === 'visible') &&
1296
+ (!root.contain || root.contain === 'none') &&
1297
+ (!style.contain || style.contain === 'none'))
1298
+ break;
1299
+ }
1264
1300
  const clipsX = /^(auto|scroll|hidden|clip)$/.test(style.overflowX || '');
1265
1301
  const clipsY = /^(auto|scroll|hidden|clip)$/.test(style.overflowY || '');
1266
1302
  if (clipsX || clipsY) {
@@ -3,6 +3,27 @@ import { type AgentServiceActionMap } from './agentServiceProtocol.js';
3
3
  import type { BrowserEnhancementRequest, BrowserEnhancementResponse } from './browserEnhancement.js';
4
4
  import { type ToolboxServiceActionMap, type ToolboxTaskRequest, type ToolboxTaskResponse } from './toolbox.js';
5
5
  export declare const EXTENSION_RPC_VERSION = 1;
6
+ export interface PageUploadTransfer {
7
+ id: string;
8
+ deadline: number;
9
+ files: Array<{
10
+ filename: string;
11
+ bytes: number;
12
+ }>;
13
+ }
14
+ export interface PageUploadChunkRequest {
15
+ id: string;
16
+ tabId: number;
17
+ fileIndex: number;
18
+ offset: number;
19
+ }
20
+ export interface PageUploadChunk {
21
+ base64: string;
22
+ bytes: number;
23
+ totalBytes: number;
24
+ }
25
+ export declare const PAGE_UPLOAD_TRANSFER_MAX_BYTES: number;
26
+ export declare const PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS = 180000;
6
27
  export type OperationRequest<M> = {
7
28
  [O in keyof M]: M[O] extends {
8
29
  request: infer R;
@@ -323,6 +344,7 @@ export declare const HOST_TO_EXTENSION_ACTIONS: {
323
344
  export declare function isHostToExtensionAction(value: unknown): value is keyof HostToExtensionActionMap;
324
345
  /** These services originate in the extension background, not a runtime UI message. */
325
346
  export declare const EXTENSION_BACKGROUND_ACTIONS: {
347
+ readonly page_upload_chunk: true;
326
348
  readonly preset_installation: true;
327
349
  readonly preset_browser_transfer: true;
328
350
  readonly app_profile_catalog: true;
@@ -1,6 +1,8 @@
1
1
  import { isAgentServiceAction } from './agentServiceProtocol.js';
2
2
  import { isToolboxServiceAction, } from './toolbox.js';
3
3
  export const EXTENSION_RPC_VERSION = 1;
4
+ export const PAGE_UPLOAD_TRANSFER_MAX_BYTES = 256 * 1024 * 1024;
5
+ export const PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS = 180_000;
4
6
  export const BROWSER_MANAGEMENT_ACTIONS = {
5
7
  browser_sessions: true,
6
8
  browser_instances: true,
@@ -45,6 +47,7 @@ export function isHostToExtensionAction(value) {
45
47
  }
46
48
  /** These services originate in the extension background, not a runtime UI message. */
47
49
  export const EXTENSION_BACKGROUND_ACTIONS = {
50
+ page_upload_chunk: true,
48
51
  preset_installation: true,
49
52
  preset_browser_transfer: true,
50
53
  app_profile_catalog: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/browser-core",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Shared pure-logic utilities for Mearl — usable in both browser extension and Node.js environments",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",