sapper-iq 1.1.25 → 1.1.27
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 +49 -15
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -522,7 +522,22 @@ async function runSapper() {
|
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
|
|
525
|
-
|
|
525
|
+
let localModels;
|
|
526
|
+
try {
|
|
527
|
+
localModels = await ollama.list();
|
|
528
|
+
} catch (e) {
|
|
529
|
+
console.error(chalk.red('\n❌ Cannot connect to Ollama!'));
|
|
530
|
+
console.log(chalk.yellow(' Make sure Ollama is running: ') + chalk.cyan('ollama serve'));
|
|
531
|
+
console.log(chalk.gray(' Or install from: https://ollama.ai\n'));
|
|
532
|
+
process.exit(1);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (!localModels.models || localModels.models.length === 0) {
|
|
536
|
+
console.error(chalk.red('\n❌ No models found!'));
|
|
537
|
+
console.log(chalk.yellow(' Pull a model first: ') + chalk.cyan('ollama pull llama3.2'));
|
|
538
|
+
process.exit(1);
|
|
539
|
+
}
|
|
540
|
+
|
|
526
541
|
console.log(divider());
|
|
527
542
|
console.log(statusBadge('MODELS', 'info') + chalk.gray(' Available Ollama models:\n'));
|
|
528
543
|
localModels.models.forEach((m, i) => {
|
|
@@ -537,13 +552,23 @@ async function runSapper() {
|
|
|
537
552
|
if (messages.length === 0) {
|
|
538
553
|
messages = [{
|
|
539
554
|
role: 'system',
|
|
540
|
-
content: `You are Sapper,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
555
|
+
content: `You are Sapper, a high-level Autonomous Software Engineer.
|
|
556
|
+
Your goal is to solve the user's request by interacting with the filesystem and shell.
|
|
557
|
+
|
|
558
|
+
RULES:
|
|
559
|
+
1. EXPLORE FIRST: Use LIST and READ to understand the codebase before making changes.
|
|
560
|
+
2. THINK IN STEPS: Explain what you found and what you plan to do before executing tools.
|
|
561
|
+
3. BE PRECISE: When using PATCH, ensure the 'oldText' matches exactly.
|
|
562
|
+
4. VERIFY: After writing code, use the SHELL tool to run tests or linting.
|
|
563
|
+
5. NO HALLUCINATIONS: If a file doesn't exist, don't guess its content. List the directory instead.
|
|
564
|
+
|
|
565
|
+
TOOL SYNTAX:
|
|
566
|
+
- [TOOL:LIST]dir[/TOOL] - List directory contents
|
|
567
|
+
- [TOOL:READ]file_path[/TOOL] - Read file contents
|
|
568
|
+
- [TOOL:SEARCH]pattern[/TOOL] - Search codebase for pattern
|
|
569
|
+
- [TOOL:WRITE]path:::content[/TOOL] - Create/overwrite file
|
|
570
|
+
- [TOOL:PATCH]path:::old|||new[/TOOL] - Edit existing file
|
|
571
|
+
- [TOOL:SHELL]command[/TOOL] - Run shell command`
|
|
547
572
|
}];
|
|
548
573
|
}
|
|
549
574
|
|
|
@@ -626,13 +651,22 @@ async function runSapper() {
|
|
|
626
651
|
// 4. Add reminder to stay in Agent Mode (not chatbot mode)
|
|
627
652
|
messages.push({
|
|
628
653
|
role: 'system',
|
|
629
|
-
content: `CONTEXT PRUNED. REMINDER: You are
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
654
|
+
content: `CONTEXT PRUNED. REMINDER: You are Sapper, an Autonomous Software Engineer.
|
|
655
|
+
|
|
656
|
+
RULES:
|
|
657
|
+
1. EXPLORE FIRST: Use LIST and READ before making changes.
|
|
658
|
+
2. THINK IN STEPS: Explain your plan before executing tools.
|
|
659
|
+
3. BE PRECISE: When using PATCH, ensure 'oldText' matches exactly.
|
|
660
|
+
4. VERIFY: Run tests or linting after writing code.
|
|
661
|
+
5. NO HALLUCINATIONS: Don't guess file contents.
|
|
662
|
+
|
|
663
|
+
TOOL SYNTAX:
|
|
664
|
+
- [TOOL:LIST]dir[/TOOL]
|
|
665
|
+
- [TOOL:READ]file_path[/TOOL]
|
|
666
|
+
- [TOOL:SEARCH]pattern[/TOOL]
|
|
667
|
+
- [TOOL:WRITE]path:::content[/TOOL]
|
|
668
|
+
- [TOOL:PATCH]path:::old|||new[/TOOL]
|
|
669
|
+
- [TOOL:SHELL]command[/TOOL]`
|
|
636
670
|
});
|
|
637
671
|
|
|
638
672
|
// 5. Save to context file so it persists
|