codeep 1.2.11 → 1.2.12

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 (88) hide show
  1. package/dist/api/index.js +7 -7
  2. package/dist/config/index.js +3 -3
  3. package/dist/config/providers.d.ts +6 -0
  4. package/dist/config/providers.js +41 -2
  5. package/dist/config/providers.test.js +31 -2
  6. package/dist/hooks/index.js +1 -1
  7. package/dist/hooks/useAgent.js +3 -3
  8. package/dist/renderer/App.js +8 -8
  9. package/dist/renderer/ChatUI.js +3 -3
  10. package/dist/renderer/Screen.js +1 -1
  11. package/dist/renderer/components/Export.js +1 -1
  12. package/dist/renderer/components/Help.js +1 -1
  13. package/dist/renderer/components/Intro.js +1 -1
  14. package/dist/renderer/components/Login.js +3 -3
  15. package/dist/renderer/components/Logout.js +1 -1
  16. package/dist/renderer/components/Modal.js +2 -2
  17. package/dist/renderer/components/Permission.js +2 -2
  18. package/dist/renderer/components/Search.js +1 -1
  19. package/dist/renderer/components/SelectScreen.js +1 -1
  20. package/dist/renderer/components/Settings.js +3 -3
  21. package/dist/renderer/components/Status.js +1 -1
  22. package/dist/renderer/demo-app.js +1 -1
  23. package/dist/renderer/demo.js +1 -1
  24. package/dist/renderer/index.js +9 -9
  25. package/dist/renderer/main.js +31 -31
  26. package/dist/utils/agent.js +10 -10
  27. package/dist/utils/agent.test.js +1 -1
  28. package/dist/utils/codeReview.js +1 -1
  29. package/dist/utils/context.js +1 -1
  30. package/dist/utils/git.test.js +1 -1
  31. package/dist/utils/gitignore.test.js +1 -1
  32. package/dist/utils/keychain.js +1 -1
  33. package/dist/utils/project.test.js +1 -1
  34. package/dist/utils/ratelimit.js +1 -1
  35. package/dist/utils/ratelimit.test.js +1 -1
  36. package/dist/utils/retry.test.js +1 -1
  37. package/dist/utils/smartContext.js +1 -1
  38. package/dist/utils/smartContext.test.js +1 -1
  39. package/dist/utils/taskPlanner.js +2 -2
  40. package/dist/utils/tools.d.ts +64 -4
  41. package/dist/utils/tools.js +212 -7
  42. package/dist/utils/tools.test.js +1 -1
  43. package/dist/utils/validation.test.js +1 -1
  44. package/dist/utils/verify.js +1 -1
  45. package/package.json +1 -1
  46. package/bin/codeep.js +0 -2
  47. package/dist/app.d.ts +0 -2
  48. package/dist/app.js +0 -1501
  49. package/dist/components/AgentActions.d.ts +0 -18
  50. package/dist/components/AgentActions.js +0 -122
  51. package/dist/components/AgentProgress.d.ts +0 -59
  52. package/dist/components/AgentProgress.js +0 -368
  53. package/dist/components/Export.d.ts +0 -8
  54. package/dist/components/Export.js +0 -27
  55. package/dist/components/Help.d.ts +0 -6
  56. package/dist/components/Help.js +0 -7
  57. package/dist/components/Input.d.ts +0 -9
  58. package/dist/components/Input.js +0 -334
  59. package/dist/components/Loading.d.ts +0 -17
  60. package/dist/components/Loading.js +0 -52
  61. package/dist/components/Login.d.ts +0 -7
  62. package/dist/components/Login.js +0 -77
  63. package/dist/components/Logo.d.ts +0 -8
  64. package/dist/components/Logo.js +0 -89
  65. package/dist/components/LogoutPicker.d.ts +0 -8
  66. package/dist/components/LogoutPicker.js +0 -61
  67. package/dist/components/Message.d.ts +0 -10
  68. package/dist/components/Message.js +0 -242
  69. package/dist/components/MessageList.d.ts +0 -10
  70. package/dist/components/MessageList.js +0 -42
  71. package/dist/components/ProjectPermission.d.ts +0 -7
  72. package/dist/components/ProjectPermission.js +0 -65
  73. package/dist/components/Search.d.ts +0 -10
  74. package/dist/components/Search.js +0 -30
  75. package/dist/components/SessionPicker.d.ts +0 -9
  76. package/dist/components/SessionPicker.js +0 -88
  77. package/dist/components/Sessions.d.ts +0 -12
  78. package/dist/components/Sessions.js +0 -119
  79. package/dist/components/Settings.d.ts +0 -9
  80. package/dist/components/Settings.js +0 -198
  81. package/dist/components/Spinner.d.ts +0 -34
  82. package/dist/components/Spinner.js +0 -38
  83. package/dist/components/Status.d.ts +0 -2
  84. package/dist/components/Status.js +0 -13
  85. package/dist/components/StreamingMessage.d.ts +0 -14
  86. package/dist/components/StreamingMessage.js +0 -19
  87. package/dist/index.d.ts +0 -2
  88. package/dist/index.js +0 -42
