codeep 1.0.18 → 1.0.19
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/dist/utils/agent.js +23 -10
- package/package.json +1 -1
package/dist/utils/agent.js
CHANGED
|
@@ -505,27 +505,40 @@ export async function runAgent(prompt, projectContext, options = {}) {
|
|
|
505
505
|
finalResponse = content.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
|
|
506
506
|
// CRITICAL: Don't stop prematurely if we haven't done much work yet
|
|
507
507
|
// Check if prompt contains "create", "build", "make", "implement", "add" etc.
|
|
508
|
-
const taskKeywords = ['create', 'build', 'make', 'implement', 'add', 'generate', 'write', 'setup', 'develop', 'kreiraj', 'napravi', 'dodaj'];
|
|
508
|
+
const taskKeywords = ['create', 'build', 'make', 'implement', 'add', 'generate', 'write', 'setup', 'develop', 'kreiraj', 'napravi', 'dodaj', 'website', 'app', 'feature'];
|
|
509
509
|
const promptLowerCase = prompt.toLowerCase();
|
|
510
510
|
const isCreationTask = taskKeywords.some(kw => promptLowerCase.includes(kw));
|
|
511
511
|
const hasCreatedFiles = actions.some(a => a.type === 'write' || a.type === 'mkdir');
|
|
512
|
-
const
|
|
513
|
-
const isVeryEarlyIteration = iteration <=
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
512
|
+
const writeFileCount = actions.filter(a => a.type === 'write').length;
|
|
513
|
+
const isVeryEarlyIteration = iteration <= 5; // Extended to 5 iterations
|
|
514
|
+
console.error(`[DEBUG] Task check: isCreationTask=${isCreationTask}, hasCreatedFiles=${hasCreatedFiles}, writeFileCount=${writeFileCount}, iteration=${iteration}`);
|
|
515
|
+
// STRICT RULE: If it's a creation task, agent MUST create files
|
|
516
|
+
// Don't accept early stopping even if it has "done some actions"
|
|
517
|
+
if (isCreationTask && !hasCreatedFiles && iteration <= 10) {
|
|
518
|
+
console.error(`[DEBUG] BLOCKING early stop - creation task detected but NO files created yet (iteration ${iteration}, ${actions.length} actions)`);
|
|
519
|
+
// Force agent to create files
|
|
518
520
|
messages.push({ role: 'assistant', content: finalResponse });
|
|
519
521
|
messages.push({
|
|
520
522
|
role: 'user',
|
|
521
|
-
content:
|
|
523
|
+
content: `❌ STOP. You have NOT created any files yet!\n\nYou MUST use write_file and create_directory tools to create the actual files I asked for.\n\nDo NOT respond with explanations. Execute the tools NOW:\n1. Use create_directory if needed\n2. Use write_file to create EACH file\n3. Only after creating ALL files, respond with a summary.`
|
|
522
524
|
});
|
|
523
525
|
finalResponse = ''; // Reset
|
|
524
526
|
continue;
|
|
525
527
|
}
|
|
526
|
-
//
|
|
528
|
+
// If creation task but not enough files created, keep pushing
|
|
529
|
+
if (isCreationTask && writeFileCount < 2 && iteration <= 10) {
|
|
530
|
+
console.error(`[DEBUG] BLOCKING early stop - only ${writeFileCount} files created, need more (iteration ${iteration})`);
|
|
531
|
+
messages.push({ role: 'assistant', content: finalResponse });
|
|
532
|
+
messages.push({
|
|
533
|
+
role: 'user',
|
|
534
|
+
content: `You've only created ${writeFileCount} file(s). The task requires creating multiple files. Continue creating the remaining files now.`
|
|
535
|
+
});
|
|
536
|
+
finalResponse = ''; // Reset
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
// General safety: very few actions in early iterations
|
|
527
540
|
if (isVeryEarlyIteration && actions.length < 2) {
|
|
528
|
-
console.error(`[DEBUG]
|
|
541
|
+
console.error(`[DEBUG] BLOCKING early stop - very few actions (iteration ${iteration}, only ${actions.length} actions)`);
|
|
529
542
|
messages.push({ role: 'assistant', content: finalResponse });
|
|
530
543
|
messages.push({
|
|
531
544
|
role: 'user',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|