codeep 1.2.35 → 1.2.36

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.
@@ -5,6 +5,7 @@ import { StdioTransport } from './transport.js';
5
5
  import { runAgentSession } from './session.js';
6
6
  import { initWorkspace, handleCommand } from './commands.js';
7
7
  import { autoSaveSession } from '../config/index.js';
8
+ import { getCurrentVersion } from '../utils/update.js';
8
9
  // All advertised slash commands (shown in Zed autocomplete)
9
10
  const AVAILABLE_COMMANDS = [
10
11
  // Configuration
@@ -83,7 +84,7 @@ export function startAcpServer() {
83
84
  },
84
85
  agentInfo: {
85
86
  name: 'codeep',
86
- version: '1.0.0',
87
+ version: getCurrentVersion(),
87
88
  },
88
89
  authMethods: [],
89
90
  };
@@ -134,7 +135,9 @@ export function startAcpServer() {
134
135
  .join('\n');
135
136
  const abortController = new AbortController();
136
137
  session.abortController = abortController;
138
+ const agentResponseChunks = [];
137
139
  const sendChunk = (text) => {
140
+ agentResponseChunks.push(text);
138
141
  transport.notify('session/update', {
139
142
  sessionId: params.sessionId,
140
143
  update: {
@@ -203,6 +206,10 @@ export function startAcpServer() {
203
206
  },
204
207
  }).then(() => {
205
208
  session.history.push({ role: 'user', content: prompt });
209
+ const agentResponse = agentResponseChunks.join('');
210
+ if (agentResponse) {
211
+ session.history.push({ role: 'assistant', content: agentResponse });
212
+ }
206
213
  autoSaveSession(session.history, session.workspaceRoot);
207
214
  transport.respond(msg.id, { stopReason: 'end_turn' });
208
215
  }).catch((err) => {
@@ -44,6 +44,8 @@ function toolCallMeta(toolName, params) {
44
44
  export async function runAgentSession(opts) {
45
45
  const projectContext = buildProjectContext(opts.workspaceRoot);
46
46
  let toolCallCounter = 0;
47
+ // Maps tool call key → ACP toolCallId so onToolResult can emit finished/error status
48
+ const toolCallIdMap = new Map();
47
49
  const result = await runAgent(opts.prompt, projectContext, {
48
50
  abortSignal: opts.abortSignal,
49
51
  onIteration: (_iteration, _message) => {
@@ -68,6 +70,9 @@ export async function runAgentSession(opts) {
68
70
  : join(opts.workspaceRoot, filePath);
69
71
  locations.push(pathToFileURL(absPath).href);
70
72
  }
73
+ // Track this tool call so onToolResult can emit finished/error
74
+ const mapKey = toolCall.id ?? `${name}_${toolCallCounter}`;
75
+ toolCallIdMap.set(mapKey, { toolCallId, kind, locations: locations.length ? locations : undefined });
71
76
  // Emit tool_call notification (running state)
72
77
  opts.onToolCall?.(toolCallId, name, kind, title, 'running', locations.length ? locations : undefined);
73
78
  // For file edits, also send structured file/edit notification
@@ -81,6 +86,20 @@ export async function runAgentSession(opts) {
81
86
  }
82
87
  }
83
88
  },
89
+ onToolResult: (toolResult, toolCall) => {
90
+ // Find the tracked entry by tool call id or by matching tool name in insertion order
91
+ const mapKey = toolCall.id
92
+ ? [...toolCallIdMap.keys()].find(k => k === toolCall.id)
93
+ : [...toolCallIdMap.keys()].find(k => k.startsWith(`${toolCall.tool}_`));
94
+ if (mapKey) {
95
+ const tracked = toolCallIdMap.get(mapKey);
96
+ if (opts.onToolCall) {
97
+ const status = toolResult.success ? 'finished' : 'error';
98
+ opts.onToolCall(tracked.toolCallId, toolCall.tool, tracked.kind, '', status, tracked.locations);
99
+ }
100
+ toolCallIdMap.delete(mapKey);
101
+ }
102
+ },
84
103
  });
85
104
  // Emit the final response text if present
86
105
  if (result.finalResponse) {
package/dist/api/index.js CHANGED
@@ -579,6 +579,6 @@ export async function validateApiKey(apiKey, providerId) {
579
579
  }
580
580
  }
581
581
  catch (err) {
582
- return { valid: false, error: err.message };
582
+ return { valid: false, error: err instanceof Error ? err.message : String(err) };
583
583
  }
584
584
  }
@@ -406,7 +406,7 @@ export function setProvider(providerId) {
406
406
  config.set('protocol', provider.defaultProtocol);
407
407
  // Load API key for the new provider into cache
408
408
  // This is async but we fire-and-forget since the key will be loaded before next API call
409
- loadApiKey(providerId);
409
+ loadApiKey(providerId).catch(() => { });
410
410
  return true;
411
411
  }
412
412
  // Get models for current provider
@@ -207,7 +207,7 @@ export function supportsNativeTools(providerId, protocol) {
207
207
  const provider = PROVIDERS[providerId];
208
208
  if (!provider)
209
209
  return false;
210
- return provider.protocols[protocol]?.supportsNativeTools ?? true; // Default to true
210
+ return provider.protocols[protocol]?.supportsNativeTools ?? false; // Default to false (safer)
211
211
  }
212
212
  /**
213
213
  * Returns the effective max output tokens for a provider, capped by the provider's limit.
@@ -129,17 +129,17 @@ async function handleSubmit(message) {
129
129
  executeAgentTask(enhancedTask, dryRun, ctx);
130
130
  return;
131
131
  }
132
+ const rateCheck = checkApiRateLimit();
133
+ if (!rateCheck.allowed) {
134
+ app.notify(rateCheck.message || 'Rate limit exceeded', 5000);
135
+ return;
136
+ }
132
137
  // Auto agent mode
133
138
  const agentMode = config.get('agentMode') || 'off';
134
139
  if (agentMode === 'on' && projectContext && hasWriteAccess && !isAgentRunningFlag) {
135
140
  runAgentTask(message, false, ctx, () => pendingInteractiveContext, (v) => { pendingInteractiveContext = v; });
136
141
  return;
137
142
  }
138
- const rateCheck = checkApiRateLimit();
139
- if (!rateCheck.allowed) {
140
- app.notify(rateCheck.message || 'Rate limit exceeded', 5000);
141
- return;
142
- }
143
143
  try {
144
144
  app.startStreaming();
145
145
  const history = app.getChatHistory();
@@ -159,7 +159,7 @@ export async function runAgent(prompt, projectContext, options = {}) {
159
159
  const dynamicTimeout = calculateDynamicTimeout(prompt, iteration, baseTimeout);
160
160
  debug(`Using timeout: ${dynamicTimeout}ms (base: ${baseTimeout}ms)`);
161
161
  // Get AI response with retry logic for timeouts
162
- let chatResponse;
162
+ let chatResponse = null;
163
163
  let retryCount = 0;
164
164
  while (true) {
165
165
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.2.35",
3
+ "version": "1.2.36",
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",