@vecanova/zana 3.0.5

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,42 @@
1
+ # @vecanova/zana
2
+
3
+ **Every person in the world can have their own Aeon.**
4
+
5
+ ```bash
6
+ npm install -g @vecanova/zana
7
+ zana init
8
+ ```
9
+
10
+ That's it. Your sovereign cognitive AI, running on your hardware.
11
+
12
+ ## What this installs
13
+
14
+ This npm package is a thin wrapper that:
15
+ 1. Verifies Python 3.11+ is present
16
+ 2. Installs the `zana` Python package via pip
17
+ 3. Exposes the `zana` command globally in your terminal
18
+
19
+ ## Requirements
20
+
21
+ - Node.js 18+ (for this installer)
22
+ - Python 3.11+ (for ZANA to run)
23
+
24
+ No Docker required for the default install. No API keys required if you use Ollama.
25
+
26
+ ## Quick start
27
+
28
+ ```bash
29
+ npm install -g @vecanova/zana # installs everything
30
+ zana init # ≀4 questions, <3 min to first conversation
31
+ zana start # boot the stack
32
+ zana chat # talk to your Aeon
33
+ ```
34
+
35
+ ## More
36
+
37
+ - [GitHub](https://github.com/Kemquiros/zana-core)
38
+ - [Documentation](https://github.com/Kemquiros/zana-core/tree/main/docs)
39
+
40
+ MIT License β€” Built with honor in MedellΓ­n, Colombia πŸ‡¨πŸ‡΄ by [VECANOVA](https://vecanova.com)
41
+
42
+ *JUNTOS HACEMOS TEMBLAR LOS CIELOS.*
package/bin/zana.js ADDED
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ZANA CLI β€” npm wrapper for the Python CLI.
4
+ *
5
+ * This file is the entry point when installed via `npm install -g @vecanova/zana`.
6
+ * It delegates all arguments to the Python `zana` CLI installed by postinstall.js.
7
+ */
8
+
9
+ "use strict";
10
+
11
+ const { spawnSync, execFileSync } = require("child_process");
12
+ const path = require("path");
13
+ const os = require("os");
14
+ const fs = require("fs");
15
+
16
+ // ── Locate the Python zana binary ────────────────────────────────────────────
17
+
18
+ function findZanaBinary() {
19
+ // 1. Check if already in PATH
20
+ const which = process.platform === "win32" ? "where" : "which";
21
+ try {
22
+ const found = execFileSync(which, ["zana-py"], { encoding: "utf8" }).trim().split("\n")[0];
23
+ if (found) return found;
24
+ } catch (_) {}
25
+
26
+ // 2. Check common pip/uv install locations
27
+ const candidates = [
28
+ path.join(os.homedir(), ".local", "bin", "zana"),
29
+ path.join(os.homedir(), ".cargo", "bin", "zana"),
30
+ "/usr/local/bin/zana",
31
+ "/usr/bin/zana",
32
+ // Windows pip
33
+ path.join(os.homedir(), "AppData", "Local", "Programs", "Python", "Python312", "Scripts", "zana.exe"),
34
+ ];
35
+
36
+ for (const c of candidates) {
37
+ if (fs.existsSync(c)) return c;
38
+ }
39
+
40
+ return null;
41
+ }
42
+
43
+ function findPython() {
44
+ for (const bin of ["python3.12", "python3.11", "python3", "python"]) {
45
+ try {
46
+ const v = execFileSync(bin, ["--version"], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
47
+ const match = v.match(/Python (\d+)\.(\d+)/);
48
+ if (match && parseInt(match[1]) >= 3 && parseInt(match[2]) >= 11) {
49
+ return bin;
50
+ }
51
+ } catch (_) {}
52
+ }
53
+ return null;
54
+ }
55
+
56
+ // ── Bootstrap if not installed ────────────────────────────────────────────────
57
+
58
+ function bootstrap() {
59
+ const python = findPython();
60
+ if (!python) {
61
+ console.error(
62
+ "\n❌ Python 3.11+ not found.\n" +
63
+ " Install it from https://python.org/downloads/ then run:\n" +
64
+ " npm install -g @vecanova/zana\n"
65
+ );
66
+ process.exit(1);
67
+ }
68
+
69
+ console.log("βš™οΈ Installing ZANA Python package (first run)...");
70
+ const result = spawnSync(
71
+ python,
72
+ ["-m", "pip", "install", "--quiet", "--upgrade", "zana"],
73
+ { stdio: "inherit" }
74
+ );
75
+
76
+ if (result.status !== 0) {
77
+ console.error(
78
+ "\n❌ Failed to install ZANA Python package.\n" +
79
+ " Try manually: pip install zana\n" +
80
+ " Or run the installer: bash <(curl -LsSf https://zana.vecanova.com/install.sh)\n"
81
+ );
82
+ process.exit(1);
83
+ }
84
+
85
+ console.log("βœ… ZANA installed. Running your command...\n");
86
+ }
87
+
88
+ // ── Main: delegate to Python CLI ─────────────────────────────────────────────
89
+
90
+ let zanaBin = findZanaBinary();
91
+
92
+ if (!zanaBin) {
93
+ bootstrap();
94
+ zanaBin = findZanaBinary();
95
+ }
96
+
97
+ if (!zanaBin) {
98
+ // Last resort: run via python -m cli.main
99
+ const python = findPython();
100
+ if (!python) {
101
+ console.error("❌ Could not locate ZANA. Run: pip install zana");
102
+ process.exit(1);
103
+ }
104
+ zanaBin = null;
105
+ const args = process.argv.slice(2);
106
+ const result = spawnSync(python, ["-m", "cli.main", ...args], {
107
+ stdio: "inherit",
108
+ env: process.env,
109
+ });
110
+ process.exit(result.status ?? 1);
111
+ }
112
+
113
+ const args = process.argv.slice(2);
114
+ const result = spawnSync(zanaBin, args, {
115
+ stdio: "inherit",
116
+ env: process.env,
117
+ shell: process.platform === "win32",
118
+ });
119
+
120
+ process.exit(result.status ?? 0);
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@vecanova/zana",
3
+ "version": "3.0.5",
4
+ "description": "ZANA β€” Zero Autonomous Neural Architecture. Every person deserves their own Aeon.",
5
+ "keywords": [
6
+ "ai",
7
+ "agent",
8
+ "cognitive",
9
+ "sovereign",
10
+ "aeon",
11
+ "llm",
12
+ "local-ai"
13
+ ],
14
+ "author": "John Tapias <absurdoeco@gmail.com> (https://vecanova.com)",
15
+ "license": "MIT",
16
+ "homepage": "https://github.com/Kemquiros/zana-core",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/Kemquiros/zana-core.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/Kemquiros/zana-core/issues"
23
+ },
24
+ "bin": {
25
+ "zana": "./bin/zana.js"
26
+ },
27
+ "scripts": {
28
+ "postinstall": "node postinstall.js"
29
+ },
30
+ "engines": {
31
+ "node": ">=18.0.0"
32
+ },
33
+ "files": [
34
+ "bin/",
35
+ "postinstall.js",
36
+ "README.md"
37
+ ]
38
+ }
package/postinstall.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * postinstall.js β€” runs on `npm install -g @vecanova/zana`.
4
+ * Checks Python 3.11+, installs the ZANA Python package if missing.
5
+ */
6
+
7
+ "use strict";
8
+
9
+ const { execFileSync, spawnSync } = require("child_process");
10
+
11
+ // Skip in CI environments to avoid hanging
12
+ if (process.env.CI || process.env.ZANA_SKIP_POSTINSTALL) {
13
+ process.exit(0);
14
+ }
15
+
16
+ function findPython() {
17
+ for (const bin of ["python3.12", "python3.11", "python3", "python"]) {
18
+ try {
19
+ const v = execFileSync(bin, ["--version"], {
20
+ encoding: "utf8",
21
+ stdio: ["pipe", "pipe", "pipe"],
22
+ timeout: 5000,
23
+ }).trim();
24
+ const match = v.match(/Python (\d+)\.(\d+)/);
25
+ if (match && parseInt(match[1]) >= 3 && parseInt(match[2]) >= 11) {
26
+ return bin;
27
+ }
28
+ } catch (_) {}
29
+ }
30
+ return null;
31
+ }
32
+
33
+ function isZanaInstalled(python) {
34
+ try {
35
+ execFileSync(python, ["-c", "import cli.main"], {
36
+ encoding: "utf8",
37
+ stdio: ["pipe", "pipe", "pipe"],
38
+ timeout: 5000,
39
+ });
40
+ return true;
41
+ } catch (_) {}
42
+ try {
43
+ execFileSync(python, ["-m", "pip", "show", "zana"], {
44
+ encoding: "utf8",
45
+ stdio: ["pipe", "pipe", "pipe"],
46
+ timeout: 5000,
47
+ });
48
+ return true;
49
+ } catch (_) {}
50
+ return false;
51
+ }
52
+
53
+ console.log("\n╔══════════════════════════════════════════════════╗");
54
+ console.log("β•‘ @vecanova/zana β€” ZANA CLI installer β•‘");
55
+ console.log("β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\n");
56
+
57
+ const python = findPython();
58
+
59
+ if (!python) {
60
+ console.warn(
61
+ "⚠️ Python 3.11+ not found. ZANA needs Python to run.\n" +
62
+ " Install it from https://python.org/downloads/\n" +
63
+ " Then run: npm install -g @vecanova/zana\n"
64
+ );
65
+ process.exit(0); // non-fatal: npm install still succeeds
66
+ }
67
+
68
+ console.log(`βœ“ Python found: ${python}`);
69
+
70
+ if (isZanaInstalled(python)) {
71
+ console.log("βœ“ ZANA Python package already installed.\n");
72
+ console.log(" Run: zana init β€” to create your Aeon");
73
+ console.log(" Run: zana --help β€” to explore commands\n");
74
+ process.exit(0);
75
+ }
76
+
77
+ console.log("βš™οΈ Installing ZANA Python package via pip...");
78
+ console.log(" This may take 1-2 minutes on first install.\n");
79
+
80
+ const result = spawnSync(
81
+ python,
82
+ ["-m", "pip", "install", "--upgrade", "--quiet", "zana"],
83
+ { stdio: "inherit", timeout: 300_000 }
84
+ );
85
+
86
+ if (result.status === 0) {
87
+ console.log("\nβœ… ZANA installed successfully!\n");
88
+ console.log("╔══════════════════════════════════════════════════╗");
89
+ console.log("β•‘ Quick start: β•‘");
90
+ console.log("β•‘ β•‘");
91
+ console.log("β•‘ zana init β€” create your Aeon (<3 min) β•‘");
92
+ console.log("β•‘ zana start β€” boot the stack β•‘");
93
+ console.log("β•‘ zana chat β€” first conversation β•‘");
94
+ console.log("β•‘ β•‘");
95
+ console.log("β•‘ Your data. Your hardware. Your soul. β•‘");
96
+ console.log("β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•\n");
97
+ } else {
98
+ console.warn(
99
+ "\n⚠️ Could not auto-install ZANA Python package.\n" +
100
+ " Run manually: pip install zana\n" +
101
+ " Or: bash <(curl -LsSf https://zana.vecanova.com/install.sh)\n"
102
+ );
103
+ // non-fatal exit
104
+ process.exit(0);
105
+ }