sapper-iq 1.1.31 → 1.1.32
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/sapper.mjs +13 -0
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -1122,6 +1122,19 @@ TOOL SYNTAX:
|
|
|
1122
1122
|
// Regex: supports both old format (path]content) and new format (path:::content)
|
|
1123
1123
|
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^:\]]*?)(?:(?:::|\])([\s\S]*?))?\[\/TOOL\]/g)];
|
|
1124
1124
|
|
|
1125
|
+
// Check for unclosed tool calls (AI started a tool but didn't close it)
|
|
1126
|
+
const hasUnclosedTool = msg.includes('[TOOL:') && !msg.includes('[/TOOL]');
|
|
1127
|
+
if (hasUnclosedTool) {
|
|
1128
|
+
console.log(chalk.yellow('\n⚠️ Unclosed tool detected! AI forgot [/TOOL] closing tag.'));
|
|
1129
|
+
console.log(chalk.gray(' Asking AI to complete the tool call...\n'));
|
|
1130
|
+
|
|
1131
|
+
messages.push({
|
|
1132
|
+
role: 'user',
|
|
1133
|
+
content: 'ERROR: Your tool call is incomplete - you forgot to add [/TOOL] at the end. Please complete the tool call by providing the closing [/TOOL] tag. If you were writing a file, just output [/TOOL] to close it.'
|
|
1134
|
+
});
|
|
1135
|
+
continue; // Let AI respond with the closing tag
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1125
1138
|
// Debug mode: show what regex sees
|
|
1126
1139
|
if (debugMode) {
|
|
1127
1140
|
console.log(chalk.magenta('\n═══ DEBUG: REGEX ANALYSIS ═══'));
|