package/dist/api/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { config, getApiKey } from '../config/index.js';
2
- import { withRetry, isNetworkError, isTimeoutError } from '../utils/retry.js';
3
- import { getProvider, getProviderBaseUrl, getProviderAuthHeader } from '../config/providers.js';
4
- import { logApiRequest, logApiResponse } from '../utils/logger.js';
5
- import { loadProjectIntelligence, generateContextFromIntelligence } from '../utils/projectIntelligence.js';
6
- import { loadProjectRules } from '../utils/agent.js';
7
- import { recordTokenUsage, extractOpenAIUsage, extractAnthropicUsage } from '../utils/tokenTracker.js';
1
+ import { config, getApiKey } from '../config/index';
2
+ import { withRetry, isNetworkError, isTimeoutError } from '../utils/retry';
3
+ import { getProvider, getProviderBaseUrl, getProviderAuthHeader } from '../config/providers';
4
+ import { logApiRequest, logApiResponse } from '../utils/logger';
5
+ import { loadProjectIntelligence, generateContextFromIntelligence } from '../utils/projectIntelligence';
6
+ import { loadProjectRules } from '../utils/agent';
7
+ import { recordTokenUsage, extractOpenAIUsage, extractAnthropicUsage } from '../utils/tokenTracker';
8
8
  // Error messages by language
