@rikipurpur/puru-ai 1.3.0 → 2.0.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 +28 -17
- package/bin/puru.js +3 -3
- package/package.json +2 -2
- package/scripts/binary.js +2 -2
- package/scripts/install.js +7 -7
package/README.md
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
# @rikipurpur/puru-ai
|
|
1
|
+
# @rikipurpur/puru-ai
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
PURU-AI on npm — a lightweight, self-hosted Telegram AI assistant. No web
|
|
4
|
+
server by default. The Go binary is downloaded automatically from GitHub
|
|
5
|
+
Releases during install.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
5
8
|
|
|
6
9
|
```bash
|
|
7
10
|
npm i -g @rikipurpur/puru-ai
|
|
8
|
-
puru setup # wizard →
|
|
9
|
-
puru gateway #
|
|
10
|
-
puru gateway --health --port 8080 # opt-in health check
|
|
11
|
-
puru chat "
|
|
11
|
+
puru setup # interactive wizard → writes ~/.puru/config.json
|
|
12
|
+
puru gateway # run the Telegram bot (long-polling, no /health endpoint)
|
|
13
|
+
puru gateway --health --port 8080 # opt-in health check for Docker/VPS
|
|
14
|
+
puru chat "hello" # local debugging without Telegram
|
|
12
15
|
```
|
|
13
16
|
|
|
14
|
-
Non-
|
|
17
|
+
## Non-interactive setup (CI)
|
|
15
18
|
|
|
16
19
|
```bash
|
|
17
|
-
TELEGRAM_BOT_TOKEN=x PURU_BASE_URL
|
|
20
|
+
TELEGRAM_BOT_TOKEN=x PURU_BASE_URL=https://api.openai.com/v1 \
|
|
21
|
+
PURU_API_KEY=sk-... PURU_MODEL=gpt-4o-mini \
|
|
18
22
|
puru setup --force
|
|
19
23
|
```
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
`
|
|
25
|
+
Installer environment variables: `PURU_AI_VERSION` (defaults to the package
|
|
26
|
+
version), `PURU_AI_REPO` (defaults to `purujawa06-bot/PURU-AI`),
|
|
27
|
+
`PURU_AI_BINARY` (use a local binary instead of downloading),
|
|
28
|
+
`PURU_AI_SKIP_DOWNLOAD=1` (skip the download step).
|
|
24
29
|
|
|
25
30
|
## Termux (Android)
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
`puru-linux-arm` (armv7) — installer
|
|
32
|
+
Most 64-bit phones use the `puru-linux-arm64` binary; 32-bit phones use
|
|
33
|
+
`puru-linux-arm` (armv7) — the installer picks the right one automatically.
|
|
29
34
|
|
|
30
35
|
```bash
|
|
31
36
|
pkg install nodejs
|
|
@@ -34,8 +39,14 @@ puru setup
|
|
|
34
39
|
puru gateway
|
|
35
40
|
```
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
Tip: run under `termux-wake-lock` so the bot stays alive when the screen is
|
|
43
|
+
off. Node.js is optional — you can download the binary straight from
|
|
39
44
|
[Releases](https://github.com/purujawa06-bot/PURU-AI/releases)
|
|
40
|
-
(`puru-linux-arm64`
|
|
45
|
+
(`puru-linux-arm64` or `puru-linux-arm`), `chmod +x` it, then run
|
|
41
46
|
`./puru-linux-arm64 setup`.
|
|
47
|
+
|
|
48
|
+
## Links
|
|
49
|
+
|
|
50
|
+
- Repository: <https://github.com/purujawa06-bot/PURU-AI>
|
|
51
|
+
- Issues: <https://github.com/purujawa06-bot/PURU-AI/issues>
|
|
52
|
+
- License: MIT
|
package/bin/puru.js
CHANGED
|
@@ -7,9 +7,9 @@ const { binaryPath } = require('../scripts/binary');
|
|
|
7
7
|
|
|
8
8
|
const bin = binaryPath();
|
|
9
9
|
if (!fs.existsSync(bin)) {
|
|
10
|
-
console.error(`[puru-ai] binary
|
|
11
|
-
console.error('[puru-ai]
|
|
12
|
-
console.error('[puru-ai]
|
|
10
|
+
console.error(`[puru-ai] binary not found: ${bin}`);
|
|
11
|
+
console.error('[puru-ai] Run `npm rebuild -g @rikipurpur/puru-ai` or reinstall.');
|
|
12
|
+
console.error('[puru-ai] Alternative: set PURU_AI_BINARY=/path/to/puru');
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
15
15
|
const res = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rikipurpur/puru-ai",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "PURU-AI CLI — setup
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "PURU-AI CLI — setup wizard and Telegram bot gateway (no web server). Self-contained Go binary distributed via npm.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ricky",
|
|
7
7
|
"homepage": "https://github.com/purujawa06-bot/PURU-AI",
|
package/scripts/binary.js
CHANGED
|
@@ -8,7 +8,7 @@ function mapOS(platform = process.platform) {
|
|
|
8
8
|
if (platform === 'darwin') return 'darwin';
|
|
9
9
|
// Termux di Android lapor 'linux' — binary linux statik (CGO_ENABLED=0) jalan langsung.
|
|
10
10
|
if (platform === 'linux' || platform === 'android') return 'linux';
|
|
11
|
-
throw new Error(`OS
|
|
11
|
+
throw new Error(`Unsupported OS: ${platform} (supported: linux, darwin, windows)`);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function mapArch(arch = process.arch) {
|
|
@@ -16,7 +16,7 @@ function mapArch(arch = process.arch) {
|
|
|
16
16
|
if (arch === 'arm64') return 'arm64';
|
|
17
17
|
// HP Android 32-bit (armv7) — Termux lapor 'arm'.
|
|
18
18
|
if (arch === 'arm') return 'arm';
|
|
19
|
-
throw new Error(`
|
|
19
|
+
throw new Error(`Unsupported arch: ${arch} (supported: x64, arm64, arm)`);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function assetName(goos, goarch) {
|
package/scripts/install.js
CHANGED
|
@@ -23,7 +23,7 @@ function fetch(url, dest, redirects = 5) {
|
|
|
23
23
|
return new Promise((resolve, reject) => {
|
|
24
24
|
https.get(url, { headers: { 'User-Agent': 'puru-ai-npm-install' } }, (res) => {
|
|
25
25
|
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
26
|
-
if (redirects === 0) return reject(new Error('
|
|
26
|
+
if (redirects === 0) return reject(new Error('Too many redirects'));
|
|
27
27
|
res.resume();
|
|
28
28
|
const next = res.headers.location.startsWith('http')
|
|
29
29
|
? res.headers.location
|
|
@@ -32,7 +32,7 @@ function fetch(url, dest, redirects = 5) {
|
|
|
32
32
|
}
|
|
33
33
|
if (res.statusCode !== 200) {
|
|
34
34
|
res.resume();
|
|
35
|
-
return reject(new Error(`Download
|
|
35
|
+
return reject(new Error(`Download failed HTTP ${res.statusCode}: ${url}`));
|
|
36
36
|
}
|
|
37
37
|
const out = fs.createWriteStream(dest, { mode: 0o755 });
|
|
38
38
|
res.pipe(out);
|
|
@@ -54,21 +54,21 @@ async function main() {
|
|
|
54
54
|
const url = downloadURL({ repo, tag, goos, goarch });
|
|
55
55
|
const dest = binaryPath();
|
|
56
56
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
57
|
-
console.log(`[puru-ai]
|
|
57
|
+
console.log(`[puru-ai] downloading ${assetName(goos, goarch)} ${tag} from ${repo}...`);
|
|
58
58
|
try {
|
|
59
59
|
await fetch(url, dest);
|
|
60
60
|
} catch (err) {
|
|
61
61
|
try { fs.unlinkSync(dest); } catch (_) {}
|
|
62
|
-
console.error(`[puru-ai]
|
|
63
|
-
console.error(`[puru-ai]
|
|
64
|
-
console.error(`[puru-ai]
|
|
62
|
+
console.error(`[puru-ai] FAILED: ${err.message}`);
|
|
63
|
+
console.error(`[puru-ai] Check the release at https://github.com/${repo}/releases/tag/${tag}`);
|
|
64
|
+
console.error(`[puru-ai] Or set PURU_AI_BINARY=/path/to/puru and reinstall.`);
|
|
65
65
|
throw err;
|
|
66
66
|
}
|
|
67
67
|
if (goos !== 'windows') {
|
|
68
68
|
try { fs.chmodSync(dest, 0o755); } catch (_) {}
|
|
69
69
|
}
|
|
70
70
|
console.log(`[puru-ai] OK: ${dest}`);
|
|
71
|
-
console.log('[puru-ai]
|
|
71
|
+
console.log('[puru-ai] Next: puru setup → puru gateway');
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (require.main === module) {
|