agent-browser-priv 0.27.3-priv.6 → 0.27.3-priv.8

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
@@ -1279,7 +1279,8 @@ The daemon starts automatically on first command and persists between commands f
1279
1279
  | macOS ARM64 | Native Rust |
1280
1280
  | Linux ARM64 | Native Rust |
1281
1281
  | Linux x64 | Native Rust |
1282
- | Windows x64 | Native Rust |
1282
+
1283
+ Windows release artifacts are temporarily disabled while the fork stabilizes its Patchright-first CI lane.
1283
1284
 
1284
1285
  ## Usage with AI Agents
1285
1286
 
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-browser-priv",
3
- "version": "0.27.3-priv.6",
3
+ "version": "0.27.3-priv.8",
4
4
  "description": "Browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.1.3",
@@ -24,8 +24,8 @@
24
24
  "build:native": "pnpm run version:sync && cargo build --release --manifest-path cli/Cargo.toml && node scripts/copy-native.js",
25
25
  "build:linux": "pnpm run version:sync && docker compose -f docker/docker-compose.yml run --rm build-linux",
26
26
  "build:macos": "pnpm run version:sync && cargo build --release --manifest-path cli/Cargo.toml --target aarch64-apple-darwin && cp cli/target/aarch64-apple-darwin/release/agent-browser bin/agent-browser-priv-darwin-arm64",
27
- "build:windows": "pnpm run version:sync && docker compose -f docker/docker-compose.yml run --rm build-windows",
28
- "build:all-platforms": "pnpm run version:sync && (pnpm run build:linux & pnpm run build:windows & wait) && pnpm run build:macos",
27
+ "build:windows": "echo \"Windows builds are temporarily disabled\" && exit 0",
28
+ "build:all-platforms": "pnpm run version:sync && pnpm run build:linux && pnpm run build:macos",
29
29
  "build:docker": "docker build --platform linux/amd64 -t agent-browser-builder -f docker/Dockerfile.build .",
30
30
  "release": "pnpm run version:sync && pnpm run build:all-platforms",
31
31
  "postinstall": "node scripts/postinstall.js",
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
  set -euo pipefail
3
3
 
4
- # Build agent-browser for all platforms using Docker
4
+ # Build agent-browser release platforms using Docker
5
5
  # Usage: ./scripts/build-all-platforms.sh
6
6
 
7
7
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -14,7 +14,7 @@ GREEN='\033[0;32m'
14
14
  YELLOW='\033[1;33m'
15
15
  NC='\033[0m' # No Color
16
16
 
17
- echo -e "${YELLOW}Building agent-browser for all platforms...${NC}"
17
+ echo -e "${YELLOW}Building agent-browser release platforms...${NC}"
18
18
  echo ""
19
19
 
20
20
  # Ensure output directory exists
@@ -63,8 +63,9 @@ build_target "x86_64-unknown-linux-gnu" "x86_64-unknown-linux-gnu.2.28" "agent-b
63
63
  # Linux ARM64
64
64
  build_target "aarch64-unknown-linux-gnu" "aarch64-unknown-linux-gnu.2.28" "agent-browser-priv-linux-arm64"
65
65
 
66
- # Windows x64
67
- build_target "x86_64-pc-windows-gnu" "x86_64-pc-windows-gnu" "agent-browser-priv-win32-x64.exe"
66
+ # Windows x64 is temporarily disabled. Restore this line when Windows support
67
+ # is re-enabled:
68
+ # build_target "x86_64-pc-windows-gnu" "x86_64-pc-windows-gnu" "agent-browser-priv-win32-x64.exe"
68
69
 
69
70
  # macOS ARM64 (via zig for cross-compilation)
70
71
  build_target "aarch64-apple-darwin" "aarch64-apple-darwin" "agent-browser-priv-darwin-arm64"
@@ -5,8 +5,10 @@
5
5
  *
6
6
  * Downloads the platform-specific native binary if not present.
7
7
  * On global installs, patches npm's bin entry to use the native binary directly:
