@agentistics/agentop 1.22.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 ADDED
@@ -0,0 +1,41 @@
1
+ # @agentistics/agentop
2
+
3
+ npm install for the `agentop` CLI — the same native binary published on
4
+ [GitHub Releases](https://github.com/blpsoares/agentistics/releases) and
5
+ installed by the project's `curl | bash` script. This package is only an
6
+ **additional** install channel; it downloads and runs the identical binary,
7
+ never a JS reimplementation.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm i -g @agentistics/agentop
13
+ ```
14
+
15
+ `postinstall` downloads the `agentop` binary matching this package's own
16
+ version from the corresponding GitHub Release and makes it executable.
17
+
18
+ ## Supported platforms
19
+
20
+ Linux x86_64 only, same as the current GitHub Release. Installing on any
21
+ other platform fails during `postinstall` with a clear error instead of
22
+ leaving a broken binary in place.
23
+
24
+ ## Usage
25
+
26
+ ```bash
27
+ agentop server # web dashboard + daemon
28
+ agentop tui # terminal TUI
29
+ agentop watch # daemon only
30
+ ```
31
+
32
+ See the [main README](https://github.com/blpsoares/agentistics#readme) for
33
+ full CLI documentation.
34
+
35
+ ## Alternative install
36
+
37
+ ```bash
38
+ curl -fsSL https://agentop.openvibes.tech/cli | bash
39
+ ```
40
+
41
+ Both methods install the exact same binary.
package/bin/agentop.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ // Thin exec shim — the real CLI is the native binary postinstall.js downloaded
3
+ // alongside this file. This wrapper exists only because npm's `bin` field
4
+ // needs a file it can chmod +x and put on PATH; it does not reimplement or
5
+ // rebundle any agentop behavior.
6
+ 'use strict';
7
+
8
+ const { spawnSync } = require('child_process');
9
+ const path = require('path');
10
+ const fs = require('fs');
11
+
12
+ const BIN_PATH = path.join(__dirname, 'agentop-bin');
13
+
14
+ if (!fs.existsSync(BIN_PATH)) {
15
+ console.error(
16
+ 'agentop binary not found — the npm postinstall step did not complete. Try reinstalling: npm i -g @agentistics/agentop'
17
+ );
18
+ process.exit(1);
19
+ }
20
+
21
+ const result = spawnSync(BIN_PATH, process.argv.slice(2), { stdio: 'inherit' });
22
+
23
+ if (result.error) {
24
+ console.error(`Failed to launch agentop: ${result.error.message}`);
25
+ process.exit(1);
26
+ }
27
+
28
+ process.exit(result.status === null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@agentistics/agentop",
3
+ "version": "1.22.2",
4
+ "description": "agentop CLI — npm install for the same native binary distributed via install.sh (Linux x86_64 only)",
5
+ "type": "commonjs",
6
+ "bin": {
7
+ "agentop": "bin/agentop.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "scripts/",
12
+ "!scripts/*.test.js",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "postinstall": "node scripts/postinstall.js",
17
+ "prepublishOnly": "bun test scripts/platform.test.js"
18
+ },
19
+ "os": [
20
+ "linux"
21
+ ],
22
+ "cpu": [
23
+ "x64"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "keywords": [
29
+ "cli",
30
+ "claude",
31
+ "claude-code",
32
+ "analytics",
33
+ "agentistics",
34
+ "agentop"
35
+ ],
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/blpsoares/agentistics.git",
40
+ "directory": "packages/agentop"
41
+ },
42
+ "homepage": "https://github.com/blpsoares/agentistics"
43
+ }
@@ -0,0 +1,62 @@
1
+ // Pure platform resolution for the @agentistics/agentop npm postinstall.
2
+ //
3
+ // Mirrors the gate in /install.sh (Linux x86_64 only, same error message shape).
4
+ // install.sh cannot be sourced from here — it is fetched standalone via
5
+ // `curl | bash` with no local checkout at run time — so this check is kept in
6
+ // sync by hand. See CLAUDE.md's PKG_FILES comment in release.yml for the same
7
+ // documented trade-off (two things that must agree, checked nowhere but here).
8
+
9
+ const REPO = 'blpsoares/agentistics';
10
+ const BINARY = 'agentop';
11
+
12
+ // node's process.platform/process.arch -> the `uname -s` / `uname -m` strings
13
+ // install.sh's error messages are phrased in terms of, so a Node-side failure
14
+ // reads the same way as a curl|bash one.
15
+ const OS_NAMES = {
16
+ linux: 'Linux',
17
+ darwin: 'Darwin',
18
+ win32: 'Windows',
19
+ };
20
+
21
+ const ARCH_NAMES = {
22
+ x64: 'x86_64',
23
+ arm64: 'arm64',
24
+ ia32: 'x86',
25
+ };
26
+
27
+ function displayOs(platform) {
28
+ return OS_NAMES[platform] || platform;
29
+ }
30
+
31
+ function displayArch(arch) {
32
+ return ARCH_NAMES[arch] || arch;
33
+ }
34
+
35
+ /**
36
+ * @param {string} platform - process.platform value
37
+ * @param {string} arch - process.arch value
38
+ * @param {string} version - the npm package's own version (no leading "v")
39
+ * @returns {{ok: true, url: string} | {ok: false, message: string}}
40
+ */
41
+ function resolveAsset(platform, arch, version) {
42
+ if (platform !== 'linux') {
43
+ return {
44
+ ok: false,
45
+ message: `Error: only Linux binaries are published at the moment (detected: ${displayOs(platform)}).`,
46
+ };
47
+ }
48
+
49
+ if (arch !== 'x64') {
50
+ return {
51
+ ok: false,
52
+ message: `Error: only x86_64 binaries are published at the moment (detected: ${displayArch(arch)}).`,
53
+ };
54
+ }
55
+
56
+ return {
57
+ ok: true,
58
+ url: `https://github.com/${REPO}/releases/download/v${version}/${BINARY}`,
59
+ };
60
+ }
61
+
62
+ module.exports = { resolveAsset, REPO, BINARY };
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ // Downloads the native `agentop` binary this npm package's own version was
3
+ // released with, from the same GitHub Release install.sh downloads from —
4
+ // npm is an ADDITIONAL install channel for the identical binary, never a
5
+ // separate build. Unlike install.sh (which always grabs the rolling
6
+ // `latest` release), this fetches the VERSION-TAGGED asset — an `npm i
7
+ // @agentistics/agentop@1.20.0` must download the 1.20.0 binary, not
8
+ // whatever happens to be newest on GitHub.
9
+ 'use strict';
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const https = require('https');
14
+ const { resolveAsset } = require('./platform.js');
15
+
16
+ const pkg = require('../package.json');
17
+
18
+ const BIN_DIR = path.join(__dirname, '..', 'bin');
19
+ const BIN_PATH = path.join(BIN_DIR, 'agentop-bin');
20
+ const MAX_REDIRECTS = 5;
21
+
22
+ function download(url, destPath, redirectsLeft) {
23
+ return new Promise((resolve, reject) => {
24
+ https
25
+ .get(url, { headers: { 'User-Agent': '@agentistics/agentop-postinstall' } }, (res) => {
26
+ const { statusCode, headers } = res;
27
+
28
+ if (statusCode >= 300 && statusCode < 400 && headers.location) {
29
+ res.resume();
30
+ if (redirectsLeft <= 0) {
31
+ reject(new Error('Too many redirects while downloading the agentop binary.'));
32
+ return;
33
+ }
34
+ download(headers.location, destPath, redirectsLeft - 1).then(resolve, reject);
35
+ return;
36
+ }
37
+
38
+ if (statusCode !== 200) {
39
+ res.resume();
40
+ reject(new Error(`Download failed: HTTP ${statusCode} for ${url}`));
41
+ return;
42
+ }
43
+
44
+ const file = fs.createWriteStream(destPath, { mode: 0o755 });
45
+ res.pipe(file);
46
+ file.on('finish', () => file.close(resolve));
47
+ file.on('error', reject);
48
+ })
49
+ .on('error', reject);
50
+ });
51
+ }
52
+
53
+ async function main() {
54
+ const asset = resolveAsset(process.platform, process.arch, pkg.version);
55
+
56
+ if (!asset.ok) {
57
+ console.error(asset.message);
58
+ console.error(
59
+ 'The agentop CLI is not available for this platform via npm. See https://github.com/blpsoares/agentistics for other install options.'
60
+ );
61
+ process.exit(1);
62
+ }
63
+
64
+ fs.mkdirSync(BIN_DIR, { recursive: true });
65
+ console.log(`Downloading agentop from ${asset.url} ...`);
66
+ await download(asset.url, BIN_PATH, MAX_REDIRECTS);
67
+ fs.chmodSync(BIN_PATH, 0o755);
68
+ console.log(`Installed: ${BIN_PATH}`);
69
+ }
70
+
71
+ main().catch((err) => {
72
+ console.error(`Failed to install the agentop binary: ${err.message}`);
73
+ process.exit(1);
74
+ });