browserclaw 0.5.8 → 0.6.0

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/dist/index.d.cts CHANGED
@@ -1,8 +1,6 @@
1
- import * as playwright_core from 'playwright-core';
2
1
  import { BrowserContext, Page, CDPSession } from 'playwright-core';
3
- import * as node_dns from 'node:dns';
4
- import { lookup as lookup$1 } from 'node:dns';
5
- import { lookup } from 'node:dns/promises';
2
+ import { lookup } from 'node:dns';
3
+ import { lookup as lookup$1 } from 'node:dns/promises';
6
4
 
7
5
  /** A single action within a batch. */
8
6
  type BatchAction = {
@@ -58,11 +56,11 @@ type BatchAction = {
58
56
  timeoutMs?: number;
59
57
  } | {
60
58
  kind: 'fill';
61
- fields: Array<{
59
+ fields: {
62
60
  ref: string;
63
61
  type?: string;
64
62
  value?: string | number | boolean;
65
- }>;
63
+ }[];
66
64
  targetId?: string;
67
65
  timeoutMs?: number;
68
66
  } | {
@@ -551,7 +549,7 @@ interface ContextState {
551
549
  interface PinnedHostname {
552
550
  hostname: string;
553
551
  addresses: string[];
554
- lookup: typeof node_dns.lookup;
552
+ lookup: typeof lookup;
555
553
  }
556
554
 
557
555
  /**
@@ -925,7 +923,7 @@ declare class CrawlPage {
925
923
  type?: 'png' | 'jpeg';
926
924
  }): Promise<{
927
925
  buffer: Buffer;
928
- labels: Array<{
926
+ labels: {
929
927
  ref: string;
930
928
  index: number;
931
929
  box: {
@@ -934,7 +932,7 @@ declare class CrawlPage {
934
932
  width: number;
935
933
  height: number;
936
934
  };
937
- }>;
935
+ }[];
938
936
  skipped: string[];
939
937
  }>;
940
938
  /**
@@ -1022,7 +1020,7 @@ declare class CrawlPage {
1022
1020
  *
1023
1021
  * @returns Array of cookie objects
1024
1022
  */
1025
- cookies(): Promise<Awaited<ReturnType<playwright_core.BrowserContext['cookies']>>>;
1023
+ cookies(): Promise<Awaited<ReturnType<BrowserContext['cookies']>>>;
1026
1024
  /**
1027
1025
  * Set a cookie in the browser context.
1028
1026
  *
@@ -1296,7 +1294,7 @@ declare function isChromeReachable(cdpUrl: string, timeoutMs?: number, authToken
1296
1294
  declare function getChromeWebSocketUrl(cdpUrl: string, timeoutMs?: number, authToken?: string): Promise<string | null>;
1297
1295
  declare function isChromeCdpReady(cdpUrl: string, timeoutMs?: number, handshakeTimeoutMs?: number): Promise<boolean>;
1298
1296
 
1299
- type LookupFn = typeof lookup;
1297
+ type LookupFn = typeof lookup$1;
1300
1298
  /**
1301
1299
  * Thrown when a navigation URL is blocked by SSRF policy.
1302
1300
  * Callers can catch this specifically to distinguish navigation blocks
@@ -1306,14 +1304,14 @@ declare class InvalidBrowserNavigationUrlError extends Error {
1306
1304
  constructor(message: string);
1307
1305
  }
1308
1306
  /** Options for browser navigation SSRF policy. */
1309
- type BrowserNavigationPolicyOptions = {
1307
+ interface BrowserNavigationPolicyOptions {
1310
1308
  ssrfPolicy?: SsrfPolicy;
1311
- };
1309
+ }
1312
1310
  /** Playwright-compatible request interface for redirect chain inspection. */
1313
- type BrowserNavigationRequestLike = {
1311
+ interface BrowserNavigationRequestLike {
1314
1312
  url(): string;
1315
1313
  redirectedFrom(): BrowserNavigationRequestLike | null;
1316
- };
1314
+ }
1317
1315
  /** Build a BrowserNavigationPolicyOptions from an SsrfPolicy. */
1318
1316
  declare function withBrowserNavigationPolicy(ssrfPolicy?: SsrfPolicy): BrowserNavigationPolicyOptions;
1319
1317
  /**
@@ -1323,8 +1321,8 @@ declare function withBrowserNavigationPolicy(ssrfPolicy?: SsrfPolicy): BrowserNa
1323
1321
  declare function createPinnedLookup(params: {
1324
1322
  hostname: string;
1325
1323
  addresses: string[];
1326
- fallback?: typeof lookup$1;
1327
- }): typeof lookup$1;
1324
+ fallback?: typeof lookup;
1325
+ }): typeof lookup;
1328
1326
  /**
1329
1327
  * Resolve DNS for a hostname and validate resolved addresses against SSRF policy.
1330
1328
  * Returns a PinnedHostname with pre-resolved addresses and a pinned lookup function.
@@ -1401,14 +1399,12 @@ declare class BrowserTabNotFoundError extends Error {
1401
1399
  declare function withPlaywrightPageCdpSession<T>(page: Page, fn: (session: CDPSession) => Promise<T>): Promise<T>;
1402
1400
  /**
1403
1401
  * Run a function with a page-scoped CDP client.
1404
- * For extension relay endpoints, routes through the raw CDP websocket.
1405
- * Otherwise, uses a Playwright CDP session.
1406
1402
  */
1407
1403
  declare function withPageScopedCdpClient<T>(opts: {
1408
1404
  cdpUrl: string;
1409
1405
  page: Page;
1410
1406
  targetId?: string;
1411
- fn: (send: (method: string, params?: Record<string, unknown>) => Promise<any>) => Promise<T>;
1407
+ fn: (send: (method: string, params?: Record<string, unknown>) => Promise<unknown>) => Promise<T>;
1412
1408
  }): Promise<T>;
1413
1409
  declare function ensureContextState(context: BrowserContext): ContextState;
1414
1410
  /**
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import * as playwright_core from 'playwright-core';
2
1
  import { BrowserContext, Page, CDPSession } from 'playwright-core';
3
- import * as node_dns from 'node:dns';
4
- import { lookup as lookup$1 } from 'node:dns';
5
- import { lookup } from 'node:dns/promises';
2
+ import { lookup } from 'node:dns';
3
+ import { lookup as lookup$1 } from 'node:dns/promises';
6
4
 
7
5
  /** A single action within a batch. */
8
6
  type BatchAction = {
@@ -58,11 +56,11 @@ type BatchAction = {
58
56
  timeoutMs?: number;
59
57
  } | {
60
58
  kind: 'fill';
61
- fields: Array<{
59
+ fields: {
62
60
  ref: string;
63
61
  type?: string;
64
62
  value?: string | number | boolean;
65
- }>;
63
+ }[];
66
64
  targetId?: string;
67
65
  timeoutMs?: number;
68
66
  } | {
@@ -551,7 +549,7 @@ interface ContextState {
551
549
  interface PinnedHostname {
552
550
  hostname: string;
553
551
  addresses: string[];
554
- lookup: typeof node_dns.lookup;
552
+ lookup: typeof lookup;
555
553
  }
556
554
 
557
555
  /**
@@ -925,7 +923,7 @@ declare class CrawlPage {
925
923
  type?: 'png' | 'jpeg';
926
924
  }): Promise<{
927
925
  buffer: Buffer;
928
- labels: Array<{
926
+ labels: {
929
927
  ref: string;
930
928
  index: number;
931
929
  box: {
@@ -934,7 +932,7 @@ declare class CrawlPage {
934
932
  width: number;
935
933
  height: number;
936
934
  };
937
- }>;
935
+ }[];
938
936
  skipped: string[];
939
937
  }>;
940
938
  /**
@@ -1022,7 +1020,7 @@ declare class CrawlPage {
1022
1020
  *
1023
1021
  * @returns Array of cookie objects
1024
1022
  */
1025
- cookies(): Promise<Awaited<ReturnType<playwright_core.BrowserContext['cookies']>>>;
1023
+ cookies(): Promise<Awaited<ReturnType<BrowserContext['cookies']>>>;
1026
1024
  /**
1027
1025
  * Set a cookie in the browser context.
1028
1026
  *
@@ -1296,7 +1294,7 @@ declare function isChromeReachable(cdpUrl: string, timeoutMs?: number, authToken
1296
1294
  declare function getChromeWebSocketUrl(cdpUrl: string, timeoutMs?: number, authToken?: string): Promise<string | null>;
1297
1295
  declare function isChromeCdpReady(cdpUrl: string, timeoutMs?: number, handshakeTimeoutMs?: number): Promise<boolean>;
1298
1296
 
1299
- type LookupFn = typeof lookup;
1297
+ type LookupFn = typeof lookup$1;
1300
1298
  /**
1301
1299
  * Thrown when a navigation URL is blocked by SSRF policy.
1302
1300
  * Callers can catch this specifically to distinguish navigation blocks
@@ -1306,14 +1304,14 @@ declare class InvalidBrowserNavigationUrlError extends Error {
1306
1304
  constructor(message: string);
1307
1305
  }
1308
1306
  /** Options for browser navigation SSRF policy. */
1309
- type BrowserNavigationPolicyOptions = {
1307
+ interface BrowserNavigationPolicyOptions {
1310
1308
  ssrfPolicy?: SsrfPolicy;
1311
- };
1309
+ }
1312
1310
  /** Playwright-compatible request interface for redirect chain inspection. */
1313
- type BrowserNavigationRequestLike = {
1311
+ interface BrowserNavigationRequestLike {
1314
1312
  url(): string;
1315
1313
  redirectedFrom(): BrowserNavigationRequestLike | null;
1316
- };
1314
+ }
1317
1315
  /** Build a BrowserNavigationPolicyOptions from an SsrfPolicy. */
1318
1316
  declare function withBrowserNavigationPolicy(ssrfPolicy?: SsrfPolicy): BrowserNavigationPolicyOptions;
1319
1317
  /**
@@ -1323,8 +1321,8 @@ declare function withBrowserNavigationPolicy(ssrfPolicy?: SsrfPolicy): BrowserNa
1323
1321
  declare function createPinnedLookup(params: {
1324
1322
  hostname: string;
1325
1323
  addresses: string[];
1326
- fallback?: typeof lookup$1;
1327
- }): typeof lookup$1;
1324
+ fallback?: typeof lookup;
1325
+ }): typeof lookup;
1328
1326
  /**
1329
1327
  * Resolve DNS for a hostname and validate resolved addresses against SSRF policy.
1330
1328
  * Returns a PinnedHostname with pre-resolved addresses and a pinned lookup function.
@@ -1401,14 +1399,12 @@ declare class BrowserTabNotFoundError extends Error {
1401
1399
  declare function withPlaywrightPageCdpSession<T>(page: Page, fn: (session: CDPSession) => Promise<T>): Promise<T>;
1402
1400
  /**
1403
1401
  * Run a function with a page-scoped CDP client.
1404
- * For extension relay endpoints, routes through the raw CDP websocket.
1405
- * Otherwise, uses a Playwright CDP session.
1406
1402
  */
1407
1403
  declare function withPageScopedCdpClient<T>(opts: {
1408
1404
  cdpUrl: string;
1409
1405
  page: Page;
1410
1406
  targetId?: string;
1411
- fn: (send: (method: string, params?: Record<string, unknown>) => Promise<any>) => Promise<T>;
1407
+ fn: (send: (method: string, params?: Record<string, unknown>) => Promise<unknown>) => Promise<T>;
1412
1408
  }): Promise<T>;
1413
1409
  declare function ensureContextState(context: BrowserContext): ContextState;
1414
1410
  /**