9
9
  const ERROR_MESSAGES = {
10
10
  en: {
@@ -1,8 +1,8 @@
1
1
  import Conf from 'conf';
2
2
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, unlinkSync, statSync } from 'fs';
3
3
  import { join, dirname } from 'path';
4
- import { PROVIDERS, getProvider } from './providers.js';
5
- import { logSession } from '../utils/logger.js';
4
+ import { PROVIDERS, getProvider } from './providers';
5
+ import { logSession } from '../utils/logger';
6
6
  // We'll initialize GLOBAL_SESSIONS_DIR after config is created (to use config.path)
7
7
  /**
8
8
  * Get sessions directory - local .codeep/sessions/ if in project, otherwise global
@@ -422,7 +422,7 @@ export function getModelsForCurrentProvider() {
422
422
  return models;
423
423
  }
424
424
  // Re-export PROVIDERS for convenience
425
- export { PROVIDERS } from './providers.js';
425
+ export { PROVIDERS } from './providers';
426
426
  // Generate unique session ID
427
427
  function generateSessionId() {
428
428
  const now = new Date();
@@ -25,6 +25,11 @@ export interface ProviderConfig {
25
25
  defaultProtocol: 'openai' | 'anthropic';
26
26
  envKey?: string;
27
27
  subscribeUrl?: string;
28
+ mcpEndpoints?: {
29
+ webSearch?: string;
30
+ webReader?: string;
31
+ zread?: string;
32
+ };
28
33
  }
29
34
  export declare const PROVIDERS: Record<string, ProviderConfig>;
30
35
  export type ProviderId = keyof typeof PROVIDERS;
@@ -42,4 +47,5 @@ export declare function getProviderModels(providerId: string): {
42
47
  }[];
43
48
  export declare function getProviderBaseUrl(providerId: string, protocol: 'openai' | 'anthropic'): string | null;
44
49
  export declare function getProviderAuthHeader(providerId: string, protocol: 'openai' | 'anthropic'): 'Bearer' | 'x-api-key';
50
+ export declare function getProviderMcpEndpoints(providerId: string): ProviderConfig['mcpEndpoints'] | null;
45
51
  export declare function supportsNativeTools(providerId: string, protocol: 'openai' | 'anthropic'): boolean;
@@ -26,6 +26,41 @@ export const PROVIDERS = {
26
26
  defaultProtocol: 'openai',
27
27
  envKey: 'ZAI_API_KEY',
28
28
  subscribeUrl: 'https://z.ai/subscribe?ic=NXYNXZOV14',
29
+ mcpEndpoints: {
30
+ webSearch: 'https://api.z.ai/api/mcp/web_search_prime/mcp',
31
+ webReader: 'https://api.z.ai/api/mcp/web_reader/mcp',
32
+ zread: 'https://api.z.ai/api/mcp/zread/mcp',
33
+ },
34
+ },
35
+ 'z.ai-cn': {
36
+ name: 'Z.AI China (ZhipuAI)',
37
+ description: 'GLM Coding Plan (China)',
38
+ protocols: {
39
+ openai: {
40
+ baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4',
41
+ authHeader: 'Bearer',
42
+ supportsNativeTools: true,
43
+ },
44
+ anthropic: {
45
+ baseUrl: 'https://open.bigmodel.cn/api/anthropic',
46
+ authHeader: 'x-api-key',
47
+ supportsNativeTools: true,
48
+ },
49
+ },
50
+ models: [
51
+ { id: 'glm-5', name: 'GLM-5', description: 'Most capable GLM model (Pro/Max subscription)' },
52
+ { id: 'glm-4.7', name: 'GLM-4.7', description: 'Latest GLM model' },
53
+ { id: 'glm-4.7-flash', name: 'GLM-4.7 Flash', description: 'Faster, lighter version' },
54
+ ],
55
+ defaultModel: 'glm-4.7',
56
+ defaultProtocol: 'openai',
57
+ envKey: 'ZAI_CN_API_KEY',
58
+ subscribeUrl: 'https://open.bigmodel.cn/glm-coding',
59
+ mcpEndpoints: {
60
+ webSearch: 'https://open.bigmodel.cn/api/mcp/web_search_prime/mcp',
61
+ webReader: 'https://open.bigmodel.cn/api/mcp/web_reader/mcp',
62
+ zread: 'https://open.bigmodel.cn/api/mcp/zread/mcp',
63
+ },
29
64
  },
30
65
  'minimax': {
31
66
  name: 'MiniMax',
@@ -43,9 +78,9 @@ export const PROVIDERS = {
43
78
  },
44
79
  },
45
80
  models: [
46
- { id: 'MiniMax-M2.1', name: 'MiniMax M2.1', description: 'Latest MiniMax coding model' },
81
+ { id: 'MiniMax-M2.5', name: 'MiniMax M2.5', description: 'Latest MiniMax coding model' },
47
82
  ],
48
- defaultModel: 'MiniMax-M2.1',
83
+ defaultModel: 'MiniMax-M2.5',
49
84
  defaultProtocol: 'anthropic',
50
85
  envKey: 'MINIMAX_API_KEY',
51
86
  subscribeUrl: 'https://platform.minimax.io/subscribe/coding-plan?code=2lWvoWUhrp&source=link',
@@ -116,6 +151,10 @@ export function getProviderAuthHeader(providerId, protocol) {
116
151
  return 'Bearer';
117
152
  return provider.protocols[protocol]?.authHeader || 'Bearer';
118
153
  }
154
+ export function getProviderMcpEndpoints(providerId) {
155
+ const provider = PROVIDERS[providerId];
156
+ return provider?.mcpEndpoints || null;
157
+ }
119
158
  export function supportsNativeTools(providerId, protocol) {
120
159
  const provider = PROVIDERS[providerId];
121
160
  if (!provider)
@@ -1,11 +1,15 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { PROVIDERS, getProvider, getProviderList, getProviderModels, getProviderBaseUrl, getProviderAuthHeader, } from './providers.js';
2
+ import { PROVIDERS, getProvider, getProviderList, getProviderModels, getProviderBaseUrl, getProviderAuthHeader, getProviderMcpEndpoints, } from './providers';
3
3
  describe('providers', () => {
4
4
  describe('PROVIDERS constant', () => {
5
5
  it('should have z.ai provider', () => {
6
6
  expect(PROVIDERS['z.ai']).toBeDefined();
7
7
  expect(PROVIDERS['z.ai'].name).toBe('Z.AI (ZhipuAI)');
8
8
  });
9
+ it('should have z.ai-cn provider', () => {
10
+ expect(PROVIDERS['z.ai-cn']).toBeDefined();
11
+ expect(PROVIDERS['z.ai-cn'].name).toBe('Z.AI China (ZhipuAI)');
12
+ });
9
13
  it('should have minimax provider', () => {
10
14
  expect(PROVIDERS['minimax']).toBeDefined();
11
15
  expect(PROVIDERS['minimax'].name).toBe('MiniMax');
@@ -68,10 +72,11 @@ describe('providers', () => {
68
72
  expect(item.description).toBeDefined();
69
73
  }
70
74
  });
71
- it('should include z.ai and minimax', () => {
75
+ it('should include z.ai, z.ai-cn, and minimax', () => {
72
76
  const list = getProviderList();
73
77
  const ids = list.map(p => p.id);
74
78
  expect(ids).toContain('z.ai');
79
+ expect(ids).toContain('z.ai-cn');
75
80
  expect(ids).toContain('minimax');
76
81
  });
77
82
  });
@@ -125,8 +130,32 @@ describe('providers', () => {
125
130
  it('should have env key for z.ai', () => {
126
131
  expect(PROVIDERS['z.ai'].envKey).toBe('ZAI_API_KEY');
127
132
  });
133
+ it('should have env key for z.ai-cn', () => {
134
+ expect(PROVIDERS['z.ai-cn'].envKey).toBe('ZAI_CN_API_KEY');
135
+ });
128
136
  it('should have env key for minimax', () => {
129
137
  expect(PROVIDERS['minimax'].envKey).toBe('MINIMAX_API_KEY');
130
138
  });
131
139
  });
140
+ describe('MCP endpoints', () => {
141
+ it('should have MCP endpoints for z.ai', () => {
142
+ const endpoints = getProviderMcpEndpoints('z.ai');
143
+ expect(endpoints).not.toBeNull();
144
+ expect(endpoints.webSearch).toContain('api.z.ai');
145
+ expect(endpoints.webReader).toContain('api.z.ai');
146
+ expect(endpoints.zread).toContain('api.z.ai');
147
+ });
148
+ it('should have MCP endpoints for z.ai-cn', () => {
149
+ const endpoints = getProviderMcpEndpoints('z.ai-cn');
150
+ expect(endpoints).not.toBeNull();
151
+ expect(endpoints.webSearch).toContain('open.bigmodel.cn');
152
+ expect(endpoints.webReader).toContain('open.bigmodel.cn');
153
+ expect(endpoints.zread).toContain('open.bigmodel.cn');
154
+ });
155
+ it('should return null for providers without MCP endpoints', () => {
156
+ expect(getProviderMcpEndpoints('minimax')).toBeNull();
157
+ expect(getProviderMcpEndpoints('deepseek')).toBeNull();
158
+ expect(getProviderMcpEndpoints('nonexistent')).toBeNull();
159
+ });
160
+ });
132
161
  });
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Custom hooks for Codeep
3
3
  */
4
- export { useAgent } from './useAgent.js';
4
+ export { useAgent } from './useAgent';
@@ -3,9 +3,9 @@
3
3
  * Reduces re-renders in App component when agent state changes
4
4
  */
5
5
  import { useState, useCallback, useRef } from 'react';
6
- import { runAgent, formatAgentResult } from '../utils/agent.js';
7
- import { createActionLog } from '../utils/tools.js';
8
- import { autoSaveSession } from '../config/index.js';
6
+ import { runAgent, formatAgentResult } from '../utils/agent';
7
+ import { createActionLog } from '../utils/tools';
8
+ import { autoSaveSession } from '../config/index';
9
9
  export function useAgent({ projectContext, hasWriteAccess, messages, projectPath, onMessageAdd, notify, }) {
10
10
  const [isAgentRunning, setIsAgentRunning] = useState(false);
11
11
  const [agentIteration, setAgentIteration] = useState(0);
@@ -2,9 +2,9 @@
2
2
  * Main Application using custom renderer
3
3
  * Replaces Ink-based App
4
4
  */
5
- import { Screen } from './Screen.js';
6
- import { Input, LineEditor } from './Input.js';
7
- import { fg, style, stringWidth } from './ansi.js';
5
+ import { Screen } from './Screen';
6
+ import { Input, LineEditor } from './Input';
7
+ import { fg, style, stringWidth } from './ansi';
8
8
  import clipboardy from 'clipboardy';
9
9
  import { spawn } from 'child_process';
10
10
  // Primary color: #f02a30 (Codeep red)
@@ -222,11 +222,11 @@ const COMMAND_DESCRIPTIONS = {
222
222
  'context-clear': 'Clear saved context',
223
223
  'learn': 'Learn code preferences',
224
224
  };
225
- import { helpCategories, keyboardShortcuts } from './components/Help.js';
226
- import { handleSettingsKey, SETTINGS } from './components/Settings.js';
227
- import { renderExportPanel, handleExportKey as handleExportKeyComponent } from './components/Export.js';
228
- import { renderLogoutPanel, handleLogoutKey as handleLogoutKeyComponent } from './components/Logout.js';
229
- import { renderSearchPanel, handleSearchKey as handleSearchKeyComponent } from './components/Search.js';
225
+ import { helpCategories, keyboardShortcuts } from './components/Help';
226
+ import { handleSettingsKey, SETTINGS } from './components/Settings';
227
+ import { renderExportPanel, handleExportKey as handleExportKeyComponent } from './components/Export';
228
+ import { renderLogoutPanel, handleLogoutKey as handleLogoutKeyComponent } from './components/Logout';
229
+ import { renderSearchPanel, handleSearchKey as handleSearchKeyComponent } from './components/Search';
230
230
  export class App {
231
231
  screen;
232
232
  input;
@@ -2,9 +2,9 @@
2
2
  * Simple Chat UI - Proof of Concept
3
3
  * Demonstrates custom renderer without Ink
4
4
  */
5
- import { Screen } from './Screen.js';
6
- import { Input, LineEditor } from './Input.js';
7
- import { fg } from './ansi.js';
5
+ import { Screen } from './Screen';
6
+ import { Input, LineEditor } from './Input';
7
+ import { fg } from './ansi';
8
8
  export class ChatUI {
9
9
  screen;
10
10
  input;
@@ -2,7 +2,7 @@
2
2
  * Screen buffer with diff-based rendering
3
3
  * Only writes changes to terminal - minimizes flickering
4
4
  */
5
- import { cursor, screen, style, visibleLength, charWidth } from './ansi.js';
5
+ import { cursor, screen, style, visibleLength, charWidth } from './ansi';
6
6
  export class Screen {
7
7
  width;
8
8
  height;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Export panel component
3
3
  */
4
- import { fg, style } from '../ansi.js';
4
+ import { fg, style } from '../ansi';
5
5
  // Primary color: #f02a30 (Codeep red)
6
6
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
7
7
  const FORMATS = [
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Help screen component
3
3
  */
4
- import { fg, style } from '../ansi.js';
4
+ import { fg, style } from '../ansi';
5
5
  // Primary color: #f02a30 (Codeep red)
6
6
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Intro animation component - matches Ink version style
3
3
  */
4
- import { fg, style } from '../ansi.js';
4
+ import { fg, style } from '../ansi';
5
5
  // ASCII Logo (same as Ink version)
6
6
  const LOGO = [
7
7
  ' ██████╗ ██████╗ ██████╗ ███████╗███████╗██████╗ ',
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Login screen for API key setup
3
3
  */
4
- import { LineEditor } from '../Input.js';
5
- import { fg, style } from '../ansi.js';
6
- import { createBox, centerBox } from './Box.js';
4
+ import { LineEditor } from '../Input';
5
+ import { fg, style } from '../ansi';
6
+ import { createBox, centerBox } from './Box';
7
7
  import { spawn } from 'child_process';
8
8
  import clipboardy from 'clipboardy';
9
9
  // Primary color: #f02a30 (Codeep red)
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Logout panel component
3
3
  */
4
- import { fg, style } from '../ansi.js';
4
+ import { fg, style } from '../ansi';
5
5
  // Primary color: #f02a30 (Codeep red)
6
6
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
7
7
  /**
@@ -2,8 +2,8 @@
2
2
  * Modal overlay component
3
3
  * Renders a box with content on top of existing screen
4
4
  */
5
- import { fg, style } from '../ansi.js';
6
- import { createBox, centerBox } from './Box.js';
5
+ import { fg, style } from '../ansi';
6
+ import { createBox, centerBox } from './Box';
7
7
  // Primary color: #f02a30 (Codeep red)
8
8
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
9
9
  const PRIMARY_BRIGHT = fg.rgb(255, 80, 85);
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Permission screen for granting folder access
3
3
  */
4
- import { fg, style } from '../ansi.js';
5
- import { createBox, centerBox } from './Box.js';
4
+ import { fg, style } from '../ansi';
5
+ import { createBox, centerBox } from './Box';
6
6
  // Primary color: #f02a30 (Codeep red)
7
7
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
8
8
  const PRIMARY_BRIGHT = fg.rgb(255, 80, 85);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Search panel component
3
3
  */
4
- import { fg, style } from '../ansi.js';
4
+ import { fg, style } from '../ansi';
5
5
  // Primary color: #f02a30 (Codeep red)
6
6
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
7
7
  /**
@@ -2,7 +2,7 @@
2
2
  * Generic fullscreen selection component
3
3
  * Used for Language, Provider, Model, Protocol selection
4
4
  */
5
- import { fg, style } from '../ansi.js';
5
+ import { fg, style } from '../ansi';
6
6
  // Primary color: #f02a30 (Codeep red)
7
7
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
8
8
  const PRIMARY_BRIGHT = fg.rgb(255, 80, 85);
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Settings screen component
3
3
  */
4
- import { fg, style } from '../ansi.js';
5
- import { config } from '../../config/index.js';
6
- import { updateRateLimits } from '../../utils/ratelimit.js';
4
+ import { fg, style } from '../ansi';
5
+ import { config } from '../../config/index';
6
+ import { updateRateLimits } from '../../utils/ratelimit';
7
7
  // Primary color: #f02a30 (Codeep red)
8
8
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
9
9
  const PRIMARY_BRIGHT = fg.rgb(255, 80, 85);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Status screen component
3
3
  */
4
- import { fg, style } from '../ansi.js';
4
+ import { fg, style } from '../ansi';
5
5
  // Primary color: #f02a30 (Codeep red)
6
6
  const PRIMARY_COLOR = fg.rgb(240, 42, 48);
7
7
  /**
@@ -3,7 +3,7 @@
3
3
  * Demo for full App with modals
4
4
  * Run with: npm run demo:app
5
5
  */
6
- import { App } from './App.js';
6
+ import { App } from './App';
7
7
  // Simulate API response
8
8
  function simulateResponse(app, text) {
9
9
  return new Promise((resolve) => {
@@ -3,7 +3,7 @@
3
3
  * Demo/Test for custom renderer
4
4
  * Run with: npx ts-node src/renderer/demo.ts
5
5
  */
6
- import { ChatUI } from './ChatUI.js';
6
+ import { ChatUI } from './ChatUI';
7
7
  // Simulate streaming response
8
8
  function simulateStreaming(ui, text) {
9
9
  return new Promise((resolve) => {
@@ -5,13 +5,13 @@
5
5
  * Uses direct ANSI escape codes and a virtual screen buffer
6
6
  * with diff-based rendering for flicker-free updates.
7
7
  */
8
- export { cursor, screen, fg, bg, style, styled, stripAnsi, visibleLength, truncate, wordWrap } from './ansi.js';
9
- export { Screen } from './Screen.js';
10
- export { Input, LineEditor } from './Input.js';
11
- export { ChatUI } from './ChatUI.js';
12
- export { App } from './App.js';
8
+ export { cursor, screen, fg, bg, style, styled, stripAnsi, visibleLength, truncate, wordWrap } from './ansi';
9
+ export { Screen } from './Screen';
10
+ export { Input, LineEditor } from './Input';
11
+ export { ChatUI } from './ChatUI';
12
+ export { App } from './App';
13
13
  // Components
14
- export { createBox, centerBox } from './components/Box.js';
15
- export { renderModal, renderHelpModal, renderListModal } from './components/Modal.js';
16
- export { renderHelpScreen, helpCategories, keyboardShortcuts } from './components/Help.js';
17
- export { renderStatusScreen } from './components/Status.js';
14
+ export { createBox, centerBox } from './components/Box';
15
+ export { renderModal, renderHelpModal, renderListModal } from './components/Modal';
16
+ export { renderHelpScreen, helpCategories, keyboardShortcuts } from './components/Help';
17
+ export { renderStatusScreen } from './components/Status';
@@ -3,19 +3,19 @@
3
3
  * Codeep with Custom Renderer
4
4
  * Main entry point using the new ANSI-based renderer instead of Ink
5
5
  */
6
- import { App } from './App.js';
7
- import { Screen } from './Screen.js';
8
- import { Input } from './Input.js';
9
- import { LoginScreen, renderProviderSelect } from './components/Login.js';
10
- import { renderPermissionScreen, getPermissionOptions } from './components/Permission.js';
6
+ import { App } from './App';
7
+ import { Screen } from './Screen';
8
+ import { Input } from './Input';
9
+ import { LoginScreen, renderProviderSelect } from './components/Login';
10
+ import { renderPermissionScreen, getPermissionOptions } from './components/Permission';
11
11
  // Intro animation is now handled by App.startIntro()
12
- import { chat, setProjectContext } from '../api/index.js';
13
- import { runAgent } from '../utils/agent.js';
14
- import { config, loadApiKey, loadAllApiKeys, getCurrentProvider, getModelsForCurrentProvider, PROTOCOLS, LANGUAGES, setProvider, setApiKey, clearApiKey, getApiKey, autoSaveSession, saveSession, startNewSession, getCurrentSessionId, loadSession, listSessionsWithInfo, deleteSession, renameSession, hasReadPermission, hasWritePermission, setProjectPermission, initializeAsProject, isManuallyInitializedProject, } from '../config/index.js';
15
- import { isProjectDirectory, getProjectContext } from '../utils/project.js';
16
- import { getCurrentVersion } from '../utils/update.js';
17
- import { getProviderList, getProvider } from '../config/providers.js';
18
- import { getSessionStats } from '../utils/tokenTracker.js';
12
+ import { chat, setProjectContext } from '../api/index';
13
+ import { runAgent } from '../utils/agent';
14
+ import { config, loadApiKey, loadAllApiKeys, getCurrentProvider, getModelsForCurrentProvider, PROTOCOLS, LANGUAGES, setProvider, setApiKey, clearApiKey, getApiKey, autoSaveSession, saveSession, startNewSession, getCurrentSessionId, loadSession, listSessionsWithInfo, deleteSession, renameSession, hasReadPermission, hasWritePermission, setProjectPermission, initializeAsProject, isManuallyInitializedProject, } from '../config/index';
15
+ import { isProjectDirectory, getProjectContext } from '../utils/project';
16
+ import { getCurrentVersion } from '../utils/update';
17
+ import { getProviderList, getProvider } from '../config/providers';
18
+ import { getSessionStats } from '../utils/tokenTracker';
19
19
  // State
20
20
  let projectPath = process.cwd();
21
21
  let projectContext = null;
@@ -67,7 +67,7 @@ function formatAddedFilesContext() {
67
67
  async function handleSubmit(message) {
68
68
  // Check if we're waiting for interactive mode answers
69
69
  if (pendingInteractiveContext) {
70
- const { parseAnswers, enhancePromptWithAnswers } = await import('../utils/interactive.js');
70
+ const { parseAnswers, enhancePromptWithAnswers } = await import('../utils/interactive');
71
71
  const answers = parseAnswers(message, pendingInteractiveContext.context);
72
72
  // Enhance the original prompt with user's answers
73
73
  const enhancedTask = enhancePromptWithAnswers(pendingInteractiveContext.context, answers);
@@ -213,7 +213,7 @@ async function runAgentTask(task, dryRun = false) {
213
213
  const interactiveMode = config.get('agentInteractive') !== false;
214
214
  if (interactiveMode) {
215
215
  // Analyze task for ambiguity
216
- const { analyzeForClarification, formatQuestions } = await import('../utils/interactive.js');
216
+ const { analyzeForClarification, formatQuestions } = await import('../utils/interactive');
217
217
  const interactiveContext = analyzeForClarification(task);
218
218
  if (interactiveContext.needsClarification) {
219
219
  // Store context for follow-up
@@ -429,7 +429,7 @@ async function executeAgentTask(task, dryRun = false) {
429
429
  // Auto-commit if enabled and there were file changes
430
430
  if (!dryRun && config.get('agentAutoCommit') && result.actions.length > 0) {
431
431
  try {
432
- const { autoCommitAgentChanges, createBranchAndCommit } = await import('../utils/git.js');
432
+ const { autoCommitAgentChanges, createBranchAndCommit } = await import('../utils/git');
433
433
  const useBranch = config.get('agentAutoCommitBranch');
434
434
  if (useBranch) {
435
435
  const commitResult = createBranchAndCommit(task, result.actions, context.root);
@@ -482,13 +482,13 @@ async function executeAgentTask(task, dryRun = false) {
482
482
  * Wires the skill execution engine to App's UI.
483
483
  */
484
484
  async function runSkill(nameOrShortcut, args) {
485
- const { findSkill, parseSkillArgs, executeSkill, trackSkillUsage } = await import('../utils/skills.js');
485
+ const { findSkill, parseSkillArgs, executeSkill, trackSkillUsage } = await import('../utils/skills');
486
486
  const skill = findSkill(nameOrShortcut);
487
487
  if (!skill)
488
488
  return false;
489
489
  // Pre-flight checks
490
490
  if (skill.requiresGit) {
491
- const { getGitStatus } = await import('../utils/git.js');
491
+ const { getGitStatus } = await import('../utils/git');
492
492
  if (!projectPath || !getGitStatus(projectPath).isRepo) {
493
493
  app.notify('This skill requires a git repository');
494
494
  return true;
@@ -732,7 +732,7 @@ function handleCommand(command, args) {
732
732
  const staged = args.includes('--staged') || args.includes('-s');
733
733
  app.notify(staged ? 'Getting staged diff...' : 'Getting diff...');
734
734
  // Import dynamically to avoid circular deps
735
- import('../utils/git.js').then(({ getGitDiff, formatDiffForDisplay }) => {
735
+ import('../utils/git').then(({ getGitDiff, formatDiffForDisplay }) => {
736
736
  const result = getGitDiff(staged, projectPath);
737
737
  if (!result.success || !result.diff) {
738
738
  app.notify(result.error || 'No changes');
@@ -746,14 +746,14 @@ function handleCommand(command, args) {
746
746
  break;
747
747
  }
748
748
  case 'undo': {
749
- import('../utils/agent.js').then(({ undoLastAction }) => {
749
+ import('../utils/agent').then(({ undoLastAction }) => {
750
750
  const result = undoLastAction();
751
751
  app.notify(result.success ? `Undo: ${result.message}` : `Cannot undo: ${result.message}`);
752
752
  });
753
753
  break;
754
754
  }
755
755
  case 'undo-all': {
756
- import('../utils/agent.js').then(({ undoAllActions }) => {
756
+ import('../utils/agent').then(({ undoAllActions }) => {
757
757
  const result = undoAllActions();
758
758
  app.notify(result.success ? `Undone ${result.results.length} action(s)` : 'Nothing to undo');
759
759
  });
@@ -765,7 +765,7 @@ function handleCommand(command, args) {
765
765
  return;
766
766
  }
767
767
  app.notify('Scanning project...');
768
- import('../utils/projectIntelligence.js').then(({ scanProject, saveProjectIntelligence, generateContextFromIntelligence }) => {
768
+ import('../utils/projectIntelligence').then(({ scanProject, saveProjectIntelligence, generateContextFromIntelligence }) => {
769
769
  scanProject(projectContext.root).then(intelligence => {
770
770
  saveProjectIntelligence(projectContext.root, intelligence);
771
771
  const context = generateContextFromIntelligence(intelligence);
@@ -785,7 +785,7 @@ function handleCommand(command, args) {
785
785
  app.notify('No project context');
786
786
  return;
787
787
  }
788
- import('../utils/codeReview.js').then(({ performCodeReview, formatReviewResult }) => {
788
+ import('../utils/codeReview').then(({ performCodeReview, formatReviewResult }) => {
789
789
  const reviewFiles = args.length > 0 ? args : undefined;
790
790
  const result = performCodeReview(projectContext, reviewFiles);
791
791
  app.addMessage({
@@ -797,7 +797,7 @@ function handleCommand(command, args) {
797
797
  }
798
798
  case 'update': {
799
799
  app.notify('Checking for updates...');
800
- import('../utils/update.js').then(({ checkForUpdates, formatVersionInfo }) => {
800
+ import('../utils/update').then(({ checkForUpdates, formatVersionInfo }) => {
801
801
  checkForUpdates().then(info => {
802
802
  const message = formatVersionInfo(info);
803
803
  app.notify(message.split('\n')[0], 5000);
@@ -1017,7 +1017,7 @@ function handleCommand(command, args) {
1017
1017
  app.notify(`Invalid block number. Available: 1-${codeBlocks.length}`);
1018
1018
  return;
1019
1019
  }
1020
- import('../utils/clipboard.js').then(({ copyToClipboard }) => {
1020
+ import('../utils/clipboard').then(({ copyToClipboard }) => {
1021
1021
  if (copyToClipboard(codeBlocks[index])) {
1022
1022
  app.notify(`Copied block ${index + 1} to clipboard`);
1023
1023
  }
@@ -1219,7 +1219,7 @@ function handleCommand(command, args) {
1219
1219
  }
1220
1220
  // Agent history and changes
1221
1221
  case 'history': {
1222
- import('../utils/agent.js').then(({ getAgentHistory }) => {
1222
+ import('../utils/agent').then(({ getAgentHistory }) => {
1223
1223
  const history = getAgentHistory();
1224
1224
  if (history.length === 0) {
1225
1225
  app.notify('No agent history');
@@ -1239,7 +1239,7 @@ function handleCommand(command, args) {
1239
1239
  break;
1240
1240
  }
1241
1241
  case 'changes': {
1242
- import('../utils/agent.js').then(({ getCurrentSessionActions }) => {
1242
+ import('../utils/agent').then(({ getCurrentSessionActions }) => {
1243
1243
  const actions = getCurrentSessionActions();
1244
1244
  if (actions.length === 0) {
1245
1245
  app.notify('No changes in current session');
@@ -1286,7 +1286,7 @@ function handleCommand(command, args) {
1286
1286
  // Learning mode
1287
1287
  case 'learn': {
1288
1288
  if (args[0] === 'status') {
1289
- import('../utils/learning.js').then(({ getLearningStatus }) => {
1289
+ import('../utils/learning').then(({ getLearningStatus }) => {
1290
1290
  const status = getLearningStatus(projectPath);
1291
1291
  app.addMessage({
1292
1292
  role: 'system',
@@ -1298,7 +1298,7 @@ function handleCommand(command, args) {
1298
1298
  return;
1299
1299
  }
1300
1300
  if (args[0] === 'rule' && args.length > 1) {
1301
- import('../utils/learning.js').then(({ addCustomRule }) => {
1301
+ import('../utils/learning').then(({ addCustomRule }) => {
1302
1302
  addCustomRule(projectPath, args.slice(1).join(' '));
1303
1303
  app.notify('Custom rule added');
1304
1304
  }).catch(() => {
@@ -1311,7 +1311,7 @@ function handleCommand(command, args) {
1311
1311
  return;
1312
1312
  }
1313
1313
  app.notify('Learning from project...');
1314
- import('../utils/learning.js').then(({ learnFromProject, formatPreferencesForPrompt }) => {
1314
+ import('../utils/learning').then(({ learnFromProject, formatPreferencesForPrompt }) => {
1315
1315
  // Get some source files to learn from
1316
1316
  import('fs').then(fs => {
1317
1317
  import('path').then(path => {
@@ -1394,7 +1394,7 @@ function handleCommand(command, args) {
1394
1394
  break;
1395
1395
  }
1396
1396
  case 'skills': {
1397
- import('../utils/skills.js').then(({ getAllSkills, searchSkills, formatSkillsList, getSkillStats }) => {
1397
+ import('../utils/skills').then(({ getAllSkills, searchSkills, formatSkillsList, getSkillStats }) => {
1398
1398
  const query = args.join(' ').toLowerCase();
1399
1399
  // Check for stats subcommand
1400
1400
  if (query === 'stats') {
@@ -1418,7 +1418,7 @@ function handleCommand(command, args) {
1418
1418
  break;
1419
1419
  }
1420
1420
  case 'skill': {
1421
- import('../utils/skills.js').then(({ findSkill, formatSkillHelp, createSkillTemplate, saveCustomSkill, deleteCustomSkill }) => {
1421
+ import('../utils/skills').then(({ findSkill, formatSkillHelp, createSkillTemplate, saveCustomSkill, deleteCustomSkill }) => {
1422
1422
  const subCommand = args[0]?.toLowerCase();
1423
1423
  const skillName = args[1];
1424
1424
  if (!subCommand) {