codeep 1.0.23 → 1.0.24

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.
@@ -68,14 +68,14 @@ export const config = new Conf({
68
68
  agentMaxFixAttempts: 3,
69
69
  agentMaxIterations: 100,
70
70
  agentMaxDuration: 20, // minutes
71
- agentApiTimeout: 90000, // 90 seconds base timeout for agent (dynamically adjusted)
71
+ agentApiTimeout: 120000, // 120 seconds base timeout for agent (dynamically adjusted)
72
72
  protocol: 'openai',
73
73
  plan: 'lite',
74
74
  language: 'en',
75
75
  autoSave: true,
76
76
  currentSessionId: '',
77
77
  temperature: 0.7,
78
- maxTokens: 4096,
78
+ maxTokens: 8192,
79
79
  apiTimeout: 60000,
80
80
  rateLimitApi: 30, // 30 requests per minute
81
81
  rateLimitCommands: 100, // 100 commands per minute
@@ -15,46 +15,19 @@ class TimeoutError extends Error {
15
15
  * Complex tasks (creating pages, multiple files) need more time
16
16
  */
17
17
  function calculateDynamicTimeout(prompt, iteration, baseTimeout) {
18
- const promptLower = prompt.toLowerCase();
19
- // Keywords that indicate complex tasks requiring more time
20
- const complexKeywords = [
21
- 'create', 'build', 'implement', 'generate', 'make', 'develop', 'setup',
22
- 'website', 'app', 'application', 'page', 'component', 'feature',
23
- 'kreiraj', 'napravi', 'izgradi', 'generiraj', 'razvij', 'stranica', 'aplikacija'
24
- ];
25
- // Keywords indicating very large tasks
26
- const veryComplexKeywords = [
27
- 'full', 'complete', 'entire', 'whole', 'multiple', 'all',
28
- 'cijeli', 'kompletni', 'sve', 'višestruki'
29
- ];
18
+ // Simple approach: just use base timeout with small multiplier for later iterations
19
+ // Complex calculations were causing more problems than they solved
30
20
  let multiplier = 1.0;
31
- // Check for complex keywords
32
- const hasComplexKeyword = complexKeywords.some(kw => promptLower.includes(kw));
33
- if (hasComplexKeyword) {
34
- multiplier = 2.0; // Double timeout for complex tasks
21
+ // Later iterations have larger context, may need slightly more time
22
+ if (iteration > 3) {
23
+ multiplier = 1.2;
35
24
  }
36
- // Check for very complex keywords
37
- const hasVeryComplexKeyword = veryComplexKeywords.some(kw => promptLower.includes(kw));
38
- if (hasVeryComplexKeyword) {
39
- multiplier = 3.0; // Triple timeout for very complex tasks
25
+ if (iteration > 8) {
26
+ multiplier = 1.5;
40
27
  }
41
- // Long prompts usually mean complex tasks
42
- if (prompt.length > 200) {
43
- multiplier = Math.max(multiplier, 2.0);
44
- }
45
- if (prompt.length > 500) {
46
- multiplier = Math.max(multiplier, 3.0);
47
- }
48
- // Later iterations might need more time (context is larger)
49
- if (iteration > 5) {
50
- multiplier *= 1.2;
51
- }
52
- if (iteration > 10) {
53
- multiplier *= 1.3;
54
- }
55
- // Minimum 60 seconds, maximum 5 minutes for a single API call
28
+ // Minimum 120 seconds, maximum 5 minutes for a single API call
56
29
  const calculatedTimeout = baseTimeout * multiplier;
57
- return Math.min(Math.max(calculatedTimeout, 60000), 300000);
30
+ return Math.min(Math.max(calculatedTimeout, 120000), 300000);
58
31
  }
59
32
  import { parseToolCalls, executeTool, createActionLog, formatToolDefinitions, getOpenAITools, getAnthropicTools, parseOpenAIToolCalls, parseAnthropicToolCalls } from './tools.js';
60
33
  import { config, getApiKey } from '../config/index.js';
@@ -261,10 +234,27 @@ async function agentChat(messages, systemPrompt, onChunk, abortSignal, dynamicTi
261
234
  throw new Error(`API error: ${response.status} - ${errorText}`);
262
235
  }
263
236
  const data = await response.json();
237
+ // Debug: log raw API response
238
+ console.error(`[DEBUG] Raw API response:`, JSON.stringify(data, null, 2).substring(0, 1000));
264
239
  if (protocol === 'openai') {
265
240
  const message = data.choices?.[0]?.message;
266
241
  const content = message?.content || '';
267
- const toolCalls = parseOpenAIToolCalls(message?.tool_calls || []);
242
+ const rawToolCalls = message?.tool_calls || [];
243
+ // Debug: log raw tool calls from API
244
+ console.error(`[DEBUG] Raw tool_calls from API:`, JSON.stringify(rawToolCalls, null, 2));
245
+ const toolCalls = parseOpenAIToolCalls(rawToolCalls);
246
+ // Debug: log parsed tool calls
247
+ console.error(`[DEBUG] Parsed tool calls:`, JSON.stringify(toolCalls, null, 2));
248
+ // If no native tool calls, try parsing from content (some models return text-based)
249
+ if (toolCalls.length === 0 && content) {
250
+ console.error(`[DEBUG] No native tool calls, checking content for text-based calls...`);
251
+ console.error(`[DEBUG] Content preview:`, content.substring(0, 500));
252
+ const textToolCalls = parseToolCalls(content);
253
+ if (textToolCalls.length > 0) {
254
+ console.error(`[DEBUG] Found ${textToolCalls.length} text-based tool calls`);
255
+ return { content, toolCalls: textToolCalls, usedNativeTools: false };
256
+ }
257
+ }
268
258
  if (onChunk && content) {
269
259
  onChunk(content);
270
260
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
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",