browser-pilot-cli 0.2.1 → 0.2.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/README.md CHANGED
@@ -177,7 +177,7 @@ A project can pin Browser Pilot locally and run the same CLI without a global
177
177
  installation:
178
178
 
179
179
  ```bash
180
- npm install --save-exact browser-pilot-cli@0.2.1
180
+ npm install --save-exact browser-pilot-cli@0.2.2
181
181
  npx --no-install browser-pilot tabs
182
182
  ```
183
183
 
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import { writeFileSync as writeFileSync2, readFileSync as readFileSync4, existsS
6
6
  import { resolve as resolvePath } from "path";
7
7
 
8
8
  // src/version.ts
9
- var BROWSER_PILOT_VERSION = "0.2.1";
9
+ var BROWSER_PILOT_VERSION = "0.2.2";
10
10
 
11
11
  // src/protocol/errors.ts
12
12
  var ERROR_CODES = [
@@ -3319,16 +3319,37 @@ async function validateDaemon(client) {
3319
3319
  });
3320
3320
  }
3321
3321
  }
3322
+ async function validateCompatibilityDaemon(client, executableVersion) {
3323
+ await validateDaemon(client);
3324
+ const health = await client.healthInfo();
3325
+ const requester = createExecutableMetadataSync(
3326
+ executableVersion,
3327
+ publicExecutablePath(import.meta.url)
3328
+ );
3329
+ if (health.executableVersion !== void 0 && health.executableVersion !== requester.version || health.executableIdentity !== void 0 && health.executableIdentity !== requester.identity) {
3330
+ throw new BrowserPilotError("protocol_incompatible", "Running Browser Pilot daemon is from another executable installation", {
3331
+ context: {
3332
+ brokerExecutableVersion: health.executableVersion,
3333
+ requesterExecutableVersion: requester.version
3334
+ },
3335
+ remediation: {
3336
+ code: "use_matching_executable_or_isolate",
3337
+ message: "Use the matching Browser Pilot installation, or set BROWSER_PILOT_HOME for a deliberately isolated Broker.",
3338
+ actionRequired: true
3339
+ }
3340
+ });
3341
+ }
3342
+ }
3322
3343
  async function connectCompatibility(executableVersion, browserFilter) {
3323
3344
  const daemon = await connectDaemon(browserFilter);
3324
- await validateDaemon(daemon);
3345
+ await validateCompatibilityDaemon(daemon, executableVersion);
3325
3346
  return CompatibilityBrokerClient.create(daemon, executableVersion);
3326
3347
  }
3327
3348
  async function resumeCompatibility(executableVersion) {
3328
3349
  if (!isDaemonRunning()) return null;
3329
3350
  const daemon = new DaemonClient();
3330
3351
  try {
3331
- await validateDaemon(daemon);
3352
+ await validateCompatibilityDaemon(daemon, executableVersion);
3332
3353
  return await CompatibilityBrokerClient.create(daemon, executableVersion);
3333
3354
  } catch (error) {
3334
3355
  if (error instanceof BrowserPilotError && error.code === "protocol_incompatible") throw error;
package/dist/daemon.js CHANGED
@@ -13209,7 +13209,7 @@ var ManagedTargetJanitorClient = class {
13209
13209
  };
13210
13210
 
13211
13211
  // src/version.ts
13212
- var BROWSER_PILOT_VERSION = "0.2.1";
13212
+ var BROWSER_PILOT_VERSION = "0.2.2";
13213
13213
 
13214
13214
  // src/daemon.ts
13215
13215
  var CLI_EXECUTABLE_PATH = publicExecutablePath(import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-pilot-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "CLI tool to control your browser via Chrome DevTools Protocol",
5
5
  "repository": "https://github.com/relixiaobo/browser-pilot",
6
6
  "type": "module",