crawlio-browser 1.4.6 → 1.4.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.
@@ -1,7 +1,7 @@
1
1
  // src/shared/constants.ts
2
2
  import { homedir } from "os";
3
3
  import { join } from "path";
4
- var PKG_VERSION = "1.4.6";
4
+ var PKG_VERSION = "1.4.8";
5
5
  var WS_PORT = 9333;
6
6
  var WS_HOST = "127.0.0.1";
7
7
  var CRAWLIO_PORT_FILE = join(
@@ -7,7 +7,7 @@ import {
7
7
  WS_PORT,
8
8
  WS_RECONNECT_GRACE,
9
9
  WS_STALE_THRESHOLD
10
- } from "./chunk-WJU4IGLN.js";
10
+ } from "./chunk-EYPPJZP7.js";
11
11
 
12
12
  // src/mcp-server/index.ts
13
13
  import { randomBytes as randomBytes2 } from "crypto";
@@ -446,11 +446,25 @@ var WebSocketBridge = class {
446
446
  } catch {
447
447
  }
448
448
  await new Promise((resolve2, reject) => {
449
- this.httpServer.once("error", (err) => reject(err));
450
- this.httpServer.listen(WS_PORT, WS_HOST, () => {
451
- console.error(`[Bridge] WebSocket server listening on ws://${WS_HOST}:${WS_PORT}`);
452
- resolve2();
453
- });
449
+ let attempts = 0;
450
+ const tryListen = () => {
451
+ const onError = (err) => {
452
+ if (err.code === "EADDRINUSE" && attempts < 3) {
453
+ attempts++;
454
+ console.error(`[Bridge] Port ${WS_PORT} still in use, retry ${attempts}/3...`);
455
+ setTimeout(tryListen, 1e3 * attempts);
456
+ } else {
457
+ reject(err);
458
+ }
459
+ };
460
+ this.httpServer.once("error", onError);
461
+ this.httpServer.listen(WS_PORT, WS_HOST, () => {
462
+ this.httpServer.removeListener("error", onError);
463
+ console.error(`[Bridge] WebSocket server listening on ws://${WS_HOST}:${WS_PORT}`);
464
+ resolve2();
465
+ });
466
+ };
467
+ tryListen();
454
468
  });
455
469
  }
456
470
  get isConnected() {
@@ -512,7 +526,15 @@ var WebSocketBridge = class {
512
526
  if (msg.success) {
513
527
  req.resolve(msg.data ?? {});
514
528
  } else {
515
- req.reject(new Error(msg.error ?? "Unknown extension error"));
529
+ const err = new Error(msg.error ?? "Unknown extension error");
530
+ const wire = msg;
531
+ if (wire.permission_required) {
532
+ const errObj = err;
533
+ errObj.permission_required = true;
534
+ errObj.missing = wire.missing;
535
+ errObj.suggestion = wire.suggestion;
536
+ }
537
+ req.reject(err);
516
538
  }
517
539
  this.pending.delete(msg.id);
518
540
  }
@@ -1421,7 +1443,7 @@ function createTools(bridge2, crawlio2) {
1421
1443
  // --- AI orchestration tools ---
1422
1444
  {
1423
1445
  name: "connect_tab",
1424
- description: "Connect to a browser tab for capture and interaction. Three modes: (1) provide a URL to find or create a tab, (2) provide a tabId to connect to a specific tab, (3) no args to connect to the active tab. Starts CDP capture automatically.",
1446
+ description: "Pin a specific browser tab for all subsequent commands. Optional \u2014 without this, tools auto-connect to the active tab. Three modes: (1) provide a URL to find or create a tab, (2) provide a tabId to connect to a specific tab, (3) no args to pin the active tab. Starts CDP capture automatically.",
1425
1447
  inputSchema: {
1426
1448
  type: "object",
1427
1449
  properties: {
@@ -4015,6 +4037,10 @@ function createCodeModeTools(bridge2, crawlio2) {
4015
4037
  return toolSuccess(result);
4016
4038
  } catch (error) {
4017
4039
  const msg = error instanceof Error ? error.message : String(error);
4040
+ if (error instanceof Error && error.permission_required) {
4041
+ const missing = error.missing;
4042
+ return toolError(formatPermissionDenial(missing, "execute"));
4043
+ }
4018
4044
  return toolError(`Execution error: ${msg}`);
4019
4045
  } finally {
4020
4046
  clearTimeout(timer);
@@ -4030,7 +4056,7 @@ function createCodeModeTools(bridge2, crawlio2) {
4030
4056
  process.title = "Crawlio Agent";
4031
4057
  var initMode = process.argv.includes("init") || process.argv.includes("--setup") || process.argv.includes("setup");
4032
4058
  if (initMode) {
4033
- const { runInit } = await import("./init-E233DCMN.js");
4059
+ const { runInit } = await import("./init-4LUNCDCD.js");
4034
4060
  await runInit(process.argv.slice(2));
4035
4061
  process.exit(0);
4036
4062
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PKG_VERSION
3
- } from "./chunk-WJU4IGLN.js";
3
+ } from "./chunk-EYPPJZP7.js";
4
4
 
5
5
  // src/mcp-server/init.ts
6
6
  import { execFileSync, spawn } from "child_process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crawlio-browser",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "MCP server with 96 CDP-backed tools for browser automation — screenshots, DOM, network capture, framework detection, cookies, storage, session recording, performance metrics via Chrome",
5
5
  "type": "module",
6
6
  "main": "dist/mcp-server/index.js",