@browserbridge/bbx 1.11.2 → 1.11.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbridge/bbx",
3
- "version": "1.11.2",
3
+ "version": "1.11.3",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "agent-tools",
@@ -76,19 +76,19 @@
76
76
  "@modelcontextprotocol/server": "^2.0.0",
77
77
  "@mozilla/readability": "^0.6.0",
78
78
  "linkedom": "^0.18.13",
79
- "zod": "^4.4.3"
79
+ "zod": "^4.6.5"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@modelcontextprotocol/client": "^2.0.0",
83
- "@types/chrome": "^0.2.6",
84
- "@types/node": "^26.2.0",
83
+ "@types/chrome": "^0.3.0",
84
+ "@types/node": "^26.6.1",
85
85
  "ajv": "^8.20.0",
86
86
  "ajv-formats": "^3.0.1",
87
87
  "c8": "^12.0.0",
88
88
  "har-schema": "^2.0.0",
89
- "oxfmt": "^0.63.0",
90
- "oxlint": "^1.78.0",
91
- "tsx": "^4.23.12",
89
+ "oxfmt": "^0.68.0",
90
+ "oxlint": "^1.83.0",
91
+ "tsx": "^4.23.13",
92
92
  "typescript": "^7.0.2"
93
93
  },
94
94
  "engines": {
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import { isProtocolVersionSupported } from '../../protocol/src/index.js';
2
3
 
3
4
  import { EventEmitter, once } from 'node:events';
4
5
  import fs from 'node:fs';
@@ -744,7 +745,7 @@ export class BridgeClient extends EventEmitter {
744
745
  if (
745
746
  healthResult?.extensionConnected === true &&
746
747
  Array.isArray(extensionVersions) &&
747
- !extensionVersions.includes(getProtocolVersion())
748
+ !isProtocolVersionSupported(getProtocolVersion(), extensionVersions)
748
749
  ) {
749
750
  return false;
750
751
  }
@@ -802,7 +803,7 @@ export class BridgeClient extends EventEmitter {
802
803
  };
803
804
  }
804
805
  const localVersion = getProtocolVersion();
805
- const compatible = remoteVersions.includes(localVersion);
806
+ const compatible = isProtocolVersionSupported(localVersion, remoteVersions);
806
807
  return {
807
808
  compatible,
808
809
  localVersion,
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import { isProtocolVersionSupported } from '../../protocol/src/index.js';
2
3
 
3
4
  import { execFile } from 'node:child_process';
4
5
  import { createHash } from 'node:crypto';
@@ -75,12 +76,12 @@ export function derivePackageProtocolVersion(version) {
75
76
  */
76
77
  export function selectCompatibleNpmVersion(versions, supportedProtocols, currentVersion) {
77
78
  if (!parseStableVersion(currentVersion)) return null;
78
- const supported = new Set(supportedProtocols.filter((version) => /^\d+\.\d+$/u.test(version)));
79
79
  let selected = null;
80
80
  for (const value of versions) {
81
81
  if (typeof value !== 'string' || !parseStableVersion(value)) continue;
82
82
  const protocolVersion = derivePackageProtocolVersion(value);
83
- if (!protocolVersion || !supported.has(protocolVersion)) continue;
83
+ if (!protocolVersion || !isProtocolVersionSupported(protocolVersion, supportedProtocols))
84
+ continue;
84
85
  if (comparePackageVersions(value, currentVersion) <= 0) continue;
85
86
  if (selected === null || comparePackageVersions(value, selected) > 0) selected = value;
86
87
  }
@@ -252,7 +253,10 @@ export async function updateCompatibleNpmPackage(options) {
252
253
  const packageRoot = options.packageRoot ?? PACKAGE_ROOT;
253
254
  const runNpmFn = options.runNpmFn ?? runNpmCommand;
254
255
  const extensionProtocol = derivePackageProtocolVersion(options.extensionVersion);
255
- if (!extensionProtocol || !options.supportedVersions.includes(extensionProtocol)) {
256
+ if (
257
+ !extensionProtocol ||
258
+ !isProtocolVersionSupported(extensionProtocol, options.supportedVersions)
259
+ ) {
256
260
  return { updated: false, reason: 'invalid_extension_version' };
257
261
  }
258
262
 
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import { isProtocolVersionSupported } from '../../protocol/src/index.js';
2
3
 
3
4
  import fs from 'node:fs';
4
5
  import os from 'node:os';
@@ -839,11 +840,11 @@ function summarizeProtocol(health, extensionConnected) {
839
840
  : safeVersions(health?.supported_versions)
840
841
  : [];
841
842
  const daemonCompatible = daemonSupportedVersions.length
842
- ? daemonSupportedVersions.includes(clientVersion)
843
+ ? isProtocolVersionSupported(clientVersion, daemonSupportedVersions)
843
844
  : null;
844
845
  const extensionCompatible = extensionConnected
845
846
  ? extensionSupportedVersions.length
846
- ? extensionSupportedVersions.includes(clientVersion)
847
+ ? isProtocolVersionSupported(clientVersion, extensionSupportedVersions)
847
848
  : null
848
849
  : null;
849
850
  const knownCompatibility = [daemonCompatible, extensionCompatible].filter(
@@ -1,4 +1,5 @@
1
1
  // @ts-check
2
+ import { isProtocolVersionSupported } from '../../protocol/src/index.js';
2
3
 
3
4
  import fs from 'node:fs';
4
5
  import net from 'node:net';
@@ -361,7 +362,11 @@ function createHealthRecoveryPayload(daemon, extensionResult) {
361
362
  function getVersionNegotiationPayload(requestedVersion) {
362
363
  const supportedVersions = getSupportedProtocolVersions();
363
364
  const latestSupported = supportedVersions[0];
364
- if (!requestedVersion || !latestSupported || supportedVersions.includes(requestedVersion)) {
365
+ if (
366
+ !requestedVersion ||
367
+ !latestSupported ||
368
+ isProtocolVersionSupported(requestedVersion, supportedVersions)
369
+ ) {
365
370
  return { supported_versions: supportedVersions };
366
371
  }
367
372
 
@@ -133,6 +133,20 @@ export function deriveProtocolVersion(packageVersion) {
133
133
  return match ? `${match[1]}.${match[2]}` : '0.0';
134
134
  }
135
135
 
136
+ /**
137
+ * Minor and patch releases are compatible in either direction within a major.
138
+ * @param {string} requestedVersion
139
+ * @param {readonly string[]} supportedVersions
140
+ * @returns {boolean}
141
+ */
142
+ export function isProtocolVersionSupported(requestedVersion, supportedVersions) {
143
+ const major = /^(\d+)\.\d+$/.exec(requestedVersion)?.[1];
144
+ return (
145
+ major !== undefined &&
146
+ supportedVersions.some((version) => /^(\d+)\.\d+$/.exec(version)?.[1] === major)
147
+ );
148
+ }
149
+
136
150
  /**
137
151
  * @returns {string | null}
138
152
  */