8
- * - Windows: Overwrites .cmd/.ps1 shims
9
8
  * - Mac/Linux: Replaces symlink to point to native binary
9
+ *
10
+ * Windows npm binaries are temporarily disabled. The shim helpers remain below
11
+ * for a future re-enable.
10
12
  */
11
13
 
12
14
  import { existsSync, mkdirSync, chmodSync, createWriteStream, unlinkSync, writeFileSync, symlinkSync, lstatSync } from 'fs';
@@ -37,11 +39,15 @@ if (platform() === 'linux' && isMusl()) {
37
39
  process.exit(0);
38
40
  }
39
41
 
42
+ if (platform() === 'win32') {
43
+ console.log('agent-browser-priv Windows npm binaries are temporarily disabled.');
44
+ console.log('Use Linux x64, Linux ARM64, or macOS ARM64 for the published package.');
45
+ process.exit(0);
46
+ }
47
+
40
48
  // Platform detection
41
49
  const osKey = platform();
42
- // Windows ARM64 falls back to x64 binary (no native ARM64 build available).
43
- // x64 binaries run via Windows' built-in emulation on ARM64.
44
- const effectiveArch = platform() === 'win32' && arch() === 'arm64' ? 'x64' : arch();
50
+ const effectiveArch = arch();
45
51
  const platformKey = `${osKey}-${effectiveArch}`;
46
52
  const ext = platform() === 'win32' ? '.exe' : '';
47
53
  const binaryName = `agent-browser-priv-${platformKey}${ext}`;
@@ -138,9 +144,6 @@ async function main() {
138
144
  }
139
145
 
140
146
  console.log(`Downloading native binary for ${platformKey}...`);
141
- if (platform() === 'win32' && arch() === 'arm64') {
142
- console.log(` Note: Using x64 binary on ARM64 Windows (runs via emulation)`);
143
- }
144
147
  console.log(`URL: ${DOWNLOAD_URL}`);
145
148
 
