sapper-iq 1.1.23 → 1.1.25
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 +13 -7
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -541,8 +541,8 @@ async function runSapper() {
|
|
|
541
541
|
- [TOOL:LIST]path[/TOOL] - List directory
|
|
542
542
|
- [TOOL:READ]path[/TOOL] - Read file
|
|
543
543
|
- [TOOL:SEARCH]pattern[/TOOL] - Search codebase
|
|
544
|
-
- [TOOL:WRITE]path
|
|
545
|
-
- [TOOL:PATCH]path
|
|
544
|
+
- [TOOL:WRITE]path:::content[/TOOL] - Create/overwrite file (use ::: between path and content)
|
|
545
|
+
- [TOOL:PATCH]path:::old|||new[/TOOL] - Edit file
|
|
546
546
|
- [TOOL:SHELL]command[/TOOL] - Run terminal command`
|
|
547
547
|
}];
|
|
548
548
|
}
|
|
@@ -630,8 +630,8 @@ async function runSapper() {
|
|
|
630
630
|
- [TOOL:LIST]path[/TOOL] - List directory
|
|
631
631
|
- [TOOL:READ]path[/TOOL] - Read file
|
|
632
632
|
- [TOOL:SEARCH]pattern[/TOOL] - Search codebase
|
|
633
|
-
- [TOOL:WRITE]path
|
|
634
|
-
- [TOOL:PATCH]path
|
|
633
|
+
- [TOOL:WRITE]path:::content[/TOOL] - Create/overwrite file (use ::: between path and content)
|
|
634
|
+
- [TOOL:PATCH]path:::old|||new[/TOOL] - Edit file
|
|
635
635
|
- [TOOL:SHELL]command[/TOOL] - Run terminal command.`
|
|
636
636
|
});
|
|
637
637
|
|
|
@@ -814,8 +814,8 @@ async function runSapper() {
|
|
|
814
814
|
|
|
815
815
|
messages.push({ role: 'assistant', content: msg });
|
|
816
816
|
|
|
817
|
-
//
|
|
818
|
-
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([
|
|
817
|
+
// Regex: supports both old format (path]content) and new format (path:::content)
|
|
818
|
+
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^:\]]*?)(?:(?:::|\])([\s\S]*?))?\[\/TOOL\]/g)];
|
|
819
819
|
|
|
820
820
|
// Debug mode: show what regex sees
|
|
821
821
|
if (debugMode) {
|
|
@@ -874,7 +874,13 @@ async function runSapper() {
|
|
|
874
874
|
if (type.toLowerCase() === 'list') result = tools.list(path);
|
|
875
875
|
else if (type.toLowerCase() === 'read') result = tools.read(path);
|
|
876
876
|
else if (type.toLowerCase() === 'mkdir') result = tools.mkdir(path);
|
|
877
|
-
else if (type.toLowerCase() === 'write')
|
|
877
|
+
else if (type.toLowerCase() === 'write') {
|
|
878
|
+
if (!content || content.trim() === '') {
|
|
879
|
+
result = 'Error: WRITE requires content. Use [TOOL:WRITE]path]content here[/TOOL]';
|
|
880
|
+
} else {
|
|
881
|
+
result = await tools.write(path, content);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
878
884
|
else if (type.toLowerCase() === 'patch') {
|
|
879
885
|
// PATCH format: [TOOL:PATCH]path]OLD_TEXT|||NEW_TEXT[/TOOL]
|
|
880
886
|
const parts = content?.split('|||');
|