natureco-cli 5.20.1 → 5.20.3

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/natureco.js CHANGED
@@ -598,7 +598,7 @@ program
598
598
 
599
599
  program
600
600
  .command('naturehub [action] [params...]')
601
- .description('Nature Hub\'a içerik yayınla (post|list|trending|config)')
601
+ .description('Nature Hub\'a içerik yayınla (post|robot-house|forum|list|info|config)')
602
602
  .action((action, params) => {
603
603
  naturehub(action ? [action, ...(params || [])] : []);
604
604
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.20.1",
3
+ "version": "5.20.3",
4
4
  "description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -1,14 +1,15 @@
1
1
  /**
2
- * natureco naturehub — NatureCo Bot API iletişimi
2
+ * natureco naturehub — NatureCo platform paylaşımları
3
3
  *
4
- * natureco.me/api/v1/bots endpoint'lerini kullanır.
5
4
  * Kullanım:
6
- * natureco naturehub post <text> Bota mesaj gönder
7
- * natureco naturehub list Botları listele
8
- * natureco naturehub info [bot_id] Bot detayı
9
- * natureco naturehub config Ayarları göster
5
+ * natureco naturehub post <text> Bota mesaj gönder
6
+ * natureco naturehub robot-house <content> Robot House gönderisi
7
+ * natureco naturehub forum <title> <content> Forum gönderisi
8
+ * natureco naturehub list Botları listele
9
+ * natureco naturehub info [bot_id] Bot detayı
10
+ * natureco naturehub config Ayarları göster
10
11
  *
11
- * API: https://natureco.me/api/v1/bots
12
+ * API: https://api.natureco.me/api/v1
12
13
  */
13
14
 
14
15
  const chalk = require('chalk');
@@ -185,18 +186,93 @@ async function cmdConfig() {
185
186
  console.log('');
186
187
  }
187
188
 
189
+ async function cmdRobotHouse(args) {
190
+ const content = args.join(' ').trim();
191
+ if (!content) {
192
+ console.log(chalk.red('\n Kullanım: natureco naturehub robot-house "<içerik>"\n'));
193
+ return;
194
+ }
195
+
196
+ const token = getApiKey();
197
+ if (!token) {
198
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
199
+ return;
200
+ }
201
+
202
+ console.log(chalk.cyan('\n 📤 Robot House\'a gönderiliyor...\n'));
203
+
204
+ try {
205
+ const result = await apiCall('/posts', {
206
+ method: 'POST',
207
+ token,
208
+ body: { content, type: 'text', tags: [], mood: '🌿' },
209
+ });
210
+ console.log(chalk.green(' ✓ Robot House\'a gönderildi!\n'));
211
+ if (result.post?.id) console.log(chalk.gray(` ID: ${result.post.id}\n`));
212
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'robot-house' });
213
+ } catch (e) {
214
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
215
+ }
216
+ }
217
+
218
+ async function cmdForum(args) {
219
+ const text = args.join(' ').trim();
220
+ const titleMatch = text.match(/^"([^"]+)"\s*(.*)$/);
221
+ let title, content;
222
+
223
+ if (titleMatch) {
224
+ title = titleMatch[1].trim();
225
+ content = titleMatch[2].trim();
226
+ } else {
227
+ const parts = text.split(/\s+/);
228
+ title = parts[0];
229
+ content = parts.slice(1).join(' ');
230
+ }
231
+
232
+ if (!title || !content) {
233
+ console.log(chalk.red('\n Kullanım: natureco naturehub forum "<başlık>" <içerik>\n'));
234
+ return;
235
+ }
236
+
237
+ const token = getApiKey();
238
+ if (!token) {
239
+ console.log(chalk.yellow('\n ⚠️ API key tanımlı değil. Önce `natureco login` ile giriş yapın.\n'));
240
+ return;
241
+ }
242
+
243
+ console.log(chalk.cyan('\n 📤 Forum\'a gönderiliyor...\n'));
244
+ console.log(chalk.gray(` Başlık: ${title}\n`));
245
+
246
+ try {
247
+ const result = await apiCall('/forum', {
248
+ method: 'POST',
249
+ token,
250
+ body: { title, content },
251
+ });
252
+ console.log(chalk.green(' ✓ Forum\'a gönderildi!\n'));
253
+ if (result.post?.id) console.log(chalk.gray(` ID: ${result.post.id}\n`));
254
+ audit.log(audit.ACTIONS.INFO, { source: 'naturehub', action: 'forum' });
255
+ } catch (e) {
256
+ console.log(chalk.red(` ✗ Hata: ${e.message}\n`));
257
+ }
258
+ }
259
+
188
260
  async function naturehub(args) {
189
261
  const [action, ...params] = args || [];
190
262
  if (!action || action === 'help') {
191
263
  console.log(chalk.yellow('\n Kullanım:'));
192
- console.log(chalk.gray(' natureco naturehub post "<mesaj>" Bota mesaj gönder'));
193
- console.log(chalk.gray(' natureco naturehub list Botları listele'));
194
- console.log(chalk.gray(' natureco naturehub info [bot_id] Bot detayı'));
195
- console.log(chalk.gray(' natureco naturehub config Ayarlar'));
264
+ console.log(chalk.gray(' natureco naturehub post "<mesaj>" Bota mesaj gönder'));
265
+ console.log(chalk.gray(' natureco naturehub robot-house "<içerik>" Robot House gönderisi'));
266
+ console.log(chalk.gray(' natureco naturehub forum "<başlık>" <içerik> Forum gönderisi'));
267
+ console.log(chalk.gray(' natureco naturehub list Botları listele'));
268
+ console.log(chalk.gray(' natureco naturehub info [bot_id] Bot detayı'));
269
+ console.log(chalk.gray(' natureco naturehub config Ayarlar'));
196
270
  console.log('');
197
271
  return;
198
272
  }
199
273
  if (action === 'post') return cmdPost(params);
274
+ if (action === 'robot-house' || action === 'robot_house' || action === 'robothouse') return cmdRobotHouse(params);
275
+ if (action === 'forum') return cmdForum(params);
200
276
  if (action === 'list') return cmdList();
201
277
  if (action === 'info') return cmdInfo(params[0]);
202
278
  if (action === 'config') return cmdConfig();
@@ -0,0 +1,78 @@
1
+ module.exports = {
2
+ name: 'http_request',
3
+ description: 'Make HTTP requests to any URL (GET, POST, PUT, DELETE, PATCH)',
4
+ inputSchema: {
5
+ type: 'object',
6
+ properties: {
7
+ method: {
8
+ type: 'string',
9
+ description: 'HTTP method: GET, POST, PUT, DELETE, PATCH',
10
+ enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
11
+ default: 'GET'
12
+ },
13
+ url: {
14
+ type: 'string',
15
+ description: 'Full URL to request'
16
+ },
17
+ headers: {
18
+ type: 'object',
19
+ description: 'Optional headers (key-value pairs)'
20
+ },
21
+ body: {
22
+ type: 'object',
23
+ description: 'Optional request body (for POST/PUT/PATCH)'
24
+ }
25
+ },
26
+ required: ['url']
27
+ },
28
+
29
+ async execute(params) {
30
+ try {
31
+ const method = (params.method || 'GET').toUpperCase();
32
+
33
+ const options = {
34
+ method,
35
+ headers: {
36
+ 'Content-Type': 'application/json',
37
+ 'User-Agent': 'NatureCo-CLI/2.7.0',
38
+ ...(params.headers || {})
39
+ }
40
+ };
41
+
42
+ // Add body for POST/PUT/PATCH
43
+ if (params.body && ['POST', 'PUT', 'PATCH'].includes(method)) {
44
+ options.body = JSON.stringify(params.body);
45
+ }
46
+
47
+ const response = await fetch(params.url, options);
48
+ const text = await response.text();
49
+
50
+ // Try to parse as JSON
51
+ let data;
52
+ try {
53
+ data = JSON.parse(text);
54
+ } catch {
55
+ data = text;
56
+ }
57
+
58
+ // Truncate large responses
59
+ if (typeof data === 'string' && data.length > 2000) {
60
+ data = data.slice(0, 2000) + '... (truncated)';
61
+ }
62
+
63
+ return {
64
+ success: true,
65
+ status: response.status,
66
+ ok: response.ok,
67
+ statusText: response.statusText,
68
+ headers: Object.fromEntries(response.headers.entries()),
69
+ data: data
70
+ };
71
+ } catch (error) {
72
+ return {
73
+ success: false,
74
+ error: error.message
75
+ };
76
+ }
77
+ }
78
+ };
@@ -98,10 +98,35 @@ async function workflow(params) {
98
98
 
99
99
  const skillsIndexBlock = buildSkillIndex();
100
100
 
101
+ // Non-tool-calling model tespiti
102
+ function supportsToolCalls() {
103
+ const url = (providerUrl || '').toLowerCase();
104
+ // MiniMax, Gemini (direct), Ollama, Mistral (direct) tool calling'i desteklemez
105
+ if (url.includes('minimax')) return false;
106
+ if (url.includes('ollama')) return false;
107
+ if (url.includes('localhost')) return false;
108
+ if (url.includes('groq')) return false;
109
+ return true; // OpenAI, Anthropic, vs.
110
+ }
111
+
101
112
  // ── RUN: Execute a complete workflow ──────────────────────────────────
102
113
  if (action === 'run') {
103
114
  if (!task) return { success: false, error: 'task gerekli' };
104
115
 
116
+ // Non-tool-calling modellerde dogrudan passthrough (plan yok, direkt uretim)
117
+ if (!supportsToolCalls()) {
118
+ const memCtx = memoryContext();
119
+ const sysMsg = 'Sen yardimci bir asistansin. Kullanici ne istediyse onu dogrudan yap. Dosya olusturulacaksa icerigi eksiksiz olarak yanitla.' + (memCtx ? '\n\nKullanici bilgisi:\n' + memCtx : '') + '\n\n' + skillsIndexBlock;
120
+ const chatBody = { model, stream: false, messages: [{ role: 'system', content: sysMsg }, { role: 'user', content: task }], temperature: 0.7, max_tokens: 4000 };
121
+ try {
122
+ const chatResult = await apiCall(providerUrl, providerApiKey, chatBody);
123
+ const reply = chatResult.choices?.[0]?.message?.content || '';
124
+ return { success: true, workflowId: 'passthrough', name: 'Direct Generation', status: 'completed', totalSteps: 0, completedSteps: 0, results: [{ step: 0, tool: 'chat', status: 'done', result: { reply } }], passthrough: true, reply };
125
+ } catch (e) {
126
+ return { success: false, error: 'Yanit alinamadi: ' + e.message };
127
+ }
128
+ }
129
+
105
130
  // Phase 0: Check if simple chat (passthrough) — no planning needed
106
131
  const simpleCheckPrompt = {
107
132
  role: 'system',