@shuyhere/bb-agent 0.0.5 → 0.0.6
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/CHANGELOG.md +8 -2
- package/bin/bb +30 -9
- package/package.json +1 -1
- package/scripts/postinstall.js +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,13 @@ All notable changes to BB-Agent will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [0.0.
|
|
8
|
+
## [0.0.6] - 2026-04-06
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- npm launcher no longer recurses into itself when the native binary is missing
|
|
13
|
+
- npm postinstall now better detects whether the current package already has a usable native binary
|
|
14
|
+
- clearer npm fallback messaging when matching GitHub release assets are not yet available
|
|
9
15
|
|
|
10
16
|
### Added
|
|
11
17
|
|
|
@@ -28,4 +34,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
28
34
|
- **Print mode** (`bb -p`) for non-interactive scripted usage
|
|
29
35
|
- **Session resume** (`bb -c` to continue, `bb -r` to pick)
|
|
30
36
|
|
|
31
|
-
[0.0.
|
|
37
|
+
[0.0.6]: https://github.com/shuyhere/bb-agent/releases/tag/v0.0.6
|
package/bin/bb
CHANGED
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
var execFileSync = require("child_process").execFileSync;
|
|
6
6
|
var path = require("path");
|
|
7
7
|
var fs = require("fs");
|
|
8
|
+
var packageJson = require("../package.json");
|
|
9
|
+
|
|
10
|
+
var wrapperRealPath = null;
|
|
11
|
+
try { wrapperRealPath = fs.realpathSync(__filename); } catch (e) {}
|
|
12
|
+
|
|
13
|
+
function isSelfBinary(candidate) {
|
|
14
|
+
try {
|
|
15
|
+
if (!wrapperRealPath) return false;
|
|
16
|
+
return fs.realpathSync(candidate) === wrapperRealPath;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
8
21
|
|
|
9
22
|
function findBinary() {
|
|
10
23
|
var nativeBin = path.join(__dirname, "..", "native", "bb");
|
|
@@ -16,7 +29,11 @@ function findBinary() {
|
|
|
16
29
|
for (var i = 0; i < dirs.length; i++) {
|
|
17
30
|
if (path.resolve(dirs[i]) === path.resolve(__dirname)) continue;
|
|
18
31
|
var full = path.join(dirs[i], "bb");
|
|
19
|
-
try {
|
|
32
|
+
try {
|
|
33
|
+
fs.accessSync(full, fs.constants.X_OK);
|
|
34
|
+
if (isSelfBinary(full)) continue;
|
|
35
|
+
return full;
|
|
36
|
+
} catch (e) {}
|
|
20
37
|
}
|
|
21
38
|
|
|
22
39
|
return null;
|
|
@@ -26,23 +43,27 @@ var binary = findBinary();
|
|
|
26
43
|
|
|
27
44
|
if (!binary) {
|
|
28
45
|
console.error("");
|
|
29
|
-
console.error("BB-Agent binary not found.");
|
|
46
|
+
console.error("BB-Agent native binary not found.");
|
|
47
|
+
console.error("");
|
|
48
|
+
console.error("This npm package is a small launcher and expects a matching native binary.");
|
|
49
|
+
console.error("That binary may not have been downloaded yet for version " + packageJson.version + ".");
|
|
30
50
|
console.error("");
|
|
31
|
-
console.error("
|
|
32
|
-
console.error("
|
|
33
|
-
console.error("
|
|
51
|
+
console.error("Try reinstalling after the GitHub release assets are available:");
|
|
52
|
+
console.error(" npm uninstall -g @shuyhere/bb-agent");
|
|
53
|
+
console.error(" npm install -g @shuyhere/bb-agent@" + packageJson.version);
|
|
34
54
|
console.error("");
|
|
35
|
-
console.error("
|
|
55
|
+
console.error("Or build from source:");
|
|
36
56
|
console.error(" git clone https://github.com/shuyhere/bb-agent.git");
|
|
37
57
|
console.error(" cd bb-agent && cargo install --path crates/cli");
|
|
38
58
|
console.error("");
|
|
39
|
-
console.error("Then run: bb");
|
|
40
|
-
console.error("");
|
|
41
59
|
process.exit(1);
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
try {
|
|
45
|
-
execFileSync(binary, process.argv.slice(2), {
|
|
63
|
+
execFileSync(binary, process.argv.slice(2), {
|
|
64
|
+
stdio: "inherit",
|
|
65
|
+
env: Object.assign({}, process.env, { BB_NPM_WRAPPER_ACTIVE: "1" })
|
|
66
|
+
});
|
|
46
67
|
} catch (err) {
|
|
47
68
|
process.exit(err.status || 1);
|
|
48
69
|
}
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -11,6 +11,8 @@ const https = require("https");
|
|
|
11
11
|
const packageJson = require("../package.json");
|
|
12
12
|
const BINARY_RELEASE_TAG = `v${packageJson.version}`;
|
|
13
13
|
const REPO = "shuyhere/bb-agent";
|
|
14
|
+
const PACKAGE_ROOT = path.resolve(__dirname, "..");
|
|
15
|
+
const WRAPPER_SCRIPT = path.join(PACKAGE_ROOT, "bin", "bb");
|
|
14
16
|
const NATIVE_DIR = path.join(__dirname, "..", "native");
|
|
15
17
|
const DOWNLOAD_TIMEOUT_MS = 15_000;
|
|
16
18
|
|
|
@@ -85,12 +87,21 @@ async function tryDownloadPrebuilt(target) {
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
function isCurrentPackageWrapper(candidate) {
|
|
91
|
+
try {
|
|
92
|
+
return fs.realpathSync(candidate) === fs.realpathSync(WRAPPER_SCRIPT);
|
|
93
|
+
} catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
function findInPath(name) {
|
|
89
99
|
const dirs = (process.env.PATH || "").split(path.delimiter);
|
|
90
100
|
for (const dir of dirs) {
|
|
91
101
|
const full = path.join(dir, name);
|
|
92
102
|
try {
|
|
93
103
|
fs.accessSync(full, fs.constants.X_OK);
|
|
104
|
+
if (isCurrentPackageWrapper(full)) continue;
|
|
94
105
|
return full;
|
|
95
106
|
} catch {}
|
|
96
107
|
}
|
|
@@ -130,6 +141,8 @@ async function main() {
|
|
|
130
141
|
// (cargo build takes 5+ minutes and would appear to hang)
|
|
131
142
|
const platform = `${os.platform()}-${os.arch()}`;
|
|
132
143
|
console.log("");
|
|
144
|
+
console.log(`BB-Agent ${packageJson.version}: matching prebuilt binary not available yet for ${platform}.`);
|
|
145
|
+
console.log("");
|
|
133
146
|
console.log("╔══════════════════════════════════════════════════════════════╗");
|
|
134
147
|
console.log("║ BB-Agent: no prebuilt binary for " + platform.padEnd(19) + " ║");
|
|
135
148
|
console.log("║ ║");
|