codeep 1.2.17 → 1.2.18

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.
Files changed (62) hide show
  1. package/README.md +20 -7
  2. package/dist/api/index.d.ts +7 -0
  3. package/dist/api/index.js +21 -17
  4. package/dist/renderer/App.d.ts +1 -5
  5. package/dist/renderer/App.js +106 -486
  6. package/dist/renderer/agentExecution.d.ts +36 -0
  7. package/dist/renderer/agentExecution.js +394 -0
  8. package/dist/renderer/commands.d.ts +16 -0
  9. package/dist/renderer/commands.js +838 -0
  10. package/dist/renderer/handlers.d.ts +87 -0
  11. package/dist/renderer/handlers.js +260 -0
  12. package/dist/renderer/highlight.d.ts +18 -0
  13. package/dist/renderer/highlight.js +130 -0
  14. package/dist/renderer/main.d.ts +4 -2
  15. package/dist/renderer/main.js +103 -1550
  16. package/dist/utils/agent.d.ts +5 -15
  17. package/dist/utils/agent.js +9 -693
  18. package/dist/utils/agentChat.d.ts +46 -0
  19. package/dist/utils/agentChat.js +343 -0
  20. package/dist/utils/agentStream.d.ts +23 -0
  21. package/dist/utils/agentStream.js +216 -0
  22. package/dist/utils/keychain.js +3 -2
  23. package/dist/utils/learning.js +9 -3
  24. package/dist/utils/mcpIntegration.d.ts +61 -0
  25. package/dist/utils/mcpIntegration.js +154 -0
  26. package/dist/utils/project.js +8 -3
  27. package/dist/utils/skills.js +21 -11
  28. package/dist/utils/smartContext.d.ts +4 -0
  29. package/dist/utils/smartContext.js +51 -14
  30. package/dist/utils/toolExecution.d.ts +27 -0
  31. package/dist/utils/toolExecution.js +525 -0
  32. package/dist/utils/toolParsing.d.ts +18 -0
  33. package/dist/utils/toolParsing.js +302 -0
  34. package/dist/utils/tools.d.ts +11 -24
  35. package/dist/utils/tools.js +22 -1187
  36. package/package.json +3 -1
  37. package/dist/config/config.test.d.ts +0 -1
  38. package/dist/config/config.test.js +0 -157
  39. package/dist/config/providers.test.d.ts +0 -1
  40. package/dist/config/providers.test.js +0 -187
  41. package/dist/hooks/index.d.ts +0 -4
  42. package/dist/hooks/index.js +0 -4
  43. package/dist/hooks/useAgent.d.ts +0 -29
  44. package/dist/hooks/useAgent.js +0 -148
  45. package/dist/utils/agent.test.d.ts +0 -1
  46. package/dist/utils/agent.test.js +0 -315
  47. package/dist/utils/git.test.d.ts +0 -1
  48. package/dist/utils/git.test.js +0 -193
  49. package/dist/utils/gitignore.test.d.ts +0 -1
  50. package/dist/utils/gitignore.test.js +0 -167
  51. package/dist/utils/project.test.d.ts +0 -1
  52. package/dist/utils/project.test.js +0 -212
  53. package/dist/utils/ratelimit.test.d.ts +0 -1
  54. package/dist/utils/ratelimit.test.js +0 -131
  55. package/dist/utils/retry.test.d.ts +0 -1
  56. package/dist/utils/retry.test.js +0 -163
  57. package/dist/utils/smartContext.test.d.ts +0 -1
  58. package/dist/utils/smartContext.test.js +0 -382
  59. package/dist/utils/tools.test.d.ts +0 -1
  60. package/dist/utils/tools.test.js +0 -681
  61. package/dist/utils/validation.test.d.ts +0 -1
  62. 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 models
26
- - **MiniMax** - MiniMax M2.1 model
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 Fetch
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.ai API key |
652
- | `ZHIPUAI_API_KEY` | ZhipuAI API key (alternative) |
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
 
@@ -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 (err.isTimeout) {
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
- const err = new Error(`${getErrorMessage('apiError')}: ${parseApiError(response.status, body)}`);
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
- const err = new Error(getErrorMessage('timeout'));
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
- const err = new Error(`${getErrorMessage('apiError')}: ${parseApiError(response.status, body)}`);
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
- const err = new Error(getErrorMessage('timeout'));
456
- err.isTimeout = true;
457
- throw err;
461
+ throw new TimeoutError(getErrorMessage('timeout'));
458
462
  }
459
463
  throw error;
460
464
  }
@@ -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 confirmation dialog keys
316
+ * Handle permission dialog keys
321
317
  */
322
318
  private handleInlinePermissionKey;
323
319
  private handleInlineSessionPickerKey;