sapper-iq 1.1.4 → 1.1.5

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 +24 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
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
@@ -27,7 +27,13 @@ process.on('SIGINT', () => {
27
27
  console.log(chalk.red('\nForce quitting...'));
28
28
  process.exit(1);
29
29
  }
30
- console.log(chalk.yellow('\n\nUse "exit" to close Sapper safely, or Ctrl+C again to force quit.'));
30
+ // Clear current line and move to new one - stops ghost output
31
+ process.stdout.clearLine(0);
32
+ process.stdout.cursorTo(0);
33
+ console.log(chalk.yellow('\nStopping AI stream... (Ctrl+C again to force quit)'));
34
+
35
+ // Reset terminal immediately
36
+ resetTerminal();
31
37
  setTimeout(() => { ctrlCCount = 0; }, 2000); // Reset after 2 seconds
32
38
  });
33
39
 
@@ -294,7 +300,13 @@ PATCH vs WRITE:
294
300
  - Use WRITE only for new files or complete rewrites
295
301
 
296
302
  WORKFLOW:
297
- 1. LIST or SEARCH → 2. READ relevant files → 3. ANALYZE and RESPOND`
303
+ 1. LIST or SEARCH → 2. READ relevant files → 3. ANALYZE and RESPOND
304
+
305
+ IMPORTANT RULES:
306
+ - Be concise. Do not generate repetitive lists or filler text.
307
+ - If a list exceeds 10 items, summarize instead of listing everything.
308
+ - Never repeat the same content multiple times.
309
+ - Stop writing when you've made your point.`
298
310
  }];
299
311
  }
300
312
 
@@ -389,10 +401,18 @@ WORKFLOW:
389
401
  spinner.stop();
390
402
 
391
403
  let msg = '';
404
+ const MAX_RESPONSE_LENGTH = 15000; // Guard against infinite loops
405
+
392
406
  process.stdout.write(chalk.white('Sapper: '));
393
407
  for await (const chunk of response) {
394
- process.stdout.write(chunk.message.content);
395
- msg += chunk.message.content;
408
+ const content = chunk.message.content;
409
+ process.stdout.write(content);
410
+ msg += content;
411
+
412
+ if (msg.length > MAX_RESPONSE_LENGTH) {
413
+ console.log(chalk.red('\n\n⚠️ RESPONSE TOO LONG: Forcing stop to prevent infinite loop.'));
414
+ break;
415
+ }
396
416
  }
397
417
  console.log();
398
418
  messages.push({ role: 'assistant', content: msg });