sapper-iq 1.1.24 → 1.1.26
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 +22 -7
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) => {
|
|
@@ -541,8 +556,8 @@ async function runSapper() {
|
|
|
541
556
|
- [TOOL:LIST]path[/TOOL] - List directory
|
|
542
557
|
- [TOOL:READ]path[/TOOL] - Read file
|
|
543
558
|
- [TOOL:SEARCH]pattern[/TOOL] - Search codebase
|
|
544
|
-
- [TOOL:WRITE]path
|
|
545
|
-
- [TOOL:PATCH]path
|
|
559
|
+
- [TOOL:WRITE]path:::content[/TOOL] - Create/overwrite file (use ::: between path and content)
|
|
560
|
+
- [TOOL:PATCH]path:::old|||new[/TOOL] - Edit file
|
|
546
561
|
- [TOOL:SHELL]command[/TOOL] - Run terminal command`
|
|
547
562
|
}];
|
|
548
563
|
}
|
|
@@ -630,8 +645,8 @@ async function runSapper() {
|
|
|
630
645
|
- [TOOL:LIST]path[/TOOL] - List directory
|
|
631
646
|
- [TOOL:READ]path[/TOOL] - Read file
|
|
632
647
|
- [TOOL:SEARCH]pattern[/TOOL] - Search codebase
|
|
633
|
-
- [TOOL:WRITE]path
|
|
634
|
-
- [TOOL:PATCH]path
|
|
648
|
+
- [TOOL:WRITE]path:::content[/TOOL] - Create/overwrite file (use ::: between path and content)
|
|
649
|
+
- [TOOL:PATCH]path:::old|||new[/TOOL] - Edit file
|
|
635
650
|
- [TOOL:SHELL]command[/TOOL] - Run terminal command.`
|
|
636
651
|
});
|
|
637
652
|
|
|
@@ -814,8 +829,8 @@ async function runSapper() {
|
|
|
814
829
|
|
|
815
830
|
messages.push({ role: 'assistant', content: msg });
|
|
816
831
|
|
|
817
|
-
//
|
|
818
|
-
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([
|
|
832
|
+
// Regex: supports both old format (path]content) and new format (path:::content)
|
|
833
|
+
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^:\]]*?)(?:(?:::|\])([\s\S]*?))?\[\/TOOL\]/g)];
|
|
819
834
|
|
|
820
835
|
// Debug mode: show what regex sees
|
|
821
836
|
if (debugMode) {
|