codeep 1.0.17 → 1.0.18

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.
@@ -504,16 +504,32 @@ export async function runAgent(prompt, projectContext, options = {}) {
504
504
  // Remove <think>...</think> tags from response (some models include thinking)
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
- // Agent should create files, not just respond with text
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'];
509
+ const promptLowerCase = prompt.toLowerCase();
510
+ const isCreationTask = taskKeywords.some(kw => promptLowerCase.includes(kw));
508
511
  const hasCreatedFiles = actions.some(a => a.type === 'write' || a.type === 'mkdir');
509
- const isVeryEarlyIteration = iteration <= 2 && actions.length < 3;
510
- if (isVeryEarlyIteration && !hasCreatedFiles) {
511
- console.error(`[DEBUG] Agent trying to stop too early (iteration ${iteration}, ${actions.length} actions, no files created)`);
512
+ const hasEnoughActions = actions.length >= 3;
513
+ const isVeryEarlyIteration = iteration <= 3;
514
+ // If it's a creation task and agent hasn't created files yet, push it to continue
515
+ if (isCreationTask && isVeryEarlyIteration && !hasCreatedFiles) {
516
+ console.error(`[DEBUG] Agent trying to stop too early (iteration ${iteration}, ${actions.length} actions, no files created for creation task)`);
512
517
  // Push agent to actually do the work
513
518
  messages.push({ role: 'assistant', content: finalResponse });
514
519
  messages.push({
515
520
  role: 'user',
516
- content: `You haven't completed the task yet. You need to use the tools to actually CREATE the files and folders I asked for. Don't just plan - execute! Use create_directory, write_file, and other tools NOW.`
521
+ content: `You haven't completed the task yet. You need to use the tools to actually CREATE the files and folders I asked for. Don't just plan or explain - EXECUTE! Use create_directory and write_file tools NOW to create the actual files.`
522
+ });
523
+ finalResponse = ''; // Reset
524
+ continue;
525
+ }
526
+ // Even if not clearly a creation task, if very few actions in early iterations, push to continue
527
+ if (isVeryEarlyIteration && actions.length < 2) {
528
+ console.error(`[DEBUG] Agent stopping with very few actions (iteration ${iteration}, only ${actions.length} actions)`);
529
+ messages.push({ role: 'assistant', content: finalResponse });
530
+ messages.push({
531
+ role: 'user',
532
+ content: `Continue working on the task. Use the available tools to complete what I asked for.`
517
533
  });
518
534
  finalResponse = ''; // Reset
519
535
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
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",