beast-agent 1.8.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/LICENSE +21 -21
- package/README.md +130 -128
- package/bin/beast-agent.js +137 -137
- package/package.json +1 -1
- package/scripts/fix-electron.js +138 -138
- package/scripts/release.js +137 -131
- package/scripts/swap-electron.js +40 -40
- package/src/agent/agentdefs.js +122 -122
- package/src/agent/bots.js +580 -580
- package/src/agent/bus.js +389 -389
- package/src/agent/computeruse.js +200 -200
- package/src/agent/config.js +284 -284
- package/src/agent/discord.js +332 -332
- package/src/agent/engine.js +85 -11
- package/src/agent/kb.js +123 -123
- package/src/agent/llm.js +430 -430
- package/src/agent/logger.js +90 -90
- package/src/agent/mcp.js +427 -0
- package/src/agent/mem0.js +605 -605
- package/src/agent/memory.js +427 -427
- package/src/agent/mqueue.js +124 -124
- package/src/agent/pdf.js +20 -20
- package/src/agent/research.js +133 -133
- package/src/agent/scripts/news.py +113 -113
- package/src/agent/scripts/stealthsearch.py +30 -30
- package/src/agent/scripts/websearch.py +225 -225
- package/src/agent/searxng.js +325 -325
- package/src/agent/seeds/brainstorming/SKILL.md +90 -90
- package/src/agent/seeds/dispatching-parallel-agents/SKILL.md +120 -120
- package/src/agent/seeds/executing-plans/SKILL.md +60 -60
- package/src/agent/seeds/subagent-driven-development/SKILL.md +167 -167
- package/src/agent/seeds/systematic-debugging/SKILL.md +131 -131
- package/src/agent/seeds/test-driven-development/SKILL.md +152 -152
- package/src/agent/seeds/verification-before-completion/SKILL.md +63 -63
- package/src/agent/seeds/writing-plans/SKILL.md +162 -162
- package/src/agent/seeds/writing-skills/SKILL.md +229 -229
- package/src/agent/skills.js +652 -651
- package/src/agent/store.js +378 -378
- package/src/agent/telegram.js +155 -155
- package/src/agent/tokens.js +39 -39
- package/src/agent/usage.js +125 -125
- package/src/agent/watchers.js +312 -312
- package/src/agent/watext.js +80 -80
- package/src/agent/whatsapp.js +555 -555
- package/src/cron.js +255 -255
- package/src/main.js +385 -6
- package/src/preload.js +13 -0
- package/src/renderer/browserPreload.js +73 -73
- package/src/renderer/i18n.js +38 -0
- package/src/renderer/index.html +448 -407
- package/src/renderer/renderer.js +897 -42
- package/src/renderer/style.css +275 -11
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 algokodcom (AlgoKod)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 algokodcom (AlgoKod)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,128 +1,130 @@
|
|
|
1
|
-
# Beast Agent
|
|
2
|
-
|
|
3
|
-
> **fast, light and resourceful** — a local agent shell for Windows. It chats, runs commands, writes files, searches the web, and is fully controllable from WhatsApp.
|
|
4
|
-
|
|
5
|
-
  
