sapper-iq 1.0.12 → 1.0.14
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 +32 -9
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -135,14 +135,20 @@ CRITICAL: You are working in the CURRENT DIRECTORY. Always use relative paths!
|
|
|
135
135
|
|
|
136
136
|
STRATEGY:
|
|
137
137
|
1. When asked to analyze, use [TOOL:LIST].[/TOOL] first (NOTE: dot, not slash!)
|
|
138
|
-
2.
|
|
139
|
-
3.
|
|
140
|
-
4.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
✅ CORRECT: [TOOL:
|
|
145
|
-
|
|
138
|
+
2. Read ONLY 2-3 KEY files in the SAME turn (README, package.json, main entry)
|
|
139
|
+
3. DON'T read ALL files at once - read strategically!
|
|
140
|
+
4. After reading files, PROVIDE ANALYSIS - don't just list more!
|
|
141
|
+
5. Use format: [TOOL:TYPE]path]content[/TOOL]
|
|
142
|
+
|
|
143
|
+
TOOL FORMAT (CRITICAL - FOLLOW EXACTLY):
|
|
144
|
+
✅ CORRECT: [TOOL:LIST].[/TOOL]
|
|
145
|
+
✅ CORRECT: [TOOL:READ]./file.js[/TOOL]
|
|
146
|
+
❌ WRONG: [TOOL:LIST].[/] - missing TOOL at end!
|
|
147
|
+
❌ WRONG: [TOOL:LIST]/[/TOOL] - wrong directory!
|
|
148
|
+
|
|
149
|
+
WORKFLOW:
|
|
150
|
+
1. LIST directory → 2. READ 2-3 key files → 3. ANALYZE and RESPOND
|
|
151
|
+
Don't keep executing tools endlessly - provide insights after reading!`
|
|
146
152
|
}];
|
|
147
153
|
}
|
|
148
154
|
|
|
@@ -185,8 +191,25 @@ EXAMPLES:
|
|
|
185
191
|
messages.push({ role: 'user', content: `RESULT (${path}): ${result}` });
|
|
186
192
|
}
|
|
187
193
|
fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
|
|
194
|
+
|
|
195
|
+
// Limit tool executions - if too many, warn and exit
|
|
196
|
+
if (toolMatches.length > 10) {
|
|
197
|
+
console.log(chalk.yellow('\n⚠️ Too many tool calls in one response! AI should analyze, not just read endlessly.'));
|
|
198
|
+
active = false;
|
|
199
|
+
}
|
|
188
200
|
} else {
|
|
189
|
-
|
|
201
|
+
// No tools found - check if malformed command
|
|
202
|
+
if (msg.includes('[TOOL:') && msg.includes('[/]')) {
|
|
203
|
+
console.log(chalk.red('\n❌ Malformed tool command detected! Expected format: [TOOL:TYPE]path[/TOOL]'));
|
|
204
|
+
messages.push({
|
|
205
|
+
role: 'user',
|
|
206
|
+
content: 'ERROR: Your tool command is malformed. Use [TOOL:TYPE]path]content[/TOOL] or [TOOL:TYPE]path[/TOOL]'
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
// Normal response without tools - save context and wait for next input
|
|
210
|
+
fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
|
|
211
|
+
active = false;
|
|
212
|
+
}
|
|
190
213
|
}
|
|
191
214
|
}
|
|
192
215
|
ask();
|