aiexecode 1.0.66 → 1.0.69

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.

Potentially problematic release.


This version of aiexecode might be problematic. Click here for more details.

Files changed (87) hide show
  1. package/config_template/settings.json +1 -3
  2. package/index.js +46 -71
  3. package/package.json +1 -12
  4. package/payload_viewer/out/404/index.html +1 -1
  5. package/payload_viewer/out/404.html +1 -1
  6. package/payload_viewer/out/index.html +1 -1
  7. package/payload_viewer/out/index.txt +1 -1
  8. package/payload_viewer/web_server.js +0 -163
  9. package/prompts/completion_judge.txt +11 -7
  10. package/src/ai_based/completion_judge.js +97 -6
  11. package/src/ai_based/orchestrator.js +71 -3
  12. package/src/ai_based/pip_package_installer.js +14 -12
  13. package/src/ai_based/pip_package_lookup.js +13 -10
  14. package/src/commands/apikey.js +8 -34
  15. package/src/commands/help.js +3 -4
  16. package/src/commands/model.js +17 -74
  17. package/src/commands/reasoning_effort.js +1 -1
  18. package/src/config/feature_flags.js +0 -12
  19. package/src/{ui → frontend}/App.js +23 -25
  20. package/src/frontend/README.md +81 -0
  21. package/src/{ui/components/SuggestionsDisplay.js → frontend/components/AutocompleteMenu.js} +3 -3
  22. package/src/{ui/components/HistoryItemDisplay.js → frontend/components/ConversationItem.js} +37 -89
  23. package/src/{ui → frontend}/components/CurrentModelView.js +3 -5
  24. package/src/{ui → frontend}/components/Footer.js +4 -6
  25. package/src/{ui → frontend}/components/Header.js +2 -5
  26. package/src/{ui/components/InputPrompt.js → frontend/components/Input.js} +16 -54
  27. package/src/frontend/components/ModelListView.js +106 -0
  28. package/src/{ui → frontend}/components/ModelUpdatedView.js +3 -5
  29. package/src/{ui → frontend}/components/SessionSpinner.js +3 -3
  30. package/src/{ui → frontend}/components/SetupWizard.js +8 -101
  31. package/src/{ui → frontend}/components/ToolApprovalPrompt.js +16 -14
  32. package/src/frontend/design/themeColors.js +42 -0
  33. package/src/{ui → frontend}/index.js +7 -7
  34. package/src/frontend/utils/inputBuffer.js +441 -0
  35. package/src/{ui/utils/markdownRenderer.js → frontend/utils/markdownParser.js} +3 -3
  36. package/src/{ui/utils/ConsolePatcher.js → frontend/utils/outputRedirector.js} +9 -9
  37. package/src/{ui/utils/codeColorizer.js → frontend/utils/syntaxHighlighter.js} +2 -3
  38. package/src/system/ai_request.js +145 -595
  39. package/src/system/code_executer.js +111 -16
  40. package/src/system/file_integrity.js +5 -7
  41. package/src/system/log.js +3 -3
  42. package/src/system/mcp_integration.js +15 -13
  43. package/src/system/output_helper.js +0 -20
  44. package/src/system/session.js +97 -23
  45. package/src/system/session_memory.js +2 -82
  46. package/src/system/system_info.js +1 -1
  47. package/src/system/ui_events.js +0 -43
  48. package/src/tools/code_editor.js +17 -2
  49. package/src/tools/file_reader.js +17 -2
  50. package/src/tools/glob.js +9 -1
  51. package/src/tools/response_message.js +0 -2
  52. package/src/tools/ripgrep.js +9 -1
  53. package/src/tools/web_downloader.js +9 -1
  54. package/src/util/config.js +3 -8
  55. package/src/util/debug_log.js +4 -11
  56. package/src/util/mcp_config_manager.js +3 -5
  57. package/src/util/output_formatter.js +0 -47
  58. package/src/util/prompt_loader.js +3 -4
  59. package/src/util/safe_fs.js +60 -0
  60. package/src/util/setup_wizard.js +1 -3
  61. package/src/util/text_formatter.js +0 -86
  62. package/src/config/claude_models.js +0 -195
  63. package/src/ui/README.md +0 -208
  64. package/src/ui/api.js +0 -167
  65. package/src/ui/components/AgenticProgressDisplay.js +0 -126
  66. package/src/ui/components/Composer.js +0 -55
  67. package/src/ui/components/LoadingIndicator.js +0 -54
  68. package/src/ui/components/ModelListView.js +0 -214
  69. package/src/ui/components/Notifications.js +0 -55
  70. package/src/ui/components/StreamingIndicator.js +0 -36
  71. package/src/ui/contexts/AppContext.js +0 -25
  72. package/src/ui/contexts/StreamingContext.js +0 -20
  73. package/src/ui/contexts/UIStateContext.js +0 -117
  74. package/src/ui/example-usage.js +0 -180
  75. package/src/ui/hooks/useTerminalResize.js +0 -39
  76. package/src/ui/themes/semantic-tokens.js +0 -73
  77. package/src/ui/utils/text-buffer.js +0 -975
  78. /package/payload_viewer/out/_next/static/{t0WTsjXST7ISD1Boa6ifx → 7FgHZugvVp3pn1XStUYUJ}/_buildManifest.js +0 -0
  79. /package/payload_viewer/out/_next/static/{t0WTsjXST7ISD1Boa6ifx → 7FgHZugvVp3pn1XStUYUJ}/_clientMiddlewareManifest.json +0 -0
  80. /package/payload_viewer/out/_next/static/{t0WTsjXST7ISD1Boa6ifx → 7FgHZugvVp3pn1XStUYUJ}/_ssgManifest.js +0 -0
  81. /package/src/{ui → frontend}/components/BlankLine.js +0 -0
  82. /package/src/{ui → frontend}/components/FileDiffViewer.js +0 -0
  83. /package/src/{ui → frontend}/components/HelpView.js +0 -0
  84. /package/src/{ui → frontend}/hooks/useCompletion.js +0 -0
  85. /package/src/{ui → frontend}/hooks/useKeypress.js +0 -0
  86. /package/src/{ui → frontend}/utils/diffUtils.js +0 -0
  87. /package/src/{ui → frontend}/utils/renderInkComponent.js +0 -0
