sapper-iq 1.1.3 → 1.1.4
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 +12 -0
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -301,6 +301,13 @@ WORKFLOW:
|
|
|
301
301
|
// Main conversation loop - never exits unless user types 'exit'
|
|
302
302
|
while (true) {
|
|
303
303
|
try {
|
|
304
|
+
// Context size warning - large context causes hangs
|
|
305
|
+
const contextSize = JSON.stringify(messages).length;
|
|
306
|
+
if (contextSize > 32000) {
|
|
307
|
+
console.log(chalk.red.bold('\n⚠️ WARNING: Context is very large (~' + Math.round(contextSize/1024) + 'KB). Sapper might hang.'));
|
|
308
|
+
console.log(chalk.yellow('👉 Suggestion: Type /prune to keep only the latest analysis.'));
|
|
309
|
+
}
|
|
310
|
+
|
|
304
311
|
const input = await safeQuestion(chalk.blue.bold('\nIbrahim ➔ '));
|
|
305
312
|
|
|
306
313
|
if (input.toLowerCase() === 'exit') process.exit();
|
|
@@ -399,6 +406,8 @@ WORKFLOW:
|
|
|
399
406
|
// Prevent infinite tool loops
|
|
400
407
|
if (toolRounds >= MAX_TOOL_ROUNDS) {
|
|
401
408
|
console.log(chalk.yellow(`\n⚠️ Tool limit reached (${MAX_TOOL_ROUNDS} rounds). Stopping auto-execution.`));
|
|
409
|
+
console.log(chalk.gray('💡 Tip: Type /prune after analysis to reduce context size.'));
|
|
410
|
+
resetTerminal(); // Ensure terminal is responsive
|
|
402
411
|
messages.push({
|
|
403
412
|
role: 'user',
|
|
404
413
|
content: 'STOP using tools now. You have enough information. Please provide your analysis based on what you have read.'
|
|
@@ -446,6 +455,9 @@ WORKFLOW:
|
|
|
446
455
|
// Normal response - save and wait for next input
|
|
447
456
|
fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
|
|
448
457
|
active = false;
|
|
458
|
+
spinner.stop(); // Ensure spinner is dead
|
|
459
|
+
resetTerminal(); // Force terminal back to normal state
|
|
460
|
+
process.stdout.write('\n'); // Force newline to break out of stream mode
|
|
449
461
|
}
|
|
450
462
|
}
|
|
451
463
|
}
|