open-agents-ai 0.21.2 → 0.22.1

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.
Files changed (2) hide show
  1. package/dist/launcher.cjs +118 -0
  2. package/package.json +4 -4
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+ // Node version gate — uses only ES5 syntax so it parses on any Node version.
3
+ // On old Node: offers to install Node 20 via nvm with y/n prompts.
4
+ var nodeVersion = parseInt(process.versions.node, 10);
5
+
6
+ if (nodeVersion < 18) {
7
+ var os = require("os");
8
+ var path = require("path");
9
+ var childProcess = require("child_process");
10
+ var readline = require("readline");
11
+
12
+ var platform = os.platform();
13
+ var arch = os.arch();
14
+
15
+ console.log(
16
+ "\n open-agents requires Node.js >= 18 (you have " + process.version + ")" +
17
+ "\n Platform: " + platform + "/" + arch + "\n"
18
+ );
19
+
20
+ // Check if nvm is already installed
21
+ var nvmDir = process.env.NVM_DIR || path.join(os.homedir(), ".nvm");
22
+ var hasNvm = false;
23
+ try {
24
+ require("fs").statSync(path.join(nvmDir, "nvm.sh"));
25
+ hasNvm = true;
26
+ } catch (e) {}
27
+
28
+ var rl = readline.createInterface({ input: process.stdin, output: process.stdout });
29
+
30
+ function ask(question, cb) {
31
+ rl.question(question, function(answer) {
32
+ cb(answer.trim().toLowerCase());
33
+ });
34
+ }
35
+
36
+ function run(cmd, opts) {
37
+ console.log(" $ " + cmd);
38
+ try {
39
+ childProcess.execSync(cmd, Object.assign({ stdio: "inherit" }, opts || {}));
40
+ return true;
41
+ } catch (e) {
42
+ console.error(" Command failed: " + (e.message || e));
43
+ return false;
44
+ }
45
+ }
46
+
47
+ function installNode() {
48
+ if (!hasNvm) {
49
+ console.log("\n nvm not found. Installing nvm first...\n");
50
+ var ok = run("curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash");
51
+ if (!ok) {
52
+ console.error("\n nvm install failed. Install manually:");
53
+ console.error(" https://github.com/nvm-sh/nvm#installing-and-updating\n");
54
+ rl.close();
55
+ process.exit(1);
56
+ }
57
+ // Re-source nvm for this session
58
+ nvmDir = process.env.NVM_DIR || path.join(os.homedir(), ".nvm");
59
+ } else {
60
+ console.log("\n nvm found at " + nvmDir + "\n");
61
+ }
62
+
63
+ // nvm is a shell function, so we run through bash
64
+ var shell = process.env.SHELL || "/bin/bash";
65
+ var nvmCmd = 'export NVM_DIR="' + nvmDir + '" && ' +
66
+ '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && ' +
67
+ "nvm install 20 && nvm use 20 && nvm alias default 20";
68
+
69
+ console.log(" Installing Node.js 20...\n");
70
+ var ok = run(shell + ' -c \'' + nvmCmd + "'");
71
+ if (!ok) {
72
+ console.error("\n Node 20 install failed.\n");
73
+ rl.close();
74
+ process.exit(1);
75
+ }
76
+
77
+ // Now reinstall open-agents under the new Node
78
+ console.log("\n Node 20 installed. Reinstalling open-agents...\n");
79
+ var reinstallCmd = 'export NVM_DIR="' + nvmDir + '" && ' +
80
+ '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && ' +
81
+ "npm i -g open-agents-ai";
82
+ var ok2 = run(shell + ' -c \'' + reinstallCmd + "'");
83
+ if (!ok2) {
84
+ console.error("\n Reinstall failed. After opening a new terminal, run:");
85
+ console.error(" npm i -g open-agents-ai\n");
86
+ rl.close();
87
+ process.exit(1);
88
+ }
89
+
90
+ console.log(
91
+ "\n Done! Open a new terminal (or run: source ~/.bashrc) then run:" +
92
+ "\n oa\n"
93
+ );
94
+ rl.close();
95
+ process.exit(0);
96
+ }
97
+
98
+ ask(" Install Node.js 20 now? [Y/n] ", function(answer) {
99
+ if (answer === "n" || answer === "no") {
100
+ console.log(
101
+ "\n To install manually:\n" +
102
+ " curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash\n" +
103
+ " source ~/.bashrc\n" +
104
+ " nvm install 20\n" +
105
+ " npm i -g open-agents-ai\n"
106
+ );
107
+ rl.close();
108
+ process.exit(1);
109
+ }
110
+ installNode();
111
+ });
112
+ } else {
113
+ // Node >= 18 — load the ESM bundle
114
+ import("./index.js").catch(function(err) {
115
+ console.error("Failed to load open-agents:", err.message || err);
116
+ process.exit(1);
117
+ });
118
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.21.2",
3
+ "version": "0.22.1",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "open-agents": "dist/index.js",
10
- "oa": "dist/index.js"
9
+ "open-agents": "dist/launcher.cjs",
10
+ "oa": "dist/launcher.cjs"
11
11
  },
12
12
  "files": [
13
13
  "dist",
@@ -41,7 +41,7 @@
41
41
  "url": "https://github.com/robit-man/open-agents/issues"
42
42
  },
43
43
  "engines": {
44
- "node": ">=20.0.0"
44
+ "node": ">=18.0.0"
45
45
  },
46
46
  "dependencies": {
47
47
  "better-sqlite3": "^11.7.0",