agent-toolkit-cli 1.10.0

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,14 @@
1
+ # agent-toolkit-cli (npm)
2
+
3
+ Thin Node launcher for the **native V** `agent-toolkit` binary. Same product name as PyPI: **`agent-toolkit-cli`**.
4
+
5
+ ```bash
6
+ npm install -g agent-toolkit-cli
7
+ agent-toolkit --help
8
+ ```
9
+
10
+ The installer pulls a platform package via `optionalDependencies` (`agent-toolkit-cli-<os>-<cpu>`). Those packages contain GitHub Release V binaries (ADR-018 / ADR-025), not a second CLI.
11
+
12
+ Dev override: `AGENT_TOOLKIT_BIN=/path/to/agent-toolkit`.
13
+
14
+ Publish: GitHub Actions OIDC trusted publishing (`.github/workflows/publish-npm.yml`). No long-lived `NPM_TOKEN`.
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ /**
5
+ * Thin npm launcher — spawn the bundled V binary (ADR-025 / #536).
6
+ * No JS business logic. Product commands agent-toolkit and agent-toolkit-cli
7
+ * hand off to the native binary (same product as PyPI).
8
+ */
9
+
10
+ const { spawn } = require("node:child_process");
11
+ const fs = require("node:fs");
12
+ const path = require("node:path");
13
+
14
+ const PLATFORMS = require("../platforms.json");
15
+ const EXIT_MISSING = 127;
16
+
17
+ function platformSpec() {
18
+ const osName = process.platform;
19
+ const cpu = process.arch === "ia32" ? "ia32" : process.arch;
20
+ return PLATFORMS.find((p) => p.os === osName && p.cpu === cpu) || null;
21
+ }
22
+
23
+ function resolveNativeBin() {
24
+ const env = (process.env.AGENT_TOOLKIT_BIN || "").trim();
25
+ if (env) {
26
+ return fs.existsSync(env) ? env : null;
27
+ }
28
+ const spec = platformSpec();
29
+ if (spec) {
30
+ try {
31
+ const pkgDir = path.dirname(require.resolve(`${spec.npm}/package.json`));
32
+ const cand = path.join(pkgDir, "bin", spec.bin);
33
+ if (fs.existsSync(cand)) {
34
+ return cand;
35
+ }
36
+ } catch {
37
+ // optionalDependency not installed for this platform
38
+ }
39
+ }
40
+ const root = (process.env.AGENT_TOOLKIT_ROOT || "").trim();
41
+ if (root) {
42
+ const names =
43
+ process.platform === "win32"
44
+ ? ["build/agent-toolkit.exe", "build/agent-toolkit"]
45
+ : ["build/agent-toolkit", "build/agent-toolkit-v"];
46
+ for (const rel of names) {
47
+ const cand = path.join(root, rel);
48
+ if (fs.existsSync(cand)) {
49
+ return cand;
50
+ }
51
+ }
52
+ }
53
+ return null;
54
+ }
55
+
56
+ function missingBinaryMessage() {
57
+ return [
58
+ "agent-toolkit: native V binary not found (ADR-025).",
59
+ " npm optionalDependencies should install agent-toolkit-cli-<os>-<cpu>.",
60
+ " Dev: make build-cli, or set AGENT_TOOLKIT_BIN to that executable.",
61
+ "",
62
+ ].join("\n");
63
+ }
64
+
65
+ function runNative(binPath, argv) {
66
+ const child = spawn(binPath, argv, {
67
+ stdio: "inherit",
68
+ windowsHide: true,
69
+ });
70
+ const forward = (signal) => {
71
+ if (child.killed) {
72
+ return;
73
+ }
74
+ try {
75
+ child.kill(signal);
76
+ } catch {
77
+ /* child already gone */
78
+ }
79
+ };
80
+ process.on("SIGINT", () => forward("SIGINT"));
81
+ process.on("SIGTERM", () => forward("SIGTERM"));
82
+ child.on("error", (err) => {
83
+ process.stderr.write(`agent-toolkit: failed to spawn native binary: ${err.message}\n`);
84
+ process.exit(EXIT_MISSING);
85
+ });
86
+ child.on("exit", (code, signal) => {
87
+ if (signal) {
88
+ process.exit(1);
89
+ }
90
+ process.exit(code == null ? 1 : code);
91
+ });
92
+ }
93
+
94
+ function main(argv) {
95
+ const rest = argv.slice(2);
96
+ const binPath = resolveNativeBin();
97
+ if (!binPath) {
98
+ process.stderr.write(missingBinaryMessage());
99
+ process.exit(EXIT_MISSING);
100
+ }
101
+ runNative(binPath, rest);
102
+ }
103
+
104
+ module.exports = { platformSpec, resolveNativeBin, missingBinaryMessage, EXIT_MISSING };
105
+
106
+ if (require.main === module) {
107
+ main(process.argv);
108
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "agent-toolkit-cli",
3
+ "version": "1.10.0",
4
+ "description": "Thin Node launcher for the agent-toolkit native V CLI (same product as PyPI)",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ulises-jeremias/agent-toolkit.git",
9
+ "directory": "packages/npm/agent-toolkit-cli"
10
+ },
11
+ "homepage": "https://github.com/ulises-jeremias/agent-toolkit",
12
+ "bugs": {
13
+ "url": "https://github.com/ulises-jeremias/agent-toolkit/issues"
14
+ },
15
+ "bin": {
16
+ "agent-toolkit": "bin/agent-toolkit.js",
17
+ "agent-toolkit-cli": "bin/agent-toolkit.js"
18
+ },
19
+ "files": [
20
+ "bin/",
21
+ "platforms.json",
22
+ "README.md"
23
+ ],
24
+ "engines": {
25
+ "node": ">=18"
26
+ },
27
+ "scripts": {
28
+ "test": "node --test test/launcher.test.js"
29
+ },
30
+ "optionalDependencies": {
31
+ "agent-toolkit-cli-linux-x64": "1.10.0",
32
+ "agent-toolkit-cli-linux-arm64": "1.10.0",
33
+ "agent-toolkit-cli-darwin-arm64": "1.10.0",
34
+ "agent-toolkit-cli-darwin-x64": "1.10.0",
35
+ "agent-toolkit-cli-win32-x64": "1.10.0"
36
+ },
37
+ "keywords": [
38
+ "agent-toolkit",
39
+ "cli",
40
+ "ai-agents"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public"
44
+ }
45
+ }
package/platforms.json ADDED
@@ -0,0 +1,39 @@
1
+ [
2
+ {
3
+ "npm": "agent-toolkit-cli-linux-x64",
4
+ "os": "linux",
5
+ "cpu": "x64",
6
+ "libc": "glibc",
7
+ "floating": "agent-toolkit-linux-x86_64",
8
+ "bin": "agent-toolkit"
9
+ },
10
+ {
11
+ "npm": "agent-toolkit-cli-linux-arm64",
12
+ "os": "linux",
13
+ "cpu": "arm64",
14
+ "libc": "glibc",
15
+ "floating": "agent-toolkit-linux-arm64",
16
+ "bin": "agent-toolkit"
17
+ },
18
+ {
19
+ "npm": "agent-toolkit-cli-darwin-arm64",
20
+ "os": "darwin",
21
+ "cpu": "arm64",
22
+ "floating": "agent-toolkit-macos-arm64",
23
+ "bin": "agent-toolkit"
24
+ },
25
+ {
26
+ "npm": "agent-toolkit-cli-darwin-x64",
27
+ "os": "darwin",
28
+ "cpu": "x64",
29
+ "floating": "agent-toolkit-macos-x86_64",
30
+ "bin": "agent-toolkit"
31
+ },
32
+ {
33
+ "npm": "agent-toolkit-cli-win32-x64",
34
+ "os": "win32",
35
+ "cpu": "x64",
36
+ "floating": "agent-toolkit-windows-x86_64.exe",
37
+ "bin": "agent-toolkit.exe"
38
+ }
39
+ ]