snow-ai 0.4.15 → 0.4.17
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/bundle/cli.mjs +477445 -0
- package/bundle/sql-wasm.wasm +0 -0
- package/package.json +31 -26
- package/dist/agents/codebaseIndexAgent.d.ts +0 -102
- package/dist/agents/codebaseIndexAgent.js +0 -641
- package/dist/agents/codebaseReviewAgent.d.ts +0 -61
- package/dist/agents/codebaseReviewAgent.js +0 -301
- package/dist/agents/compactAgent.d.ts +0 -55
- package/dist/agents/compactAgent.js +0 -306
- package/dist/agents/promptOptimizeAgent.d.ts +0 -54
- package/dist/agents/promptOptimizeAgent.js +0 -268
- package/dist/agents/reviewAgent.d.ts +0 -50
- package/dist/agents/reviewAgent.js +0 -265
- package/dist/agents/summaryAgent.d.ts +0 -57
- package/dist/agents/summaryAgent.js +0 -260
- package/dist/api/anthropic.d.ts +0 -44
- package/dist/api/anthropic.js +0 -598
- package/dist/api/chat.d.ts +0 -73
- package/dist/api/chat.js +0 -386
- package/dist/api/embedding.d.ts +0 -34
- package/dist/api/embedding.js +0 -80
- package/dist/api/gemini.d.ts +0 -31
- package/dist/api/gemini.js +0 -445
- package/dist/api/models.d.ts +0 -15
- package/dist/api/models.js +0 -139
- package/dist/api/responses.d.ts +0 -38
- package/dist/api/responses.js +0 -515
- package/dist/api/systemPrompt.d.ts +0 -4
- package/dist/api/systemPrompt.js +0 -408
- package/dist/api/types.d.ts +0 -53
- package/dist/api/types.js +0 -4
- package/dist/app.d.ts +0 -8
- package/dist/app.js +0 -112
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -199
- package/dist/hooks/useAgentPicker.d.ts +0 -14
- package/dist/hooks/useAgentPicker.js +0 -119
- package/dist/hooks/useClipboard.d.ts +0 -4
- package/dist/hooks/useClipboard.js +0 -175
- package/dist/hooks/useCommandHandler.d.ts +0 -35
- package/dist/hooks/useCommandHandler.js +0 -346
- package/dist/hooks/useCommandPanel.d.ts +0 -17
- package/dist/hooks/useCommandPanel.js +0 -114
- package/dist/hooks/useConversation.d.ts +0 -49
- package/dist/hooks/useConversation.js +0 -1052
- package/dist/hooks/useFilePicker.d.ts +0 -18
- package/dist/hooks/useFilePicker.js +0 -224
- package/dist/hooks/useGlobalExit.d.ts +0 -5
- package/dist/hooks/useGlobalExit.js +0 -34
- package/dist/hooks/useGlobalNavigation.d.ts +0 -6
- package/dist/hooks/useGlobalNavigation.js +0 -17
- package/dist/hooks/useHistoryNavigation.d.ts +0 -35
- package/dist/hooks/useHistoryNavigation.js +0 -133
- package/dist/hooks/useInputBuffer.d.ts +0 -6
- package/dist/hooks/useInputBuffer.js +0 -45
- package/dist/hooks/useKeyboardInput.d.ts +0 -80
- package/dist/hooks/useKeyboardInput.js +0 -608
- package/dist/hooks/useSessionManagement.d.ts +0 -10
- package/dist/hooks/useSessionManagement.js +0 -43
- package/dist/hooks/useSessionSave.d.ts +0 -8
- package/dist/hooks/useSessionSave.js +0 -63
- package/dist/hooks/useSnapshotState.d.ts +0 -26
- package/dist/hooks/useSnapshotState.js +0 -28
- package/dist/hooks/useStreamingState.d.ts +0 -33
- package/dist/hooks/useStreamingState.js +0 -105
- package/dist/hooks/useTerminalFocus.d.ts +0 -28
- package/dist/hooks/useTerminalFocus.js +0 -87
- package/dist/hooks/useTerminalSize.d.ts +0 -4
- package/dist/hooks/useTerminalSize.js +0 -20
- package/dist/hooks/useTodoPicker.d.ts +0 -16
- package/dist/hooks/useTodoPicker.js +0 -94
- package/dist/hooks/useToolConfirmation.d.ts +0 -19
- package/dist/hooks/useToolConfirmation.js +0 -61
- package/dist/hooks/useVSCodeState.d.ts +0 -8
- package/dist/hooks/useVSCodeState.js +0 -81
- package/dist/i18n/I18nContext.d.ts +0 -14
- package/dist/i18n/I18nContext.js +0 -24
- package/dist/i18n/index.d.ts +0 -3
- package/dist/i18n/index.js +0 -2
- package/dist/i18n/lang/en.d.ts +0 -2
- package/dist/i18n/lang/en.js +0 -502
- package/dist/i18n/lang/es.d.ts +0 -2
- package/dist/i18n/lang/es.js +0 -502
- package/dist/i18n/lang/ja.d.ts +0 -2
- package/dist/i18n/lang/ja.js +0 -502
- package/dist/i18n/lang/ko.d.ts +0 -2
- package/dist/i18n/lang/ko.js +0 -502
- package/dist/i18n/lang/zh-TW.d.ts +0 -2
- package/dist/i18n/lang/zh-TW.js +0 -502
- package/dist/i18n/lang/zh.d.ts +0 -2
- package/dist/i18n/lang/zh.js +0 -502
- package/dist/i18n/translations.d.ts +0 -2
- package/dist/i18n/translations.js +0 -14
- package/dist/i18n/types.d.ts +0 -478
- package/dist/i18n/types.js +0 -1
- package/dist/mcp/aceCodeSearch.d.ts +0 -247
- package/dist/mcp/aceCodeSearch.js +0 -1058
- package/dist/mcp/bash.d.ts +0 -50
- package/dist/mcp/bash.js +0 -153
- package/dist/mcp/codebaseSearch.d.ts +0 -44
- package/dist/mcp/codebaseSearch.js +0 -275
- package/dist/mcp/filesystem.d.ts +0 -392
- package/dist/mcp/filesystem.js +0 -1445
- package/dist/mcp/ideDiagnostics.d.ts +0 -36
- package/dist/mcp/ideDiagnostics.js +0 -90
- package/dist/mcp/notebook.d.ts +0 -10
- package/dist/mcp/notebook.js +0 -367
- package/dist/mcp/subagent.d.ts +0 -37
- package/dist/mcp/subagent.js +0 -113
- package/dist/mcp/todo.d.ts +0 -46
- package/dist/mcp/todo.js +0 -511
- package/dist/mcp/types/aceCodeSearch.types.d.ts +0 -92
- package/dist/mcp/types/aceCodeSearch.types.js +0 -4
- package/dist/mcp/types/bash.types.d.ts +0 -13
- package/dist/mcp/types/bash.types.js +0 -4
- package/dist/mcp/types/filesystem.types.d.ts +0 -210
- package/dist/mcp/types/filesystem.types.js +0 -27
- package/dist/mcp/types/todo.types.d.ts +0 -27
- package/dist/mcp/types/todo.types.js +0 -4
- package/dist/mcp/types/websearch.types.d.ts +0 -30
- package/dist/mcp/types/websearch.types.js +0 -4
- package/dist/mcp/utils/aceCodeSearch/filesystem.utils.d.ts +0 -34
- package/dist/mcp/utils/aceCodeSearch/filesystem.utils.js +0 -146
- package/dist/mcp/utils/aceCodeSearch/language.utils.d.ts +0 -14
- package/dist/mcp/utils/aceCodeSearch/language.utils.js +0 -418
- package/dist/mcp/utils/aceCodeSearch/search.utils.d.ts +0 -31
- package/dist/mcp/utils/aceCodeSearch/search.utils.js +0 -136
- package/dist/mcp/utils/aceCodeSearch/symbol.utils.d.ts +0 -20
- package/dist/mcp/utils/aceCodeSearch/symbol.utils.js +0 -141
- package/dist/mcp/utils/bash/security.utils.d.ts +0 -20
- package/dist/mcp/utils/bash/security.utils.js +0 -34
- package/dist/mcp/utils/filesystem/batch-operations.utils.d.ts +0 -39
- package/dist/mcp/utils/filesystem/batch-operations.utils.js +0 -182
- package/dist/mcp/utils/filesystem/code-analysis.utils.d.ts +0 -18
- package/dist/mcp/utils/filesystem/code-analysis.utils.js +0 -165
- package/dist/mcp/utils/filesystem/match-finder.utils.d.ts +0 -16
- package/dist/mcp/utils/filesystem/match-finder.utils.js +0 -85
- package/dist/mcp/utils/filesystem/office-parser.utils.d.ts +0 -43
- package/dist/mcp/utils/filesystem/office-parser.utils.js +0 -163
- package/dist/mcp/utils/filesystem/path-fixer.utils.d.ts +0 -7
- package/dist/mcp/utils/filesystem/path-fixer.utils.js +0 -60
- package/dist/mcp/utils/filesystem/similarity.utils.d.ts +0 -22
- package/dist/mcp/utils/filesystem/similarity.utils.js +0 -75
- package/dist/mcp/utils/todo/date.utils.d.ts +0 -9
- package/dist/mcp/utils/todo/date.utils.js +0 -14
- package/dist/mcp/utils/websearch/browser.utils.d.ts +0 -8
- package/dist/mcp/utils/websearch/browser.utils.js +0 -58
- package/dist/mcp/utils/websearch/text.utils.d.ts +0 -16
- package/dist/mcp/utils/websearch/text.utils.js +0 -39
- package/dist/mcp/websearch.d.ts +0 -88
- package/dist/mcp/websearch.js +0 -375
- package/dist/test/logger-test.d.ts +0 -1
- package/dist/test/logger-test.js +0 -7
- package/dist/types/index.d.ts +0 -15
- package/dist/types/index.js +0 -1
- package/dist/ui/components/AgentPickerPanel.d.ts +0 -10
- package/dist/ui/components/AgentPickerPanel.js +0 -74
- package/dist/ui/components/ChatInput.d.ts +0 -46
- package/dist/ui/components/ChatInput.js +0 -379
- package/dist/ui/components/CommandPanel.d.ts +0 -15
- package/dist/ui/components/CommandPanel.js +0 -80
- package/dist/ui/components/DiffViewer.d.ts +0 -11
- package/dist/ui/components/DiffViewer.js +0 -178
- package/dist/ui/components/FileList.d.ts +0 -15
- package/dist/ui/components/FileList.js +0 -360
- package/dist/ui/components/FileRollbackConfirmation.d.ts +0 -8
- package/dist/ui/components/FileRollbackConfirmation.js +0 -108
- package/dist/ui/components/HelpPanel.d.ts +0 -2
- package/dist/ui/components/HelpPanel.js +0 -67
- package/dist/ui/components/MCPInfoPanel.d.ts +0 -2
- package/dist/ui/components/MCPInfoPanel.js +0 -108
- package/dist/ui/components/MCPInfoScreen.d.ts +0 -7
- package/dist/ui/components/MCPInfoScreen.js +0 -115
- package/dist/ui/components/MarkdownRenderer.d.ts +0 -6
- package/dist/ui/components/MarkdownRenderer.js +0 -70
- package/dist/ui/components/Menu.d.ts +0 -17
- package/dist/ui/components/Menu.js +0 -88
- package/dist/ui/components/MessageList.d.ts +0 -56
- package/dist/ui/components/MessageList.js +0 -97
- package/dist/ui/components/PendingMessages.d.ts +0 -13
- package/dist/ui/components/PendingMessages.js +0 -29
- package/dist/ui/components/PendingToolCalls.d.ts +0 -11
- package/dist/ui/components/PendingToolCalls.js +0 -35
- package/dist/ui/components/ScrollableSelectInput.d.ts +0 -29
- package/dist/ui/components/ScrollableSelectInput.js +0 -157
- package/dist/ui/components/SessionListPanel.d.ts +0 -7
- package/dist/ui/components/SessionListPanel.js +0 -175
- package/dist/ui/components/SessionListScreen.d.ts +0 -7
- package/dist/ui/components/SessionListScreen.js +0 -217
- package/dist/ui/components/SessionListScreenWrapper.d.ts +0 -7
- package/dist/ui/components/SessionListScreenWrapper.js +0 -14
- package/dist/ui/components/ShimmerText.d.ts +0 -9
- package/dist/ui/components/ShimmerText.js +0 -30
- package/dist/ui/components/TodoPickerPanel.d.ts +0 -14
- package/dist/ui/components/TodoPickerPanel.js +0 -119
- package/dist/ui/components/TodoTree.d.ts +0 -15
- package/dist/ui/components/TodoTree.js +0 -60
- package/dist/ui/components/ToolConfirmation.d.ts +0 -21
- package/dist/ui/components/ToolConfirmation.js +0 -204
- package/dist/ui/components/ToolResultPreview.d.ts +0 -13
- package/dist/ui/components/ToolResultPreview.js +0 -337
- package/dist/ui/components/UsagePanel.d.ts +0 -2
- package/dist/ui/components/UsagePanel.js +0 -394
- package/dist/ui/contexts/ThemeContext.d.ts +0 -13
- package/dist/ui/contexts/ThemeContext.js +0 -28
- package/dist/ui/pages/ChatScreen.d.ts +0 -6
- package/dist/ui/pages/ChatScreen.js +0 -1495
- package/dist/ui/pages/CodeBaseConfigScreen.d.ts +0 -8
- package/dist/ui/pages/CodeBaseConfigScreen.js +0 -350
- package/dist/ui/pages/ConfigScreen.d.ts +0 -8
- package/dist/ui/pages/ConfigScreen.js +0 -1101
- package/dist/ui/pages/CustomHeadersScreen.d.ts +0 -6
- package/dist/ui/pages/CustomHeadersScreen.js +0 -502
- package/dist/ui/pages/HeadlessModeScreen.d.ts +0 -7
- package/dist/ui/pages/HeadlessModeScreen.js +0 -381
- package/dist/ui/pages/LanguageSettingsScreen.d.ts +0 -7
- package/dist/ui/pages/LanguageSettingsScreen.js +0 -91
- package/dist/ui/pages/MCPConfigScreen.d.ts +0 -6
- package/dist/ui/pages/MCPConfigScreen.js +0 -55
- package/dist/ui/pages/ProxyConfigScreen.d.ts +0 -8
- package/dist/ui/pages/ProxyConfigScreen.js +0 -149
- package/dist/ui/pages/SensitiveCommandConfigScreen.d.ts +0 -7
- package/dist/ui/pages/SensitiveCommandConfigScreen.js +0 -271
- package/dist/ui/pages/SubAgentConfigScreen.d.ts +0 -9
- package/dist/ui/pages/SubAgentConfigScreen.js +0 -435
- package/dist/ui/pages/SubAgentListScreen.d.ts +0 -9
- package/dist/ui/pages/SubAgentListScreen.js +0 -131
- package/dist/ui/pages/SystemPromptConfigScreen.d.ts +0 -6
- package/dist/ui/pages/SystemPromptConfigScreen.js +0 -326
- package/dist/ui/pages/ThemeSettingsScreen.d.ts +0 -7
- package/dist/ui/pages/ThemeSettingsScreen.js +0 -106
- package/dist/ui/pages/WelcomeScreen.d.ts +0 -7
- package/dist/ui/pages/WelcomeScreen.js +0 -217
- package/dist/ui/themes/index.d.ts +0 -23
- package/dist/ui/themes/index.js +0 -140
- package/dist/utils/apiConfig.d.ts +0 -126
- package/dist/utils/apiConfig.js +0 -423
- package/dist/utils/autoCompress.d.ts +0 -15
- package/dist/utils/autoCompress.js +0 -24
- package/dist/utils/chatExporter.d.ts +0 -9
- package/dist/utils/chatExporter.js +0 -118
- package/dist/utils/checkpointManager.d.ts +0 -74
- package/dist/utils/checkpointManager.js +0 -181
- package/dist/utils/codebaseConfig.d.ts +0 -16
- package/dist/utils/codebaseConfig.js +0 -67
- package/dist/utils/codebaseDatabase.d.ts +0 -102
- package/dist/utils/codebaseDatabase.js +0 -333
- package/dist/utils/codebaseSearchEvents.d.ts +0 -16
- package/dist/utils/codebaseSearchEvents.js +0 -13
- package/dist/utils/commandExecutor.d.ts +0 -13
- package/dist/utils/commandExecutor.js +0 -26
- package/dist/utils/commands/agent.d.ts +0 -2
- package/dist/utils/commands/agent.js +0 -12
- package/dist/utils/commands/clear.d.ts +0 -2
- package/dist/utils/commands/clear.js +0 -12
- package/dist/utils/commands/compact.d.ts +0 -2
- package/dist/utils/commands/compact.js +0 -12
- package/dist/utils/commands/export.d.ts +0 -2
- package/dist/utils/commands/export.js +0 -12
- package/dist/utils/commands/help.d.ts +0 -2
- package/dist/utils/commands/help.js +0 -11
- package/dist/utils/commands/home.d.ts +0 -2
- package/dist/utils/commands/home.js +0 -34
- package/dist/utils/commands/ide.d.ts +0 -2
- package/dist/utils/commands/ide.js +0 -32
- package/dist/utils/commands/init.d.ts +0 -2
- package/dist/utils/commands/init.js +0 -93
- package/dist/utils/commands/mcp.d.ts +0 -2
- package/dist/utils/commands/mcp.js +0 -12
- package/dist/utils/commands/resume.d.ts +0 -2
- package/dist/utils/commands/resume.js +0 -12
- package/dist/utils/commands/review.d.ts +0 -2
- package/dist/utils/commands/review.js +0 -81
- package/dist/utils/commands/role.d.ts +0 -2
- package/dist/utils/commands/role.js +0 -37
- package/dist/utils/commands/todoPicker.d.ts +0 -2
- package/dist/utils/commands/todoPicker.js +0 -12
- package/dist/utils/commands/usage.d.ts +0 -2
- package/dist/utils/commands/usage.js +0 -12
- package/dist/utils/commands/yolo.d.ts +0 -2
- package/dist/utils/commands/yolo.js +0 -12
- package/dist/utils/configManager.d.ts +0 -45
- package/dist/utils/configManager.js +0 -303
- package/dist/utils/contextCompressor.d.ts +0 -16
- package/dist/utils/contextCompressor.js +0 -334
- package/dist/utils/devMode.d.ts +0 -13
- package/dist/utils/devMode.js +0 -54
- package/dist/utils/escapeHandler.d.ts +0 -79
- package/dist/utils/escapeHandler.js +0 -153
- package/dist/utils/fileDialog.d.ts +0 -9
- package/dist/utils/fileDialog.js +0 -74
- package/dist/utils/fileUtils.d.ts +0 -40
- package/dist/utils/fileUtils.js +0 -185
- package/dist/utils/historyManager.d.ts +0 -45
- package/dist/utils/historyManager.js +0 -159
- package/dist/utils/incrementalSnapshot.d.ts +0 -109
- package/dist/utils/incrementalSnapshot.js +0 -383
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/index.js +0 -18
- package/dist/utils/languageConfig.d.ts +0 -21
- package/dist/utils/languageConfig.js +0 -61
- package/dist/utils/logger.d.ts +0 -37
- package/dist/utils/logger.js +0 -122
- package/dist/utils/mcpToolsManager.d.ts +0 -52
- package/dist/utils/mcpToolsManager.js +0 -878
- package/dist/utils/messageFormatter.d.ts +0 -12
- package/dist/utils/messageFormatter.js +0 -115
- package/dist/utils/notebookManager.d.ts +0 -59
- package/dist/utils/notebookManager.js +0 -213
- package/dist/utils/patch-highlight.d.ts +0 -5
- package/dist/utils/patch-highlight.js +0 -23
- package/dist/utils/processManager.d.ts +0 -27
- package/dist/utils/processManager.js +0 -75
- package/dist/utils/proxyUtils.d.ts +0 -15
- package/dist/utils/proxyUtils.js +0 -50
- package/dist/utils/resourceMonitor.d.ts +0 -65
- package/dist/utils/resourceMonitor.js +0 -175
- package/dist/utils/retryUtils.d.ts +0 -49
- package/dist/utils/retryUtils.js +0 -303
- package/dist/utils/sensitiveCommandManager.d.ts +0 -53
- package/dist/utils/sensitiveCommandManager.js +0 -308
- package/dist/utils/sessionConverter.d.ts +0 -7
- package/dist/utils/sessionConverter.js +0 -306
- package/dist/utils/sessionManager.d.ts +0 -53
- package/dist/utils/sessionManager.js +0 -371
- package/dist/utils/subAgentConfig.d.ts +0 -50
- package/dist/utils/subAgentConfig.js +0 -221
- package/dist/utils/subAgentExecutor.d.ts +0 -40
- package/dist/utils/subAgentExecutor.js +0 -434
- package/dist/utils/terminal.d.ts +0 -5
- package/dist/utils/terminal.js +0 -13
- package/dist/utils/textBuffer.d.ts +0 -99
- package/dist/utils/textBuffer.js +0 -547
- package/dist/utils/textUtils.d.ts +0 -37
- package/dist/utils/textUtils.js +0 -102
- package/dist/utils/themeConfig.d.ts +0 -21
- package/dist/utils/themeConfig.js +0 -61
- package/dist/utils/todoPreprocessor.d.ts +0 -5
- package/dist/utils/todoPreprocessor.js +0 -18
- package/dist/utils/todoScanner.d.ts +0 -8
- package/dist/utils/todoScanner.js +0 -148
- package/dist/utils/toolDisplayConfig.d.ts +0 -16
- package/dist/utils/toolDisplayConfig.js +0 -47
- package/dist/utils/toolExecutor.d.ts +0 -37
- package/dist/utils/toolExecutor.js +0 -224
- package/dist/utils/usageLogger.d.ts +0 -11
- package/dist/utils/usageLogger.js +0 -114
- package/dist/utils/vscodeConnection.d.ts +0 -76
- package/dist/utils/vscodeConnection.js +0 -430
- package/dist/utils/workspaceSnapshot.d.ts +0 -63
- package/dist/utils/workspaceSnapshot.js +0 -300
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type Diagnostic } from '../utils/vscodeConnection.js';
|
|
2
|
-
/**
|
|
3
|
-
* IDE Diagnostics MCP Service
|
|
4
|
-
* Provides access to diagnostics (errors, warnings, hints) from connected IDE
|
|
5
|
-
* Supports both VSCode and JetBrains IDEs
|
|
6
|
-
*/
|
|
7
|
-
export declare class IdeDiagnosticsMCPService {
|
|
8
|
-
/**
|
|
9
|
-
* Get diagnostics for a specific file from the connected IDE
|
|
10
|
-
* @param filePath - Absolute path to the file to get diagnostics for
|
|
11
|
-
* @returns Promise that resolves with array of diagnostics
|
|
12
|
-
*/
|
|
13
|
-
getDiagnostics(filePath: string): Promise<Diagnostic[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Format diagnostics into human-readable text
|
|
16
|
-
* @param diagnostics - Array of diagnostics to format
|
|
17
|
-
* @param filePath - Path to the file (for display)
|
|
18
|
-
* @returns Formatted string
|
|
19
|
-
*/
|
|
20
|
-
formatDiagnostics(diagnostics: Diagnostic[], filePath: string): string;
|
|
21
|
-
}
|
|
22
|
-
export declare const ideDiagnosticsService: IdeDiagnosticsMCPService;
|
|
23
|
-
export declare const mcpTools: {
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
inputSchema: {
|
|
27
|
-
type: string;
|
|
28
|
-
properties: {
|
|
29
|
-
filePath: {
|
|
30
|
-
type: string;
|
|
31
|
-
description: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
required: string[];
|
|
35
|
-
};
|
|
36
|
-
}[];
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { vscodeConnection } from '../utils/vscodeConnection.js';
|
|
2
|
-
/**
|
|
3
|
-
* IDE Diagnostics MCP Service
|
|
4
|
-
* Provides access to diagnostics (errors, warnings, hints) from connected IDE
|
|
5
|
-
* Supports both VSCode and JetBrains IDEs
|
|
6
|
-
*/
|
|
7
|
-
export class IdeDiagnosticsMCPService {
|
|
8
|
-
/**
|
|
9
|
-
* Get diagnostics for a specific file from the connected IDE
|
|
10
|
-
* @param filePath - Absolute path to the file to get diagnostics for
|
|
11
|
-
* @returns Promise that resolves with array of diagnostics
|
|
12
|
-
*/
|
|
13
|
-
async getDiagnostics(filePath) {
|
|
14
|
-
if (!vscodeConnection.isConnected()) {
|
|
15
|
-
throw new Error('IDE connection not available. Please ensure VSCode or JetBrains IDE plugin is installed and running.');
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const diagnostics = await vscodeConnection.requestDiagnostics(filePath);
|
|
19
|
-
return diagnostics;
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
23
|
-
throw new Error(`Failed to get diagnostics: ${message}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Format diagnostics into human-readable text
|
|
28
|
-
* @param diagnostics - Array of diagnostics to format
|
|
29
|
-
* @param filePath - Path to the file (for display)
|
|
30
|
-
* @returns Formatted string
|
|
31
|
-
*/
|
|
32
|
-
formatDiagnostics(diagnostics, filePath) {
|
|
33
|
-
if (diagnostics.length === 0) {
|
|
34
|
-
return `No diagnostics found for ${filePath}`;
|
|
35
|
-
}
|
|
36
|
-
const lines = [`Diagnostics for ${filePath}:\n`];
|
|
37
|
-
// Group by severity
|
|
38
|
-
const grouped = {
|
|
39
|
-
error: diagnostics.filter(d => d.severity === 'error'),
|
|
40
|
-
warning: diagnostics.filter(d => d.severity === 'warning'),
|
|
41
|
-
info: diagnostics.filter(d => d.severity === 'info'),
|
|
42
|
-
hint: diagnostics.filter(d => d.severity === 'hint'),
|
|
43
|
-
};
|
|
44
|
-
// Add summary
|
|
45
|
-
const counts = [
|
|
46
|
-
grouped.error.length > 0 ? `${grouped.error.length} errors` : null,
|
|
47
|
-
grouped.warning.length > 0 ? `${grouped.warning.length} warnings` : null,
|
|
48
|
-
grouped.info.length > 0 ? `${grouped.info.length} info` : null,
|
|
49
|
-
grouped.hint.length > 0 ? `${grouped.hint.length} hints` : null,
|
|
50
|
-
].filter(Boolean);
|
|
51
|
-
lines.push(`Total: ${counts.join(', ')}\n`);
|
|
52
|
-
// Format each severity group
|
|
53
|
-
const formatGroup = (items, label, icon) => {
|
|
54
|
-
if (items.length === 0)
|
|
55
|
-
return;
|
|
56
|
-
lines.push(`\n${label}:`);
|
|
57
|
-
items.forEach(d => {
|
|
58
|
-
const location = `Line ${d.line + 1}, Col ${d.character + 1}`;
|
|
59
|
-
const source = d.source ? ` [${d.source}]` : '';
|
|
60
|
-
const code = d.code ? ` (${d.code})` : '';
|
|
61
|
-
lines.push(` ${icon} ${location}${source}${code}`);
|
|
62
|
-
lines.push(` ${d.message}`);
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
formatGroup(grouped.error, 'Errors', '❌');
|
|
66
|
-
formatGroup(grouped.warning, 'Warnings', '⚠️');
|
|
67
|
-
formatGroup(grouped.info, 'Info', 'ℹ️');
|
|
68
|
-
formatGroup(grouped.hint, 'Hints', '💡');
|
|
69
|
-
return lines.join('\n');
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Export a default instance
|
|
73
|
-
export const ideDiagnosticsService = new IdeDiagnosticsMCPService();
|
|
74
|
-
// Export MCP tool definitions
|
|
75
|
-
export const mcpTools = [
|
|
76
|
-
{
|
|
77
|
-
name: 'ide-get_diagnostics',
|
|
78
|
-
description: '🔍 Get diagnostics (errors, warnings, hints) for a specific file from the connected IDE. Works with both VSCode and JetBrains IDEs. Returns array of diagnostic information including severity, line number, character position, message, and source. Requires IDE plugin to be installed and running.',
|
|
79
|
-
inputSchema: {
|
|
80
|
-
type: 'object',
|
|
81
|
-
properties: {
|
|
82
|
-
filePath: {
|
|
83
|
-
type: 'string',
|
|
84
|
-
description: 'Absolute path to the file to get diagnostics for. Must be a valid file path accessible by the IDE.',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
required: ['filePath'],
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
];
|
package/dist/mcp/notebook.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Tool, type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Notebook MCP 工具定义
|
|
4
|
-
* 用于代码备忘录管理,帮助AI记录重要的代码注意事项
|
|
5
|
-
*/
|
|
6
|
-
export declare const mcpTools: Tool[];
|
|
7
|
-
/**
|
|
8
|
-
* 执行 Notebook 工具
|
|
9
|
-
*/
|
|
10
|
-
export declare function executeNotebookTool(toolName: string, args: any): Promise<CallToolResult>;
|
package/dist/mcp/notebook.js
DELETED
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
import { addNotebook, queryNotebook, updateNotebook, deleteNotebook, getNotebooksByFile, } from '../utils/notebookManager.js';
|
|
2
|
-
/**
|
|
3
|
-
* Notebook MCP 工具定义
|
|
4
|
-
* 用于代码备忘录管理,帮助AI记录重要的代码注意事项
|
|
5
|
-
*/
|
|
6
|
-
export const mcpTools = [
|
|
7
|
-
{
|
|
8
|
-
name: 'notebook-add',
|
|
9
|
-
description: `📝 Record code parts that are fragile and easily broken during iteration.
|
|
10
|
-
|
|
11
|
-
**Core Purpose:** Prevent new features from breaking existing functionality.
|
|
12
|
-
|
|
13
|
-
**When to record:**
|
|
14
|
-
- After fixing bugs that could easily reoccur
|
|
15
|
-
- Fragile code that new features might break
|
|
16
|
-
- Non-obvious dependencies between components
|
|
17
|
-
- Workarounds that shouldn't be "optimized away"
|
|
18
|
-
|
|
19
|
-
**Examples:**
|
|
20
|
-
- "⚠️ validateInput() MUST be called first - new features broke this twice"
|
|
21
|
-
- "Component X depends on null return - DO NOT change to empty array"
|
|
22
|
-
- "setTimeout workaround for race condition - don't remove"
|
|
23
|
-
- "Parser expects exact format - adding fields breaks backward compat"`,
|
|
24
|
-
inputSchema: {
|
|
25
|
-
type: 'object',
|
|
26
|
-
properties: {
|
|
27
|
-
filePath: {
|
|
28
|
-
type: 'string',
|
|
29
|
-
description: 'File path (relative or absolute). Example: "src/utils/parser.ts"',
|
|
30
|
-
},
|
|
31
|
-
note: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
description: 'Brief, specific note. Focus on risks/constraints, NOT what code does.',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
required: ['filePath', 'note'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'notebook-query',
|
|
41
|
-
description: `🔍 Search notebook entries by file path pattern.
|
|
42
|
-
|
|
43
|
-
**Auto-triggered:** When reading files, last 10 notebooks are automatically shown.
|
|
44
|
-
**Manual use:** Query specific patterns or see more entries.`,
|
|
45
|
-
inputSchema: {
|
|
46
|
-
type: 'object',
|
|
47
|
-
properties: {
|
|
48
|
-
filePathPattern: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
description: 'Fuzzy search pattern (e.g., "parser"). Empty = all entries.',
|
|
51
|
-
default: '',
|
|
52
|
-
},
|
|
53
|
-
topN: {
|
|
54
|
-
type: 'number',
|
|
55
|
-
description: 'Max results to return (default: 10, max: 50)',
|
|
56
|
-
default: 10,
|
|
57
|
-
minimum: 1,
|
|
58
|
-
maximum: 50,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'notebook-update',
|
|
65
|
-
description: `✏️ Update an existing notebook entry to fix mistakes or refine notes.
|
|
66
|
-
|
|
67
|
-
**Core Purpose:** Correct errors in previously recorded notes or update outdated information.
|
|
68
|
-
|
|
69
|
-
**When to use:**
|
|
70
|
-
- Found a mistake in a previously recorded note
|
|
71
|
-
- Need to clarify or improve the wording
|
|
72
|
-
- Update note after code changes
|
|
73
|
-
- Refine warning messages for better clarity
|
|
74
|
-
|
|
75
|
-
**Usage:**
|
|
76
|
-
1. Use notebook-query or notebook-list to find the entry ID
|
|
77
|
-
2. Call notebook-update with the ID and new note content
|
|
78
|
-
|
|
79
|
-
**Example:**
|
|
80
|
-
- Old: "⚠️ Don't change this"
|
|
81
|
-
- New: "⚠️ validateInput() MUST be called first - parser depends on sanitized input"`,
|
|
82
|
-
inputSchema: {
|
|
83
|
-
type: 'object',
|
|
84
|
-
properties: {
|
|
85
|
-
notebookId: {
|
|
86
|
-
type: 'string',
|
|
87
|
-
description: 'Notebook entry ID to update (get from notebook-query or notebook-list)',
|
|
88
|
-
},
|
|
89
|
-
note: {
|
|
90
|
-
type: 'string',
|
|
91
|
-
description: 'New note content to replace the existing one',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
required: ['notebookId', 'note'],
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: 'notebook-delete',
|
|
99
|
-
description: `🗑️ Delete an outdated or incorrect notebook entry.
|
|
100
|
-
|
|
101
|
-
**Core Purpose:** Remove notes that are no longer relevant or were recorded by mistake.
|
|
102
|
-
|
|
103
|
-
**When to use:**
|
|
104
|
-
- Code has been refactored and note is obsolete
|
|
105
|
-
- Note was recorded by mistake
|
|
106
|
-
- Workaround has been properly fixed
|
|
107
|
-
- Entry is duplicate or redundant
|
|
108
|
-
|
|
109
|
-
**Usage:**
|
|
110
|
-
1. Use notebook-query or notebook-list to find the entry ID
|
|
111
|
-
2. Call notebook-delete with the ID to remove it
|
|
112
|
-
|
|
113
|
-
**⚠️ Warning:** Deletion is permanent. Make sure the note is truly obsolete.`,
|
|
114
|
-
inputSchema: {
|
|
115
|
-
type: 'object',
|
|
116
|
-
properties: {
|
|
117
|
-
notebookId: {
|
|
118
|
-
type: 'string',
|
|
119
|
-
description: 'Notebook entry ID to delete (get from notebook-query)',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
required: ['notebookId'],
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'notebook-list',
|
|
127
|
-
description: `📋 List all notebook entries for a specific file.
|
|
128
|
-
|
|
129
|
-
**Core Purpose:** View all notes associated with a particular file for management.
|
|
130
|
-
|
|
131
|
-
**When to use:**
|
|
132
|
-
- Need to see all notes for a file before editing
|
|
133
|
-
- Want to clean up old notes for a specific file
|
|
134
|
-
- Review constraints before making changes to a file
|
|
135
|
-
|
|
136
|
-
**Returns:** All notebook entries for the specified file, ordered by creation time.`,
|
|
137
|
-
inputSchema: {
|
|
138
|
-
type: 'object',
|
|
139
|
-
properties: {
|
|
140
|
-
filePath: {
|
|
141
|
-
type: 'string',
|
|
142
|
-
description: 'File path (relative or absolute) to list notebooks for',
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
required: ['filePath'],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
];
|
|
149
|
-
/**
|
|
150
|
-
* 执行 Notebook 工具
|
|
151
|
-
*/
|
|
152
|
-
export async function executeNotebookTool(toolName, args) {
|
|
153
|
-
try {
|
|
154
|
-
switch (toolName) {
|
|
155
|
-
case 'notebook-add': {
|
|
156
|
-
const { filePath, note } = args;
|
|
157
|
-
if (!filePath || !note) {
|
|
158
|
-
return {
|
|
159
|
-
content: [
|
|
160
|
-
{
|
|
161
|
-
type: 'text',
|
|
162
|
-
text: 'Error: Both filePath and note are required',
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
isError: true,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
const entry = addNotebook(filePath, note);
|
|
169
|
-
return {
|
|
170
|
-
content: [
|
|
171
|
-
{
|
|
172
|
-
type: 'text',
|
|
173
|
-
text: JSON.stringify({
|
|
174
|
-
success: true,
|
|
175
|
-
message: `Notebook entry added for: ${entry.filePath}`,
|
|
176
|
-
entry: {
|
|
177
|
-
id: entry.id,
|
|
178
|
-
filePath: entry.filePath,
|
|
179
|
-
note: entry.note,
|
|
180
|
-
createdAt: entry.createdAt,
|
|
181
|
-
},
|
|
182
|
-
}, null, 2),
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
case 'notebook-query': {
|
|
188
|
-
const { filePathPattern = '', topN = 10 } = args;
|
|
189
|
-
const results = queryNotebook(filePathPattern, topN);
|
|
190
|
-
if (results.length === 0) {
|
|
191
|
-
return {
|
|
192
|
-
content: [
|
|
193
|
-
{
|
|
194
|
-
type: 'text',
|
|
195
|
-
text: JSON.stringify({
|
|
196
|
-
message: 'No notebook entries found',
|
|
197
|
-
pattern: filePathPattern || '(all)',
|
|
198
|
-
totalResults: 0,
|
|
199
|
-
}, null, 2),
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
content: [
|
|
206
|
-
{
|
|
207
|
-
type: 'text',
|
|
208
|
-
text: JSON.stringify({
|
|
209
|
-
message: `Found ${results.length} notebook entries`,
|
|
210
|
-
pattern: filePathPattern || '(all)',
|
|
211
|
-
totalResults: results.length,
|
|
212
|
-
entries: results.map(entry => ({
|
|
213
|
-
id: entry.id,
|
|
214
|
-
filePath: entry.filePath,
|
|
215
|
-
note: entry.note,
|
|
216
|
-
createdAt: entry.createdAt,
|
|
217
|
-
})),
|
|
218
|
-
}, null, 2),
|
|
219
|
-
},
|
|
220
|
-
],
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
case 'notebook-update': {
|
|
224
|
-
const { notebookId, note } = args;
|
|
225
|
-
if (!notebookId || !note) {
|
|
226
|
-
return {
|
|
227
|
-
content: [
|
|
228
|
-
{
|
|
229
|
-
type: 'text',
|
|
230
|
-
text: 'Error: Both notebookId and note are required',
|
|
231
|
-
},
|
|
232
|
-
],
|
|
233
|
-
isError: true,
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
const updatedEntry = updateNotebook(notebookId, note);
|
|
237
|
-
if (!updatedEntry) {
|
|
238
|
-
return {
|
|
239
|
-
content: [
|
|
240
|
-
{
|
|
241
|
-
type: 'text',
|
|
242
|
-
text: JSON.stringify({
|
|
243
|
-
success: false,
|
|
244
|
-
message: `Notebook entry not found: ${notebookId}`,
|
|
245
|
-
}, null, 2),
|
|
246
|
-
},
|
|
247
|
-
],
|
|
248
|
-
isError: true,
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
content: [
|
|
253
|
-
{
|
|
254
|
-
type: 'text',
|
|
255
|
-
text: JSON.stringify({
|
|
256
|
-
success: true,
|
|
257
|
-
message: `Notebook entry updated: ${notebookId}`,
|
|
258
|
-
entry: {
|
|
259
|
-
id: updatedEntry.id,
|
|
260
|
-
filePath: updatedEntry.filePath,
|
|
261
|
-
note: updatedEntry.note,
|
|
262
|
-
updatedAt: updatedEntry.updatedAt,
|
|
263
|
-
},
|
|
264
|
-
}, null, 2),
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
case 'notebook-delete': {
|
|
270
|
-
const { notebookId } = args;
|
|
271
|
-
if (!notebookId) {
|
|
272
|
-
return {
|
|
273
|
-
content: [
|
|
274
|
-
{
|
|
275
|
-
type: 'text',
|
|
276
|
-
text: 'Error: notebookId is required',
|
|
277
|
-
},
|
|
278
|
-
],
|
|
279
|
-
isError: true,
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const deleted = deleteNotebook(notebookId);
|
|
283
|
-
if (!deleted) {
|
|
284
|
-
return {
|
|
285
|
-
content: [
|
|
286
|
-
{
|
|
287
|
-
type: 'text',
|
|
288
|
-
text: JSON.stringify({
|
|
289
|
-
success: false,
|
|
290
|
-
message: `Notebook entry not found: ${notebookId}`,
|
|
291
|
-
}, null, 2),
|
|
292
|
-
},
|
|
293
|
-
],
|
|
294
|
-
isError: true,
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
return {
|
|
298
|
-
content: [
|
|
299
|
-
{
|
|
300
|
-
type: 'text',
|
|
301
|
-
text: JSON.stringify({
|
|
302
|
-
success: true,
|
|
303
|
-
message: `Notebook entry deleted: ${notebookId}`,
|
|
304
|
-
}, null, 2),
|
|
305
|
-
},
|
|
306
|
-
],
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
case 'notebook-list': {
|
|
310
|
-
const { filePath } = args;
|
|
311
|
-
if (!filePath) {
|
|
312
|
-
return {
|
|
313
|
-
content: [
|
|
314
|
-
{
|
|
315
|
-
type: 'text',
|
|
316
|
-
text: 'Error: filePath is required',
|
|
317
|
-
},
|
|
318
|
-
],
|
|
319
|
-
isError: true,
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
const entries = getNotebooksByFile(filePath);
|
|
323
|
-
return {
|
|
324
|
-
content: [
|
|
325
|
-
{
|
|
326
|
-
type: 'text',
|
|
327
|
-
text: JSON.stringify({
|
|
328
|
-
message: entries.length > 0
|
|
329
|
-
? `Found ${entries.length} notebook entries for: ${filePath}`
|
|
330
|
-
: `No notebook entries found for: ${filePath}`,
|
|
331
|
-
filePath,
|
|
332
|
-
totalEntries: entries.length,
|
|
333
|
-
entries: entries.map(entry => ({
|
|
334
|
-
id: entry.id,
|
|
335
|
-
note: entry.note,
|
|
336
|
-
createdAt: entry.createdAt,
|
|
337
|
-
updatedAt: entry.updatedAt,
|
|
338
|
-
})),
|
|
339
|
-
}, null, 2),
|
|
340
|
-
},
|
|
341
|
-
],
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
default:
|
|
345
|
-
return {
|
|
346
|
-
content: [
|
|
347
|
-
{
|
|
348
|
-
type: 'text',
|
|
349
|
-
text: `Unknown notebook tool: ${toolName}`,
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
isError: true,
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
catch (error) {
|
|
357
|
-
return {
|
|
358
|
-
content: [
|
|
359
|
-
{
|
|
360
|
-
type: 'text',
|
|
361
|
-
text: `Error executing notebook tool: ${error instanceof Error ? error.message : String(error)}`,
|
|
362
|
-
},
|
|
363
|
-
],
|
|
364
|
-
isError: true,
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
}
|
package/dist/mcp/subagent.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { SubAgentMessage } from '../utils/subAgentExecutor.js';
|
|
2
|
-
import type { ToolCall } from '../utils/toolExecutor.js';
|
|
3
|
-
import type { ConfirmationResult } from '../ui/components/ToolConfirmation.js';
|
|
4
|
-
export interface SubAgentToolExecutionOptions {
|
|
5
|
-
agentId: string;
|
|
6
|
-
prompt: string;
|
|
7
|
-
onMessage?: (message: SubAgentMessage) => void;
|
|
8
|
-
abortSignal?: AbortSignal;
|
|
9
|
-
requestToolConfirmation?: (toolCall: ToolCall, batchToolNames?: string, allTools?: ToolCall[]) => Promise<ConfirmationResult>;
|
|
10
|
-
isToolAutoApproved?: (toolName: string) => boolean;
|
|
11
|
-
yoloMode?: boolean;
|
|
12
|
-
addToAlwaysApproved?: (toolName: string) => void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Sub-Agent MCP Service
|
|
16
|
-
* Provides tools for executing sub-agents with their own specialized system prompts and tool access
|
|
17
|
-
*/
|
|
18
|
-
export declare class SubAgentService {
|
|
19
|
-
/**
|
|
20
|
-
* Execute a sub-agent as a tool
|
|
21
|
-
*/
|
|
22
|
-
execute(options: SubAgentToolExecutionOptions): Promise<any>;
|
|
23
|
-
/**
|
|
24
|
-
* Get all available sub-agents as MCP tools
|
|
25
|
-
*/
|
|
26
|
-
getTools(): Array<{
|
|
27
|
-
name: string;
|
|
28
|
-
description: string;
|
|
29
|
-
inputSchema: any;
|
|
30
|
-
}>;
|
|
31
|
-
}
|
|
32
|
-
export declare const subAgentService: SubAgentService;
|
|
33
|
-
export declare function getMCPTools(): Array<{
|
|
34
|
-
name: string;
|
|
35
|
-
description: string;
|
|
36
|
-
inputSchema: any;
|
|
37
|
-
}>;
|
package/dist/mcp/subagent.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { executeSubAgent } from '../utils/subAgentExecutor.js';
|
|
2
|
-
import { getUserSubAgents } from '../utils/subAgentConfig.js';
|
|
3
|
-
/**
|
|
4
|
-
* Sub-Agent MCP Service
|
|
5
|
-
* Provides tools for executing sub-agents with their own specialized system prompts and tool access
|
|
6
|
-
*/
|
|
7
|
-
export class SubAgentService {
|
|
8
|
-
/**
|
|
9
|
-
* Execute a sub-agent as a tool
|
|
10
|
-
*/
|
|
11
|
-
async execute(options) {
|
|
12
|
-
const { agentId, prompt, onMessage, abortSignal, requestToolConfirmation, isToolAutoApproved, yoloMode, addToAlwaysApproved, } = options;
|
|
13
|
-
// Create a tool confirmation adapter for sub-agent if needed
|
|
14
|
-
const subAgentToolConfirmation = requestToolConfirmation
|
|
15
|
-
? async (toolName, toolArgs) => {
|
|
16
|
-
// Create a fake tool call for confirmation
|
|
17
|
-
const fakeToolCall = {
|
|
18
|
-
id: 'subagent-tool',
|
|
19
|
-
type: 'function',
|
|
20
|
-
function: {
|
|
21
|
-
name: toolName,
|
|
22
|
-
arguments: JSON.stringify(toolArgs),
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
return await requestToolConfirmation(fakeToolCall);
|
|
26
|
-
}
|
|
27
|
-
: undefined;
|
|
28
|
-
const result = await executeSubAgent(agentId, prompt, onMessage, abortSignal, subAgentToolConfirmation, isToolAutoApproved, yoloMode, addToAlwaysApproved);
|
|
29
|
-
if (!result.success) {
|
|
30
|
-
throw new Error(result.error || 'Sub-agent execution failed');
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
success: true,
|
|
34
|
-
result: result.result,
|
|
35
|
-
usage: result.usage,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get all available sub-agents as MCP tools
|
|
40
|
-
*/
|
|
41
|
-
getTools() {
|
|
42
|
-
// Get only user-configured agents (built-in agents are hardcoded below)
|
|
43
|
-
const userAgents = getUserSubAgents();
|
|
44
|
-
// Built-in agents (hardcoded, always available)
|
|
45
|
-
const tools = [
|
|
46
|
-
{
|
|
47
|
-
name: 'agent_explore',
|
|
48
|
-
description: 'Explore Agent: Specialized for quickly exploring and understanding codebases. Excels at searching code, finding definitions, analyzing code structure and dependencies. Read-only operations, will not modify files or execute commands.',
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: {
|
|
52
|
-
prompt: {
|
|
53
|
-
type: 'string',
|
|
54
|
-
description: 'CRITICAL: Provide COMPLETE context from main session. Sub-agent has NO access to main conversation history. Include: (1) Full task description with business requirements, (2) Known file locations and code paths, (3) Relevant code snippets or patterns already discovered, (4) Any constraints or important context. Example: "Explore authentication implementation. Main flow uses OAuth in src/auth/oauth.ts, need to find all related error handling. User mentioned JWT tokens are validated in middleware."',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
required: ['prompt'],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'agent_plan',
|
|
62
|
-
description: 'Plan Agent: Specialized for planning complex tasks. Analyzes requirements, explores code, identifies relevant files, and creates detailed implementation plans. Read-only operations, outputs structured implementation proposals.',
|
|
63
|
-
inputSchema: {
|
|
64
|
-
type: 'object',
|
|
65
|
-
properties: {
|
|
66
|
-
prompt: {
|
|
67
|
-
type: 'string',
|
|
68
|
-
description: 'CRITICAL: Provide COMPLETE context from main session. Sub-agent has NO access to main conversation history. Include: (1) Full requirement details and business objectives, (2) Current architecture/file structure understanding, (3) Known dependencies and constraints, (4) Files/modules already identified that need changes, (5) User preferences or specific implementation approaches mentioned. Example: "Plan caching implementation. Current API uses Express in src/server.ts, data layer in src/models/. Need Redis caching, user wants minimal changes to existing controllers in src/controllers/."',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
required: ['prompt'],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'agent_general',
|
|
76
|
-
description: 'General Purpose Agent: General-purpose multi-step task execution agent. Has full tool access for searching, modifying files, and executing commands. Best for complex tasks requiring actual operations.',
|
|
77
|
-
inputSchema: {
|
|
78
|
-
type: 'object',
|
|
79
|
-
properties: {
|
|
80
|
-
prompt: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
description: 'CRITICAL: Provide COMPLETE context from main session. Sub-agent has NO access to main conversation history. Include: (1) Full task description with step-by-step requirements, (2) Exact file paths and locations to modify, (3) Code patterns/snippets to follow or replicate, (4) Dependencies between files/changes, (5) Testing/verification requirements, (6) Any business logic or constraints discovered in main session. Example: "Update error handling across API. Files: src/api/users.ts, src/api/posts.ts, src/api/comments.ts. Replace old pattern try-catch with new ErrorHandler class from src/utils/errorHandler.ts. Must preserve existing error codes. Run npm test after changes."',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
required: ['prompt'],
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
];
|
|
89
|
-
// Add user-configured agents (avoid duplicates with built-in)
|
|
90
|
-
tools.push(...userAgents.map(agent => ({
|
|
91
|
-
name: agent.id,
|
|
92
|
-
description: `${agent.name}: ${agent.description}`,
|
|
93
|
-
inputSchema: {
|
|
94
|
-
type: 'object',
|
|
95
|
-
properties: {
|
|
96
|
-
prompt: {
|
|
97
|
-
type: 'string',
|
|
98
|
-
description: 'CRITICAL: Provide COMPLETE context from main session. Sub-agent has NO access to main conversation history. Include all relevant: (1) Task requirements and objectives, (2) Known file locations and code structure, (3) Business logic and constraints, (4) Code patterns or examples, (5) Dependencies and relationships. Be specific and comprehensive - sub-agent cannot ask for clarification from main session.',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
required: ['prompt'],
|
|
102
|
-
},
|
|
103
|
-
})));
|
|
104
|
-
return tools;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
// Export a default instance
|
|
108
|
-
export const subAgentService = new SubAgentService();
|
|
109
|
-
// MCP Tool definitions (dynamically generated from configuration)
|
|
110
|
-
// Note: These are generated at runtime, so we export a function instead of a constant
|
|
111
|
-
export function getMCPTools() {
|
|
112
|
-
return subAgentService.getTools();
|
|
113
|
-
}
|