natureco-cli 5.9.5 → 5.9.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/package.json +1 -1
- package/src/commands/repl.js +18 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.7",
|
|
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"
|
package/src/commands/repl.js
CHANGED
|
@@ -246,7 +246,9 @@ function apiRequest(providerUrl, providerApiKey, body, stream = false) {
|
|
|
246
246
|
const isMM = isMiniMax(providerUrl);
|
|
247
247
|
const endpoint = isMM
|
|
248
248
|
? `${providerUrl.replace(/\/+$/, '')}/v1/text/chatcompletion_v2`
|
|
249
|
-
:
|
|
249
|
+
: isGemini(providerUrl)
|
|
250
|
+
? `${providerUrl.replace(/\/+$/, '')}/openai/chat/completions`
|
|
251
|
+
: `${providerUrl.replace(/\/+$/, '')}/chat/completions`;
|
|
250
252
|
const req = https.request(endpoint, {
|
|
251
253
|
method: 'POST',
|
|
252
254
|
headers: {
|
|
@@ -275,6 +277,7 @@ function apiRequest(providerUrl, providerApiKey, body, stream = false) {
|
|
|
275
277
|
|
|
276
278
|
async function sendStreaming(providerUrl, providerApiKey, messages, model, onChunk, onToolCall) {
|
|
277
279
|
const isMM = isMiniMax(providerUrl);
|
|
280
|
+
const isGM = isGemini(providerUrl);
|
|
278
281
|
const toolDefs = getToolDefs();
|
|
279
282
|
const toolParam = toOpenAIFormat(toolDefs);
|
|
280
283
|
guardrails.reset();
|
|
@@ -315,7 +318,7 @@ async function sendStreaming(providerUrl, providerApiKey, messages, model, onChu
|
|
|
315
318
|
iterations++;
|
|
316
319
|
// v5.7.18: Preflight compress before each iteration to prevent context bloat
|
|
317
320
|
currentMessages = preflightCompress(currentMessages);
|
|
318
|
-
const shouldStream = !isMM; // MiniMax
|
|
321
|
+
const shouldStream = !isMM && !isGM; // MiniMax + Gemini non-stream (tool_calls reliability)
|
|
319
322
|
const body = {
|
|
320
323
|
model,
|
|
321
324
|
messages: currentMessages,
|
|
@@ -324,7 +327,7 @@ async function sendStreaming(providerUrl, providerApiKey, messages, model, onChu
|
|
|
324
327
|
max_tokens: 2048,
|
|
325
328
|
};
|
|
326
329
|
if (toolParam) body.tools = toolParam;
|
|
327
|
-
if (isMM) body.tool_choice = 'auto'; // MiniMax için explicit
|
|
330
|
+
if (isMM || isGM) body.tool_choice = 'auto'; // MiniMax + Gemini için explicit
|
|
328
331
|
|
|
329
332
|
if (!shouldStream) {
|
|
330
333
|
// MiniMax (non-stream) — tool_calls desteklemiyor varsayalım
|
|
@@ -524,10 +527,21 @@ async function processToolCalls(toolCalls, onToolCall) {
|
|
|
524
527
|
}
|
|
525
528
|
|
|
526
529
|
// Notify UI done + build messages
|
|
530
|
+
// v5.9.7: Skip internal meta-tools (_loop_warning, _no_progress) from tool messages
|
|
531
|
+
// Inject loop warning as user message instead (Gemini requires real tool names)
|
|
532
|
+
// Gemini also requires 'name' field in tool response messages
|
|
527
533
|
const messages = [];
|
|
528
534
|
for (const { name, id, result } of results) {
|
|
529
535
|
if (onToolCall) onToolCall({ name, args: null, status: 'done', result });
|
|
530
536
|
|
|
537
|
+
if (name === '_loop_warning' || name === '_no_progress') {
|
|
538
|
+
if (name === '_loop_warning') {
|
|
539
|
+
const warnContent = typeof result?.result === 'string' ? result.result : '';
|
|
540
|
+
if (warnContent) messages.push({ role: 'user', content: '[System: ' + warnContent + ']' });
|
|
541
|
+
}
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
|
|
531
545
|
let content;
|
|
532
546
|
if (result.error) {
|
|
533
547
|
content = JSON.stringify({ error: result.error });
|
|
@@ -541,7 +555,7 @@ async function processToolCalls(toolCalls, onToolCall) {
|
|
|
541
555
|
}
|
|
542
556
|
}
|
|
543
557
|
|
|
544
|
-
messages.push({ role: 'tool', tool_call_id: id, content });
|
|
558
|
+
messages.push({ role: 'tool', tool_call_id: id, name, content });
|
|
545
559
|
}
|
|
546
560
|
|
|
547
561
|
return messages;
|