snow-ai 0.4.16 → 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 -384
- 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 -1519
- 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
package/dist/mcp/todo.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Tool, type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import type { TodoItem, TodoList, GetCurrentSessionId } from './types/todo.types.js';
|
|
3
|
-
/**
|
|
4
|
-
* TODO 管理服务 - 支持创建、查询、更新 TODO
|
|
5
|
-
*/
|
|
6
|
-
export declare class TodoService {
|
|
7
|
-
private readonly todoDir;
|
|
8
|
-
private getCurrentSessionId;
|
|
9
|
-
constructor(baseDir: string, getCurrentSessionId: GetCurrentSessionId);
|
|
10
|
-
initialize(): Promise<void>;
|
|
11
|
-
private getTodoPath;
|
|
12
|
-
private ensureTodoDir;
|
|
13
|
-
/**
|
|
14
|
-
* 创建或更新会话的 TODO List
|
|
15
|
-
*/
|
|
16
|
-
saveTodoList(sessionId: string, todos: TodoItem[], existingList?: TodoList | null): Promise<TodoList>;
|
|
17
|
-
/**
|
|
18
|
-
* 获取会话的 TODO List
|
|
19
|
-
*/
|
|
20
|
-
getTodoList(sessionId: string): Promise<TodoList | null>;
|
|
21
|
-
private findTodoInDateFolders;
|
|
22
|
-
/**
|
|
23
|
-
* 更新单个 TODO 项
|
|
24
|
-
*/
|
|
25
|
-
updateTodoItem(sessionId: string, todoId: string, updates: Partial<Omit<TodoItem, 'id' | 'createdAt'>>): Promise<TodoList | null>;
|
|
26
|
-
/**
|
|
27
|
-
* 添加 TODO 项
|
|
28
|
-
*/
|
|
29
|
-
addTodoItem(sessionId: string, content: string, parentId?: string): Promise<TodoList>;
|
|
30
|
-
/**
|
|
31
|
-
* 删除 TODO 项
|
|
32
|
-
*/
|
|
33
|
-
deleteTodoItem(sessionId: string, todoId: string): Promise<TodoList | null>;
|
|
34
|
-
/**
|
|
35
|
-
* 删除整个会话的 TODO 列表
|
|
36
|
-
*/
|
|
37
|
-
deleteTodoList(sessionId: string): Promise<boolean>;
|
|
38
|
-
/**
|
|
39
|
-
* 获取所有工具定义
|
|
40
|
-
*/
|
|
41
|
-
getTools(): Tool[];
|
|
42
|
-
/**
|
|
43
|
-
* 执行工具调用
|
|
44
|
-
*/
|
|
45
|
-
executeTool(toolName: string, args: Record<string, unknown>): Promise<CallToolResult>;
|
|
46
|
-
}
|
package/dist/mcp/todo.js
DELETED
|
@@ -1,511 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
// Utility functions
|
|
4
|
-
import { formatDateForFolder } from './utils/todo/date.utils.js';
|
|
5
|
-
/**
|
|
6
|
-
* TODO 管理服务 - 支持创建、查询、更新 TODO
|
|
7
|
-
*/
|
|
8
|
-
export class TodoService {
|
|
9
|
-
constructor(baseDir, getCurrentSessionId) {
|
|
10
|
-
Object.defineProperty(this, "todoDir", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true,
|
|
14
|
-
value: void 0
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(this, "getCurrentSessionId", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
this.todoDir = path.join(baseDir, 'todos');
|
|
23
|
-
this.getCurrentSessionId = getCurrentSessionId;
|
|
24
|
-
}
|
|
25
|
-
async initialize() {
|
|
26
|
-
await fs.mkdir(this.todoDir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
getTodoPath(sessionId, date) {
|
|
29
|
-
const sessionDate = date || new Date();
|
|
30
|
-
const dateFolder = formatDateForFolder(sessionDate);
|
|
31
|
-
const todoDir = path.join(this.todoDir, dateFolder);
|
|
32
|
-
return path.join(todoDir, `${sessionId}.json`);
|
|
33
|
-
}
|
|
34
|
-
async ensureTodoDir(date) {
|
|
35
|
-
try {
|
|
36
|
-
await fs.mkdir(this.todoDir, { recursive: true });
|
|
37
|
-
if (date) {
|
|
38
|
-
const dateFolder = formatDateForFolder(date);
|
|
39
|
-
const todoDir = path.join(this.todoDir, dateFolder);
|
|
40
|
-
await fs.mkdir(todoDir, { recursive: true });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
// Directory already exists or other error
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* 创建或更新会话的 TODO List
|
|
49
|
-
*/
|
|
50
|
-
async saveTodoList(sessionId, todos, existingList) {
|
|
51
|
-
// 使用现有TODO列表的createdAt信息,或者使用当前时间
|
|
52
|
-
const sessionCreatedAt = existingList?.createdAt
|
|
53
|
-
? new Date(existingList.createdAt).getTime()
|
|
54
|
-
: Date.now();
|
|
55
|
-
const sessionDate = new Date(sessionCreatedAt);
|
|
56
|
-
await this.ensureTodoDir(sessionDate);
|
|
57
|
-
const todoPath = this.getTodoPath(sessionId, sessionDate);
|
|
58
|
-
try {
|
|
59
|
-
const content = await fs.readFile(todoPath, 'utf-8');
|
|
60
|
-
existingList = JSON.parse(content);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// 文件不存在,创建新的
|
|
64
|
-
}
|
|
65
|
-
const now = new Date().toISOString();
|
|
66
|
-
const todoList = {
|
|
67
|
-
sessionId,
|
|
68
|
-
todos,
|
|
69
|
-
createdAt: existingList?.createdAt ?? now,
|
|
70
|
-
updatedAt: now,
|
|
71
|
-
};
|
|
72
|
-
await fs.writeFile(todoPath, JSON.stringify(todoList, null, 2));
|
|
73
|
-
return todoList;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 获取会话的 TODO List
|
|
77
|
-
*/
|
|
78
|
-
async getTodoList(sessionId) {
|
|
79
|
-
// 首先尝试从旧格式加载(向下兼容)
|
|
80
|
-
try {
|
|
81
|
-
const oldTodoPath = path.join(this.todoDir, `${sessionId}.json`);
|
|
82
|
-
const content = await fs.readFile(oldTodoPath, 'utf-8');
|
|
83
|
-
return JSON.parse(content);
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
// 旧格式不存在,搜索日期文件夹
|
|
87
|
-
}
|
|
88
|
-
// 在日期文件夹中查找 TODO
|
|
89
|
-
try {
|
|
90
|
-
const todo = await this.findTodoInDateFolders(sessionId);
|
|
91
|
-
return todo;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
// 搜索失败
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
async findTodoInDateFolders(sessionId) {
|
|
99
|
-
try {
|
|
100
|
-
const files = await fs.readdir(this.todoDir);
|
|
101
|
-
for (const file of files) {
|
|
102
|
-
const filePath = path.join(this.todoDir, file);
|
|
103
|
-
const stat = await fs.stat(filePath);
|
|
104
|
-
if (stat.isDirectory() && /^\d{4}-\d{2}-\d{2}$/.test(file)) {
|
|
105
|
-
// 这是日期文件夹,查找 TODO 文件
|
|
106
|
-
const todoPath = path.join(filePath, `${sessionId}.json`);
|
|
107
|
-
try {
|
|
108
|
-
const content = await fs.readFile(todoPath, 'utf-8');
|
|
109
|
-
return JSON.parse(content);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
// 文件不存在或读取失败,继续搜索
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
// 目录读取失败
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* 更新单个 TODO 项
|
|
125
|
-
*/
|
|
126
|
-
async updateTodoItem(sessionId, todoId, updates) {
|
|
127
|
-
const todoList = await this.getTodoList(sessionId);
|
|
128
|
-
if (!todoList) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
const todoIndex = todoList.todos.findIndex(t => t.id === todoId);
|
|
132
|
-
if (todoIndex === -1) {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
const existingTodo = todoList.todos[todoIndex];
|
|
136
|
-
todoList.todos[todoIndex] = {
|
|
137
|
-
...existingTodo,
|
|
138
|
-
...updates,
|
|
139
|
-
updatedAt: new Date().toISOString(),
|
|
140
|
-
};
|
|
141
|
-
return this.saveTodoList(sessionId, todoList.todos, todoList);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* 添加 TODO 项
|
|
145
|
-
*/
|
|
146
|
-
async addTodoItem(sessionId, content, parentId) {
|
|
147
|
-
const todoList = await this.getTodoList(sessionId);
|
|
148
|
-
const now = new Date().toISOString();
|
|
149
|
-
const newTodo = {
|
|
150
|
-
id: `todo-${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
|
|
151
|
-
content,
|
|
152
|
-
status: 'pending',
|
|
153
|
-
createdAt: now,
|
|
154
|
-
updatedAt: now,
|
|
155
|
-
parentId,
|
|
156
|
-
};
|
|
157
|
-
const todos = todoList ? [...todoList.todos, newTodo] : [newTodo];
|
|
158
|
-
return this.saveTodoList(sessionId, todos, todoList);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* 删除 TODO 项
|
|
162
|
-
*/
|
|
163
|
-
async deleteTodoItem(sessionId, todoId) {
|
|
164
|
-
const todoList = await this.getTodoList(sessionId);
|
|
165
|
-
if (!todoList) {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
const filteredTodos = todoList.todos.filter(t => t.id !== todoId && t.parentId !== todoId);
|
|
169
|
-
return this.saveTodoList(sessionId, filteredTodos, todoList);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* 删除整个会话的 TODO 列表
|
|
173
|
-
*/
|
|
174
|
-
async deleteTodoList(sessionId) {
|
|
175
|
-
// 首先尝试删除旧格式(向下兼容)
|
|
176
|
-
try {
|
|
177
|
-
const oldTodoPath = path.join(this.todoDir, `${sessionId}.json`);
|
|
178
|
-
await fs.unlink(oldTodoPath);
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
// 旧格式不存在,搜索日期文件夹
|
|
183
|
-
}
|
|
184
|
-
// 在日期文件夹中查找并删除 TODO
|
|
185
|
-
try {
|
|
186
|
-
const files = await fs.readdir(this.todoDir);
|
|
187
|
-
for (const file of files) {
|
|
188
|
-
const filePath = path.join(this.todoDir, file);
|
|
189
|
-
const stat = await fs.stat(filePath);
|
|
190
|
-
if (stat.isDirectory() && /^\d{4}-\d{2}-\d{2}$/.test(file)) {
|
|
191
|
-
// 这是日期文件夹,查找 TODO 文件
|
|
192
|
-
const todoPath = path.join(filePath, `${sessionId}.json`);
|
|
193
|
-
try {
|
|
194
|
-
await fs.unlink(todoPath);
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
// 文件不存在,继续搜索
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
// 目录读取失败
|
|
206
|
-
}
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* 获取所有工具定义
|
|
211
|
-
*/
|
|
212
|
-
getTools() {
|
|
213
|
-
return [
|
|
214
|
-
{
|
|
215
|
-
name: 'todo-create',
|
|
216
|
-
description: `✅ RECOMMENDED: Create TODO list for structured task execution. Use this for ALL multi-step tasks!
|
|
217
|
-
|
|
218
|
-
⚠️ MANDATORY RULE - PARALLEL CALLS ONLY:
|
|
219
|
-
🚫 NEVER call todo-create alone! MUST call with other tools in the SAME function call block.
|
|
220
|
-
✅ ALWAYS: todo-create + filesystem-read (or other action tool) in parallel
|
|
221
|
-
❌ FORBIDDEN: Call todo-create, wait for result, then call other tools
|
|
222
|
-
|
|
223
|
-
## 🎯 DEFAULT USAGE - Use TODO by default for:
|
|
224
|
-
✅ ANY multi-file changes (always create TODO first)
|
|
225
|
-
✅ ANY feature implementation (plan with TODO)
|
|
226
|
-
✅ ANY refactoring work (track with TODO)
|
|
227
|
-
✅ Bug fixes involving 2+ files (use TODO)
|
|
228
|
-
✅ Tasks with 3+ distinct steps (create TODO)
|
|
229
|
-
⚠️ SKIP ONLY: Single-file trivial edits (1-2 lines)
|
|
230
|
-
|
|
231
|
-
## 🚀 WHY CREATE TODO:
|
|
232
|
-
- Ensures all requirements are addressed
|
|
233
|
-
- Prevents missing critical steps
|
|
234
|
-
- Provides clear progress tracking
|
|
235
|
-
- Improves code quality through systematic approach
|
|
236
|
-
- Builds user confidence with visible structure
|
|
237
|
-
|
|
238
|
-
## 📋 WHEN TO CALL:
|
|
239
|
-
1. **NEW TASK**: Create TODO immediately when starting work (with parallel action)
|
|
240
|
-
2. **NEW REQUIREMENT**: Delete old todos, create fresh list (with parallel action)
|
|
241
|
-
3. **BEST PRACTICE**: Call todo-create + filesystem-read in parallel
|
|
242
|
-
|
|
243
|
-
## ⚡ CREATION GUIDELINES:
|
|
244
|
-
- Break work into 3-7 clear, actionable tasks
|
|
245
|
-
- Order by logical dependencies
|
|
246
|
-
- Be specific (e.g., "Modify validateInput in form.ts" not "fix validation")
|
|
247
|
-
- Include verification step if critical
|
|
248
|
-
|
|
249
|
-
## ⚠️ LIFECYCLE:
|
|
250
|
-
This REPLACES the entire TODO list. For adding tasks to existing list, use "todo-add" instead.
|
|
251
|
-
|
|
252
|
-
## 💡 REMEMBER: MUST call with other tools - never alone!`,
|
|
253
|
-
inputSchema: {
|
|
254
|
-
type: 'object',
|
|
255
|
-
properties: {
|
|
256
|
-
todos: {
|
|
257
|
-
type: 'array',
|
|
258
|
-
items: {
|
|
259
|
-
type: 'object',
|
|
260
|
-
properties: {
|
|
261
|
-
content: {
|
|
262
|
-
type: 'string',
|
|
263
|
-
description: 'TODO item description - must be specific, actionable, and technically precise (e.g., "Modify handleSubmit function in ChatInput.tsx to validate user input before processing" NOT "fix input validation")',
|
|
264
|
-
},
|
|
265
|
-
parentId: {
|
|
266
|
-
type: 'string',
|
|
267
|
-
description: 'Parent TODO ID (optional, for creating subtasks in hierarchical structure)',
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
required: ['content', 'parentId'],
|
|
271
|
-
},
|
|
272
|
-
description: 'Complete list of TODO items. Each item must represent a discrete, verifiable unit of work. For programming tasks, typical structure: analyze code → implement changes → test functionality → verify build → commit (if requested).',
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
required: ['todos'],
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
name: 'todo-get',
|
|
280
|
-
description: `Get current TODO list with task IDs, status, and hierarchy.
|
|
281
|
-
|
|
282
|
-
⚠️ MANDATORY RULE - PARALLEL CALLS ONLY:
|
|
283
|
-
🚫 NEVER call todo-get alone! MUST call with other tools in the SAME function call block.
|
|
284
|
-
✅ ALWAYS: todo-get + filesystem-read/terminal-execute/etc in parallel
|
|
285
|
-
❌ FORBIDDEN: Call todo-get alone to check status
|
|
286
|
-
|
|
287
|
-
## 🔄 WHEN TO USE IN DIALOGUE:
|
|
288
|
-
- **User provides additional info**: Use todo-get + filesystem-read to check what's done
|
|
289
|
-
- **User requests modifications**: Check current progress before adding/updating tasks
|
|
290
|
-
- **Continuing work**: Always check status first to avoid redoing completed tasks
|
|
291
|
-
|
|
292
|
-
USAGE: Combine with filesystem-read, terminal-execute, or other actions to check progress while working.`,
|
|
293
|
-
inputSchema: {
|
|
294
|
-
type: 'object',
|
|
295
|
-
properties: {},
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
name: 'todo-update',
|
|
300
|
-
description: `Update TODO status/content - USE THIS FREQUENTLY to track progress!
|
|
301
|
-
|
|
302
|
-
⚠️ MANDATORY RULE - PARALLEL CALLS ONLY:
|
|
303
|
-
🚫 NEVER call todo-update alone! MUST call with other tools in the SAME function call block.
|
|
304
|
-
✅ ALWAYS: todo-update + filesystem-edit/terminal-execute/etc in parallel
|
|
305
|
-
❌ FORBIDDEN: Call todo-update, wait for result, then proceed
|
|
306
|
-
|
|
307
|
-
BEST PRACTICE: Mark "completed" ONLY after task is verified.
|
|
308
|
-
Example: todo-update(task1, completed) + filesystem-edit(task2) → Update while working!
|
|
309
|
-
|
|
310
|
-
💡 This ensures efficient workflow and prevents unnecessary wait times.`,
|
|
311
|
-
inputSchema: {
|
|
312
|
-
type: 'object',
|
|
313
|
-
properties: {
|
|
314
|
-
todoId: {
|
|
315
|
-
type: 'string',
|
|
316
|
-
description: 'TODO item ID to update (get exact ID from todo-get)',
|
|
317
|
-
},
|
|
318
|
-
status: {
|
|
319
|
-
type: 'string',
|
|
320
|
-
enum: ['pending', 'completed'],
|
|
321
|
-
description: 'New status - "pending" (not done) or "completed" (100% finished and verified)',
|
|
322
|
-
},
|
|
323
|
-
content: {
|
|
324
|
-
type: 'string',
|
|
325
|
-
description: 'Updated TODO content (optional, only if task description needs refinement)',
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
required: ['todoId'],
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
name: 'todo-add',
|
|
333
|
-
description: `Add new task to existing TODO list when requirements expand.
|
|
334
|
-
|
|
335
|
-
⚠️ MANDATORY RULE - PARALLEL CALLS ONLY:
|
|
336
|
-
🚫 NEVER call todo-add alone! MUST call with other tools in the SAME function call block.
|
|
337
|
-
✅ ALWAYS: todo-add + filesystem-edit/filesystem-read/etc in parallel
|
|
338
|
-
❌ FORBIDDEN: Call todo-add alone to add task
|
|
339
|
-
|
|
340
|
-
USE WHEN:
|
|
341
|
-
- User adds new requirements during work
|
|
342
|
-
- You discover additional necessary steps
|
|
343
|
-
- Breaking down a complex task into subtasks
|
|
344
|
-
|
|
345
|
-
DO NOT use for initial planning - use todo-create instead.`,
|
|
346
|
-
inputSchema: {
|
|
347
|
-
type: 'object',
|
|
348
|
-
properties: {
|
|
349
|
-
content: {
|
|
350
|
-
type: 'string',
|
|
351
|
-
description: 'TODO item description - must be specific, actionable, and technically precise',
|
|
352
|
-
},
|
|
353
|
-
parentId: {
|
|
354
|
-
type: 'string',
|
|
355
|
-
description: 'Parent TODO ID to create a subtask (optional). Get valid IDs from todo-get.',
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
required: ['content'],
|
|
359
|
-
},
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
name: 'todo-delete',
|
|
363
|
-
description: `Delete TODO item from the list.
|
|
364
|
-
|
|
365
|
-
⚠️ MANDATORY RULE - PARALLEL CALLS ONLY:
|
|
366
|
-
🚫 NEVER call todo-delete alone! MUST call with other tools in the SAME function call block.
|
|
367
|
-
✅ ALWAYS: todo-delete + filesystem-edit/todo-get/etc in parallel
|
|
368
|
-
❌ FORBIDDEN: Call todo-delete alone
|
|
369
|
-
|
|
370
|
-
NOTE: Deleting a parent task will cascade delete all its children automatically.`,
|
|
371
|
-
inputSchema: {
|
|
372
|
-
type: 'object',
|
|
373
|
-
properties: {
|
|
374
|
-
todoId: {
|
|
375
|
-
type: 'string',
|
|
376
|
-
description: 'TODO item ID to delete. Deleting a parent will cascade delete all its children. Get exact ID from todo-get.',
|
|
377
|
-
},
|
|
378
|
-
},
|
|
379
|
-
required: ['todoId'],
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
];
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* 执行工具调用
|
|
386
|
-
*/
|
|
387
|
-
async executeTool(toolName, args) {
|
|
388
|
-
// 自动获取当前会话 ID
|
|
389
|
-
const sessionId = this.getCurrentSessionId();
|
|
390
|
-
if (!sessionId) {
|
|
391
|
-
return {
|
|
392
|
-
content: [
|
|
393
|
-
{
|
|
394
|
-
type: 'text',
|
|
395
|
-
text: 'Error: No active session found',
|
|
396
|
-
},
|
|
397
|
-
],
|
|
398
|
-
isError: true,
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
try {
|
|
402
|
-
switch (toolName) {
|
|
403
|
-
case 'create': {
|
|
404
|
-
const { todos } = args;
|
|
405
|
-
const todoItems = todos.map(t => {
|
|
406
|
-
const now = new Date().toISOString();
|
|
407
|
-
return {
|
|
408
|
-
id: `todo-${Date.now()}_${Math.random()
|
|
409
|
-
.toString(36)
|
|
410
|
-
.slice(2, 9)}`,
|
|
411
|
-
content: t.content,
|
|
412
|
-
status: 'pending',
|
|
413
|
-
createdAt: now,
|
|
414
|
-
updatedAt: now,
|
|
415
|
-
parentId: t.parentId,
|
|
416
|
-
};
|
|
417
|
-
});
|
|
418
|
-
const existingList = await this.getTodoList(sessionId);
|
|
419
|
-
const result = await this.saveTodoList(sessionId, todoItems, existingList);
|
|
420
|
-
return {
|
|
421
|
-
content: [
|
|
422
|
-
{
|
|
423
|
-
type: 'text',
|
|
424
|
-
text: JSON.stringify(result, null, 2),
|
|
425
|
-
},
|
|
426
|
-
],
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
case 'get': {
|
|
430
|
-
const result = await this.getTodoList(sessionId);
|
|
431
|
-
return {
|
|
432
|
-
content: [
|
|
433
|
-
{
|
|
434
|
-
type: 'text',
|
|
435
|
-
text: result
|
|
436
|
-
? JSON.stringify(result, null, 2)
|
|
437
|
-
: 'No TODO list found',
|
|
438
|
-
},
|
|
439
|
-
],
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
case 'update': {
|
|
443
|
-
const { todoId, status, content } = args;
|
|
444
|
-
const updates = {};
|
|
445
|
-
if (status)
|
|
446
|
-
updates.status = status;
|
|
447
|
-
if (content)
|
|
448
|
-
updates.content = content;
|
|
449
|
-
const result = await this.updateTodoItem(sessionId, todoId, updates);
|
|
450
|
-
return {
|
|
451
|
-
content: [
|
|
452
|
-
{
|
|
453
|
-
type: 'text',
|
|
454
|
-
text: result
|
|
455
|
-
? JSON.stringify(result, null, 2)
|
|
456
|
-
: 'TODO item not found',
|
|
457
|
-
},
|
|
458
|
-
],
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
case 'add': {
|
|
462
|
-
const { content, parentId } = args;
|
|
463
|
-
const result = await this.addTodoItem(sessionId, content, parentId);
|
|
464
|
-
return {
|
|
465
|
-
content: [
|
|
466
|
-
{
|
|
467
|
-
type: 'text',
|
|
468
|
-
text: JSON.stringify(result, null, 2),
|
|
469
|
-
},
|
|
470
|
-
],
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
case 'delete': {
|
|
474
|
-
const { todoId } = args;
|
|
475
|
-
const result = await this.deleteTodoItem(sessionId, todoId);
|
|
476
|
-
return {
|
|
477
|
-
content: [
|
|
478
|
-
{
|
|
479
|
-
type: 'text',
|
|
480
|
-
text: result
|
|
481
|
-
? JSON.stringify(result, null, 2)
|
|
482
|
-
: 'TODO item not found',
|
|
483
|
-
},
|
|
484
|
-
],
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
default:
|
|
488
|
-
return {
|
|
489
|
-
content: [
|
|
490
|
-
{
|
|
491
|
-
type: 'text',
|
|
492
|
-
text: `Unknown tool: ${toolName}`,
|
|
493
|
-
},
|
|
494
|
-
],
|
|
495
|
-
isError: true,
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
catch (error) {
|
|
500
|
-
return {
|
|
501
|
-
content: [
|
|
502
|
-
{
|
|
503
|
-
type: 'text',
|
|
504
|
-
text: `Error executing ${toolName}: ${error instanceof Error ? error.message : String(error)}`,
|
|
505
|
-
},
|
|
506
|
-
],
|
|
507
|
-
isError: true,
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for ACE Code Search Service
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Code symbol types
|
|
6
|
-
*/
|
|
7
|
-
export type SymbolType = 'function' | 'class' | 'method' | 'variable' | 'constant' | 'interface' | 'type' | 'enum' | 'import' | 'export';
|
|
8
|
-
/**
|
|
9
|
-
* Code symbol information
|
|
10
|
-
*/
|
|
11
|
-
export interface CodeSymbol {
|
|
12
|
-
name: string;
|
|
13
|
-
type: SymbolType;
|
|
14
|
-
filePath: string;
|
|
15
|
-
line: number;
|
|
16
|
-
column: number;
|
|
17
|
-
endLine?: number;
|
|
18
|
-
endColumn?: number;
|
|
19
|
-
signature?: string;
|
|
20
|
-
scope?: string;
|
|
21
|
-
language: string;
|
|
22
|
-
context?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Code reference types
|
|
26
|
-
*/
|
|
27
|
-
export type ReferenceType = 'definition' | 'usage' | 'import' | 'type';
|
|
28
|
-
/**
|
|
29
|
-
* Code reference information
|
|
30
|
-
*/
|
|
31
|
-
export interface CodeReference {
|
|
32
|
-
symbol: string;
|
|
33
|
-
filePath: string;
|
|
34
|
-
line: number;
|
|
35
|
-
column: number;
|
|
36
|
-
context: string;
|
|
37
|
-
referenceType: ReferenceType;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Semantic search result
|
|
41
|
-
*/
|
|
42
|
-
export interface SemanticSearchResult {
|
|
43
|
-
query: string;
|
|
44
|
-
symbols: CodeSymbol[];
|
|
45
|
-
references: CodeReference[];
|
|
46
|
-
totalResults: number;
|
|
47
|
-
searchTime: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* AST node structure
|
|
51
|
-
*/
|
|
52
|
-
export interface ASTNode {
|
|
53
|
-
type: string;
|
|
54
|
-
name?: string;
|
|
55
|
-
line: number;
|
|
56
|
-
column: number;
|
|
57
|
-
endLine?: number;
|
|
58
|
-
endColumn?: number;
|
|
59
|
-
children?: ASTNode[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Text search result
|
|
63
|
-
*/
|
|
64
|
-
export interface TextSearchResult {
|
|
65
|
-
filePath: string;
|
|
66
|
-
line: number;
|
|
67
|
-
column: number;
|
|
68
|
-
content: string;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Language configuration
|
|
72
|
-
*/
|
|
73
|
-
export interface LanguageConfig {
|
|
74
|
-
extensions: string[];
|
|
75
|
-
parser: string;
|
|
76
|
-
symbolPatterns: {
|
|
77
|
-
function: RegExp;
|
|
78
|
-
class: RegExp;
|
|
79
|
-
variable?: RegExp;
|
|
80
|
-
import?: RegExp;
|
|
81
|
-
export?: RegExp;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Index statistics
|
|
86
|
-
*/
|
|
87
|
-
export interface IndexStats {
|
|
88
|
-
totalFiles: number;
|
|
89
|
-
totalSymbols: number;
|
|
90
|
-
languageBreakdown: Record<string, number>;
|
|
91
|
-
cacheAge: number;
|
|
92
|
-
}
|