liagent 0.0.0-stage → 0.8.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/bin/liagent.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ // `npx liagent`: runs agent.py with Python 3.8+. If rich + prompt_toolkit aren't installed, the first run makes
3
+ // a private venv for them (~12 MB, once). Nothing else is downloaded.
4
+ "use strict";
5
+ const { spawnSync } = require("child_process");
6
+ const fs = require("fs");
7
+ const os = require("os");
8
+ const path = require("path");
9
+
10
+ const WIN = process.platform === "win32";
11
+ const AGENT = path.join(__dirname, "..", "agent.py");
12
+ const DATA = WIN ? process.env.LOCALAPPDATA || os.homedir()
13
+ : process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share");
14
+ const VENV = path.join(DATA, "liagent", "npm-venv");
15
+ const VPY = WIN ? path.join(VENV, "Scripts", "python.exe") : path.join(VENV, "bin", "python");
16
+
17
+ const ok = (cmd, args) => spawnSync(cmd, args, { stdio: "ignore" }).status === 0;
18
+ const run = (cmd, args) => spawnSync(cmd, args, { stdio: "inherit" });
19
+ const hasDeps = (py) => ok(py[0], [...py.slice(1), "-c", "import rich, prompt_toolkit"]);
20
+
21
+ function findPython() {
22
+ if (process.env.LIAGENT_PYTHON) return [process.env.LIAGENT_PYTHON]; // e.g. a specific python3.11
23
+ const candidates = WIN ? [["py", "-3"], ["python"], ["python3"]] : [["python3"], ["python"]];
24
+ return candidates.find((c) => ok(c[0], [...c.slice(1), "-c", "import sys; sys.exit(sys.version_info < (3, 8))"]));
25
+ }
26
+
27
+ function fail(msg) {
28
+ console.error("liagent: " + msg);
29
+ process.exit(1);
30
+ }
31
+
32
+ let py = fs.existsSync(VPY) && hasDeps([VPY]) ? [VPY] : findPython();
33
+ if (!py) fail("needs Python 3.8+ — https://www.python.org/downloads/ (Raspberry Pi: sudo apt install python3)");
34
+ if (!hasDeps(py)) {
35
+ console.error(`liagent: first run — installing rich + prompt_toolkit into ${VENV} (~12 MB, once)…`);
36
+ // --system-site-packages: apt's gpiozero / lgpio stay visible for GPIO on a Pi
37
+ if (run(py[0], [...py.slice(1), "-m", "venv", "--system-site-packages", VENV]).status !== 0) {
38
+ fail("could not create a venv. On Debian / Raspberry Pi OS: sudo apt install python3-venv, " +
39
+ "or install the .deb: https://github.com/Kuloka/liagent#install");
40
+ }
41
+ const pkgs = ["rich>=13", "prompt_toolkit>=3", ...(WIN ? ["psutil"] : [])];
42
+ if (run(VPY, ["-m", "pip", "install", "-q", "--disable-pip-version-check", ...pkgs]).status !== 0) {
43
+ fail("pip install failed (offline?). Run it again, or install the .deb.");
44
+ }
45
+ py = [VPY];
46
+ }
47
+
48
+ // ctrl+c belongs to the agent (it stops a reply); keep this wrapper alive until the agent exits
49
+ process.on("SIGINT", () => {});
50
+ const r = run(py[0], [...py.slice(1), AGENT, ...process.argv.slice(2)]);
51
+ process.exit(r.status === null ? 1 : r.status);
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "liagent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.8.0",
4
+ "description": "Tiny terminal AI agent for Raspberry Pi cyberdecks: shell, files, GPIO, voice, web UI, Discord bot, calculators/LoRa/SMS. One Python file, ~240 KB.",
5
+ "bin": {
6
+ "liagent": "bin/liagent.js"
7
+ },
8
+ "files": [
9
+ "agent.py",
10
+ "bin/",
11
+ "DEVICES.md",
12
+ "samples/"
13
+ ],
14
+ "engines": {
15
+ "node": ">=16"
16
+ },
17
+ "keywords": [
18
+ "ai",
19
+ "agent",
20
+ "cli",
21
+ "terminal",
22
+ "raspberry-pi",
23
+ "cyberdeck",
24
+ "llm",
25
+ "groq",
26
+ "ollama",
27
+ "discord-bot",
28
+ "gpio",
29
+ "lora"
30
+ ],
31
+ "homepage": "https://github.com/Kuloka/liagent",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/Kuloka/liagent.git"
35
+ },
36
+ "bugs": "https://github.com/Kuloka/liagent/issues",
37
+ "author": "Kuloka",
38
+ "license": "MIT"
39
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file