sapper-iq 1.1.31 → 1.1.33

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sapper.mjs +14 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.1.31",
3
+ "version": "1.1.33",
4
4
  "description": "AI-powered development assistant that executes commands and builds projects",
5
5
  "main": "sapper.mjs",
6
6
  "bin": {
package/sapper.mjs CHANGED
@@ -1103,25 +1103,26 @@ TOOL SYNTAX:
1103
1103
  // Don't break - just warn. User can Ctrl+C if needed
1104
1104
  }
1105
1105
  }
1106
- console.log();
1107
-
1108
- // If response has markdown, show rendered version
1109
- const hasMarkdown = /\*\*|__|`|^#|^[-*] /m.test(msg);
1110
- if (hasMarkdown && !msg.includes('[TOOL:')) {
1111
- console.log(chalk.gray('─'.repeat(40)));
1112
- const rendered = renderMarkdown(msg);
1113
- const lines = rendered.split('\n');
1114
- for (const line of lines) {
1115
- console.log(chalk.magenta('│ ') + line);
1116
- }
1117
- console.log();
1118
- }
1106
+ console.log(chalk.magenta('└─────────────────────────────────────'));
1119
1107
 
1120
1108
  messages.push({ role: 'assistant', content: msg });
1121
1109
 
1122
1110
  // Regex: supports both old format (path]content) and new format (path:::content)
1123
1111
  const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^:\]]*?)(?:(?:::|\])([\s\S]*?))?\[\/TOOL\]/g)];
1124
1112
 
1113
+ // Check for unclosed tool calls (AI started a tool but didn't close it)
1114
+ const hasUnclosedTool = msg.includes('[TOOL:') && !msg.includes('[/TOOL]');
1115
+ if (hasUnclosedTool) {
1116
+ console.log(chalk.yellow('\n⚠️ Unclosed tool detected! AI forgot [/TOOL] closing tag.'));
1117
+ console.log(chalk.gray(' Asking AI to complete the tool call...\n'));
1118
+
1119
+ messages.push({
1120
+ role: 'user',
1121
+ 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.'
1122
+ });
1123
+ continue; // Let AI respond with the closing tag
1124
+ }
1125
+
1125
1126
  // Debug mode: show what regex sees
1126
1127
  if (debugMode) {
1127
1128
  console.log(chalk.magenta('\n═══ DEBUG: REGEX ANALYSIS ═══'));