|
|
6
|
-
|
|
7
|
-
> [!IMPORTANT]
|
|
8
|
-
> **This is a desktop app — it must be installed GLOBALLY:**
|
|
9
|
-
> ```bash
|
|
10
|
-
> npm install -g beast-agent
|
|
11
|
-
> ```
|
|
12
|
-
> ⚠️ The npm sidebar box (`npm i beast-agent`) performs a **local** install — the `beast-agent` command will NOT be on your PATH and the app won't start. If you already installed locally, either re-run the command above, or launch with `npx beast-agent`. Global install also sets up the desktop shortcut and Windows startup automatically on first launch.
|
|
13
|
-
|
|
14
|
-
**Website:** [beast.algokod.com](https://beast.algokod.com) · **AlgoKod:** [algokod.com](https://algokod.com)
|
|
15
|
-
|
|
16
|
-
Beast Agent is a personal AI agent that runs on your machine and connects to **any OpenAI-compatible provider**. Define all your models in a single `config.yaml`; Beast handles the rest.
|
|
17
|
-
|
|
18
|
-
## ✨ Features
|
|
19
|
-
|
|
20
|
-
- **Multi-provider** — unlimited models from config.yaml; instant switching in the picker, role-based models (vision / terminal / coding / subagent)
|
|
21
|
-
- **FALLOUT chain** ⚛ — if a model fails, Beast automatically moves to the next provider and resumes where it left off
|
|
22
|
-
- **CEO mode** — the talking agent does no work itself; it delegates orders to parallel agents with a live monitoring panel
|
|
23
|
-
- **WhatsApp integration** — pair via QR; DMs + groups (@mention), voice notes auto-transcribed by local Whisper, replies can be sent as voice notes too
|
|
24
|
-
- **Slash commands** — `/new`, `/open`, `/change`, `/think`, `/rule`, `/allow`, `/block`, `/backup`, `/approve` and more
|
|
25
|
-
- **Event center** — IMAP IDLE email watching, file-change watching, price feed (Binance), webhook inputs
|
|
26
|
-
- **Cron + watchers** — scheduled tasks, file/web/battery watchers
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
|
97
|
-
|
|
98
|
-
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1
|
+
# Beast Agent
|
|
2
|
+
|
|
3
|
+
> **fast, light and resourceful** — a local agent shell for Windows. It chats, runs commands, writes files, searches the web, and is fully controllable from WhatsApp.
|
|
4
|
+
|
|
5
|
+
  
|
|
6
|
+
|
|
7
|
+
> [!IMPORTANT]
|
|
8
|
+
> **This is a desktop app — it must be installed GLOBALLY:**
|
|
9
|
+
> ```bash
|
|
10
|
+
> npm install -g beast-agent
|
|
11
|
+
> ```
|
|
12
|
+
> ⚠️ The npm sidebar box (`npm i beast-agent`) performs a **local** install — the `beast-agent` command will NOT be on your PATH and the app won't start. If you already installed locally, either re-run the command above, or launch with `npx beast-agent`. Global install also sets up the desktop shortcut and Windows startup automatically on first launch.
|
|
13
|
+
|
|
14
|
+
**Website:** [beast.algokod.com](https://beast.algokod.com) · **AlgoKod:** [algokod.com](https://algokod.com)
|
|
15
|
+
|
|
16
|
+
Beast Agent is a personal AI agent that runs on your machine and connects to **any OpenAI-compatible provider**. Define all your models in a single `config.yaml`; Beast handles the rest.
|
|
17
|
+
|
|
18
|
+
## ✨ Features
|
|
19
|
+
|
|
20
|
+
- **Multi-provider** — unlimited models from config.yaml; instant switching in the picker, role-based models (vision / terminal / coding / subagent)
|
|
21
|
+
- **FALLOUT chain** ⚛ — if a model fails, Beast automatically moves to the next provider and resumes where it left off
|
|
22
|
+
- **CEO mode** — the talking agent does no work itself; it delegates orders to parallel agents with a live monitoring panel
|
|
23
|
+
- **WhatsApp integration** — pair via QR; DMs + groups (@mention), voice notes auto-transcribed by local Whisper, replies can be sent as voice notes too
|
|
24
|
+
- **Slash commands** — `/new`, `/open`, `/change`, `/think`, `/rule`, `/allow`, `/block`, `/backup`, `/approve` and more
|
|
25
|
+
- **Event center** — IMAP IDLE email watching, file-change watching, price feed (Binance), webhook inputs
|
|
26
|
+
- **Cron + watchers** — scheduled tasks, file/web/battery watchers
|
|
27
|
+
- **MCP desteği** — Model Context Protocol server bağla (filesystem, git, fetch, memory + binlerce topluluk server'ı); araçlar `mcp__server__tool` adıyla modele açılır, Ayarlar → MCP'den yönetilir
|
|
28
|
+
- **Skills** — `%APPDATA%\beast\skills\<ad>\SKILL.md` ile ajanına yetenek öğret; Superpowers metodoloji paketi (planlama, TDD, paralel ajan disiplini, doğrulama) builtin gelir
|
|
29
|
+
- **Web search chain** — TinyFish (free, used first if a key is set) → built-in browser (direct Google) → python multi-engine (DDG/Bing/Mojeek) → Exa
|
|
30
|
+
- **Approval gate** — optional confirmation for risky actions (commands / file deletion-modification): default OFF (everything free), when ON the agent asks (`/approve`, `/approve always`, `/deny`)
|
|
31
|
+
- **Provider-based limits** — per-provider max input token limit with context compression
|
|
32
|
+
- **Encrypted backups** — all data is AES-256 encrypted and signed with your machine's unique **Beast Code**
|
|
33
|
+
- **Dashboard** — session history, message statistics, cost tracking
|
|
34
|
+
- **Full TR/EN interface** — everything switches language instantly
|
|
35
|
+
- **/health** — `http://127.0.0.1:8788/health` liveness endpoint from the moment the app boots
|
|
36
|
+
|
|
37
|
+
## 📦 Download & Install — 2 commands, ready
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g beast-agent
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then start it:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
beast-agent
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
That's it — the app window opens. On first launch Beast also creates a **desktop shortcut** and registers itself to **start with Windows** (lives in the tray). Later updates: close the app and run `beast update` (or `beast-agent update`).
|
|
50
|
+
|
|
51
|
+
## ⚙️ Configuration
|
|
52
|
+
|
|
53
|
+
### Recommended: OpenCode Zen (free tier, no credit card)
|
|
54
|
+
|
|
55
|
+
Get a key at [opencode.ai/auth](https://opencode.ai/auth), then copy `config.example.yaml` → `config.yaml`:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
defaultSelection: opencode::glm-5.2
|
|
59
|
+
providers:
|
|
60
|
+
- id: opencode
|
|
61
|
+
name: OpenCode Zen
|
|
62
|
+
baseUrl: https://opencode.ai/zen/v1
|
|
63
|
+
apiKey: <your-key>
|
|
64
|
+
models:
|
|
65
|
+
- glm-5.2
|
|
66
|
+
- kimi-k2.7-code
|
|
67
|
+
- deepseek-v4-flash-free
|
|
68
|
+
- big-pickle
|
|
69
|
+
- minimax-m3
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> Free models include `deepseek-v4-flash-free`, `big-pickle`, `mimo-v2.5-free`, `nemotron-3-ultra-free`. If you have an **OpenCode Go** subscription, use the same config with `baseUrl: https://opencode.ai/zen/go/v1`.
|
|
73
|
+
|
|
74
|
+
### Any other OpenAI-compatible provider
|
|
75
|
+
|
|
76
|
+
OpenRouter, Zhipu, Ollama, OpenAI — anything that speaks `/v1/chat/completions` works:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
defaultSelection: openrouter::anthropic/claude-3.5-sonnet
|
|
80
|
+
providers:
|
|
81
|
+
- id: openrouter
|
|
82
|
+
name: OpenRouter
|
|
83
|
+
baseUrl: https://openrouter.ai/api/v1
|
|
84
|
+
apiKey: sk-or-...
|
|
85
|
+
models:
|
|
86
|
+
- anthropic/claude-3.5-sonnet
|
|
87
|
+
- gpt-4o
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
API keys can also go into `.env` (copy `.env.example` → `.env`). On first launch, Settings → Provider pulls your models automatically.
|
|
91
|
+
|
|
92
|
+
All app data lives under `%APPDATA%\beast` (sessions, memory, WhatsApp pairing, encrypted settings).
|
|
93
|
+
|
|
94
|
+
## 🗣️ Usage
|
|
95
|
+
|
|
96
|
+
| Where | What it does |
|
|
97
|
+
|---|---|
|
|
98
|
+
| Chat | Give it a task — it works on its own with tools (files, commands, web, python, browser) |
|
|
99
|
+
| WhatsApp | Add your number to the allow list, control the agent from your phone |
|
|
100
|
+
| Tray | Closing the window doesn't kill it — Beast keeps living in the tray |
|
|
101
|
+
|
|
102
|
+
Type `/help` in the chat to see every command.
|
|
103
|
+
|
|
104
|
+
## 🗑️ Uninstall
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
beast-agent uninstall
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This removes the app (package, startup registration, desktop shortcut) but **keeps all your personal data** — `config.yaml`, `.env`, sessions, memory, WhatsApp pairing and encrypted backups stay in `%APPDATA%\beast`. Reinstall later with `npm install -g beast-agent` and everything is exactly where you left it.
|
|
111
|
+
|
|
112
|
+
To wipe everything instead, delete the `%APPDATA%\beast` folder after uninstalling.
|
|
113
|
+
|
|
114
|
+
## 🔒 Security & Privacy
|
|
115
|
+
|
|
116
|
+
- Everything runs **locally**: sessions, memory and logs stay on your disk
|
|
117
|
+
- API keys are never sent to the renderer in plaintext — masking is applied
|
|
118
|
+
- Backups are AES-256 encrypted + signed with the Beast Code — only your machine can restore them
|
|
119
|
+
- The approval gate is **off by default**; enable it from the Security tab if you want
|
|
120
|
+
|
|
121
|
+
## 🧪 Development
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm test # engine + tool tests (node --test)
|
|
125
|
+
npm run dist # NSIS + portable build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 📄 License
|
|
129
|
+
|
|
130
|
+
[MIT](LICENSE) © 2026 algokodcom (AlgoKod)
|
package/bin/beast-agent.js
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/* Beast Agent global npm başlatıcısı (`beast` kısa adı da aynı scripte bağlı):
|
|
5
|
-
`beast` / `beast-agent` → uygulamayı detached başlatır, terminali hemen serbest bırakır
|
|
6
|
-
`beast update` → npm'den en son sürümü yükler (uygulama kapalıyken çalıştır) */
|
|
7
|
-
|
|
8
|
-
const { spawn, spawnSync } = require('child_process');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const os = require('os');
|
|
12
|
-
|
|
13
|
-
/* kaldırma modu: uygulamayı kaldırır ama KİŞİSEL VERİLERİ korur
|
|
14
|
-
(%APPDATA%\beast: config.yaml, .env, oturumlar, hafıza, WhatsApp eşlemesi, yedekler) */
|
|
15
|
-
if (process.argv[2] === 'uninstall') {
|
|
16
|
-
const isWin = process.platform === 'win32';
|
|
17
|
-
console.log('Beast Agent kald\u0131r\u0131l\u0131yor\u2026');
|
|
18
|
-
if (isWin) {
|
|
19
|
-
/* çalışan örnekleri kapat */
|
|
20
|
-
try {
|
|
21
|
-
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
22
|
-
"Get-Process electron -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*node_modules*beast-agent*' } | Stop-Process -Force"],
|
|
23
|
-
{ stdio: 'ignore' });
|
|
24
|
-
console.log('\u2022 \u00E7al\u0131\u015Fan Beast kapat\u0131ld\u0131 (varsa)');
|
|
25
|
-
} catch {}
|
|
26
|
-
/* startup kaydını sil — yalnız verisi beast-agent'a işaret ediyorsa */
|
|
27
|
-
try {
|
|
28
|
-
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
29
|
-
"$k='HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';" +
|
|
30
|
-
"foreach($n in (Get-Item $k -ErrorAction SilentlyContinue).GetValueNames()){" +
|
|
31
|
-
"$v=(Get-ItemProperty $k).$n; if($v -like '*node_modules*beast-agent*'){ Remove-ItemProperty -Path $k -Name $n; Write-Host '• startup kayd\u0131 silindi' } }"],
|
|
32
|
-
{ stdio: 'inherit' });
|
|
33
|
-
} catch {}
|
|
34
|
-
/* masaüstü kısayolunu sil (gerçek Masaüstü yolu: OneDrive olabilir) */
|
|
35
|
-
try {
|
|
36
|
-
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
37
|
-
"$d=[Environment]::GetFolderPath('Desktop'); if(Test-Path \"$d\\Beast Agent.lnk\"){ Remove-Item \"$d\\Beast Agent.lnk\" -Force; Write-Host '\u2022 masa\u00FCst\u00FC k\u0131sayolu silindi' }"],
|
|
38
|
-
{ stdio: 'inherit' });
|
|
39
|
-
} catch {}
|
|
40
|
-
} else {
|
|
41
|
-
try { spawnSync('pkill', ['-f', 'node_modules/beast-agent'], { stdio: 'ignore' }); } catch {}
|
|
42
|
-
}
|
|
43
|
-
console.log('\u2022 npm paketi kald\u0131r\u0131l\u0131yor\u2026');
|
|
44
|
-
const ur = spawnSync('npm', ['uninstall', '-g', 'beast-agent'], { stdio: 'inherit', shell: isWin });
|
|
45
|
-
console.log('\n\u2713 Beast Agent kald\u0131r\u0131ld\u0131.');
|
|
46
|
-
console.log('\u2139 Ki\u015Fisel verilerin korundu \u2014 %APPDATA%\\beast');
|
|
47
|
-
console.log(' (config.yaml, .env, oturumlar, haf\u0131za, WhatsApp e\u015Flemesi, \u015Fifreli yedekler)');
|
|
48
|
-
console.log(' Tekrar kurmak i\u00E7in: npm install -g beast-agent');
|
|
49
|
-
process.exit(ur.status || 0);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/* güncelleme modu: çalışan Beast'i kapat (dosya kilidi EBUSY vermesin) → npm güncelle (görünür ilerleme) → yeniden başlat.
|
|
53
|
-
Bu komut güncelleme butonu tarafından GÖRÜNÜR bir cmd penceresi içinde çalıştırılır;
|
|
54
|
-
doğrudan terminalden de çalışır — npm install çıktısı ekranda akar. */
|
|
55
|
-
if (process.argv[2] === 'update') {
|
|
56
|
-
const isWin = process.platform === 'win32';
|
|
57
|
-
console.log('\u27F3 beast-agent g\u00FCncelleniyor\u2026');
|
|
58
|
-
if (isWin) {
|
|
59
|
-
try {
|
|
60
|
-
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
61
|
-
"Get-Process electron -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*node_modules*beast-agent*' } | Stop-Process -Force"],
|
|
62
|
-
{ stdio: 'ignore' });
|
|
63
|
-
console.log('\u2022 \u00E7al\u0131\u015Fan Beast kapat\u0131ld\u0131 (varsa)');
|
|
64
|
-
} catch {}
|
|
65
|
-
} else {
|
|
66
|
-
try { spawnSync('pkill', ['-f', 'node_modules/beast-agent'], { stdio: 'ignore' }); } catch {}
|
|
67
|
-
}
|
|
68
|
-
/* dosya kilidi (EBUSY) bazen ilk denemede patlar — 5 deneme hakkı */
|
|
69
|
-
let ok = false;
|
|
70
|
-
for (let i = 1; i <= 5 && !ok; i++) {
|
|
71
|
-
const r = spawnSync('npm', ['install', '-g', 'beast-agent@latest'], { stdio: 'inherit', shell: isWin });
|
|
72
|
-
ok = r.status === 0;
|
|
73
|
-
if (!ok && i < 5) {
|
|
74
|
-
console.log(` \u2022 deneme ${i}/5 ba\u015Far\u0131s\u0131z (dosya kilidi olabilir) \u2014 3 sn sonra tekrar\u2026`);
|
|
75
|
-
if (isWin) spawnSync('powershell.exe', ['-NoProfile', '-Command', 'Start-Sleep -Seconds 3'], { stdio: 'ignore' });
|
|
76
|
-
else spawnSync('sleep', ['3']);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (!ok) {
|
|
80
|
-
console.log('\n\u2717 g\u00FCncelleme ba\u015Far\u0131s\u0131z \u2014 elle: npm install -g beast-agent@latest');
|
|
81
|
-
if (isWin) spawnSync('cmd.exe', ['/c', 'pause'], { stdio: 'inherit', shell: false });
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
console.log('\n\u2713 beast-agent g\u00FCncellendi \u2014 uygulama ba\u015Flat\u0131l\u0131yor\u2026');
|
|
85
|
-
launchDetached([]);
|
|
86
|
-
if (isWin) spawnSync('cmd.exe', ['/c', 'timeout /t 3'], { stdio: 'ignore' });
|
|
87
|
-
process.exit(0);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/* SearXNG: yerel arama motoru — kur + arka planda başlat (127.0.0.1:8888)
|
|
91
|
-
beast searxng → gerekirse kur, başlat
|
|
92
|
-
beast searxng status → durum
|
|
93
|
-
beast searxng stop → kulla */
|
|
94
|
-
if (process.argv[2] === 'searxng') {
|
|
95
|
-
require('../src/agent/searxng').cli(process.argv.slice(3)).catch((e) => {
|
|
96
|
-
console.error('\u2717 ' + String((e && e.message) || e));
|
|
97
|
-
process.exit(1);
|
|
98
|
-
});
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* detached başlatıcı + kendini onaran electron:
|
|
103
|
-
taze makinalarda npm postinstall sırasında electron binary indirmesi
|
|
104
|
-
sessizce başarısız olmuş olabilir → burada otomatik tamir edilir. */
|
|
105
|
-
function launchDetached(extraArgs) {
|
|
106
|
-
let electron = null;
|
|
107
|
-
try { electron = require('electron'); } catch {}
|
|
108
|
-
if (typeof electron !== 'string') {
|
|
109
|
-
let fix = null;
|
|
110
|
-
try { fix = require('../scripts/fix-electron'); } catch {}
|
|
111
|
-
if (fix) {
|
|
112
|
-
console.log('\u27F3 electron \u00e7al\u0131\u015Fma dosyalar\u0131 eksik bulundu \u2014 otomatik onar\u0131l\u0131yor\u2026');
|
|
113
|
-
const r = fix.repair({ quiet: false });
|
|
114
|
-
if (r.ok && !r.skipped) console.log('\u2713 electron onar\u0131ld\u0131');
|
|
115
|
-
if (r.ok) {
|
|
116
|
-
try { electron = require('electron'); } catch {}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (typeof electron !== 'string') {
|
|
121
|
-
console.log('\n\u2717 Electron \u00e7al\u0131\u015Fma dosyas\u0131 kurulamad\u0131.');
|
|
122
|
-
console.log(' Elle \u00e7\u00f6z\u00fcm \u2014 \u015fu 2 komutu \u00e7al\u0131\u015Ft\u0131r:');
|
|
123
|
-
console.log(' npm config set ignore-scripts false');
|
|
124
|
-
console.log(' npm install -g beast-agent');
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
const child = spawn(electron, [path.resolve(__dirname, '..'), ...extraArgs], {
|
|
128
|
-
stdio: 'ignore',
|
|
129
|
-
detached: true,
|
|
130
|
-
/* windowsHide KULLANMA: Chromium ilk pencereyi gizli başlatıyor (tray-only bug) */
|
|
131
|
-
});
|
|
132
|
-
child.unref();
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!launchDetached(process.argv.slice(2))) process.exit(1);
|
|
137
|
-
process.exit(0);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/* Beast Agent global npm başlatıcısı (`beast` kısa adı da aynı scripte bağlı):
|
|
5
|
+
`beast` / `beast-agent` → uygulamayı detached başlatır, terminali hemen serbest bırakır
|
|
6
|
+
`beast update` → npm'den en son sürümü yükler (uygulama kapalıyken çalıştır) */
|
|
7
|
+
|
|
8
|
+
const { spawn, spawnSync } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
|
|
13
|
+
/* kaldırma modu: uygulamayı kaldırır ama KİŞİSEL VERİLERİ korur
|
|
14
|
+
(%APPDATA%\beast: config.yaml, .env, oturumlar, hafıza, WhatsApp eşlemesi, yedekler) */
|
|
15
|
+
if (process.argv[2] === 'uninstall') {
|
|
16
|
+
const isWin = process.platform === 'win32';
|
|
17
|
+
console.log('Beast Agent kald\u0131r\u0131l\u0131yor\u2026');
|
|
18
|
+
if (isWin) {
|
|
19
|
+
/* çalışan örnekleri kapat */
|
|
20
|
+
try {
|
|
21
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
22
|
+
"Get-Process electron -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*node_modules*beast-agent*' } | Stop-Process -Force"],
|
|
23
|
+
{ stdio: 'ignore' });
|
|
24
|
+
console.log('\u2022 \u00E7al\u0131\u015Fan Beast kapat\u0131ld\u0131 (varsa)');
|
|
25
|
+
} catch {}
|
|
26
|
+
/* startup kaydını sil — yalnız verisi beast-agent'a işaret ediyorsa */
|
|
27
|
+
try {
|
|
28
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
29
|
+
"$k='HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';" +
|
|
30
|
+
"foreach($n in (Get-Item $k -ErrorAction SilentlyContinue).GetValueNames()){" +
|
|
31
|
+
"$v=(Get-ItemProperty $k).$n; if($v -like '*node_modules*beast-agent*'){ Remove-ItemProperty -Path $k -Name $n; Write-Host '• startup kayd\u0131 silindi' } }"],
|
|
32
|
+
{ stdio: 'inherit' });
|
|
33
|
+
} catch {}
|
|
34
|
+
/* masaüstü kısayolunu sil (gerçek Masaüstü yolu: OneDrive olabilir) */
|
|
35
|
+
try {
|
|
36
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
37
|
+
"$d=[Environment]::GetFolderPath('Desktop'); if(Test-Path \"$d\\Beast Agent.lnk\"){ Remove-Item \"$d\\Beast Agent.lnk\" -Force; Write-Host '\u2022 masa\u00FCst\u00FC k\u0131sayolu silindi' }"],
|
|
38
|
+
{ stdio: 'inherit' });
|
|
39
|
+
} catch {}
|
|
40
|
+
} else {
|
|
41
|
+
try { spawnSync('pkill', ['-f', 'node_modules/beast-agent'], { stdio: 'ignore' }); } catch {}
|
|
42
|
+
}
|
|
43
|
+
console.log('\u2022 npm paketi kald\u0131r\u0131l\u0131yor\u2026');
|
|
44
|
+
const ur = spawnSync('npm', ['uninstall', '-g', 'beast-agent'], { stdio: 'inherit', shell: isWin });
|
|
45
|
+
console.log('\n\u2713 Beast Agent kald\u0131r\u0131ld\u0131.');
|
|
46
|
+
console.log('\u2139 Ki\u015Fisel verilerin korundu \u2014 %APPDATA%\\beast');
|
|
47
|
+
console.log(' (config.yaml, .env, oturumlar, haf\u0131za, WhatsApp e\u015Flemesi, \u015Fifreli yedekler)');
|
|
48
|
+
console.log(' Tekrar kurmak i\u00E7in: npm install -g beast-agent');
|
|
49
|
+
process.exit(ur.status || 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* güncelleme modu: çalışan Beast'i kapat (dosya kilidi EBUSY vermesin) → npm güncelle (görünür ilerleme) → yeniden başlat.
|
|
53
|
+
Bu komut güncelleme butonu tarafından GÖRÜNÜR bir cmd penceresi içinde çalıştırılır;
|
|
54
|
+
doğrudan terminalden de çalışır — npm install çıktısı ekranda akar. */
|
|
55
|
+
if (process.argv[2] === 'update') {
|
|
56
|
+
const isWin = process.platform === 'win32';
|
|
57
|
+
console.log('\u27F3 beast-agent g\u00FCncelleniyor\u2026');
|
|
58
|
+
if (isWin) {
|
|
59
|
+
try {
|
|
60
|
+
spawnSync('powershell.exe', ['-NoProfile', '-Command',
|
|
61
|
+
"Get-Process electron -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*node_modules*beast-agent*' } | Stop-Process -Force"],
|
|
62
|
+
{ stdio: 'ignore' });
|
|
63
|
+
console.log('\u2022 \u00E7al\u0131\u015Fan Beast kapat\u0131ld\u0131 (varsa)');
|
|
64
|
+
} catch {}
|
|
65
|
+
} else {
|
|
66
|
+
try { spawnSync('pkill', ['-f', 'node_modules/beast-agent'], { stdio: 'ignore' }); } catch {}
|
|
67
|
+
}
|
|
68
|
+
/* dosya kilidi (EBUSY) bazen ilk denemede patlar — 5 deneme hakkı */
|
|
69
|
+
let ok = false;
|
|
70
|
+
for (let i = 1; i <= 5 && !ok; i++) {
|
|
71
|
+
const r = spawnSync('npm', ['install', '-g', 'beast-agent@latest'], { stdio: 'inherit', shell: isWin });
|
|
72
|
+
ok = r.status === 0;
|
|
73
|
+
if (!ok && i < 5) {
|
|
74
|
+
console.log(` \u2022 deneme ${i}/5 ba\u015Far\u0131s\u0131z (dosya kilidi olabilir) \u2014 3 sn sonra tekrar\u2026`);
|
|
75
|
+
if (isWin) spawnSync('powershell.exe', ['-NoProfile', '-Command', 'Start-Sleep -Seconds 3'], { stdio: 'ignore' });
|
|
76
|
+
else spawnSync('sleep', ['3']);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!ok) {
|
|
80
|
+
console.log('\n\u2717 g\u00FCncelleme ba\u015Far\u0131s\u0131z \u2014 elle: npm install -g beast-agent@latest');
|
|
81
|
+
if (isWin) spawnSync('cmd.exe', ['/c', 'pause'], { stdio: 'inherit', shell: false });
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
console.log('\n\u2713 beast-agent g\u00FCncellendi \u2014 uygulama ba\u015Flat\u0131l\u0131yor\u2026');
|
|
85
|
+
launchDetached([]);
|
|
86
|
+
if (isWin) spawnSync('cmd.exe', ['/c', 'timeout /t 3'], { stdio: 'ignore' });
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* SearXNG: yerel arama motoru — kur + arka planda başlat (127.0.0.1:8888)
|
|
91
|
+
beast searxng → gerekirse kur, başlat
|
|
92
|
+
beast searxng status → durum
|
|
93
|
+
beast searxng stop → kulla */
|
|
94
|
+
if (process.argv[2] === 'searxng') {
|
|
95
|
+
require('../src/agent/searxng').cli(process.argv.slice(3)).catch((e) => {
|
|
96
|
+
console.error('\u2717 ' + String((e && e.message) || e));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* detached başlatıcı + kendini onaran electron:
|
|
103
|
+
taze makinalarda npm postinstall sırasında electron binary indirmesi
|
|
104
|
+
sessizce başarısız olmuş olabilir → burada otomatik tamir edilir. */
|
|
105
|
+
function launchDetached(extraArgs) {
|
|
106
|
+
let electron = null;
|
|
107
|
+
try { electron = require('electron'); } catch {}
|
|
108
|
+
if (typeof electron !== 'string') {
|
|
109
|
+
let fix = null;
|
|
110
|
+
try { fix = require('../scripts/fix-electron'); } catch {}
|
|
111
|
+
if (fix) {
|
|
112
|
+
console.log('\u27F3 electron \u00e7al\u0131\u015Fma dosyalar\u0131 eksik bulundu \u2014 otomatik onar\u0131l\u0131yor\u2026');
|
|
113
|
+
const r = fix.repair({ quiet: false });
|
|
114
|
+
if (r.ok && !r.skipped) console.log('\u2713 electron onar\u0131ld\u0131');
|
|
115
|
+
if (r.ok) {
|
|
116
|
+
try { electron = require('electron'); } catch {}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (typeof electron !== 'string') {
|
|
121
|
+
console.log('\n\u2717 Electron \u00e7al\u0131\u015Fma dosyas\u0131 kurulamad\u0131.');
|
|
122
|
+
console.log(' Elle \u00e7\u00f6z\u00fcm \u2014 \u015fu 2 komutu \u00e7al\u0131\u015Ft\u0131r:');
|
|
123
|
+
console.log(' npm config set ignore-scripts false');
|
|
124
|
+
console.log(' npm install -g beast-agent');
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const child = spawn(electron, [path.resolve(__dirname, '..'), ...extraArgs], {
|
|
128
|
+
stdio: 'ignore',
|
|
129
|
+
detached: true,
|
|
130
|
+
/* windowsHide KULLANMA: Chromium ilk pencereyi gizli başlatıyor (tray-only bug) */
|
|
131
|
+
});
|
|
132
|
+
child.unref();
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!launchDetached(process.argv.slice(2))) process.exit(1);
|
|
137
|
+
process.exit(0);
|