browserclaw 0.2.7 → 0.2.8

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
@@ -1087,4 +1087,13 @@ declare class BrowserClaw {
1087
1087
  stop(): Promise<void>;
1088
1088
  }
1089
1089
 
1090
- export { type AriaNode, type AriaSnapshotResult, BrowserClaw, type BrowserTab, type ChromeExecutable, type ChromeKind, type ClickOptions, type ColorScheme, type ConnectOptions, type ConsoleMessage, type CookieData, CrawlPage, type DialogOptions, type DownloadResult, type FormField, type FrameEvalResult, type GeolocationOptions, type HttpCredentials, type LaunchOptions, type NetworkRequest, type PageError, type ResponseBodyResult, type RoleRefInfo, type RoleRefs, type ScreenshotOptions, type SnapshotOptions, type SnapshotResult, type SnapshotStats, type StorageKind, type TraceStartOptions, type TypeOptions, type UntrustedContentMeta, type WaitOptions };
1090
+ /**
1091
+ * Thrown when a navigation URL is blocked by SSRF policy.
1092
+ * Callers can catch this specifically to distinguish navigation blocks
1093
+ * from other errors.
1094
+ */
1095
+ declare class InvalidBrowserNavigationUrlError extends Error {
1096
+ constructor(message: string);
1097
+ }
1098
+
1099
+ export { type AriaNode, type AriaSnapshotResult, BrowserClaw, type BrowserTab, type ChromeExecutable, type ChromeKind, type ClickOptions, type ColorScheme, type ConnectOptions, type ConsoleMessage, type CookieData, CrawlPage, type DialogOptions, type DownloadResult, type FormField, type FrameEvalResult, type GeolocationOptions, type HttpCredentials, InvalidBrowserNavigationUrlError, type LaunchOptions, type NetworkRequest, type PageError, type ResponseBodyResult, type RoleRefInfo, type RoleRefs, type ScreenshotOptions, type SnapshotOptions, type SnapshotResult, type SnapshotStats, type StorageKind, type TraceStartOptions, type TypeOptions, type UntrustedContentMeta, type WaitOptions };
package/dist/index.d.ts CHANGED
@@ -1087,4 +1087,13 @@ declare class BrowserClaw {
1087
1087
  stop(): Promise<void>;
1088
1088
  }
1089
1089
 
1090
- export { type AriaNode, type AriaSnapshotResult, BrowserClaw, type BrowserTab, type ChromeExecutable, type ChromeKind, type ClickOptions, type ColorScheme, type ConnectOptions, type ConsoleMessage, type CookieData, CrawlPage, type DialogOptions, type DownloadResult, type FormField, type FrameEvalResult, type GeolocationOptions, type HttpCredentials, type LaunchOptions, type NetworkRequest, type PageError, type ResponseBodyResult, type RoleRefInfo, type RoleRefs, type ScreenshotOptions, type SnapshotOptions, type SnapshotResult, type SnapshotStats, type StorageKind, type TraceStartOptions, type TypeOptions, type UntrustedContentMeta, type WaitOptions };
1090
+ /**
1091
+ * Thrown when a navigation URL is blocked by SSRF policy.
1092
+ * Callers can catch this specifically to distinguish navigation blocks
1093
+ * from other errors.
1094
+ */
1095
+ declare class InvalidBrowserNavigationUrlError extends Error {
1096
+ constructor(message: string);
1097
+ }
1098
+
1099
+ export { type AriaNode, type AriaSnapshotResult, BrowserClaw, type BrowserTab, type ChromeExecutable, type ChromeKind, type ClickOptions, type ColorScheme, type ConnectOptions, type ConsoleMessage, type CookieData, CrawlPage, type DialogOptions, type DownloadResult, type FormField, type FrameEvalResult, type GeolocationOptions, type HttpCredentials, InvalidBrowserNavigationUrlError, type LaunchOptions, type NetworkRequest, type PageError, type ResponseBodyResult, type RoleRefInfo, type RoleRefs, type ScreenshotOptions, type SnapshotOptions, type SnapshotResult, type SnapshotStats, type StorageKind, type TraceStartOptions, type TypeOptions, type UntrustedContentMeta, type WaitOptions };
package/dist/index.js CHANGED
@@ -1378,6 +1378,12 @@ async function pressKeyViaPlaywright(opts) {
1378
1378
  ensurePageState(page);
1379
1379
  await page.keyboard.press(key, { delay: Math.max(0, Math.floor(opts.delayMs ?? 0)) });
1380
1380
  }
1381
+ var InvalidBrowserNavigationUrlError = class extends Error {
1382
+ constructor(message) {
1383
+ super(message);
1384
+ this.name = "InvalidBrowserNavigationUrlError";
1385
+ }
1386
+ };
1381
1387
  function assertSafeOutputPath(path2, allowedRoots) {
1382
1388
  if (!path2 || typeof path2 !== "string") {
1383
1389
  throw new Error("Output path is required.");
@@ -1522,7 +1528,7 @@ async function navigateViaPlaywright(opts) {
1522
1528
  const url = String(opts.url ?? "").trim();
1523
1529
  if (!url) throw new Error("url is required");
1524
1530
  if (!opts.allowInternal && await isInternalUrlResolved(url)) {
1525
- throw new Error(`Navigation to internal/loopback address blocked: "${url}". Set allowInternal: true if this is intentional.`);
1531
+ throw new InvalidBrowserNavigationUrlError(`Navigation to internal/loopback address blocked: "${url}". Set allowInternal: true if this is intentional.`);
1526
1532
  }
1527
1533
  const page = await getPageForTargetId({ cdpUrl: opts.cdpUrl, targetId: opts.targetId });
1528
1534
  ensurePageState(page);
@@ -1547,7 +1553,7 @@ async function listPagesViaPlaywright(opts) {
1547
1553
  async function createPageViaPlaywright(opts) {
1548
1554
  const targetUrl = (opts.url ?? "").trim() || "about:blank";
1549
1555
  if (targetUrl !== "about:blank" && !opts.allowInternal && await isInternalUrlResolved(targetUrl)) {
1550
- throw new Error(`Navigation to internal/loopback address blocked: "${targetUrl}". Set allowInternal: true if this is intentional.`);
1556
+ throw new InvalidBrowserNavigationUrlError(`Navigation to internal/loopback address blocked: "${targetUrl}". Set allowInternal: true if this is intentional.`);
1551
1557
  }
1552
1558
  const { browser } = await connectBrowser(opts.cdpUrl);
1553
1559
  const context = browser.contexts()[0] ?? await browser.newContext();
@@ -3063,6 +3069,6 @@ var BrowserClaw = class _BrowserClaw {
3063
3069
  }
3064
3070
  };
3065
3071
 
3066
- export { BrowserClaw, CrawlPage };
3072
+ export { BrowserClaw, CrawlPage, InvalidBrowserNavigationUrlError };
3067
3073
  //# sourceMappingURL=index.js.map
3068
3074
  //# sourceMappingURL=index.js.map