sapper-iq 1.0.4 → 1.0.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.
- package/package.json +1 -1
- package/sapper copy.mjs +9 -28
- package/sapper.mjs +15 -22
package/package.json
CHANGED
package/sapper copy.mjs
CHANGED
|
@@ -234,24 +234,16 @@ async function runSapper() {
|
|
|
234
234
|
|
|
235
235
|
**CRITICAL - Tool Format Rules:**
|
|
236
236
|
- NEVER use JSON format
|
|
237
|
-
- ONLY use this EXACT format for tools: [TOOL:TYPE:path
|
|
238
|
-
- For single-line content: [TOOL:TYPE:path:content] (legacy format still supported)
|
|
237
|
+
- ONLY use this EXACT format for tools: [TOOL:TYPE:path:content]
|
|
239
238
|
- Types: SHELL, READ, WRITE, MKDIR, LIST, SEARCH
|
|
240
239
|
|
|
241
240
|
**Examples:**
|
|
242
|
-
[TOOL:SHELL:npm install]
|
|
243
|
-
[TOOL:READ:./package.json]
|
|
244
|
-
[TOOL:WRITE:./app.js
|
|
245
|
-
[TOOL:MKDIR:./src/components]
|
|
246
|
-
[TOOL:LIST:./src]
|
|
247
|
-
[TOOL:SEARCH:function myFunction]
|
|
248
|
-
|
|
249
|
-
**For multi-line content (like markdown files):**
|
|
250
|
-
[TOOL:WRITE:./file.md]
|
|
251
|
-
Multi-line
|
|
252
|
-
content here
|
|
253
|
-
with - [ ] checkboxes
|
|
254
|
-
[/TOOL]
|
|
241
|
+
[TOOL:SHELL:npm install]
|
|
242
|
+
[TOOL:READ:./package.json]
|
|
243
|
+
[TOOL:WRITE:./app.js:console.log('hello')]
|
|
244
|
+
[TOOL:MKDIR:./src/components]
|
|
245
|
+
[TOOL:LIST:./src]
|
|
246
|
+
[TOOL:SEARCH:function myFunction]
|
|
255
247
|
|
|
256
248
|
**Shell Command Rules:**
|
|
257
249
|
- For operations in a specific directory, chain with cd: cd /path/to/project && npm install
|
|
@@ -416,18 +408,7 @@ with - [ ] checkboxes
|
|
|
416
408
|
messages.push({ role: 'assistant', content: msg });
|
|
417
409
|
|
|
418
410
|
const summaryMatch = msg.match(/\[SUMMARY:(.*?)\]/s);
|
|
419
|
-
|
|
420
|
-
// Support both formats:
|
|
421
|
-
// New: [TOOL:TYPE:path]content[/TOOL] (handles multi-line content with brackets)
|
|
422
|
-
// Old: [TOOL:TYPE:path:content] (for backward compatibility)
|
|
423
|
-
const newFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^\]]+)\]([\s\S]*?)\[\/TOOL\]/g)];
|
|
424
|
-
const oldFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^:\]]+):([^\]]+)\]/g)];
|
|
425
|
-
|
|
426
|
-
// Normalize to unified format: [fullMatch, type, path, content]
|
|
427
|
-
const toolMatches = [
|
|
428
|
-
...newFormatMatches.map(m => [m[0], m[1], m[2], m[3]]),
|
|
429
|
-
...oldFormatMatches.map(m => [m[0], m[1], m[2], m[3]])
|
|
430
|
-
];
|
|
411
|
+
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+):([^:\]]+):?([\s\S]*?)\]/g)];
|
|
431
412
|
|
|
432
413
|
if (summaryMatch) {
|
|
433
414
|
console.log(chalk.green.bold("\n✅ MISSION COMPLETE:"));
|
|
@@ -469,7 +450,7 @@ with - [ ] checkboxes
|
|
|
469
450
|
break;
|
|
470
451
|
}
|
|
471
452
|
} else {
|
|
472
|
-
const planMatch = msg.match(/\[PLAN:(
|
|
453
|
+
const planMatch = msg.match(/\[PLAN:(.*?)\]/);
|
|
473
454
|
if (planMatch) {
|
|
474
455
|
const feedback = await safeQuestion(chalk.yellow('\nModify plan or type "go": '));
|
|
475
456
|
if (feedback.toLowerCase() === '/stop') { active = false; break; }
|
package/sapper.mjs
CHANGED
|
@@ -234,25 +234,27 @@ async function runSapper() {
|
|
|
234
234
|
|
|
235
235
|
**CRITICAL - Tool Format Rules:**
|
|
236
236
|
- NEVER use JSON format
|
|
237
|
-
-
|
|
238
|
-
- For single-line content: [TOOL:TYPE:path:content] (legacy format still supported)
|
|
237
|
+
- ALWAYS use this format: [TOOL:TYPE:path]content[/TOOL]
|
|
239
238
|
- Types: SHELL, READ, WRITE, MKDIR, LIST, SEARCH
|
|
240
239
|
|
|
241
|
-
**Examples:**
|
|
242
|
-
[TOOL:SHELL
|
|
243
|
-
[TOOL:READ
|
|
244
|
-
[TOOL:WRITE
|
|
245
|
-
[TOOL:MKDIR
|
|
246
|
-
[TOOL:LIST
|
|
247
|
-
[TOOL:SEARCH
|
|
240
|
+
**Examples for ALL cases (short or long content):**
|
|
241
|
+
[TOOL:SHELL]npm install[/TOOL]
|
|
242
|
+
[TOOL:READ]./package.json[/TOOL]
|
|
243
|
+
[TOOL:WRITE]./app.js]console.log('hello')[/TOOL]
|
|
244
|
+
[TOOL:MKDIR]./src/components[/TOOL]
|
|
245
|
+
[TOOL:LIST]./src[/TOOL]
|
|
246
|
+
[TOOL:SEARCH]function myFunction[/TOOL]
|
|
248
247
|
|
|
249
|
-
**For multi-line content
|
|
250
|
-
[TOOL:WRITE
|
|
248
|
+
**For files with brackets, arrays, or multi-line content:**
|
|
249
|
+
[TOOL:WRITE]./file.md]
|
|
251
250
|
Multi-line
|
|
252
251
|
content here
|
|
253
252
|
with - [ ] checkboxes
|
|
253
|
+
and [arrays]
|
|
254
254
|
[/TOOL]
|
|
255
255
|
|
|
256
|
+
**IMPORTANT:** ALWAYS put path after colon, then close bracket, then content, then [/TOOL]
|
|
257
|
+
|
|
256
258
|
**Shell Command Rules:**
|
|
257
259
|
- For operations in a specific directory, chain with cd: cd /path/to/project && npm install
|
|
258
260
|
- Use && to chain commands that depend on each other
|
|
@@ -417,17 +419,8 @@ with - [ ] checkboxes
|
|
|
417
419
|
|
|
418
420
|
const summaryMatch = msg.match(/\[SUMMARY:(.*?)\]/s);
|
|
419
421
|
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
// Old: [TOOL:TYPE:path:content] (for backward compatibility)
|
|
423
|
-
const newFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^\]]+)\]([\s\S]*?)\[\/TOOL\]/g)];
|
|
424
|
-
const oldFormatMatches = [...msg.matchAll(/\[TOOL:(\w+):([^:\]]+):([^\]]+)\]/g)];
|
|
425
|
-
|
|
426
|
-
// Normalize to unified format: [fullMatch, type, path, content]
|
|
427
|
-
const toolMatches = [
|
|
428
|
-
...newFormatMatches.map(m => [m[0], m[1], m[2], m[3]]),
|
|
429
|
-
...oldFormatMatches.map(m => [m[0], m[1], m[2], m[3]])
|
|
430
|
-
];
|
|
422
|
+
// Primary format: [TOOL:TYPE:path]content[/TOOL]
|
|
423
|
+
const toolMatches = [...msg.matchAll(/\[TOOL:(\w+)\]([^\[]+?)\]([\s\S]*?)\[\/TOOL\]/g)];
|
|
431
424
|
|
|
432
425
|
if (summaryMatch) {
|
|
433
426
|
console.log(chalk.green.bold("\n✅ MISSION COMPLETE:"));
|