codeep 1.0.16 → 1.0.17

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,27 @@ 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
+ // Agent should create files, not just respond with text
508
+ 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
+ // Push agent to actually do the work
513
+ messages.push({ role: 'assistant', content: finalResponse });
514
+ messages.push({
515
+ 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.`
517
+ });
518
+ finalResponse = ''; // Reset
519
+ continue;
520
+ }
506
521
  // Check if we're using task planning and there are more tasks
507
522
  if (taskPlan && taskPlan.tasks.some(t => t.status === 'pending')) {
508
523
  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.17",
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",