@browserbridge/bbx 1.5.0 → 1.5.1

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/README.md CHANGED
@@ -107,7 +107,7 @@ Browser Bridge is optimized for the opposite starting point: **inspect the state
107
107
 
108
108
  1. Install [Browser Bridge from the Chrome Web Store](https://chromewebstore.google.com/detail/browser-bridge/jjjkmmcdkpcgamlopogicbnnhdgebhie) in Chrome or another Chromium-based browser
109
109
  2. `npm install -g @browserbridge/bbx` - installs the CLI and native host
110
- 3. Run `bbx install`, or target a specific browser with `bbx install --browser edge`, `bbx install --browser brave`, `bbx install --browser chromium`, or `bbx install --browser arc`
110
+ 3. Run `bbx install` (Chromium on Linux, Chrome elsewhere), or target a specific browser with `bbx install --browser chrome`, `bbx install --browser edge`, `bbx install --browser brave`, `bbx install --browser chromium`, or `bbx install --browser arc`
111
111
  4. In the extension side panel, install MCP or CLI (skill) for your agent of choice
112
112
  5. Enable Browser Bridge for the browser window you want to inspect/control with the AI agent
113
113
  6. Ask your agent to use Browser Bridge via MCP (`BB MCP` or `Browser Bridge MCP`), or invoke the installed Browser Bridge skill in CLI mode (`/browser-bridge`, `browser-bridge`, or the client-specific skill trigger)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbridge/bbx",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "agent-tools",
@@ -237,7 +237,7 @@ export const CLI_HELP_SECTIONS = Object.freeze([
237
237
  {
238
238
  title: 'Setup',
239
239
  lines: [
240
- 'bbx install [extension-id] [--browser chrome|edge|brave|chromium|arc] [--all] Install native messaging manifest',
240
+ 'bbx install [extension-id] [--browser chrome|edge|brave|chromium|arc] [--all] Install native messaging manifest (Linux defaults to Chromium)',
241
241
  'bbx uninstall Remove native host manifests, Browser Bridge runtime files, and managed MCP/skill installs',
242
242
  'bbx install-skill [targets|all] [--global] [--project <path>] Install/update the managed Browser Bridge CLI skill',
243
243
  'bbx install-mcp [client|all] [--local] Write MCP config for codex|claude|cursor|copilot|opencode|antigravity|windsurf|agents',
@@ -113,7 +113,7 @@ export async function withBridgeClient(callback) {
113
113
  }
114
114
 
115
115
  /**
116
- * @param {SupportedBrowser} [browser='chrome']
116
+ * @param {SupportedBrowser} [browser]
117
117
  * @returns {string}
118
118
  */
119
119
  export function getManifestPath(browser) {
@@ -121,7 +121,7 @@ export function getManifestPath(browser) {
121
121
  }
122
122
 
123
123
  /**
124
- * @param {SupportedBrowser} [browser='chrome']
124
+ * @param {SupportedBrowser} [browser]
125
125
  * @returns {Promise<{allowed_origins?: string[]} | null>}
126
126
  */
127
127
  export async function loadInstalledManifest(browser) {
@@ -9,7 +9,7 @@ import {
9
9
  parseExtensionId,
10
10
  uninstallNativeManifest,
11
11
  } from '../src/install-manifest.js';
12
- import { SUPPORTED_BROWSERS } from '../src/config.js';
12
+ import { getDefaultBrowser, SUPPORTED_BROWSERS } from '../src/config.js';
13
13
 
14
14
  /** @typedef {import('../src/config.js').SupportedBrowser} SupportedBrowser */
15
15
 
@@ -61,7 +61,7 @@ const targets = installAll
61
61
  ? [...SUPPORTED_BROWSERS]
62
62
  : browsers.length > 0
63
63
  ? browsers
64
- : [/** @type {SupportedBrowser} */ ('chrome')];
64
+ : [getDefaultBrowser()];
65
65
 
66
66
  for (const [index, target] of targets.entries()) {
67
67
  if (uninstall) {
@@ -1,5 +1,6 @@
1
1
  // @ts-check
2
2
 
3
+ import fs from 'node:fs';
3
4
  import os from 'node:os';
4
5
  import path from 'node:path';
5
6
 
@@ -189,14 +190,37 @@ export function getLauncherFilename() {
189
190
  */
190
191
  export const SUPPORTED_BROWSERS = ['chrome', 'edge', 'brave', 'chromium', 'arc'];
191
192
 
193
+ /**
194
+ * @returns {SupportedBrowser}
195
+ */
196
+ export function getDefaultBrowser() {
197
+ return os.platform() === 'linux' ? 'chromium' : 'chrome';
198
+ }
199
+
200
+ /**
201
+ * @param {NodeJS.ProcessEnv} env
202
+ * @param {string} home
203
+ * @returns {string}
204
+ */
205
+ function getLinuxConfigHome(env, home) {
206
+ if (env.CHROME_CONFIG_HOME) {
207
+ return env.CHROME_CONFIG_HOME;
208
+ }
209
+ if (env.XDG_CONFIG_HOME) {
210
+ return env.XDG_CONFIG_HOME;
211
+ }
212
+ return path.join(home, '.config');
213
+ }
214
+
192
215
  /**
193
216
  * Return the native messaging host manifest install directory for the given
194
217
  * browser on the current platform.
195
218
  *
196
- * @param {SupportedBrowser} [browser='chrome']
219
+ * @param {SupportedBrowser} [browser=getDefaultBrowser()]
220
+ * @param {NodeJS.ProcessEnv} [env=process.env]
197
221
  * @returns {string}
198
222
  */
199
- export function getManifestInstallDir(browser = 'chrome') {
223
+ export function getManifestInstallDir(browser = getDefaultBrowser(), env = process.env) {
200
224
  const platform = os.platform();
201
225
  const home = os.homedir();
202
226
 
@@ -213,7 +237,7 @@ export function getManifestInstallDir(browser = 'chrome') {
213
237
  }
214
238
 
215
239
  if (platform === 'win32') {
216
- const winBase = process.env.LOCALAPPDATA || path.join(home, 'AppData', 'Local');
240
+ const winBase = env.LOCALAPPDATA || path.join(home, 'AppData', 'Local');
217
241
  const winPaths = {
218
242
  chrome: path.join(winBase, 'Google', 'Chrome', 'User Data', 'NativeMessagingHosts'),
219
243
  edge: path.join(winBase, 'Microsoft', 'Edge', 'User Data', 'NativeMessagingHosts'),
@@ -231,12 +255,18 @@ export function getManifestInstallDir(browser = 'chrome') {
231
255
  }
232
256
 
233
257
  // Linux / others
258
+ const linuxConfigHome = getLinuxConfigHome(env, home);
259
+ const chromiumSnapProfile = path.join(home, 'snap', 'chromium', 'common', 'chromium');
260
+ const useChromiumSnapProfile =
261
+ !env.CHROME_CONFIG_HOME && !env.XDG_CONFIG_HOME && fs.existsSync(chromiumSnapProfile);
234
262
  const linuxPaths = {
235
- chrome: path.join(home, '.config', 'google-chrome', 'NativeMessagingHosts'),
236
- edge: path.join(home, '.config', 'microsoft-edge', 'NativeMessagingHosts'),
237
- brave: path.join(home, '.config', 'BraveSoftware', 'Brave-Browser', 'NativeMessagingHosts'),
238
- chromium: path.join(home, '.config', 'chromium', 'NativeMessagingHosts'),
239
- arc: path.join(home, '.config', 'Arc', 'User Data', 'NativeMessagingHosts'),
263
+ chrome: path.join(linuxConfigHome, 'google-chrome', 'NativeMessagingHosts'),
264
+ edge: path.join(linuxConfigHome, 'microsoft-edge', 'NativeMessagingHosts'),
265
+ brave: path.join(linuxConfigHome, 'BraveSoftware', 'Brave-Browser', 'NativeMessagingHosts'),
266
+ chromium: useChromiumSnapProfile
267
+ ? path.join(chromiumSnapProfile, 'NativeMessagingHosts')
268
+ : path.join(linuxConfigHome, 'chromium', 'NativeMessagingHosts'),
269
+ arc: path.join(linuxConfigHome, 'Arc', 'User Data', 'NativeMessagingHosts'),
240
270
  };
241
271
  return linuxPaths[browser] ?? linuxPaths.chrome;
242
272
  }
@@ -259,13 +259,13 @@ export async function installNativeManifest(options) {
259
259
  extensionIdArg,
260
260
  browser,
261
261
  nodePath = process.execPath,
262
- installDir = getManifestInstallDir(browser),
263
- bridgeDir = getBridgeDir(),
262
+ env = process.env,
263
+ installDir = getManifestInstallDir(browser, env),
264
+ bridgeDir = getBridgeDir(env),
264
265
  stdout = process.stdout,
265
266
  stderr = process.stderr,
266
267
  preserveCustomExtensionId = false,
267
268
  writeRegistryValue: writeRegistryValueFn = writeRegistryValue,
268
- env = process.env,
269
269
  } = options;
270
270
 
271
271
  const parsedExtensionId = parseExtensionId(extensionIdArg);