@agentistics/agentop 1.22.2 → 1.22.4
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 +1 -1
- package/scripts/platform.js +21 -1
- package/scripts/postinstall.js +18 -1
package/package.json
CHANGED
package/scripts/platform.js
CHANGED
|
@@ -59,4 +59,24 @@ function resolveAsset(platform, arch, version) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
// True when the ancestor package.json (the root of whatever checkout this
|
|
63
|
+
// package sits in) IS the agentistics monorepo itself, rather than some
|
|
64
|
+
// unrelated project that installed @agentistics/agentop as a dependency.
|
|
65
|
+
// `bun install` at this repo's own root runs every workspace member's
|
|
66
|
+
// postinstall (workspace-local scripts are trusted by default, unlike a
|
|
67
|
+
// dependency's) — so without this check, every contributor's `bun install`,
|
|
68
|
+
// and any CI job that runs it for an unrelated reason (e.g. the Windows
|
|
69
|
+
// desktop build, which has nothing to do with the agentop CLI), downloaded
|
|
70
|
+
// an 87MB binary it never uses, and failed outright on a platform this npm
|
|
71
|
+
// package doesn't support. The repo already builds its own binary via
|
|
72
|
+
// `bun run build:binary` — the npm postinstall exists for EXTERNAL installs.
|
|
73
|
+
/**
|
|
74
|
+
* @param {{name?: string} | null} ancestorPkg - the parsed package.json 3
|
|
75
|
+
* levels up from this file (repo root), or null if none was found/readable
|
|
76
|
+
* @returns {boolean}
|
|
77
|
+
*/
|
|
78
|
+
function isMonorepoCheckout(ancestorPkg) {
|
|
79
|
+
return ancestorPkg != null && ancestorPkg.name === 'agentistics';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = { resolveAsset, isMonorepoCheckout, REPO, BINARY };
|
package/scripts/postinstall.js
CHANGED
|
@@ -11,13 +11,23 @@
|
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const path = require('path');
|
|
13
13
|
const https = require('https');
|
|
14
|
-
const { resolveAsset } = require('./platform.js');
|
|
14
|
+
const { resolveAsset, isMonorepoCheckout } = require('./platform.js');
|
|
15
15
|
|
|
16
16
|
const pkg = require('../package.json');
|
|
17
17
|
|
|
18
18
|
const BIN_DIR = path.join(__dirname, '..', 'bin');
|
|
19
19
|
const BIN_PATH = path.join(BIN_DIR, 'agentop-bin');
|
|
20
20
|
const MAX_REDIRECTS = 5;
|
|
21
|
+
// packages/agentop/scripts -> packages/agentop -> packages -> repo root
|
|
22
|
+
const MONOREPO_ROOT_PKG = path.join(__dirname, '..', '..', '..', 'package.json');
|
|
23
|
+
|
|
24
|
+
function readAncestorPkg() {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(fs.readFileSync(MONOREPO_ROOT_PKG, 'utf8'));
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
21
31
|
|
|
22
32
|
function download(url, destPath, redirectsLeft) {
|
|
23
33
|
return new Promise((resolve, reject) => {
|
|
@@ -51,6 +61,13 @@ function download(url, destPath, redirectsLeft) {
|
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
async function main() {
|
|
64
|
+
if (isMonorepoCheckout(readAncestorPkg())) {
|
|
65
|
+
console.log(
|
|
66
|
+
'Skipping agentop binary download — running inside the agentistics monorepo itself (build it with `bun run build:binary`).'
|
|
67
|
+
);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
54
71
|
const asset = resolveAsset(process.platform, process.arch, pkg.version);
|
|
55
72
|
|
|
56
73
|
if (!asset.ok) {
|