natureco-cli 2.23.0 → 2.23.2
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/code.js +28 -21
- package/src/tools/write_file.js +1 -0
package/package.json
CHANGED
package/src/commands/code.js
CHANGED
|
@@ -260,14 +260,14 @@ async function streamMessage(providerConfig, messages, tools) {
|
|
|
260
260
|
if (tc.id != null) {
|
|
261
261
|
toolCallsBuffer[idx].id = tc.id;
|
|
262
262
|
}
|
|
263
|
+
// OpenAI format: tc.function.name / tc.function.arguments
|
|
263
264
|
if (tc.function) {
|
|
264
|
-
if (tc.function.name != null)
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
if (tc.function.arguments != null) {
|
|
268
|
-
toolCallsBuffer[idx].arguments += tc.function.arguments;
|
|
269
|
-
}
|
|
265
|
+
if (tc.function.name != null) toolCallsBuffer[idx].name += tc.function.name;
|
|
266
|
+
if (tc.function.arguments != null) toolCallsBuffer[idx].arguments += tc.function.arguments;
|
|
270
267
|
}
|
|
268
|
+
// Alternate format (llama-4-scout etc.): tc.name / tc.arguments directly
|
|
269
|
+
if (tc.name != null) toolCallsBuffer[idx].name += tc.name;
|
|
270
|
+
if (tc.arguments != null) toolCallsBuffer[idx].arguments += tc.arguments;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
} catch {}
|
|
@@ -702,15 +702,17 @@ ${indexPrompt}`;
|
|
|
702
702
|
|
|
703
703
|
console.log(chalk.yellow(`\n🔧 ${streamResult.toolCalls.length} tool çalıştırılıyor...\n`));
|
|
704
704
|
|
|
705
|
-
for (
|
|
705
|
+
for (let ti = 0; ti < streamResult.toolCalls.length; ti++) {
|
|
706
|
+
const toolCall = streamResult.toolCalls[ti];
|
|
706
707
|
const result = await runToolCall(toolCall, stats);
|
|
707
708
|
const resultStr = result.success !== false
|
|
708
709
|
? (result.output || JSON.stringify(result))
|
|
709
710
|
: `Hata: ${result.error}`;
|
|
710
711
|
|
|
712
|
+
const matchedId = assistantMsg.tool_calls?.[ti]?.id || toolCall.id;
|
|
711
713
|
conversationMessages.push({
|
|
712
714
|
role: 'tool',
|
|
713
|
-
tool_call_id:
|
|
715
|
+
tool_call_id: matchedId,
|
|
714
716
|
name: toolCall.name,
|
|
715
717
|
content: resultStr.slice(0, 3000),
|
|
716
718
|
});
|
|
@@ -719,20 +721,21 @@ ${indexPrompt}`;
|
|
|
719
721
|
console.log();
|
|
720
722
|
}
|
|
721
723
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
724
|
+
try {
|
|
725
|
+
const lastAssistant = [...conversationMessages].reverse().find(m => m.role === 'assistant');
|
|
726
|
+
if (lastAssistant?.content) {
|
|
727
|
+
addToHistory(bot.id, userMessage, lastAssistant.content, null);
|
|
728
|
+
addMessageToSession(bot.id, session.id, userMessage, lastAssistant.content);
|
|
729
|
+
}
|
|
728
730
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
await handleMessage(fixPrompt);
|
|
731
|
+
if (stats.filesChanged > prevFilesChanged && projectIndex.packageJson?.scripts?.test) {
|
|
732
|
+
const fixPrompt = await runTests(projectIndex, conversationMessages, tools, providerConfig, displayBotName);
|
|
733
|
+
if (fixPrompt) {
|
|
734
|
+
await handleMessage(fixPrompt);
|
|
735
|
+
}
|
|
735
736
|
}
|
|
737
|
+
} catch (err) {
|
|
738
|
+
console.log(chalk.red(`\n ❌ Kayıt hatası: ${err.message}\n`));
|
|
736
739
|
}
|
|
737
740
|
}
|
|
738
741
|
|
|
@@ -761,7 +764,11 @@ ${indexPrompt}`;
|
|
|
761
764
|
async function promptLoop() {
|
|
762
765
|
rl.question('', async (msg) => {
|
|
763
766
|
process.stdout.write('\x1b[1A\x1b[2K');
|
|
764
|
-
|
|
767
|
+
try {
|
|
768
|
+
await handleMessage(msg);
|
|
769
|
+
} catch (err) {
|
|
770
|
+
console.log(chalk.red(`\n ❌ Beklenmeyen hata: ${err.message}\n`));
|
|
771
|
+
}
|
|
765
772
|
promptLoop();
|
|
766
773
|
});
|
|
767
774
|
}
|