natureco-cli 2.14.5 → 2.14.7
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 +245 -131
- package/package.json +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/utils/api.js +5 -55
- package/src/utils/memory.js +4 -4
package/README.md
CHANGED
|
@@ -32,120 +32,121 @@ natureco chat # terminal agent hazır
|
|
|
32
32
|
|
|
33
33
|
## 📋 Commands
|
|
34
34
|
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
| `natureco` |
|
|
40
|
-
| `natureco setup` |
|
|
41
|
-
| `natureco login` | API key
|
|
42
|
-
| `natureco logout` |
|
|
43
|
-
| `natureco help` |
|
|
44
|
-
| `natureco doctor` |
|
|
45
|
-
| `natureco doctor --fix` |
|
|
46
|
-
| `natureco update` |
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
|
|
|
51
|
-
|
|
52
|
-
| `natureco chat` |
|
|
53
|
-
| `natureco chat Bot
|
|
54
|
-
| `natureco chat Nature Bot V3` |
|
|
55
|
-
| `natureco chat --resume` |
|
|
56
|
-
| `natureco ask "
|
|
57
|
-
| `natureco run script.md` |
|
|
58
|
-
| `natureco bots` |
|
|
59
|
-
|
|
60
|
-
**Chat
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
64
|
-
| `/clear` |
|
|
65
|
-
| `/bot` |
|
|
66
|
-
| `/bot Bot
|
|
67
|
-
| `/skills` |
|
|
68
|
-
| `/memory` |
|
|
69
|
-
| `/memory clear` |
|
|
70
|
-
| `/commands` |
|
|
71
|
-
| `/ultrareview` |
|
|
72
|
-
| `/help` |
|
|
73
|
-
| `exit` / `quit` |
|
|
74
|
-
| `Ctrl+B` |
|
|
75
|
-
|
|
76
|
-
### Skill
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
| `natureco skills` |
|
|
81
|
-
| `natureco skills install slug` |
|
|
82
|
-
| `natureco skills install clawhub:slug` |
|
|
83
|
-
| `natureco skills browse` |
|
|
84
|
-
| `natureco skills search "
|
|
85
|
-
| `natureco skills remove slug` |
|
|
86
|
-
| `natureco skills create
|
|
87
|
-
|
|
88
|
-
###
|
|
89
|
-
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
| `natureco telegram connect` | Telegram
|
|
93
|
-
| `natureco discord connect` | Discord
|
|
94
|
-
| `natureco slack connect` | Slack workspace
|
|
95
|
-
| `natureco whatsapp connect` | WhatsApp QR
|
|
96
|
-
| `natureco whatsapp status` | WhatsApp
|
|
97
|
-
| `natureco whatsapp allow <
|
|
98
|
-
| `natureco whatsapp disconnect` | WhatsApp
|
|
99
|
-
|
|
100
|
-
### MCP
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
104
|
-
| `natureco mcp list` |
|
|
105
|
-
| `natureco mcp add` | MCP
|
|
106
|
-
| `natureco mcp templates` |
|
|
107
|
-
| `natureco mcp enable <name>` | MCP
|
|
108
|
-
| `natureco mcp disable <name>` | MCP
|
|
109
|
-
|
|
110
|
-
###
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
114
|
-
| `natureco ultrareview
|
|
115
|
-
| `natureco git review` |
|
|
116
|
-
| `natureco git commit` |
|
|
117
|
-
| `natureco cron add` |
|
|
118
|
-
| `natureco cron list` |
|
|
119
|
-
| `natureco cron start` |
|
|
120
|
-
| `natureco hooks create
|
|
121
|
-
| `natureco commands create
|
|
35
|
+
### Core Commands
|
|
36
|
+
|
|
37
|
+
| Command | Description |
|
|
38
|
+
|---------|-------------|
|
|
39
|
+
| `natureco` | Opens gateway screen — system status, active bot, skill count |
|
|
40
|
+
| `natureco setup` | Setup wizard — API key, bot selection, AI provider, model, integrations |
|
|
41
|
+
| `natureco login` | Login with API key |
|
|
42
|
+
| `natureco logout` | Logout and clear config |
|
|
43
|
+
| `natureco help` | List all commands with examples |
|
|
44
|
+
| `natureco doctor` | System health check — Node, API, bot, skills, integrations |
|
|
45
|
+
| `natureco doctor --fix` | Auto-fix detected issues |
|
|
46
|
+
| `natureco update` | Check for new version |
|
|
47
|
+
|
|
48
|
+
### Chat
|
|
49
|
+
|
|
50
|
+
| Command | Description |
|
|
51
|
+
|---------|-------------|
|
|
52
|
+
| `natureco chat` | Chat with default bot (interactive selection if none) |
|
|
53
|
+
| `natureco chat Bot Name` | Chat with specific bot (spaces supported) |
|
|
54
|
+
| `natureco chat Nature Bot V3` | Multi-word bot names auto-joined |
|
|
55
|
+
| `natureco chat --resume` | Resume latest session |
|
|
56
|
+
| `natureco ask "question"` | One-time question |
|
|
57
|
+
| `natureco run script.md` | Send markdown file as prompt |
|
|
58
|
+
| `natureco bots` | List all bots |
|
|
59
|
+
|
|
60
|
+
**In-Chat Commands:**
|
|
61
|
+
|
|
62
|
+
| Command | Description |
|
|
63
|
+
|---------|-------------|
|
|
64
|
+
| `/clear` | Clear screen |
|
|
65
|
+
| `/bot` | Show bot list or switch bot |
|
|
66
|
+
| `/bot Bot Name` | Switch to specific bot |
|
|
67
|
+
| `/skills` | Show active skills |
|
|
68
|
+
| `/memory` | Show memory status |
|
|
69
|
+
| `/memory clear` | Clear memory |
|
|
70
|
+
| `/commands` | List custom commands |
|
|
71
|
+
| `/ultrareview` | Deep review last code block |
|
|
72
|
+
| `/help` | Show chat help |
|
|
73
|
+
| `exit` / `quit` | Exit chat |
|
|
74
|
+
| `Ctrl+B` | Move task to background |
|
|
75
|
+
|
|
76
|
+
### Skill System
|
|
77
|
+
|
|
78
|
+
| Command | Description |
|
|
79
|
+
|---------|-------------|
|
|
80
|
+
| `natureco skills` | List installed skills |
|
|
81
|
+
| `natureco skills install slug` | Install skill from NatureHub |
|
|
82
|
+
| `natureco skills install clawhub:slug` | Install skill from ClawHub |
|
|
83
|
+
| `natureco skills browse` | Browse popular skills, interactive selection |
|
|
84
|
+
| `natureco skills search "query"` | Search skills |
|
|
85
|
+
| `natureco skills remove slug` | Remove skill |
|
|
86
|
+
| `natureco skills create name` | Create new skill template |
|
|
87
|
+
|
|
88
|
+
### Integrations
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---------|-------------|
|
|
92
|
+
| `natureco telegram connect` | Connect Telegram bot (token + user ID) |
|
|
93
|
+
| `natureco discord connect` | Connect Discord bot |
|
|
94
|
+
| `natureco slack connect` | Connect to Slack workspace |
|
|
95
|
+
| `natureco whatsapp connect` | Connect WhatsApp with QR code (Baileys) |
|
|
96
|
+
| `natureco whatsapp status` | WhatsApp connection status and allow list |
|
|
97
|
+
| `natureco whatsapp allow <number>` | Add number to allow list |
|
|
98
|
+
| `natureco whatsapp disconnect` | Disconnect WhatsApp |
|
|
99
|
+
|
|
100
|
+
### MCP Servers
|
|
101
|
+
|
|
102
|
+
| Command | Description |
|
|
103
|
+
|---------|-------------|
|
|
104
|
+
| `natureco mcp list` | List connected MCP servers |
|
|
105
|
+
| `natureco mcp add` | Add MCP server (filesystem, github, postgres...) |
|
|
106
|
+
| `natureco mcp templates` | List ready-made MCP templates |
|
|
107
|
+
| `natureco mcp enable <name>` | Enable MCP server |
|
|
108
|
+
| `natureco mcp disable <name>` | Disable MCP server |
|
|
109
|
+
|
|
110
|
+
### Automation
|
|
111
|
+
|
|
112
|
+
| Command | Description |
|
|
113
|
+
|---------|-------------|
|
|
114
|
+
| `natureco ultrareview file.js` | Code review — security, performance, quality scores |
|
|
115
|
+
| `natureco git review` | Review staged changes |
|
|
116
|
+
| `natureco git commit` | Generate commit message with AI |
|
|
117
|
+
| `natureco cron add` | Create scheduled task |
|
|
118
|
+
| `natureco cron list` | List cron jobs |
|
|
119
|
+
| `natureco cron start` | Start cron daemon |
|
|
120
|
+
| `natureco hooks create type` | Create hook (pre-message, post-message...) |
|
|
121
|
+
| `natureco commands create name` | Create custom /command |
|
|
122
|
+
| `natureco migrate --from openclaw` | Migrate from OpenClaw (memory, crons, skills, scripts) |
|
|
122
123
|
|
|
123
124
|
### Gateway & Dashboard
|
|
124
125
|
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
| `natureco gateway start` |
|
|
128
|
-
| `natureco gateway stop` |
|
|
129
|
-
| `natureco gateway status` | Gateway
|
|
130
|
-
| `natureco gateway logs` |
|
|
131
|
-
| `natureco dashboard` |
|
|
132
|
-
| `natureco dashboard stop` |
|
|
133
|
-
| `natureco dashboard status` |
|
|
134
|
-
|
|
135
|
-
###
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
139
|
-
| `natureco config list` |
|
|
140
|
-
| `natureco config get key` |
|
|
141
|
-
| `natureco config set key val` |
|
|
142
|
-
| `natureco init` |
|
|
126
|
+
| Command | Description |
|
|
127
|
+
|---------|-------------|
|
|
128
|
+
| `natureco gateway start` | Start gateway in background (WhatsApp auto-start) |
|
|
129
|
+
| `natureco gateway stop` | Stop gateway |
|
|
130
|
+
| `natureco gateway status` | Gateway status (last 10 logs) |
|
|
131
|
+
| `natureco gateway logs` | Show all logs (~/.natureco/gateway.log) |
|
|
132
|
+
| `natureco dashboard` | Open web UI (localhost:3848) |
|
|
133
|
+
| `natureco dashboard stop` | Stop dashboard |
|
|
134
|
+
| `natureco dashboard status` | Check dashboard status |
|
|
135
|
+
|
|
136
|
+
### Configuration
|
|
137
|
+
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `natureco config list` | Show all settings |
|
|
141
|
+
| `natureco config get key` | Get specific setting |
|
|
142
|
+
| `natureco config set key val` | Change setting |
|
|
143
|
+
| `natureco init` | Create project folder (.natureco/) |
|
|
143
144
|
|
|
144
145
|
## 🔌 Integrations
|
|
145
146
|
|
|
146
147
|
### Telegram
|
|
147
148
|
|
|
148
|
-
Telegram
|
|
149
|
+
Connect your Telegram bot, receive and respond to messages. Authentication with bot token and user ID.
|
|
149
150
|
|
|
150
151
|
```bash
|
|
151
152
|
natureco telegram connect
|
|
@@ -153,7 +154,7 @@ natureco telegram connect
|
|
|
153
154
|
|
|
154
155
|
### Discord
|
|
155
156
|
|
|
156
|
-
Discord
|
|
157
|
+
Integrate Discord bots. Server channels, DMs, and slash commands supported.
|
|
157
158
|
|
|
158
159
|
```bash
|
|
159
160
|
natureco discord connect
|
|
@@ -161,7 +162,7 @@ natureco discord connect
|
|
|
161
162
|
|
|
162
163
|
### Slack
|
|
163
164
|
|
|
164
|
-
Slack
|
|
165
|
+
Connect to Slack workspaces. Manage channel and DM messages.
|
|
165
166
|
|
|
166
167
|
```bash
|
|
167
168
|
natureco slack connect
|
|
@@ -169,57 +170,170 @@ natureco slack connect
|
|
|
169
170
|
|
|
170
171
|
### WhatsApp
|
|
171
172
|
|
|
172
|
-
WhatsApp
|
|
173
|
+
Connect WhatsApp accounts with QR code. Full media support with Baileys library.
|
|
173
174
|
|
|
174
175
|
```bash
|
|
175
|
-
#
|
|
176
|
+
# Initial connection (QR code)
|
|
176
177
|
natureco whatsapp connect
|
|
177
178
|
|
|
178
|
-
#
|
|
179
|
+
# Auto-start with gateway
|
|
179
180
|
natureco gateway start
|
|
180
181
|
|
|
181
|
-
#
|
|
182
|
+
# Add number to allow list
|
|
182
183
|
natureco whatsapp allow 905551234567
|
|
183
184
|
|
|
184
|
-
#
|
|
185
|
+
# Check status
|
|
185
186
|
natureco whatsapp status
|
|
186
187
|
```
|
|
187
188
|
|
|
188
|
-
**WhatsApp
|
|
189
|
-
- QR
|
|
189
|
+
**WhatsApp Features:**
|
|
190
|
+
- QR code connection in terminal
|
|
190
191
|
- Session persistence (~/.natureco/whatsapp-sessions/)
|
|
191
|
-
-
|
|
192
|
-
- Gateway
|
|
192
|
+
- Allow list control (last 10 digits comparison)
|
|
193
|
+
- Gateway auto-start
|
|
193
194
|
- OpenClaw-style logging
|
|
194
|
-
- Auto-reconnect (515, 408
|
|
195
|
-
-
|
|
195
|
+
- Auto-reconnect (515, 408 error codes)
|
|
196
|
+
- Multiple message format support (text, caption, buttons, list...)
|
|
196
197
|
|
|
197
198
|
## 🌐 Gateway Server
|
|
198
199
|
|
|
199
|
-
|
|
200
|
+
Background gateway server. WhatsApp auto-start, OpenClaw-style logging, health check.
|
|
200
201
|
|
|
201
202
|
```bash
|
|
202
|
-
#
|
|
203
|
+
# Start gateway (background)
|
|
203
204
|
natureco gateway start
|
|
204
205
|
|
|
205
|
-
#
|
|
206
|
+
# Watch logs live
|
|
206
207
|
tail -f ~/.natureco/gateway.log
|
|
207
208
|
|
|
208
|
-
#
|
|
209
|
+
# Check status
|
|
209
210
|
natureco gateway status
|
|
210
211
|
|
|
211
|
-
#
|
|
212
|
+
# Stop
|
|
212
213
|
natureco gateway stop
|
|
213
214
|
```
|
|
214
215
|
|
|
215
|
-
**Gateway
|
|
216
|
-
- Detached process (
|
|
217
|
-
- WhatsApp
|
|
218
|
-
- OpenClaw-style log format
|
|
219
|
-
- Health check
|
|
216
|
+
**Gateway Features:**
|
|
217
|
+
- Detached process (runs even if terminal closed)
|
|
218
|
+
- WhatsApp auto-start (if saved in config)
|
|
219
|
+
- OpenClaw-style log format: `[timestamp] [module] message`
|
|
220
|
+
- Health check every 60 seconds
|
|
220
221
|
- Auto-restart on connection loss (10s delay)
|
|
221
222
|
- Platform-aware stop (SIGTERM → SIGKILL / taskkill)
|
|
222
|
-
-
|
|
223
|
+
- All logs in ~/.natureco/gateway.log
|
|
224
|
+
|
|
225
|
+
## 🎨 Dashboard
|
|
226
|
+
|
|
227
|
+
Web UI running on localhost:3848. Glassmorphism design, animated gradient background.
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
natureco dashboard
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Dashboard Features:**
|
|
234
|
+
- Modern glassmorphism UI
|
|
235
|
+
- Animated gradient background (same as natureco.me/landing)
|
|
236
|
+
- Left sidebar: Active bot, other bots, channels, skills, memory, sessions, system, cron jobs
|
|
237
|
+
- Right chat area: Bot avatar, model info, version badge
|
|
238
|
+
- Typing indicator (three dots animation)
|
|
239
|
+
- Turkish character support
|
|
240
|
+
- Responsive design
|
|
241
|
+
|
|
242
|
+
## 💾 Memory System
|
|
243
|
+
|
|
244
|
+
Bot memory — user name, bot name, nickname, preferences, and facts. Separate memory per bot.
|
|
245
|
+
|
|
246
|
+
**Memory Features:**
|
|
247
|
+
- **Bot Name:** Bot's name (from memory or agents/ folder)
|
|
248
|
+
- **User Name:** User's name
|
|
249
|
+
- **Nickname:** User's nickname
|
|
250
|
+
- **Facts:** Information about user (max 15, sorted by score)
|
|
251
|
+
- **Preferences:** User preferences
|
|
252
|
+
- **Auto-Extract:** Automatic information extraction from messages
|
|
253
|
+
- **Score System:** Each fact has a score, old facts decay
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Show memory
|
|
257
|
+
natureco chat
|
|
258
|
+
/memory
|
|
259
|
+
|
|
260
|
+
# Clear memory
|
|
261
|
+
/memory clear
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Memory Format:**
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"name": "Gencay",
|
|
268
|
+
"botName": "İchigo",
|
|
269
|
+
"nickname": "Parton",
|
|
270
|
+
"facts": [
|
|
271
|
+
{ "value": "Timezone: UTC+3", "score": 6, "updatedAt": "2025-01-12" },
|
|
272
|
+
{ "value": "Developer", "score": 5, "updatedAt": "2025-01-12" }
|
|
273
|
+
],
|
|
274
|
+
"preferences": [],
|
|
275
|
+
"lastSeen": "2025-01-12T10:30:00.000Z"
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## 🐰 Terminal UI
|
|
280
|
+
|
|
281
|
+
Minimal and clean terminal interface. Rabbit ASCII art, progress bar animation, colored output.
|
|
282
|
+
|
|
283
|
+
**UI Features:**
|
|
284
|
+
- **Startup Animation:** Rabbit ASCII art + progress bar (Memory, Skills, Gateway)
|
|
285
|
+
- **Header:** Full terminal width separator, bot name, model, timezone
|
|
286
|
+
- **Message Format:** `You message` (gray) → `İchigo response` (cyan)
|
|
287
|
+
- **Loading:** `●○○ ○●○ ○○●` animation (300ms)
|
|
288
|
+
- **Colors:** Error (red), success (green), bot name (cyan), user (gray)
|
|
289
|
+
- **No Emoji:** Clean, minimal design
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
(\\_/)
|
|
293
|
+
(•ᴥ•)
|
|
294
|
+
/>🌿
|
|
295
|
+
|
|
296
|
+
────────────────────────────────────────
|
|
297
|
+
NatureCo · İchigo · llama-3.1 · UTC+3
|
|
298
|
+
────────────────────────────────────────
|
|
299
|
+
Session · /clear /bot /skills /memory /help · Ctrl+C to exit
|
|
300
|
+
────────────────────────────────────────
|
|
301
|
+
Memory: Gencay · 67 facts Skills: 28 Crons: 21 active
|
|
302
|
+
────────────────────────────────────────
|
|
303
|
+
|
|
304
|
+
You hello
|
|
305
|
+
İchigo Hello! How can I help you?
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## 🔄 Migration from OpenClaw
|
|
309
|
+
|
|
310
|
+
Migrate from OpenClaw to NatureCo. Memory, crons, skills, scripts, and WhatsApp sessions auto-migrated.
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
# Migrate from OpenClaw
|
|
314
|
+
natureco migrate --from openclaw
|
|
315
|
+
|
|
316
|
+
# Custom OpenClaw directory
|
|
317
|
+
natureco migrate --from openclaw --openclaw-dir /path/to/.openclaw
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Migrated Data:**
|
|
321
|
+
- **Memory:** USER.md → universal-provider.json (name, nickname, timezone, notes)
|
|
322
|
+
- **Memory Files:** MEMORY.md and memory/*.md → facts (max 15, deduplicated)
|
|
323
|
+
- **Bot Name:** From agents/ folder name or cron job names
|
|
324
|
+
- **Cron Jobs:** jobs.json → crons.json (path normalization, duplicate check)
|
|
325
|
+
- **Telegram:** allowFrom → config
|
|
326
|
+
- **WhatsApp:** Session → whatsapp-sessions (number normalization)
|
|
327
|
+
- **Scripts:** workspace/scripts → .natureco/workspace/scripts (path fixes, package.json)
|
|
328
|
+
- **Skills:** workspace/skills → .natureco/skills
|
|
329
|
+
- **.env:** Workspace .env file copied
|
|
330
|
+
|
|
331
|
+
**Migration Features:**
|
|
332
|
+
- Path normalization (Windows → Unix)
|
|
333
|
+
- Duplicate detection (crons, facts)
|
|
334
|
+
- WhatsApp number normalization (JID → clean phone)
|
|
335
|
+
- Bot name extraction (agents/, cron jobs, MEMORY.md)
|
|
336
|
+
- Facts filtering (skip tables, commands, emojis)
|
|
223
337
|
|
|
224
338
|
## 🎨 Dashboard
|
|
225
339
|
|
|
@@ -329,5 +443,5 @@ MIT © NatureCo
|
|
|
329
443
|
|
|
330
444
|
---
|
|
331
445
|
|
|
332
|
-
**Version:** 2.
|
|
446
|
+
**Version:** 2.14.5 | **Node.js:** >=16.0.0 | **Platform:** macOS, Windows, Linux
|
|
333
447
|
|
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.14.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.14.7</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.14.
|
|
344
|
+
version: 'v2.14.7',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -728,69 +728,19 @@ TOOL SELECTION GUIDE:
|
|
|
728
728
|
|
|
729
729
|
let systemPrompt = baseSystemPrompt;
|
|
730
730
|
|
|
731
|
-
// Add MCP tool guidance if MCP servers are loaded
|
|
731
|
+
// Add MCP tool guidance if MCP servers are loaded (only if enabled)
|
|
732
|
+
const config = getConfig();
|
|
732
733
|
let mcpPrompt = '';
|
|
733
734
|
const mcpTools = getMcpTools();
|
|
734
|
-
if (mcpTools.length > 0) {
|
|
735
|
+
if (config.mcpEnabled !== false && mcpTools.length > 0) {
|
|
735
736
|
const mcpServerNames = Object.keys(mcpClients);
|
|
736
737
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
for (const serverName of mcpServerNames) {
|
|
740
|
-
const serverTools = mcpClients[serverName].tools;
|
|
741
|
-
mcpPrompt += `\n- ${serverName}: ${serverTools.length} tools`;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
mcpPrompt += `\n\nWhen filesystem MCP is loaded, use list_directory (not list_dir), read_file from MCP (not local).`;
|
|
745
|
-
mcpPrompt += `\nFor GitHub MCP, prefer list_issues over search_issues.`;
|
|
738
|
+
// Only show server names, not tool lists (reduce tokens)
|
|
739
|
+
mcpPrompt = `\n\nMCP SERVERS: ${mcpServerNames.join(', ')}`;
|
|
746
740
|
|
|
747
741
|
systemPrompt += mcpPrompt;
|
|
748
742
|
}
|
|
749
743
|
|
|
750
|
-
// Add available skills information
|
|
751
|
-
let skillsPrompt = '';
|
|
752
|
-
const skillsDir = path.join(homeDir, '.natureco', 'skills');
|
|
753
|
-
if (fs.existsSync(skillsDir)) {
|
|
754
|
-
try {
|
|
755
|
-
const skills = fs.readdirSync(skillsDir).filter(f => {
|
|
756
|
-
const skillPath = path.join(skillsDir, f);
|
|
757
|
-
return fs.statSync(skillPath).isDirectory();
|
|
758
|
-
});
|
|
759
|
-
|
|
760
|
-
if (skills.length > 0) {
|
|
761
|
-
// Extract skill names and short descriptions (not full SKILL.md content)
|
|
762
|
-
const skillsInfo = skills.map(skill => {
|
|
763
|
-
const skillMd = path.join(skillsDir, skill, 'SKILL.md');
|
|
764
|
-
if (!fs.existsSync(skillMd)) return skill;
|
|
765
|
-
|
|
766
|
-
try {
|
|
767
|
-
const content = fs.readFileSync(skillMd, 'utf8');
|
|
768
|
-
// Extract description from SKILL.md (first 80 chars)
|
|
769
|
-
const descMatch = content.match(/description:\s*(.+)/i);
|
|
770
|
-
const desc = descMatch ? descMatch[1].slice(0, 80) : '';
|
|
771
|
-
return desc ? `${skill}: ${desc}` : skill;
|
|
772
|
-
} catch (err) {
|
|
773
|
-
return skill;
|
|
774
|
-
}
|
|
775
|
-
}).slice(0, 10).join('\n'); // Show max 10 skills
|
|
776
|
-
|
|
777
|
-
const moreSkills = skills.length > 10 ? ` (${skills.length - 10} more)` : '';
|
|
778
|
-
skillsPrompt = `\n\nInstalled skills (${skills.length})${moreSkills}:\n${skillsInfo}\nUse /skills for details.`;
|
|
779
|
-
|
|
780
|
-
systemPrompt += skillsPrompt;
|
|
781
|
-
}
|
|
782
|
-
} catch (err) {
|
|
783
|
-
// Silently skip if skills directory can't be read
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// Add memory prompt
|
|
788
|
-
const { getMemoryPrompt } = require('./memory');
|
|
789
|
-
const memoryPrompt = getMemoryPrompt(botId);
|
|
790
|
-
if (memoryPrompt) {
|
|
791
|
-
systemPrompt += '\n\n' + memoryPrompt;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
744
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
795
745
|
}
|
|
796
746
|
|
package/src/utils/memory.js
CHANGED
|
@@ -254,7 +254,7 @@ function getMemoryPrompt(botId) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
if (facts.length > 0) {
|
|
257
|
-
// Normalize all facts to objects with score, then sort and limit
|
|
257
|
+
// Normalize all facts to objects with score, then sort and limit to 8
|
|
258
258
|
const topFacts = facts
|
|
259
259
|
.map(f => {
|
|
260
260
|
if (typeof f === 'string') return { value: f, score: 5 };
|
|
@@ -263,15 +263,15 @@ function getMemoryPrompt(botId) {
|
|
|
263
263
|
})
|
|
264
264
|
.filter(f => f && f.value && f.value.length > 0)
|
|
265
265
|
.sort((a, b) => (b.score || 0) - (a.score || 0))
|
|
266
|
-
.slice(0,
|
|
266
|
+
.slice(0, 8)
|
|
267
267
|
.map(f => f.value);
|
|
268
268
|
|
|
269
269
|
if (topFacts.length > 0) {
|
|
270
270
|
parts.push(`Bilgiler: ${topFacts.join(', ')}`);
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
-
if (facts.length >
|
|
274
|
-
parts.push(`(${facts.length -
|
|
273
|
+
if (facts.length > 8) {
|
|
274
|
+
parts.push(`(${facts.length - 8} daha fazla bilgi mevcut)`);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
}
|