codeep 1.0.15 → 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 +2 -2
- package/dist/utils/agent.js +20 -1
- package/package.json +1 -1
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:
|
|
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:
|
|
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));
|
package/dist/utils/agent.js
CHANGED
|
@@ -456,6 +456,7 @@ export async function runAgent(prompt, projectContext, options = {}) {
|
|
|
456
456
|
}
|
|
457
457
|
// Check abort signal
|
|
458
458
|
if (opts.abortSignal?.aborted) {
|
|
459
|
+
console.error(`[DEBUG] Agent aborted at iteration ${iteration}, signal:`, opts.abortSignal.aborted);
|
|
459
460
|
result = {
|
|
460
461
|
success: false,
|
|
461
462
|
iterations: iteration,
|
|
@@ -466,6 +467,7 @@ export async function runAgent(prompt, projectContext, options = {}) {
|
|
|
466
467
|
return result;
|
|
467
468
|
}
|
|
468
469
|
iteration++;
|
|
470
|
+
console.error(`[DEBUG] Starting iteration ${iteration}/${opts.maxIterations}, actions: ${actions.length}`);
|
|
469
471
|
opts.onIteration?.(iteration, `Iteration ${iteration}/${opts.maxIterations}`);
|
|
470
472
|
// Get AI response
|
|
471
473
|
let chatResponse;
|
|
@@ -495,10 +497,27 @@ export async function runAgent(prompt, projectContext, options = {}) {
|
|
|
495
497
|
toolCalls = textToolCalls;
|
|
496
498
|
}
|
|
497
499
|
}
|
|
498
|
-
// If no tool calls,
|
|
500
|
+
// If no tool calls, check if agent is really done
|
|
499
501
|
if (toolCalls.length === 0) {
|
|
502
|
+
console.error(`[DEBUG] No tool calls at iteration ${iteration}, content length: ${content.length}, actions so far: ${actions.length}`);
|
|
503
|
+
console.error(`[DEBUG] Response preview:`, content.substring(0, 200));
|
|
500
504
|
// Remove <think>...</think> tags from response (some models include thinking)
|
|
501
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
|
+
}
|
|
502
521
|
// Check if we're using task planning and there are more tasks
|
|
503
522
|
if (taskPlan && taskPlan.tasks.some(t => t.status === 'pending')) {
|
|
504
523
|
const nextTask = getNextTask(taskPlan.tasks);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeep",
|
|
3
|
-
"version": "1.0.
|
|
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",
|