codeep 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/dist/utils/agent.js +49 -18
  2. package/package.json +1 -1
@@ -27,13 +27,15 @@ function getAgentSystemPrompt(projectContext) {
27
27
  - List directory contents
28
28
 
29
29
  ## IMPORTANT: Follow User Instructions Exactly
30
- - Do EXACTLY what the user asks, nothing more
30
+ - Do EXACTLY what the user asks - complete the ENTIRE task
31
+ - If user says "create a website" -> create ALL necessary files (HTML, CSS, JS, etc.)
31
32
  - If user says "create folder X" -> use create_directory tool to create folder X
32
33
  - If user says "delete file X" -> use delete_file tool to delete file X
33
- - Do NOT interpret or expand simple requests into complex tasks
34
- - Simple tasks should be completed in 1-2 tool calls
34
+ - Do NOT stop after just 1-2 tool calls unless the task is trivially simple
35
+ - Complex tasks (like creating websites) require MANY tool calls to complete
35
36
  - The user may write in any language - understand their request and execute it
36
37
  - Tool names and parameters must ALWAYS be in English (e.g., "create_directory", not "kreiraj_direktorij")
38
+ - KEEP WORKING until the entire task is finished - do not stop prematurely
37
39
 
38
40
  ## Rules
39
41
  1. Always read files before editing them to understand the current content
@@ -70,12 +72,15 @@ function getFallbackSystemPrompt(projectContext) {
70
72
  return `You are an AI coding agent with FULL autonomous access to this project.
71
73
 
72
74
  ## IMPORTANT: Follow User Instructions Exactly
73
- - Do EXACTLY what the user asks, nothing more
75
+ - Do EXACTLY what the user asks - complete the ENTIRE task
76
+ - If user says "create a website" -> create ALL necessary files (HTML, CSS, JS, etc.)
74
77
  - If user says "create folder X" -> use create_directory tool
75
- - If user says "delete file X" -> use delete_file tool
76
- - Do NOT interpret or expand simple requests into complex tasks
78
+ - If user says "delete file X" -> use delete_file tool
79
+ - Do NOT stop after just 1-2 tool calls unless the task is trivially simple
80
+ - Complex tasks (like creating websites) require MANY tool calls to complete
77
81
  - The user may write in any language - understand and execute
78
82
  - Tool names and parameters must ALWAYS be in English
83
+ - KEEP WORKING until the entire task is finished - do not stop prematurely
79
84
 
80
85
  ## Available Tools
81
86
  ${formatToolDefinitions()}
@@ -474,18 +479,41 @@ export async function runAgent(prompt, projectContext, options = {}) {
474
479
  toolCalls = textToolCalls;
475
480
  }
476
481
  }
477
- // If no tool calls, this is the final response
482
+ // If no tool calls, check if this is really the final response
483
+ // Don't exit on first iteration without tool calls - agent might be thinking
478
484
  if (toolCalls.length === 0) {
479
- // Remove <think>...</think> tags from response (some models include thinking)
480
- finalResponse = content.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
481
- break;
482
- }
483
- // Also check if response indicates completion (even with tool calls)
484
- const completionIndicators = ['task completed', 'finished', 'done with', 'successfully created', 'all set'];
485
- const lowerContent = content.toLowerCase();
486
- if (completionIndicators.some(indicator => lowerContent.includes(indicator))) {
487
- // Agent thinks task is complete, but included tool calls - execute them and finish
488
- // Continue with tool execution but mark this as potentially the last iteration
485
+ // Only accept as final response if:
486
+ // 1. We've done at least some work (iteration > 2)
487
+ // 2. Agent explicitly indicates completion
488
+ const completionIndicators = [
489
+ 'task is complete',
490
+ 'all files have been created',
491
+ 'website has been created',
492
+ 'successfully completed',
493
+ 'everything is ready',
494
+ 'all done'
495
+ ];
496
+ const lowerContent = content.toLowerCase();
497
+ const indicatesCompletion = completionIndicators.some(indicator => lowerContent.includes(indicator));
498
+ if (iteration > 2 && indicatesCompletion) {
499
+ // Remove <think>...</think> tags from response
500
+ finalResponse = content.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
501
+ break;
502
+ }
503
+ else if (iteration <= 2) {
504
+ // Too early to quit - remind agent to continue
505
+ messages.push({ role: 'assistant', content });
506
+ messages.push({
507
+ role: 'user',
508
+ content: 'Continue with the task. Use the tools to complete what was requested. Do not stop until all files are created and the task is fully complete.'
509
+ });
510
+ continue;
511
+ }
512
+ else {
513
+ // Later iteration without completion indicator - accept as final
514
+ finalResponse = content.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
515
+ break;
516
+ }
489
517
  }
490
518
  // Add assistant response to history
491
519
  messages.push({ role: 'assistant', content });
@@ -520,9 +548,12 @@ export async function runAgent(prompt, projectContext, options = {}) {
520
548
  }
521
549
  }
522
550
  // Add tool results to messages
551
+ const nextStepPrompt = iteration < 5
552
+ ? `Tool results:\n\n${toolResults.join('\n\n')}\n\nGood progress! Continue working on the task. Use more tools to complete what was requested. Only stop when EVERYTHING is finished and working.`
553
+ : `Tool results:\n\n${toolResults.join('\n\n')}\n\nContinue with the task. If the task is fully complete, provide a final summary without any tool calls.`;
523
554
  messages.push({
524
555
  role: 'user',
525
- content: `Tool results:\n\n${toolResults.join('\n\n')}\n\nContinue with the task. If done, provide a final summary without any tool calls.`,
556
+ content: nextStepPrompt,
526
557
  });
527
558
  }
528
559
  // Check if we hit max iterations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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",