@@ -12,7 +12,6 @@ const debugLog = createDebugLogger('code_executer.log', 'code_executer');
12
12
 
13
13
  // 이 파일은 파이썬과 쉘 코드를 실행하고 필요한 패키지를 설치하는 역할을 담당합니다.
14
14
  // Orchestrator가 run_python_code와 bash 도구로 생산한 스크립트를 실제 환경에서 실행할 때 이 모듈을 직접 호출합니다.
15
- function consolelog() { }
16
15
 
17
16
  dotenv.config({ quiet: true });
18
17
 
@@ -122,7 +121,7 @@ function createProcessHandler(childProcess, tempFile, timeoutMs = 1200000) {
122
121
  const timeout = setTimeout(() => {
123
122
  isTimedOut = true;
124
123
  debugLog(`[createProcessHandler] Timeout after ${timeoutMs}ms`);
125
- consolelog(`\n⏰ Process timed out after ${timeoutMs}ms, terminating...`);
124
+ debugLog(`\n⏰ Process timed out after ${timeoutMs}ms, terminating...`);
126
125
 
127
126
  try {
128
127
  // 프로세스 그룹 전체 종료 (음수 pid로)
@@ -166,7 +165,7 @@ function createProcessHandler(childProcess, tempFile, timeoutMs = 1200000) {
166
165
  try {
167
166
  if (tempFile) await safeUnlink(tempFile);
168
167
  } catch (err) {
169
- consolelog('Failed to delete temp file:', err.message);
168
+ debugLog('Failed to delete temp file:', err.message);
170
169
  }
171
170
 
172
171
  if (isTimedOut) {
@@ -197,7 +196,7 @@ function createProcessHandler(childProcess, tempFile, timeoutMs = 1200000) {
197
196
  try {
198
197
  if (tempFile) await safeUnlink(tempFile);
199
198
  } catch (unlinkErr) {
200
- consolelog('Failed to delete temp file:', unlinkErr.message);
199
+ debugLog('Failed to delete temp file:', unlinkErr.message);
201
200
  }
202
201
 
203
202
  if (isTimedOut) {
@@ -218,12 +217,23 @@ function createProcessHandler(childProcess, tempFile, timeoutMs = 1200000) {
218
217
  // 파이썬 코드를 임시 파일에 저장하고 가상환경에서 실행합니다.
219
218
  // 실행 결과는 Verifier와 RAG 저장소가 참고할 수 있도록 index.js에서 그대로 전달됩니다.
220
219
  export async function execPythonCode(python_code, args = [], timeoutMs = 1200000) {
221
- debugLog(`[execPythonCode] Starting Python execution, code length: ${python_code.length}`);
220
+ debugLog('========================================');
221
+ debugLog('====== execPythonCode START ============');
222
+ debugLog('========================================');
223
+ debugLog(`[execPythonCode] Code length: ${python_code.length} characters`);
224
+ debugLog(`[execPythonCode] Code preview (first 200 chars): ${python_code.substring(0, 200)}${python_code.length > 200 ? '...' : ''}`);
225
+ debugLog(`[execPythonCode] Args: ${JSON.stringify(args)}`);
226
+ debugLog(`[execPythonCode] Timeout: ${timeoutMs}ms`);
227
+
228
+ debugLog(`[execPythonCode] Creating/checking virtual environment...`);
222
229
  const venvPath = await makePythonVirtualEnv(process.env.PYTHON_VENV_PATH || "venv");
223
230
 
224
231
  // Python이 설치되지 않은 경우 처리
225
232
  if (!venvPath) {
226
- debugLog(`[execPythonCode] Python not installed`);
233
+ debugLog(`[execPythonCode] ERROR: Python not installed`);
234
+ debugLog('========================================');
235
+ debugLog('====== execPythonCode END (NO PYTHON) ==');
236
+ debugLog('========================================');
227
237
  return {
228
238
  stdout: '',
229
239
  stderr: 'Python is not installed. Please install Python 3 to use this feature.',
@@ -233,20 +243,31 @@ export async function execPythonCode(python_code, args = [], timeoutMs = 1200000
233
243
  }
234
244
 
235
245
  const pythonPath = join(venvPath, 'bin', 'python');
236
- debugLog(`[execPythonCode] Using Python path: ${pythonPath}`);
246
+ debugLog(`[execPythonCode] Virtual environment path: ${venvPath}`);
247
+ debugLog(`[execPythonCode] Python executable path: ${pythonPath}`);
237
248
 
249
+ debugLog(`[execPythonCode] Ensuring temp directory exists...`);
238
250
  try {
239
251
  await safeAccess(getTempDirPath());
252
+ debugLog(`[execPythonCode] Temp directory exists: ${getTempDirPath()}`);
240
253
  } catch {
254
+ debugLog(`[execPythonCode] Creating temp directory: ${getTempDirPath()}`);
241
255
  await safeMkdir(getTempDirPath(), { recursive: true });
242
256
  }
243
257
 
244
258
  const tempFile = join(getTempDirPath(), `temp_${Date.now()}.py`);
259
+ debugLog(`[execPythonCode] Writing code to temp file: ${tempFile}`);
245
260
  await safeWriteFile(tempFile, python_code, 'utf8');
246
- debugLog(`[execPythonCode] Wrote code to ${tempFile}`);
261
+ debugLog(`[execPythonCode] Code written successfully`);
262
+
263
+ debugLog(`[execPythonCode] Installing required packages...`);
247
264
  await installRequiredPackages(tempFile);
265
+ debugLog(`[execPythonCode] Package installation complete`);
248
266
 
249
267
  try {
268
+ debugLog(`[execPythonCode] Spawning Python process...`);
269
+ debugLog(`[execPythonCode] Command: ${pythonPath} -u ${tempFile} ${args.join(' ')}`);
270
+
250
271
  const python = spawn(pythonPath, ['-u', tempFile, ...args], {
251
272
  stdio: ['ignore', 'pipe', 'pipe'], // stdin을 ignore하여 입력 프롬프트 방지
252
273
  env: {
@@ -259,18 +280,41 @@ export async function execPythonCode(python_code, args = [], timeoutMs = 1200000
259
280
  detached: true // 프로세스 그룹 생성으로 자식 프로세스까지 제어
260
281
  });
261
282
 
262
- debugLog(`[execPythonCode] Spawned Python process, pid: ${python.pid}`);
283
+ debugLog(`[execPythonCode] Process spawned - PID: ${python.pid}`);
284
+ debugLog(`[execPythonCode] Waiting for process to complete...`);
285
+
263
286
  const result = await createProcessHandler(python, tempFile, timeoutMs);
264
- debugLog(`[execPythonCode] Result - stdout: ${result.stdout.length} bytes, stderr: ${result.stderr.length} bytes, code: ${result.code}`);
287
+
288
+ debugLog(`[execPythonCode] Execution complete`);
289
+ debugLog(`[execPythonCode] Exit code: ${result.code}`);
290
+ debugLog(`[execPythonCode] Stdout length: ${result.stdout.length} bytes`);
291
+ debugLog(`[execPythonCode] Stderr length: ${result.stderr.length} bytes`);
292
+ debugLog(`[execPythonCode] Timed out: ${result.timeout}`);
293
+ if (result.stdout) {
294
+ debugLog(`[execPythonCode] Stdout preview: ${result.stdout.substring(0, 500)}${result.stdout.length > 500 ? '...' : ''}`);
295
+ }
296
+ if (result.stderr) {
297
+ debugLog(`[execPythonCode] Stderr content: ${result.stderr}`);
298
+ }
299
+
300
+ debugLog('========================================');
301
+ debugLog('====== execPythonCode END ==============');
302
+ debugLog('========================================');
265
303
  return result;
266
304
 
267
305
  } catch (err) {
268
- debugLog(`[execPythonCode] Error: ${err.message}`);
306
+ debugLog(`[execPythonCode] EXCEPTION: ${err.message}`);
307
+ debugLog(`[execPythonCode] Exception stack: ${err.stack}`);
269
308
  try {
270
309
  await safeUnlink(tempFile);
310
+ debugLog(`[execPythonCode] Cleaned up temp file after error`);
271
311
  } catch (unlinkErr) {
272
- consolelog('Failed to delete temp file:', unlinkErr.message);
312
+ debugLog(`[execPythonCode] Failed to delete temp file: ${unlinkErr.message}`);
273
313
  }
314
+
315
+ debugLog('========================================');
316
+ debugLog('====== execPythonCode END (ERROR) ======');
317
+ debugLog('========================================');
274
318
  throw err;
275
319
  }
276
320
  }
@@ -278,33 +322,57 @@ export async function execPythonCode(python_code, args = [], timeoutMs = 1200000
278
322
  // 쉘 스크립트를 임시 파일로 만들어 안전하게 실행합니다.
279
323
  // 파이썬 실행과 동일하게 Orchestrator의 지시에 따라 반복적으로 호출됩니다.
280
324
  export async function execShellScript(script, timeoutMs = 1200000) {
325
+ debugLog('========================================');
326
+ debugLog('====== execShellScript START ===========');
327
+ debugLog('========================================');
328
+ debugLog(`[execShellScript] Script length: ${script.length} characters`);
329
+ debugLog(`[execShellScript] Script preview (first 200 chars): ${script.substring(0, 200)}${script.length > 200 ? '...' : ''}`);
330
+ debugLog(`[execShellScript] Timeout: ${timeoutMs}ms`);
331
+
332
+ debugLog(`[execShellScript] Finding shell executable...`);
281
333
  let shellPath = await whichCommand("bash") || await whichCommand("sh");
282
334
  if (!shellPath) {
335
+ debugLog(`[execShellScript] ERROR: No shell found (bash/sh)`);
336
+ debugLog('========================================');
337
+ debugLog('====== execShellScript END (NO SHELL) ==');
338
+ debugLog('========================================');
283
339
  return null;
284
340
  }
341
+ debugLog(`[execShellScript] Using shell: ${shellPath}`);
285
342
 
286
343
  const tempFile = join(getTempDirPath(), `temp_${Date.now()}.sh`);
344
+ debugLog(`[execShellScript] Temp file path: ${tempFile}`);
287
345
 
288
346
  try {
289
- consolelog('tempFile', tempFile);
290
-
291
347
  // 기존 임시 파일이 있다면 삭제
292
348
  try {
293
349
  await safeAccess(tempFile);
350
+ debugLog(`[execShellScript] Temp file already exists, deleting...`);
294
351
  await safeUnlink(tempFile);
295
352
  } catch (err) {
353
+ debugLog(`[execShellScript] Temp file does not exist (normal)`);
296
354
  // 파일이 없으면 무시
297
355
  }
298
356
 
357
+ debugLog(`[execShellScript] Writing script to temp file...`);
299
358
  const result = await write_file({ file_path: tempFile, content: script });
300
359
  if (!result.operation_successful) {
360
+ debugLog(`[execShellScript] ERROR: Failed to create temp file - ${result.error}`);
301
361
  throw new Error(`Failed to create temp file: ${result.error}`);
302
362
  }
363
+ debugLog(`[execShellScript] Script written successfully`);
303
364
  } catch (err) {
365
+ debugLog(`[execShellScript] EXCEPTION during file write: ${err.message}`);
366
+ debugLog('========================================');
367
+ debugLog('====== execShellScript END (WRITE ERR) =');
368
+ debugLog('========================================');
304
369
  throw err;
305
370
  }
306
371
 
307
372
  try {
373
+ debugLog(`[execShellScript] Spawning shell process...`);
374
+ debugLog(`[execShellScript] Command: ${shellPath} ${tempFile}`);
375
+
308
376
  const shell = spawn(shellPath, [tempFile], {
309
377
  stdio: ['ignore', 'pipe', 'pipe'], // stdin을 ignore하여 입력 프롬프트 방지
310
378
  env: {
@@ -316,14 +384,41 @@ export async function execShellScript(script, timeoutMs = 1200000) {
316
384
  detached: true // 프로세스 그룹 생성으로 자식 프로세스까지 제어
317
385
  });
318
386
 
319
- return await createProcessHandler(shell, tempFile, timeoutMs);
387
+ debugLog(`[execShellScript] Process spawned - PID: ${shell.pid}`);
388
+ debugLog(`[execShellScript] Waiting for process to complete...`);
389
+
390
+ const result = await createProcessHandler(shell, tempFile, timeoutMs);
391
+
392
+ debugLog(`[execShellScript] Execution complete`);
393
+ debugLog(`[execShellScript] Exit code: ${result.code}`);
394
+ debugLog(`[execShellScript] Stdout length: ${result.stdout.length} bytes`);
395
+ debugLog(`[execShellScript] Stderr length: ${result.stderr.length} bytes`);
396
+ debugLog(`[execShellScript] Timed out: ${result.timeout}`);
397
+ if (result.stdout) {
398
+ debugLog(`[execShellScript] Stdout preview: ${result.stdout.substring(0, 500)}${result.stdout.length > 500 ? '...' : ''}`);
399
+ }
400
+ if (result.stderr) {
401
+ debugLog(`[execShellScript] Stderr content: ${result.stderr}`);
402
+ }
403
+
404
+ debugLog('========================================');
405
+ debugLog('====== execShellScript END =============');
406
+ debugLog('========================================');
407
+ return result;
320
408
 
321
409
  } catch (err) {
410
+ debugLog(`[execShellScript] EXCEPTION: ${err.message}`);
411
+ debugLog(`[execShellScript] Exception stack: ${err.stack}`);
322
412
  try {
323
413
  await safeUnlink(tempFile);
414
+ debugLog(`[execShellScript] Cleaned up temp file after error`);
324
415
  } catch (unlinkErr) {
325
- consolelog('Failed to delete temp file:', unlinkErr.message);
416
+ debugLog(`[execShellScript] Failed to delete temp file: ${unlinkErr.message}`);
326
417
  }
418
+
419
+ debugLog('========================================');
420
+ debugLog('====== execShellScript END (ERROR) =====');
421
+ debugLog('========================================');
327
422
  throw err;
328
423
  }
329
424
  }
@@ -7,8 +7,6 @@ import { dirname, join } from 'path';
7
7
  import { createDebugLogger } from '../util/debug_log.js';
8
8
  import { DEBUG_LOG_DIR } from '../util/config.js';
9
9
 
10
- function consolelog() { }
11
-
12
10
  const debugLog = createDebugLogger('file_integrity.log', 'file_integrity');
13
11
 
14
12
  // LOG_FILE을 함수로 만들어 lazy initialization
@@ -37,7 +35,7 @@ class FileIntegrityTracker {
37
35
  this.currentSessionID = sessionID;
38
36
  debugLog(`========== SESSION CHANGED ==========`);
39
37
  debugLog(`New session ID: ${sessionID}`);
40
- consolelog(`[FileIntegrity] Current session set to: ${sessionID}`);
38
+ debugLog(`[FileIntegrity] Current session set to: ${sessionID}`);
41
39
  }
42
40
 
43
41
  /**
@@ -99,7 +97,7 @@ class FileIntegrityTracker {
99
97
  await safeAppendFile(logFile, internalDebugLog.join('\n') + '\n').catch(() => {});
100
98
 
101
99
  debugLog(`========== trackRead END ==========`);
102
- consolelog(`[FileIntegrity] Tracked read: ${sessionID}:${filePath} (hash: ${hash.slice(0, 8)}...)`);
100
+ debugLog(`[FileIntegrity] Tracked read: ${sessionID}:${filePath} (hash: ${hash.slice(0, 8)}...)`);
103
101
  }
104
102
 
105
103
  /**
@@ -239,7 +237,7 @@ class FileIntegrityTracker {
239
237
  debugLog(`Total snapshots in this session: ${sessionSnapshots.size}`);
240
238
  debugLog(`========== saveSnapshot END ==========`);
241
239
 
242
- consolelog(`[FileIntegrity] Snapshot saved: ${sessionID}:${filePath} (${content.length} bytes)`);
240
+ debugLog(`[FileIntegrity] Snapshot saved: ${sessionID}:${filePath} (${content.length} bytes)`);
243
241
  }
244
242
 
245
243
  /**
@@ -320,7 +318,7 @@ export async function trackFileRead(filePath, content) {
320
318
  if (!sessionID) {
321
319
  debugLog(`ERROR: No current session set, cannot track file read`);
322
320
  debugLog('========== trackFileRead (export wrapper) END ==========');
323
- consolelog('[FileIntegrity] No current session set, skipping file read tracking');
321
+ debugLog('[FileIntegrity] No current session set, skipping file read tracking');
324
322
  return;
325
323
  }
326
324
 
@@ -365,7 +363,7 @@ export function saveFileSnapshot(filePath, content) {
365
363
  if (!sessionID) {
366
364
  debugLog(`ERROR: No current session set, cannot save snapshot`);
367
365
  debugLog('========== saveFileSnapshot (export wrapper) END ==========');
368
- consolelog('[FileIntegrity] No current session set, skipping snapshot save');
366
+ debugLog('[FileIntegrity] No current session set, skipping snapshot save');
369
367
  return;
370
368
  }
371
369
 
package/src/system/log.js CHANGED
@@ -5,7 +5,7 @@ import { PAYLOAD_LOG_DIR } from '../util/config.js';
5
5
  // 이 파일은 AI 요청과 응답을 보기 쉬운 로그 파일로 저장합니다.
6
6
  // Planner·Orchestrator·Verifier의 대화 흐름을 모두 같은 위치에 남겨 재현성과 디버깅을 확보합니다.
7
7
  const LOG_DIR = PAYLOAD_LOG_DIR;
8
- function consolelog() { }
8
+
9
9
  // 로그 폴더가 없으면 만들어서 나중에 파일을 쓸 수 있게 합니다.
10
10
  async function ensureLogDirectory() {
11
11
  try {
@@ -43,7 +43,7 @@ function generateLogFileName(taskName) {
43
43
  * 로그 저장
44
44
  * @param {string} taskName - 태스크 이름
45
45
  * @param {Object} data - JSON 데이터
46
- * @param {string} provider - AI provider ('openai' 또는 'anthropic')
46
+ * @param {string} provider - AI provider ('openai')
47
47
  * @returns {Promise<string>} 생성된 로그 파일 경로
48
48
  */
49
49
  // 요청과 응답을 기록용 파일로 남기고 파일 경로를 되돌려줍니다.
@@ -66,7 +66,7 @@ export async function saveLog(taskName, data, provider = null) {
66
66
 
67
67
  return jsonFilePath;
68
68
  } catch (error) {
69
- consolelog('Failed to save log:', error);
69
+ // Failed to save log - silently ignore
70
70
  throw error;
71
71
  }
72
72
  }
@@ -3,8 +3,10 @@ import chalk from 'chalk';
3
3
  import { loadMergedMcpConfig, expandEnvVars } from '../util/mcp_config_manager.js';
4
4
  import { registerMCPToolDisplay } from './tool_registry.js';
5
5
  import { registerMCPTool } from './tool_approval.js';
6
+ import { createDebugLogger } from '../util/debug_log.js';
7
+
8
+ const debugLog = createDebugLogger('mcp_integration.log', 'mcp_integration');
6
9
 
7
- function consolelog() { }
8
10
  /**
9
11
  * MCP Agent 통합 모듈
10
12
  *
@@ -25,15 +27,15 @@ export class MCPIntegration {
25
27
  */
26
28
  async initialize() {
27
29
  try {
28
- consolelog(chalk.blue('MCP Integration initializing...'));
30
+ debugLog('MCP Integration initializing...');
29
31
 
30
32
  // 전역 설정 로드
31
33
  const mergedServers = await loadMergedMcpConfig();
32
34
 
33
35
  // Skip if no MCP servers are configured
34
36
  if (Object.keys(mergedServers).length === 0) {
35
- consolelog(chalk.yellow('No MCP servers configured.'));
36
- consolelog(chalk.yellow(' Use "aiexecode mcp add" to configure servers.'));
37
+ debugLog('No MCP servers configured.');
38
+ debugLog(' Use "aiexecode mcp add" to configure servers.');
37
39
  return { success: false, reason: 'no_servers' };
38
40
  }
39
41
 
@@ -43,14 +45,14 @@ export class MCPIntegration {
43
45
  try {
44
46
  servers[name] = expandEnvVars(config);
45
47
  } catch (error) {
46
- consolelog(chalk.red(`Error expanding env vars for server '${name}': ${error.message}`));
47
- consolelog(chalk.yellow(` Skipping server '${name}'`));
48
+ debugLog(`Error expanding env vars for server '${name}': ${error.message}`);
49
+ debugLog(` Skipping server '${name}'`);
48
50
  continue;
49
51
  }
50
52
  }
51
53
 
52
54
  if (Object.keys(servers).length === 0) {
53
- consolelog(chalk.yellow('No valid MCP servers after configuration processing.'));
55
+ debugLog('No valid MCP servers after configuration processing.');
54
56
  return { success: false, reason: 'no_valid_servers' };
55
57
  }
56
58
 
@@ -71,7 +73,7 @@ export class MCPIntegration {
71
73
  // 사용 가능한 도구 목록 가져오기
72
74
  const availableTools = this.mcpAgent.getAvailableTools();
73
75
 
74
- consolelog(chalk.green(`MCP Agent initialization complete: ${availableTools.length} tool(s) available`));
76
+ debugLog(`MCP Agent initialization complete: ${availableTools.length} tool(s) available`);
75
77
 
76
78
  // 도구 정보를 맵에 저장
77
79
  for (const tool of availableTools) {
@@ -102,7 +104,7 @@ export class MCPIntegration {
102
104
  // 승인 시스템에 MCP 도구 등록
103
105
  registerMCPTool(tool.name, tool.server, tool.description || '');
104
106
 
105
- consolelog(chalk.cyan(` - ${tool.name} (from ${tool.server})`));
107
+ debugLog(` - ${tool.name} (from ${tool.server})`);
106
108
  }
107
109
 
108
110
  this.isInitialized = true;
@@ -113,8 +115,8 @@ export class MCPIntegration {
113
115
  };
114
116
 
115
117
  } catch (error) {
116
- consolelog(chalk.red(`MCP Integration initialization failed: ${error.message}`));
117
- consolelog(chalk.yellow(' Continuing without MCP functionality.'));
118
+ debugLog(`MCP Integration initialization failed: ${error.message}`);
119
+ debugLog(' Continuing without MCP functionality.');
118
120
  return { success: false, reason: 'initialization_error', error: error.message };
119
121
  }
120
122
  }
@@ -228,9 +230,9 @@ export class MCPIntegration {
228
230
  } else if (typeof this.mcpAgent.disconnect === 'function') {
229
231
  await this.mcpAgent.disconnect();
230
232
  }
231
- consolelog(chalk.green('MCP Agent connection terminated'));
233
+ debugLog('MCP Agent connection terminated');
232
234
  } catch (error) {
233
- consolelog(chalk.yellow(`Error during MCP Agent termination: ${error.message}`));
235
+ debugLog(`Error during MCP Agent termination: ${error.message}`);
234
236
  }
235
237
  }
236
238
  }
@@ -8,18 +8,6 @@ export function logSystem(message) {
8
8
  uiEvents.addSystemMessage(message);
9
9
  }
10
10
 
11
- export function logInfo(message) {
12
- uiEvents.addSystemMessage(message);
13
- }
14
-
15
- export function logSuccess(message) {
16
- uiEvents.addSystemMessage(message);
17
- }
18
-
19
- export function logWarning(message) {
20
- uiEvents.addSystemMessage(message);
21
- }
22
-
23
11
  export function logError(message) {
24
12
  uiEvents.addErrorMessage(message);
25
13
  }
@@ -49,10 +37,6 @@ export function logIteration(iterationNumber) {
49
37
  // uiEvents.startIteration(iterationNumber);
50
38
  }
51
39
 
52
- export function logVerificationResult(result) {
53
- uiEvents.addVerificationResult(result);
54
- }
55
-
56
40
  export function logMissionComplete() {
57
41
  uiEvents.missionCompleted(0);
58
42
  }
@@ -60,7 +44,3 @@ export function logMissionComplete() {
60
44
  export function logConversationRestored(count) {
61
45
  uiEvents.conversationRestored(count);
62
46
  }
63
-
64
- export function logRagSearch(contextLength) {
65
- uiEvents.addRagSearch(contextLength);
66
- }