codeep 1.0.16 → 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.
package/dist/app.js CHANGED
@@ -266,7 +266,7 @@ export const App = () => {
266
266
  setAbortController(controller);
267
267
  try {
268
268
  const result = await runAgent(prompt, projectContext, {
269
- maxIterations: 20,
269
+ maxIterations: 50, // Increased for complex tasks
270
270
  maxDuration: 5 * 60 * 1000, // 5 minutes
271
271
  dryRun,
272
272
  onIteration: (iteration, message) => {
@@ -1318,7 +1318,7 @@ export const App = () => {
1318
1318
  return (_jsx(LanguageSelect, { onClose: () => setScreen('chat'), notify: notify }));
1319
1319
  }
1320
1320
  // Main chat screen
1321
- return (_jsxs(Box, { flexDirection: "column", children: [messages.length === 0 && !isLoading && _jsx(Logo, {}), messages.length === 0 && !isLoading && (_jsx(Box, { justifyContent: "center", children: _jsxs(Text, { children: ["Connected to ", _jsx(Text, { color: "#f02a30", children: config.get('model') }), ". Type ", _jsx(Text, { color: "#f02a30", children: "/help" }), " for commands."] }) })), _jsx(MessageList, { messages: messages, streamingContent: streamingContent, scrollOffset: 0, terminalHeight: stdout.rows || 24 }, sessionId), isLoading && !isAgentRunning && _jsx(Loading, { isStreaming: !!streamingContent }), isAgentRunning && (_jsx(AgentProgress, { isRunning: true, iteration: agentIteration, maxIterations: 20, actions: agentActions, currentThinking: agentThinking, dryRun: agentDryRun })), !isAgentRunning && agentResult && (_jsx(AgentSummary, { success: agentResult.success, iterations: agentResult.iterations, actions: agentActions, error: agentResult.error, aborted: agentResult.aborted })), pendingFileChanges.length > 0 && !isLoading && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#f02a30", padding: 1, marginY: 1, children: [_jsxs(Text, { color: "#f02a30", bold: true, children: ["\u2713 Detected ", pendingFileChanges.length, " file change(s):"] }), pendingFileChanges.map((change, i) => {
1321
+ return (_jsxs(Box, { flexDirection: "column", children: [messages.length === 0 && !isLoading && _jsx(Logo, {}), messages.length === 0 && !isLoading && (_jsx(Box, { justifyContent: "center", children: _jsxs(Text, { children: ["Connected to ", _jsx(Text, { color: "#f02a30", children: config.get('model') }), ". Type ", _jsx(Text, { color: "#f02a30", children: "/help" }), " for commands."] }) })), _jsx(MessageList, { messages: messages, streamingContent: streamingContent, scrollOffset: 0, terminalHeight: stdout.rows || 24 }, sessionId), isLoading && !isAgentRunning && _jsx(Loading, { isStreaming: !!streamingContent }), isAgentRunning && (_jsx(AgentProgress, { isRunning: true, iteration: agentIteration, maxIterations: 50, actions: agentActions, currentThinking: agentThinking, dryRun: agentDryRun })), !isAgentRunning && agentResult && (_jsx(AgentSummary, { success: agentResult.success, iterations: agentResult.iterations, actions: agentActions, error: agentResult.error, aborted: agentResult.aborted })), pendingFileChanges.length > 0 && !isLoading && (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "#f02a30", padding: 1, marginY: 1, children: [_jsxs(Text, { color: "#f02a30", bold: true, children: ["\u2713 Detected ", pendingFileChanges.length, " file change(s):"] }), pendingFileChanges.map((change, i) => {
1322
1322
  const actionColor = change.action === 'delete' ? 'red' : change.action === 'edit' ? 'yellow' : 'green';
1323
1323
  const actionLabel = change.action === 'delete' ? 'DELETE' : change.action === 'edit' ? 'EDIT' : 'CREATE';
1324
1324
  return (_jsxs(Text, { children: ["\u2022 ", _jsxs(Text, { color: actionColor, children: ["[", actionLabel, "]"] }), " ", change.path, change.action !== 'delete' && change.content.includes('\n') && ` (${change.content.split('\n').length} lines)`] }, i));
@@ -497,12 +497,43 @@ export async function runAgent(prompt, projectContext, options = {}) {
497
497
  toolCalls = textToolCalls;
498
498
  }
499
499
  }
500
- // If no tool calls, this is the final response
500
+ // If no tool calls, check if agent is really done
501
501
  if (toolCalls.length === 0) {
502
502
  console.error(`[DEBUG] No tool calls at iteration ${iteration}, content length: ${content.length}, actions so far: ${actions.length}`);
503
503
  console.error(`[DEBUG] Response preview:`, content.substring(0, 200));
504
504
  // Remove <think>...</think> tags from response (some models include thinking)
505
505
  finalResponse = content.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();
506
+ // CRITICAL: Don't stop prematurely if we haven't done much work yet
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));
511
+ const hasCreatedFiles = actions.some(a => a.type === 'write' || a.type === 'mkdir');
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)`);
517
+ // Push agent to actually do the work
518
+ messages.push({ role: 'assistant', content: finalResponse });
519
+ messages.push({
520
+ role: 'user',
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.`
533
+ });
534
+ finalResponse = ''; // Reset
535
+ continue;
536
+ }
506
537
  // Check if we're using task planning and there are more tasks
507
538
  if (taskPlan && taskPlan.tasks.some(t => t.status === 'pending')) {
508
539
  const nextTask = getNextTask(taskPlan.tasks);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.16",
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",