146
149
  try {
@@ -236,6 +239,7 @@ function showInstallReminder() {
236
239
  */
237
240
  async function fixGlobalInstallBin() {
238
241
  if (platform() === 'win32') {
242
+ // Unreachable while Windows npm binaries are disabled; kept for future re-enable.
239
243
  await fixWindowsShims();
240
244
  } else {
241
245
  await fixUnixSymlink();
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createHash } from "node:crypto";
4
+ import { writeFileSync } from "node:fs";
5
+ import { get } from "node:https";
6
+
7
+ const ASSETS = [
8
+ {
9
+ key: "darwinArm64",
10
+ name: "agent-browser-priv-darwin-arm64",
11
+ },
12
+ {
13
+ key: "linuxArm64",
14
+ name: "agent-browser-priv-linux-arm64",
15
+ },
16
+ {
17
+ key: "linuxX64",
18
+ name: "agent-browser-priv-linux-x64",
19
+ },
20
+ ];
21
+
22
+ function argValue(name) {
23
+ const index = process.argv.indexOf(`--${name}`);
24
+ return index === -1 ? undefined : process.argv[index + 1];
25
+ }
26
+
27
+ const version = argValue("version");
28
+ const formulaPath = argValue("formula");
29
+
30
+ if (!version || !formulaPath) {
31
+ console.error("Usage: node scripts/update-homebrew-formula.mjs --version <version> --formula <path>");
32
+ process.exit(1);
33
+ }
34
+
35
+ function assetUrl(name) {
36
+ return `https://github.com/liuwen/agent-browser-priv/releases/download/v${version}/${name}`;
37
+ }
38
+
39
+ function fetchBuffer(url, redirects = 0) {
40
+ return new Promise((resolve, reject) => {
41
+ get(url, (response) => {
42
+ if ([301, 302, 303, 307, 308].includes(response.statusCode)) {
43
+ if (!response.headers.location || redirects > 5) {
44
+ reject(new Error(`Too many redirects for ${url}`));
45
+ response.resume();
46
+ return;
47
+ }
48
+ response.resume();
49
+ resolve(fetchBuffer(response.headers.location, redirects + 1));
50
+ return;
51
+ }
52
+
53
+ if (response.statusCode !== 200) {
54
+ reject(new Error(`GET ${url} returned HTTP ${response.statusCode}`));
55
+ response.resume();
56
+ return;
57
+ }
58
+
59
+ const chunks = [];
60
+ response.on("data", (chunk) => chunks.push(chunk));
61
+ response.on("end", () => resolve(Buffer.concat(chunks)));
62
+ }).on("error", reject);
63
+ });
64
+ }
65
+
66
+ async function withRetries(label, fn) {
67
+ let lastError;
68
+ for (let attempt = 1; attempt <= 5; attempt += 1) {
69
+ try {
70
+ return await fn();
71
+ } catch (error) {
72
+ lastError = error;
73
+ const delayMs = attempt * 2000;
74
+ console.error(`${label} failed on attempt ${attempt}: ${error.message}`);
75
+ if (attempt < 5) {
76
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
77
+ }
78
+ }
79
+ }
80
+ throw lastError;
81
+ }
82
+
83
+ function sha256(buffer) {
84
+ return createHash("sha256").update(buffer).digest("hex");
85
+ }
86
+
87
+ function renderFormula(checksums) {
88
+ return `class AgentBrowser < Formula
89
+ desc "Browser automation CLI for AI agents with Patchright as the default backend"
90
+ homepage "https://github.com/liuwen/agent-browser-priv"
91
+ version "${version}"
92
+ license "Apache-2.0"
93
+
94
+ on_macos do
95
+ if Hardware::CPU.arm?
96
+ url "${assetUrl("agent-browser-priv-darwin-arm64")}"
97
+ sha256 "${checksums.darwinArm64}"
98
+ end
99
+ end
100
+
101
+ on_linux do
102
+ if Hardware::CPU.arm?
103
+ url "${assetUrl("agent-browser-priv-linux-arm64")}"
104
+ sha256 "${checksums.linuxArm64}"
105
+ elsif Hardware::CPU.intel?
106
+ url "${assetUrl("agent-browser-priv-linux-x64")}"
107
+ sha256 "${checksums.linuxX64}"
108
+ end
109
+ end
110
+
111
+ def install
112
+ unsupported = "agent-browser Homebrew binary is published for macOS ARM64 and Linux x86_64/ARM64"
113
+ odie unsupported unless supported_platform?
114
+
115
+ binary = if OS.mac? && Hardware::CPU.arm?
116
+ "agent-browser-priv-darwin-arm64"
117
+ elsif OS.linux? && Hardware::CPU.arm?
118
+ "agent-browser-priv-linux-arm64"
119
+ elsif OS.linux? && Hardware::CPU.intel?
120
+ "agent-browser-priv-linux-x64"
121
+ else
122
+ odie unsupported
123
+ end
124
+
125
+ bin.install binary => "agent-browser"
126
+ bin.install_symlink bin/"agent-browser" => "agent-browser-priv"
127
+ end
128
+
129
+ test do
130
+ assert_match version.to_s, shell_output("#{bin}/agent-browser --version")
131
+ assert_match version.to_s, shell_output("#{bin}/agent-browser-priv --version")
132
+ end
133
+
134
+ def supported_platform?
135
+ (OS.mac? && Hardware::CPU.arm?) || (OS.linux? && (Hardware::CPU.arm? || Hardware::CPU.intel?))
136
+ end
137
+ end
138
+ `;
139
+ }
140
+
141
+ const checksums = {};
142
+ for (const asset of ASSETS) {
143
+ const url = assetUrl(asset.name);
144
+ const data = await withRetries(asset.name, () => fetchBuffer(url));
145
+ if (data.length < 100_000) {
146
+ throw new Error(`${asset.name} is too small (${data.length} bytes)`);
147
+ }
148
+ checksums[asset.key] = sha256(data);
149
+ console.log(`${asset.name}: ${checksums[asset.key]}`);
150
+ }
151
+
152
+ writeFileSync(formulaPath, renderFormula(checksums));
153
+ console.log(`Updated ${formulaPath}`);