bb-browser 0.11.0 → 0.11.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.
package/dist/mcp.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  COMMAND_TIMEOUT,
4
4
  DAEMON_BASE_URL,
5
5
  generateId
6
- } from "./chunk-5WGFUZLM.js";
6
+ } from "./chunk-H2VEQBAU.js";
7
7
  import {
8
8
  __commonJS,
9
9
  __export,
@@ -21003,13 +21003,34 @@ async function isDaemonRunning() {
21003
21003
  }
21004
21004
  async function ensureDaemon() {
21005
21005
  if (await isDaemonRunning()) return;
21006
- const child = spawn(process.execPath, [getDaemonPath()], {
21006
+ let cdpArgs = [];
21007
+ try {
21008
+ const cliPath = getCliPath();
21009
+ await new Promise((resolve2, reject) => {
21010
+ execFile(process.execPath, [cliPath, "daemon", "status", "--json"], { timeout: 15e3 }, (err, stdout) => {
21011
+ if (err) reject(err);
21012
+ else resolve2(stdout);
21013
+ });
21014
+ });
21015
+ if (await isDaemonRunning()) return;
21016
+ } catch {
21017
+ const { readFile } = await import("fs/promises");
21018
+ const os = await import("os");
21019
+ const path = await import("path");
21020
+ try {
21021
+ const portFile = path.join(os.default.homedir(), ".bb-browser", "browser", "cdp-port");
21022
+ const port = (await readFile(portFile, "utf8")).trim();
21023
+ if (port) cdpArgs = ["--cdp-port", port];
21024
+ } catch {
21025
+ }
21026
+ }
21027
+ const child = spawn(process.execPath, [getDaemonPath(), ...cdpArgs], {
21007
21028
  detached: true,
21008
21029
  stdio: "ignore",
21009
21030
  env: { ...process.env }
21010
21031
  });
21011
21032
  child.unref();
21012
- for (let i = 0; i < 25; i++) {
21033
+ for (let i = 0; i < 50; i++) {
21013
21034
  await new Promise((r) => setTimeout(r, 200));
21014
21035
  if (await isDaemonRunning()) return;
21015
21036
  }
@@ -21150,7 +21171,7 @@ async function runSiteCli(args) {
21150
21171
  return parsed ?? result.stdout.trim();
21151
21172
  }
21152
21173
  var server = new McpServer(
21153
- { name: "bb-browser", version: "0.11.0" },
21174
+ { name: "bb-browser", version: "0.11.2" },
21154
21175
  { instructions: `bb-browser lets you control the user's real Chrome browser via CDP (Chrome DevTools Protocol).
21155
21176
 
21156
21177
  Your browser is the API. No headless browser, no cookie extraction, no anti-bot bypass.