crawlio-browser 1.4.5 → 1.4.7

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.5";
4
+ var PKG_VERSION = "1.4.7";
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-3UA6NXNB.js";
10
+ } from "./chunk-RA3LVVKH.js";
11
11
 
12
12
  // src/mcp-server/index.ts
13
13
  import { randomBytes as randomBytes2 } from "crypto";
@@ -512,7 +512,15 @@ var WebSocketBridge = class {
512
512
  if (msg.success) {
513
513
  req.resolve(msg.data ?? {});
514
514
  } else {
515
- req.reject(new Error(msg.error ?? "Unknown extension error"));
515
+ const err = new Error(msg.error ?? "Unknown extension error");
516
+ const wire = msg;
517
+ if (wire.permission_required) {
518
+ const errObj = err;
519
+ errObj.permission_required = true;
520
+ errObj.missing = wire.missing;
521
+ errObj.suggestion = wire.suggestion;
522
+ }
523
+ req.reject(err);
516
524
  }
517
525
  this.pending.delete(msg.id);
518
526
  }
@@ -1266,7 +1274,7 @@ var TOOL_TIMEOUTS = {
1266
1274
  get_frame_tree: 1e4,
1267
1275
  switch_to_frame: 5e3,
1268
1276
  switch_to_main_frame: 5e3,
1269
- create_tab: 1e4,
1277
+ create_tab: 2e4,
1270
1278
  close_tab: 5e3,
1271
1279
  switch_tab: 5e3,
1272
1280
  set_cookie: 5e3,
@@ -2156,25 +2164,28 @@ function createTools(bridge2, crawlio2) {
2156
2164
  // --- Tab management tools (AC-3) ---
2157
2165
  {
2158
2166
  name: "create_tab",
2159
- description: "Create a new browser tab with the given URL. Returns the new tab's ID, URL, and title. The tab is created but not automatically connected \u2014 use connect_tab to attach CDP.",
2167
+ description: "Create a new browser tab with the given URL. Pass connect:true to auto-attach CDP and start capturing \u2014 the tab is immediately ready for interaction (screenshot, evaluate, navigate, etc).",
2160
2168
  inputSchema: {
2161
2169
  type: "object",
2162
2170
  properties: {
2163
2171
  url: { type: "string", description: "URL to open in the new tab" },
2164
- active: { type: "boolean", description: "Whether to make the new tab active/focused (default: true)" }
2172
+ active: { type: "boolean", description: "Whether to make the new tab active/focused (default: true)" },
2173
+ connect: { type: "boolean", description: "Auto-connect CDP debugger after creation \u2014 tab is ready for interaction immediately (default: false)" }
2165
2174
  },
2166
2175
  required: ["url"]
2167
2176
  },
2168
2177
  handler: async (args) => {
2169
2178
  const schema = z.object({
2170
2179
  url: urlSchema,
2171
- active: z.boolean().default(true)
2180
+ active: z.boolean().default(true),
2181
+ connect: z.boolean().default(false)
2172
2182
  });
2173
2183
  const parsed = schema.parse(args);
2174
2184
  const data = await bridge2.send({
2175
2185
  type: "create_tab",
2176
2186
  url: parsed.url,
2177
- active: parsed.active
2187
+ active: parsed.active,
2188
+ connect: parsed.connect
2178
2189
  }, TOOL_TIMEOUTS.create_tab);
2179
2190
  return toolSuccess(data);
2180
2191
  }
@@ -4012,6 +4023,10 @@ function createCodeModeTools(bridge2, crawlio2) {
4012
4023
  return toolSuccess(result);
4013
4024
  } catch (error) {
4014
4025
  const msg = error instanceof Error ? error.message : String(error);
4026
+ if (error instanceof Error && error.permission_required) {
4027
+ const missing = error.missing;
4028
+ return toolError(formatPermissionDenial(missing, "execute"));
4029
+ }
4015
4030
  return toolError(`Execution error: ${msg}`);
4016
4031
  } finally {
4017
4032
  clearTimeout(timer);
@@ -4027,7 +4042,7 @@ function createCodeModeTools(bridge2, crawlio2) {
4027
4042
  process.title = "Crawlio Agent";
4028
4043
  var initMode = process.argv.includes("init") || process.argv.includes("--setup") || process.argv.includes("setup");
4029
4044
  if (initMode) {
4030
- const { runInit } = await import("./init-AJOP2HY7.js");
4045
+ const { runInit } = await import("./init-4D3LCB7J.js");
4031
4046
  await runInit(process.argv.slice(2));
4032
4047
  process.exit(0);
4033
4048
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PKG_VERSION
3
- } from "./chunk-3UA6NXNB.js";
3
+ } from "./chunk-RA3LVVKH.js";
4
4
 
5
5
  // src/mcp-server/init.ts
6
6
  import { execFileSync, spawn } from "child_process";
@@ -290,7 +290,7 @@ function buildStdioEntry(options) {
290
290
  if (options?.full) args2.push("--full");
291
291
  return { command: nodePath, args: args2 };
292
292
  }
293
- const args = ["-y", `crawlio-browser@${PKG_VERSION}`];
293
+ const args = ["-y", "crawlio-browser"];
294
294
  if (options?.full) args.push("--full");
295
295
  return { command: "npx", args };
296
296
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crawlio-browser",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
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",