codeep 1.2.17 → 1.2.19
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/README.md +20 -7
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +21 -17
- package/dist/config/providers.d.ts +6 -0
- package/dist/config/providers.js +11 -0
- package/dist/renderer/App.d.ts +1 -5
- package/dist/renderer/App.js +106 -486
- package/dist/renderer/agentExecution.d.ts +36 -0
- package/dist/renderer/agentExecution.js +394 -0
- package/dist/renderer/commands.d.ts +16 -0
- package/dist/renderer/commands.js +838 -0
- package/dist/renderer/handlers.d.ts +87 -0
- package/dist/renderer/handlers.js +260 -0
- package/dist/renderer/highlight.d.ts +18 -0
- package/dist/renderer/highlight.js +130 -0
- package/dist/renderer/main.d.ts +4 -2
- package/dist/renderer/main.js +103 -1550
- package/dist/utils/agent.d.ts +5 -15
- package/dist/utils/agent.js +9 -693
- package/dist/utils/agentChat.d.ts +46 -0
- package/dist/utils/agentChat.js +343 -0
- package/dist/utils/agentStream.d.ts +23 -0
- package/dist/utils/agentStream.js +216 -0
- package/dist/utils/keychain.js +3 -2
- package/dist/utils/learning.js +9 -3
- package/dist/utils/mcpIntegration.d.ts +61 -0
- package/dist/utils/mcpIntegration.js +154 -0
- package/dist/utils/project.js +8 -3
- package/dist/utils/skills.js +21 -11
- package/dist/utils/smartContext.d.ts +4 -0
- package/dist/utils/smartContext.js +51 -14
- package/dist/utils/toolExecution.d.ts +27 -0
- package/dist/utils/toolExecution.js +525 -0
- package/dist/utils/toolParsing.d.ts +18 -0
- package/dist/utils/toolParsing.js +302 -0
- package/dist/utils/tools.d.ts +11 -24
- package/dist/utils/tools.js +22 -1187
- package/package.json +3 -1
- package/dist/config/config.test.d.ts +0 -1
- package/dist/config/config.test.js +0 -157
- package/dist/config/providers.test.d.ts +0 -1
- package/dist/config/providers.test.js +0 -187
- package/dist/hooks/index.d.ts +0 -4
- package/dist/hooks/index.js +0 -4
- package/dist/hooks/useAgent.d.ts +0 -29
- package/dist/hooks/useAgent.js +0 -148
- package/dist/utils/agent.test.d.ts +0 -1
- package/dist/utils/agent.test.js +0 -315
- package/dist/utils/git.test.d.ts +0 -1
- package/dist/utils/git.test.js +0 -193
- package/dist/utils/gitignore.test.d.ts +0 -1
- package/dist/utils/gitignore.test.js +0 -167
- package/dist/utils/project.test.d.ts +0 -1
- package/dist/utils/project.test.js +0 -212
- package/dist/utils/ratelimit.test.d.ts +0 -1
- package/dist/utils/ratelimit.test.js +0 -131
- package/dist/utils/retry.test.d.ts +0 -1
- package/dist/utils/retry.test.js +0 -163
- package/dist/utils/smartContext.test.d.ts +0 -1
- package/dist/utils/smartContext.test.js +0 -382
- package/dist/utils/tools.test.d.ts +0 -1
- package/dist/utils/tools.test.js +0 -681
- package/dist/utils/validation.test.d.ts +0 -1
- package/dist/utils/validation.test.js +0 -164
package/README.md
CHANGED
|
@@ -22,10 +22,13 @@
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
24
|
### Multi-Provider Support
|
|
25
|
-
- **Z.AI (ZhipuAI)** - GLM-4.7, GLM-4.7 Flash
|
|
26
|
-
- **MiniMax**
|
|
25
|
+
- **Z.AI (ZhipuAI)** — GLM-5, GLM-4.7, GLM-4.7 Flash (international & China endpoints)
|
|
26
|
+
- **MiniMax** — MiniMax M2.5 (international & China endpoints)
|
|
27
|
+
- **DeepSeek** — DeepSeek V3, DeepSeek R1 (reasoning)
|
|
28
|
+
- **Anthropic** — Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5
|
|
27
29
|
- Switch between providers with `/provider`
|
|
28
30
|
- Configure different API keys per provider
|
|
31
|
+
- Both OpenAI-compatible and Anthropic API protocols supported
|
|
29
32
|
|
|
30
33
|
### Project Context Awareness
|
|
31
34
|
When started in a project directory, Codeep automatically:
|
|
@@ -140,10 +143,14 @@ Codeep works as a **full AI coding agent** that autonomously:
|
|
|
140
143
|
- **Per-project context** - Each project maintains its own history
|
|
141
144
|
- **Automatic summarization** - Old messages are summarized to save space
|
|
142
145
|
|
|
143
|
-
### Web
|
|
146
|
+
### Web & MCP Tools
|
|
144
147
|
- Agent can fetch documentation and web content
|
|
145
|
-
- Useful for looking up API docs, examples, etc.
|
|
146
148
|
- Automatic HTML-to-text conversion
|
|
149
|
+
- **MCP-powered tools** (for Z.AI and Z.AI China providers):
|
|
150
|
+
- `web_search` — Search the web for current information
|
|
151
|
+
- `web_reader` — Fetch and read any web page
|
|
152
|
+
- `understand_image` — Analyze images via MiniMax vision
|
|
153
|
+
- MCP tools run as secure sub-processes with structured I/O
|
|
147
154
|
|
|
148
155
|
### Smart Context
|
|
149
156
|
Agent automatically gathers relevant files before making changes:
|
|
@@ -579,6 +586,9 @@ After installation, `codeep` is available globally in your terminal. Simply run
|
|
|
579
586
|
| `Ctrl+U` | Clear input line |
|
|
580
587
|
| `Ctrl+W` | Delete word backward |
|
|
581
588
|
| `Ctrl+K` | Delete to end of line |
|
|
589
|
+
| `Alt+F` / `Opt+F` | Move cursor forward one word |
|
|
590
|
+
| `Alt+B` / `Opt+B` | Move cursor backward one word |
|
|
591
|
+
| `Alt+D` / `Opt+D` | Delete word forward |
|
|
582
592
|
| `PageUp` / `PageDown` | Scroll chat history (10 lines) |
|
|
583
593
|
| `Mouse Scroll` | Scroll chat history |
|
|
584
594
|
| `Escape` | Cancel current request / Stop agent |
|
|
@@ -648,9 +658,12 @@ With write access enabled:
|
|
|
648
658
|
|
|
649
659
|
| Variable | Description |
|
|
650
660
|
|----------|-------------|
|
|
651
|
-
| `ZAI_API_KEY` | Z.
|
|
652
|
-
| `
|
|
653
|
-
| `MINIMAX_API_KEY` | MiniMax API key |
|
|
661
|
+
| `ZAI_API_KEY` | Z.AI (international) API key |
|
|
662
|
+
| `ZAI_CN_API_KEY` | Z.AI China API key |
|
|
663
|
+
| `MINIMAX_API_KEY` | MiniMax (international) API key |
|
|
664
|
+
| `MINIMAX_CN_API_KEY` | MiniMax China API key |
|
|
665
|
+
| `DEEPSEEK_API_KEY` | DeepSeek API key |
|
|
666
|
+
| `ANTHROPIC_API_KEY` | Anthropic Claude API key |
|
|
654
667
|
|
|
655
668
|
### Settings (`/settings`)
|
|
656
669
|
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Message } from '../config/index';
|
|
2
2
|
import { ProjectContext } from '../utils/project';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
readonly status: number;
|
|
5
|
+
constructor(message: string, status: number);
|
|
6
|
+
}
|
|
7
|
+
export declare class TimeoutError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
3
10
|
export declare function setProjectContext(ctx: ProjectContext | null): void;
|
|
4
11
|
export declare function chat(message: string, history?: Message[], onChunk?: (chunk: string) => void, onRetry?: (attempt: number) => void, projectContext?: ProjectContext | null, abortSignal?: AbortSignal): Promise<string>;
|
|
5
12
|
export declare function validateApiKey(apiKey: string, providerId?: string): Promise<{
|
package/dist/api/index.js
CHANGED
|
@@ -79,6 +79,20 @@ function getErrorMessage(key) {
|
|
|
79
79
|
const messages = ERROR_MESSAGES[lang] || ERROR_MESSAGES['en'];
|
|
80
80
|
return messages[key] || ERROR_MESSAGES['en'][key];
|
|
81
81
|
}
|
|
82
|
+
export class ApiError extends Error {
|
|
83
|
+
status;
|
|
84
|
+
constructor(message, status) {
|
|
85
|
+
super(message);
|
|
86
|
+
this.status = status;
|
|
87
|
+
this.name = 'ApiError';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export class TimeoutError extends Error {
|
|
91
|
+
constructor(message) {
|
|
92
|
+
super(message);
|
|
93
|
+
this.name = 'TimeoutError';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
82
96
|
// Store project context for use in system prompt
|
|
83
97
|
let currentProjectContext = null;
|
|
84
98
|
let cachedIntelligence = null;
|
|
@@ -144,12 +158,10 @@ export async function chat(message, history = [], onChunk, onRetry, projectConte
|
|
|
144
158
|
},
|
|
145
159
|
shouldRetry: (error) => {
|
|
146
160
|
// Don't retry on user abort or timeout
|
|
147
|
-
if (error.name === 'AbortError')
|
|
148
|
-
return false;
|
|
149
|
-
if (error.isTimeout)
|
|
161
|
+
if (error.name === 'AbortError' || error instanceof TimeoutError)
|
|
150
162
|
return false;
|
|
151
163
|
// Don't retry on 4xx client errors (except 429 rate limit)
|
|
152
|
-
if (error.status >= 400 && error.status < 500 && error.status !== 429)
|
|
164
|
+
if (error instanceof ApiError && error.status >= 400 && error.status < 500 && error.status !== 429)
|
|
153
165
|
return false;
|
|
154
166
|
// Retry on network errors, 5xx, and rate limits
|
|
155
167
|
return true;
|
|
@@ -162,7 +174,7 @@ export async function chat(message, history = [], onChunk, onRetry, projectConte
|
|
|
162
174
|
catch (error) {
|
|
163
175
|
const err = error;
|
|
164
176
|
// Timeout errors (from chatOpenAI/chatAnthropic) — show user-friendly message
|
|
165
|
-
if (
|
|
177
|
+
if (error instanceof TimeoutError) {
|
|
166
178
|
logApiResponse(providerId, false, undefined, 'timeout');
|
|
167
179
|
throw error;
|
|
168
180
|
}
|
|
@@ -309,9 +321,7 @@ async function chatOpenAI(message, history, model, apiKey, onChunk, abortSignal)
|
|
|
309
321
|
});
|
|
310
322
|
if (!response.ok) {
|
|
311
323
|
const body = await response.text();
|
|
312
|
-
|
|
313
|
-
err.status = response.status;
|
|
314
|
-
throw err;
|
|
324
|
+
throw new ApiError(`${getErrorMessage('apiError')}: ${parseApiError(response.status, body)}`, response.status);
|
|
315
325
|
}
|
|
316
326
|
if (stream && response.body) {
|
|
317
327
|
return handleOpenAIStream(response.body, onChunk);
|
|
@@ -327,9 +337,7 @@ async function chatOpenAI(message, history, model, apiKey, onChunk, abortSignal)
|
|
|
327
337
|
}
|
|
328
338
|
catch (error) {
|
|
329
339
|
if (timedOut) {
|
|
330
|
-
|
|
331
|
-
err.isTimeout = true;
|
|
332
|
-
throw err;
|
|
340
|
+
throw new TimeoutError(getErrorMessage('timeout'));
|
|
333
341
|
}
|
|
334
342
|
throw error;
|
|
335
343
|
}
|
|
@@ -434,9 +442,7 @@ async function chatAnthropic(message, history, model, apiKey, onChunk, abortSign
|
|
|
434
442
|
});
|
|
435
443
|
if (!response.ok) {
|
|
436
444
|
const body = await response.text();
|
|
437
|
-
|
|
438
|
-
err.status = response.status;
|
|
439
|
-
throw err;
|
|
445
|
+
throw new ApiError(`${getErrorMessage('apiError')}: ${parseApiError(response.status, body)}`, response.status);
|
|
440
446
|
}
|
|
441
447
|
if (stream && response.body) {
|
|
442
448
|
return handleAnthropicStream(response.body, onChunk);
|
|
@@ -452,9 +458,7 @@ async function chatAnthropic(message, history, model, apiKey, onChunk, abortSign
|
|
|
452
458
|
}
|
|
453
459
|
catch (error) {
|
|
454
460
|
if (timedOut) {
|
|
455
|
-
|
|
456
|
-
err.isTimeout = true;
|
|
457
|
-
throw err;
|
|
461
|
+
throw new TimeoutError(getErrorMessage('timeout'));
|
|
458
462
|
}
|
|
459
463
|
throw error;
|
|
460
464
|
}
|
|
@@ -23,6 +23,7 @@ export interface ProviderConfig {
|
|
|
23
23
|
}[];
|
|
24
24
|
defaultModel: string;
|
|
25
25
|
defaultProtocol: 'openai' | 'anthropic';
|
|
26
|
+
maxOutputTokens?: number;
|
|
26
27
|
envKey?: string;
|
|
27
28
|
subscribeUrl?: string;
|
|
28
29
|
mcpEndpoints?: {
|
|
@@ -49,3 +50,8 @@ export declare function getProviderBaseUrl(providerId: string, protocol: 'openai
|
|
|
49
50
|
export declare function getProviderAuthHeader(providerId: string, protocol: 'openai' | 'anthropic'): 'Bearer' | 'x-api-key';
|
|
50
51
|
export declare function getProviderMcpEndpoints(providerId: string): ProviderConfig['mcpEndpoints'] | null;
|
|
51
52
|
export declare function supportsNativeTools(providerId: string, protocol: 'openai' | 'anthropic'): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the effective max output tokens for a provider, capped by the provider's limit.
|
|
55
|
+
* Falls back to the requested value if no provider limit is set.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getEffectiveMaxTokens(providerId: string, requested: number): number;
|
package/dist/config/providers.js
CHANGED
|
@@ -124,6 +124,7 @@ export const PROVIDERS = {
|
|
|
124
124
|
],
|
|
125
125
|
defaultModel: 'deepseek-chat',
|
|
126
126
|
defaultProtocol: 'openai',
|
|
127
|
+
maxOutputTokens: 8192, // DeepSeek API limit
|
|
127
128
|
envKey: 'DEEPSEEK_API_KEY',
|
|
128
129
|
subscribeUrl: 'https://platform.deepseek.com/sign_up',
|
|
129
130
|
},
|
|
@@ -185,3 +186,13 @@ export function supportsNativeTools(providerId, protocol) {
|
|
|
185
186
|
return false;
|
|
186
187
|
return provider.protocols[protocol]?.supportsNativeTools ?? true; // Default to true
|
|
187
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Returns the effective max output tokens for a provider, capped by the provider's limit.
|
|
191
|
+
* Falls back to the requested value if no provider limit is set.
|
|
192
|
+
*/
|
|
193
|
+
export function getEffectiveMaxTokens(providerId, requested) {
|
|
194
|
+
const provider = PROVIDERS[providerId];
|
|
195
|
+
if (!provider?.maxOutputTokens)
|
|
196
|
+
return requested;
|
|
197
|
+
return Math.min(requested, provider.maxOutputTokens);
|
|
198
|
+
}
|
package/dist/renderer/App.d.ts
CHANGED
|
@@ -308,16 +308,12 @@ export declare class App {
|
|
|
308
308
|
* Handle login keys
|
|
309
309
|
*/
|
|
310
310
|
private handleLoginKey;
|
|
311
|
-
/**
|
|
312
|
-
* Paste API key from clipboard
|
|
313
|
-
*/
|
|
314
|
-
private pasteApiKey;
|
|
315
311
|
/**
|
|
316
312
|
* Handle inline menu keys
|
|
317
313
|
*/
|
|
318
314
|
private handleMenuKey;
|
|
319
315
|
/**
|
|
320
|
-
* Handle
|
|
316
|
+
* Handle permission dialog keys
|
|
321
317
|
*/
|
|
322
318
|
private handleInlinePermissionKey;
|
|
323
319
|
private handleInlineSessionPickerKey;
|