@opensumi/ide-ai-native 3.8.1-next-1741228774.0 → 3.8.1-next-1741250387.0
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/lib/browser/ai-core.contextkeys.d.ts +1 -1
- package/lib/browser/ai-core.contextkeys.d.ts.map +1 -1
- package/lib/browser/ai-core.contextkeys.js +1 -1
- package/lib/browser/ai-core.contextkeys.js.map +1 -1
- package/lib/browser/ai-core.contribution.d.ts +0 -5
- package/lib/browser/ai-core.contribution.d.ts.map +1 -1
- package/lib/browser/ai-core.contribution.js +9 -71
- package/lib/browser/ai-core.contribution.js.map +1 -1
- package/lib/browser/chat/chat-agent.service.d.ts +3 -11
- package/lib/browser/chat/chat-agent.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-agent.service.js +5 -43
- package/lib/browser/chat/chat-agent.service.js.map +1 -1
- package/lib/browser/chat/chat-manager.service.d.ts +0 -1
- package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-manager.service.js +8 -6
- package/lib/browser/chat/chat-manager.service.js.map +1 -1
- package/lib/browser/chat/chat-model.d.ts +1 -4
- package/lib/browser/chat/chat-model.d.ts.map +1 -1
- package/lib/browser/chat/chat-model.js +2 -57
- package/lib/browser/chat/chat-model.js.map +1 -1
- package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
- package/lib/browser/chat/chat-proxy.service.js +6 -13
- package/lib/browser/chat/chat-proxy.service.js.map +1 -1
- package/lib/browser/chat/chat.api.service.d.ts +2 -1
- package/lib/browser/chat/chat.api.service.d.ts.map +1 -1
- package/lib/browser/chat/chat.api.service.js +4 -0
- package/lib/browser/chat/chat.api.service.js.map +1 -1
- package/lib/browser/chat/chat.internal.service.d.ts +0 -2
- package/lib/browser/chat/chat.internal.service.d.ts.map +1 -1
- package/lib/browser/chat/chat.internal.service.js +0 -3
- package/lib/browser/chat/chat.internal.service.js.map +1 -1
- package/lib/browser/chat/chat.module.less +2 -1
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +29 -46
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ChatContext/index.js +2 -2
- package/lib/browser/components/ChatContext/index.js.map +1 -1
- package/lib/browser/components/ChatInput.d.ts.map +1 -1
- package/lib/browser/components/ChatInput.js +1 -29
- package/lib/browser/components/ChatInput.js.map +1 -1
- package/lib/browser/components/ChatReply.js +1 -6
- package/lib/browser/components/ChatReply.js.map +1 -1
- package/lib/browser/components/ChatThinking.d.ts +2 -0
- package/lib/browser/components/ChatThinking.d.ts.map +1 -1
- package/lib/browser/components/ChatThinking.js +10 -2
- package/lib/browser/components/ChatThinking.js.map +1 -1
- package/lib/browser/components/ChatToolRender.d.ts.map +1 -1
- package/lib/browser/components/ChatToolRender.js +3 -2
- package/lib/browser/components/ChatToolRender.js.map +1 -1
- package/lib/browser/components/WelcomeMsg.js +1 -1
- package/lib/browser/components/WelcomeMsg.js.map +1 -1
- package/lib/browser/components/chat-history.module.less +1 -2
- package/lib/browser/components/components.module.less +0 -22
- package/lib/browser/context/llm-context.service.d.ts +5 -18
- package/lib/browser/context/llm-context.service.d.ts.map +1 -1
- package/lib/browser/context/llm-context.service.js +47 -81
- package/lib/browser/context/llm-context.service.js.map +1 -1
- package/lib/browser/contrib/inline-completions/inline-completions.controller.js +1 -1
- package/lib/browser/contrib/inline-completions/inline-completions.controller.js.map +1 -1
- package/lib/browser/contrib/inline-completions/prompt/matcher.js +2 -2
- package/lib/browser/contrib/inline-completions/prompt/similarSnippets.d.ts +1 -1
- package/lib/browser/contrib/inline-completions/prompt/similarSnippets.js +2 -2
- package/lib/browser/contrib/intelligent-completions/index.d.ts +1 -2
- package/lib/browser/contrib/intelligent-completions/index.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/index.js +1 -4
- package/lib/browser/contrib/intelligent-completions/index.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.js +2 -2
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.js +5 -6
- package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/code-edits-previewer.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/code-edits-previewer.js +2 -4
- package/lib/browser/contrib/intelligent-completions/view/code-edits-previewer.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/default.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/view/default.js +11 -23
- package/lib/browser/contrib/intelligent-completions/view/default.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +0 -4
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/layout/layout.module.less +4 -4
- package/lib/browser/mcp/base-apply.service.d.ts +11 -26
- package/lib/browser/mcp/base-apply.service.d.ts.map +1 -1
- package/lib/browser/mcp/base-apply.service.js +103 -255
- package/lib/browser/mcp/base-apply.service.js.map +1 -1
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts +0 -6
- package/lib/browser/mcp/mcp-server-proxy.service.d.ts.map +1 -1
- package/lib/browser/mcp/mcp-server-proxy.service.js +1 -10
- package/lib/browser/mcp/mcp-server-proxy.service.js.map +1 -1
- package/lib/browser/mcp/mcp-server.feature.registry.d.ts +0 -8
- package/lib/browser/mcp/mcp-server.feature.registry.d.ts.map +1 -1
- package/lib/browser/mcp/mcp-server.feature.registry.js +3 -28
- package/lib/browser/mcp/mcp-server.feature.registry.js.map +1 -1
- package/lib/browser/mcp/tools/components/EditFile.d.ts.map +1 -1
- package/lib/browser/mcp/tools/components/EditFile.js +9 -15
- package/lib/browser/mcp/tools/components/EditFile.js.map +1 -1
- package/lib/browser/mcp/tools/components/SearchResult.d.ts +11 -0
- package/lib/browser/mcp/tools/components/SearchResult.d.ts.map +1 -0
- package/lib/browser/mcp/tools/components/{ExpandableFileList.js → SearchResult.js} +19 -29
- package/lib/browser/mcp/tools/components/SearchResult.js.map +1 -0
- package/lib/browser/mcp/tools/components/Terminal.d.ts.map +1 -1
- package/lib/browser/mcp/tools/components/Terminal.js +2 -10
- package/lib/browser/mcp/tools/components/Terminal.js.map +1 -1
- package/lib/browser/mcp/tools/components/index.module.less +0 -4
- package/lib/browser/mcp/tools/createNewFileWithText.d.ts +0 -1
- package/lib/browser/mcp/tools/createNewFileWithText.d.ts.map +1 -1
- package/lib/browser/mcp/tools/createNewFileWithText.js +11 -19
- package/lib/browser/mcp/tools/createNewFileWithText.js.map +1 -1
- package/lib/browser/mcp/tools/fileSearch.d.ts +0 -1
- package/lib/browser/mcp/tools/fileSearch.d.ts.map +1 -1
- package/lib/browser/mcp/tools/fileSearch.js +5 -14
- package/lib/browser/mcp/tools/fileSearch.js.map +1 -1
- package/lib/browser/mcp/tools/getDiagnosticsByPath.d.ts.map +1 -1
- package/lib/browser/mcp/tools/getDiagnosticsByPath.js +0 -1
- package/lib/browser/mcp/tools/getDiagnosticsByPath.js.map +1 -1
- package/lib/browser/mcp/tools/grepSearch.d.ts.map +1 -1
- package/lib/browser/mcp/tools/grepSearch.js +3 -6
- package/lib/browser/mcp/tools/grepSearch.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/EditFile.js +1 -1
- package/lib/browser/mcp/tools/handlers/EditFile.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/ListDir.d.ts +0 -1
- package/lib/browser/mcp/tools/handlers/ListDir.d.ts.map +1 -1
- package/lib/browser/mcp/tools/handlers/ListDir.js +0 -3
- package/lib/browser/mcp/tools/handlers/ListDir.js.map +1 -1
- package/lib/browser/mcp/tools/handlers/RunCommand.d.ts.map +1 -1
- package/lib/browser/mcp/tools/handlers/RunCommand.js +0 -2
- package/lib/browser/mcp/tools/handlers/RunCommand.js.map +1 -1
- package/lib/browser/mcp/tools/listDir.d.ts +0 -1
- package/lib/browser/mcp/tools/listDir.d.ts.map +1 -1
- package/lib/browser/mcp/tools/listDir.js +4 -35
- package/lib/browser/mcp/tools/listDir.js.map +1 -1
- package/lib/browser/mcp/tools/runTerminalCmd.d.ts.map +1 -1
- package/lib/browser/mcp/tools/runTerminalCmd.js +0 -1
- package/lib/browser/mcp/tools/runTerminalCmd.js.map +1 -1
- package/lib/browser/model/msg-history-manager.d.ts +2 -2
- package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
- package/lib/browser/model/msg-history-manager.js +10 -4
- package/lib/browser/model/msg-history-manager.js.map +1 -1
- package/lib/browser/preferences/schema.d.ts.map +1 -1
- package/lib/browser/preferences/schema.js +2 -22
- package/lib/browser/preferences/schema.js.map +1 -1
- package/lib/browser/types.d.ts +0 -4
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/widget/inline-chat/inline-chat-controller.d.ts.map +1 -1
- package/lib/browser/widget/inline-chat/inline-chat-controller.js +1 -6
- package/lib/browser/widget/inline-chat/inline-chat-controller.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-manager.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-manager.js +8 -68
- package/lib/browser/widget/inline-diff/inline-diff-manager.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-previewer.d.ts +4 -10
- package/lib/browser/widget/inline-diff/inline-diff-previewer.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-previewer.js +3 -14
- package/lib/browser/widget/inline-diff/inline-diff-previewer.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff-widget.module.less +4 -25
- package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts +3 -3
- package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.js +5 -10
- package/lib/browser/widget/inline-diff/inline-diff.controller.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts +17 -46
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js +53 -110
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts +0 -4
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js +1 -26
- package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js.map +1 -1
- package/lib/common/index.d.ts +4 -13
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -5
- package/lib/common/index.js.map +1 -1
- package/lib/common/llm-context.d.ts +9 -13
- package/lib/common/llm-context.d.ts.map +1 -1
- package/lib/common/llm-context.js.map +1 -1
- package/lib/common/mcp-server-manager.d.ts +1 -17
- package/lib/common/mcp-server-manager.d.ts.map +1 -1
- package/lib/common/mcp-server-manager.js.map +1 -1
- package/lib/common/prompts/context-prompt-provider.d.ts +3 -4
- package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
- package/lib/common/prompts/context-prompt-provider.js +22 -33
- package/lib/common/prompts/context-prompt-provider.js.map +1 -1
- package/lib/common/tool-invocation-registry.d.ts +2 -2
- package/lib/common/tool-invocation-registry.d.ts.map +1 -1
- package/lib/common/tool-invocation-registry.js +1 -1
- package/lib/common/tool-invocation-registry.js.map +1 -1
- package/lib/common/types.d.ts +0 -8
- package/lib/common/types.d.ts.map +1 -1
- package/lib/common/utils.d.ts.map +1 -1
- package/lib/common/utils.js +1 -2
- package/lib/common/utils.js.map +1 -1
- package/lib/node/anthropic/anthropic-language-model.d.ts +1 -3
- package/lib/node/anthropic/anthropic-language-model.d.ts.map +1 -1
- package/lib/node/anthropic/anthropic-language-model.js +2 -6
- package/lib/node/anthropic/anthropic-language-model.js.map +1 -1
- package/lib/node/base-language-model.d.ts +3 -6
- package/lib/node/base-language-model.d.ts.map +1 -1
- package/lib/node/base-language-model.js +31 -14
- package/lib/node/base-language-model.js.map +1 -1
- package/lib/node/deepseek/deepseek-language-model.d.ts +1 -3
- package/lib/node/deepseek/deepseek-language-model.d.ts.map +1 -1
- package/lib/node/deepseek/deepseek-language-model.js +2 -6
- package/lib/node/deepseek/deepseek-language-model.js.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.d.ts +3 -17
- package/lib/node/mcp/sumi-mcp-server.d.ts.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.js +6 -59
- package/lib/node/mcp/sumi-mcp-server.js.map +1 -1
- package/lib/node/mcp-server-manager-impl.d.ts +3 -4
- package/lib/node/mcp-server-manager-impl.d.ts.map +1 -1
- package/lib/node/mcp-server-manager-impl.js +6 -26
- package/lib/node/mcp-server-manager-impl.js.map +1 -1
- package/lib/node/mcp-server.d.ts +16 -5
- package/lib/node/mcp-server.d.ts.map +1 -1
- package/lib/node/mcp-server.js +6 -12
- package/lib/node/mcp-server.js.map +1 -1
- package/lib/node/openai/openai-language-model.d.ts +2 -4
- package/lib/node/openai/openai-language-model.d.ts.map +1 -1
- package/lib/node/openai/openai-language-model.js +4 -6
- package/lib/node/openai/openai-language-model.js.map +1 -1
- package/package.json +26 -27
- package/src/browser/ai-core.contextkeys.ts +3 -3
- package/src/browser/ai-core.contribution.ts +12 -89
- package/src/browser/chat/chat-agent.service.ts +9 -53
- package/src/browser/chat/chat-manager.service.ts +8 -10
- package/src/browser/chat/chat-model.ts +5 -63
- package/src/browser/chat/chat-proxy.service.ts +8 -16
- package/src/browser/chat/chat.api.service.ts +5 -1
- package/src/browser/chat/chat.internal.service.ts +0 -4
- package/src/browser/chat/chat.module.less +2 -1
- package/src/browser/chat/chat.view.tsx +69 -63
- package/src/browser/components/ChatContext/index.tsx +2 -2
- package/src/browser/components/ChatInput.tsx +6 -81
- package/src/browser/components/ChatReply.tsx +6 -6
- package/src/browser/components/ChatThinking.tsx +9 -3
- package/src/browser/components/ChatToolRender.tsx +2 -1
- package/src/browser/components/WelcomeMsg.tsx +1 -1
- package/src/browser/components/chat-history.module.less +1 -2
- package/src/browser/components/components.module.less +0 -22
- package/src/browser/context/llm-context.service.ts +54 -100
- package/src/browser/contrib/inline-completions/inline-completions.controller.ts +1 -1
- package/src/browser/contrib/inline-completions/prompt/matcher.ts +2 -2
- package/src/browser/contrib/inline-completions/prompt/similarSnippets.ts +2 -2
- package/src/browser/contrib/intelligent-completions/index.ts +1 -5
- package/src/browser/contrib/intelligent-completions/intelligent-completions.contribution.ts +3 -3
- package/src/browser/contrib/intelligent-completions/intelligent-completions.controller.ts +6 -7
- package/src/browser/contrib/intelligent-completions/view/code-edits-previewer.ts +2 -4
- package/src/browser/contrib/intelligent-completions/view/default.ts +19 -34
- package/src/browser/index.ts +0 -4
- package/src/browser/layout/layout.module.less +4 -4
- package/src/browser/mcp/base-apply.service.ts +109 -306
- package/src/browser/mcp/mcp-server-proxy.service.ts +2 -14
- package/src/browser/mcp/mcp-server.feature.registry.ts +4 -35
- package/src/browser/mcp/tools/components/EditFile.tsx +9 -16
- package/src/browser/mcp/tools/components/SearchResult.tsx +92 -0
- package/src/browser/mcp/tools/components/Terminal.tsx +2 -13
- package/src/browser/mcp/tools/components/index.module.less +0 -4
- package/src/browser/mcp/tools/createNewFileWithText.ts +12 -21
- package/src/browser/mcp/tools/fileSearch.ts +4 -14
- package/src/browser/mcp/tools/getDiagnosticsByPath.ts +0 -1
- package/src/browser/mcp/tools/grepSearch.ts +3 -6
- package/src/browser/mcp/tools/handlers/EditFile.ts +1 -1
- package/src/browser/mcp/tools/handlers/ListDir.ts +0 -4
- package/src/browser/mcp/tools/handlers/RunCommand.ts +0 -2
- package/src/browser/mcp/tools/listDir.ts +5 -36
- package/src/browser/mcp/tools/runTerminalCmd.ts +0 -1
- package/src/browser/model/msg-history-manager.ts +11 -5
- package/src/browser/preferences/schema.ts +2 -22
- package/src/browser/types.ts +0 -1
- package/src/browser/widget/inline-chat/inline-chat-controller.ts +1 -5
- package/src/browser/widget/inline-diff/inline-diff-manager.tsx +21 -143
- package/src/browser/widget/inline-diff/inline-diff-previewer.ts +7 -25
- package/src/browser/widget/inline-diff/inline-diff-widget.module.less +4 -25
- package/src/browser/widget/inline-diff/inline-diff.controller.ts +8 -16
- package/src/browser/widget/inline-stream-diff/inline-stream-diff.handler.tsx +68 -139
- package/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx +1 -30
- package/src/common/index.ts +4 -15
- package/src/common/llm-context.ts +4 -10
- package/src/common/mcp-server-manager.ts +1 -17
- package/src/common/prompts/context-prompt-provider.ts +29 -38
- package/src/common/tool-invocation-registry.ts +2 -2
- package/src/common/types.ts +0 -8
- package/src/common/utils.ts +1 -3
- package/src/node/anthropic/anthropic-language-model.ts +2 -7
- package/src/node/base-language-model.ts +38 -25
- package/src/node/deepseek/deepseek-language-model.ts +2 -7
- package/src/node/mcp/sumi-mcp-server.ts +9 -67
- package/src/node/mcp-server-manager-impl.ts +9 -30
- package/src/node/mcp-server.ts +14 -11
- package/src/node/openai/openai-language-model.ts +4 -8
- package/lib/browser/mcp/config/components/mcp-config.module.less +0 -178
- package/lib/browser/mcp/config/components/mcp-config.view.d.ts +0 -3
- package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +0 -1
- package/lib/browser/mcp/config/components/mcp-config.view.js +0 -150
- package/lib/browser/mcp/config/components/mcp-config.view.js.map +0 -1
- package/lib/browser/mcp/config/components/mcp-server-form.d.ts +0 -16
- package/lib/browser/mcp/config/components/mcp-server-form.d.ts.map +0 -1
- package/lib/browser/mcp/config/components/mcp-server-form.js +0 -84
- package/lib/browser/mcp/config/components/mcp-server-form.js.map +0 -1
- package/lib/browser/mcp/config/components/mcp-server-form.module.less +0 -78
- package/lib/browser/mcp/config/mcp-config.commands.d.ts +0 -10
- package/lib/browser/mcp/config/mcp-config.commands.d.ts.map +0 -1
- package/lib/browser/mcp/config/mcp-config.commands.js +0 -35
- package/lib/browser/mcp/config/mcp-config.commands.js.map +0 -1
- package/lib/browser/mcp/config/mcp-config.contribution.d.ts +0 -16
- package/lib/browser/mcp/config/mcp-config.contribution.d.ts.map +0 -1
- package/lib/browser/mcp/config/mcp-config.contribution.js +0 -62
- package/lib/browser/mcp/config/mcp-config.contribution.js.map +0 -1
- package/lib/browser/mcp/tools/components/ExpandableFileList.d.ts +0 -13
- package/lib/browser/mcp/tools/components/ExpandableFileList.d.ts.map +0 -1
- package/lib/browser/mcp/tools/components/ExpandableFileList.js.map +0 -1
- package/lib/common/model.d.ts +0 -12
- package/lib/common/model.d.ts.map +0 -1
- package/lib/common/model.js +0 -83
- package/lib/common/model.js.map +0 -1
- package/lib/node/openai-compatible/openai-compatible-language-model.d.ts +0 -10
- package/lib/node/openai-compatible/openai-compatible-language-model.d.ts.map +0 -1
- package/lib/node/openai-compatible/openai-compatible-language-model.js +0 -32
- package/lib/node/openai-compatible/openai-compatible-language-model.js.map +0 -1
- package/src/browser/mcp/config/components/mcp-config.module.less +0 -178
- package/src/browser/mcp/config/components/mcp-config.view.tsx +0 -215
- package/src/browser/mcp/config/components/mcp-server-form.module.less +0 -78
- package/src/browser/mcp/config/components/mcp-server-form.tsx +0 -144
- package/src/browser/mcp/config/mcp-config.commands.ts +0 -29
- package/src/browser/mcp/config/mcp-config.contribution.ts +0 -65
- package/src/browser/mcp/tools/components/ExpandableFileList.tsx +0 -133
- package/src/common/model.ts +0 -90
- package/src/node/openai-compatible/openai-compatible-language-model.ts +0 -30
package/src/common/types.ts
CHANGED
|
@@ -34,12 +34,6 @@ export interface IMCPServerProxyService {
|
|
|
34
34
|
$getMCPTools(): Promise<MCPTool[]>;
|
|
35
35
|
// 通知前端 MCP 服务注册表发生了变化
|
|
36
36
|
$updateMCPServers(): Promise<void>;
|
|
37
|
-
// 获取所有 MCP 服务器列表
|
|
38
|
-
$getServers(): Promise<Array<{ name: string; isStarted: boolean }>>;
|
|
39
|
-
// 启动指定的 MCP 服务器
|
|
40
|
-
$startServer(serverName: string): Promise<void>;
|
|
41
|
-
// 停止指定的 MCP 服务器
|
|
42
|
-
$stopServer(serverName: string): Promise<void>;
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
export interface MCPTool {
|
|
@@ -50,10 +44,8 @@ export interface MCPTool {
|
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
export interface CodeBlockData {
|
|
53
|
-
messageId: string;
|
|
54
47
|
toolCallId: string;
|
|
55
48
|
codeEdit: string;
|
|
56
|
-
originalCode: string;
|
|
57
49
|
updatedCode?: string;
|
|
58
50
|
relativePath: string;
|
|
59
51
|
status: CodeBlockStatus;
|
package/src/common/utils.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { IEditorDocumentModel } from '@opensumi/ide-editor';
|
|
2
2
|
|
|
3
|
-
import { BUILTIN_MCP_SERVER_NAME } from './index';
|
|
4
|
-
|
|
5
3
|
const BACK_QUOTE_3_SYMBOL = '```';
|
|
6
4
|
const MIN_PROMPT_CHARS = 10;
|
|
7
5
|
|
|
@@ -51,4 +49,4 @@ export const extractCodeBlocks = (content: string): string => {
|
|
|
51
49
|
return newContents.join('\n');
|
|
52
50
|
};
|
|
53
51
|
|
|
54
|
-
export const getToolName = (toolName: string, serverName =
|
|
52
|
+
export const getToolName = (toolName: string, serverName = 'sumi-builtin') => `mcp_${serverName}_${toolName}`;
|
|
@@ -4,7 +4,6 @@ import { Injectable } from '@opensumi/di';
|
|
|
4
4
|
import { IAIBackServiceOption } from '@opensumi/ide-core-common';
|
|
5
5
|
import { AINativeSettingSectionsId } from '@opensumi/ide-core-common/lib/settings/ai-native';
|
|
6
6
|
|
|
7
|
-
import { ModelInfo, anthropicModels } from '../../common/model';
|
|
8
7
|
import { BaseLanguageModel } from '../base-language-model';
|
|
9
8
|
|
|
10
9
|
export const AnthropicModelIdentifier = Symbol('AnthropicModelIdentifier');
|
|
@@ -20,11 +19,7 @@ export class AnthropicModel extends BaseLanguageModel {
|
|
|
20
19
|
return createAnthropic({ apiKey });
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
protected getModelIdentifier(provider: AnthropicProvider
|
|
24
|
-
return provider(
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
protected getModelInfo(modelId: string): ModelInfo | undefined {
|
|
28
|
-
return anthropicModels[modelId];
|
|
22
|
+
protected getModelIdentifier(provider: AnthropicProvider) {
|
|
23
|
+
return provider('claude-3-5-sonnet-20241022');
|
|
29
24
|
}
|
|
30
25
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { CoreMessage, ToolExecutionOptions, jsonSchema, streamText, tool } from 'ai';
|
|
2
2
|
|
|
3
3
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
4
|
-
import { IAIBackServiceOption } from '@opensumi/ide-core-common';
|
|
4
|
+
import { ChatMessageRole, IAIBackServiceOption, IChatMessage } from '@opensumi/ide-core-common';
|
|
5
5
|
import { ChatReadableStream } from '@opensumi/ide-core-node';
|
|
6
6
|
import { CancellationToken } from '@opensumi/ide-utils';
|
|
7
7
|
|
|
8
|
-
import { ModelInfo } from '../common';
|
|
9
8
|
import {
|
|
10
9
|
IToolInvocationRegistryManager,
|
|
11
10
|
ToolInvocationRegistryManager,
|
|
@@ -14,13 +13,26 @@ import {
|
|
|
14
13
|
|
|
15
14
|
@Injectable()
|
|
16
15
|
export abstract class BaseLanguageModel {
|
|
17
|
-
static ModelOptions: Record<string, ModelInfo>;
|
|
18
|
-
|
|
19
16
|
@Autowired(ToolInvocationRegistryManager)
|
|
20
17
|
protected readonly toolInvocationRegistryManager: IToolInvocationRegistryManager;
|
|
21
18
|
|
|
22
19
|
protected abstract initializeProvider(options: IAIBackServiceOption): any;
|
|
23
20
|
|
|
21
|
+
private convertChatMessageRole(role: ChatMessageRole) {
|
|
22
|
+
switch (role) {
|
|
23
|
+
case ChatMessageRole.System:
|
|
24
|
+
return 'system';
|
|
25
|
+
case ChatMessageRole.User:
|
|
26
|
+
return 'user';
|
|
27
|
+
case ChatMessageRole.Assistant:
|
|
28
|
+
return 'assistant';
|
|
29
|
+
case ChatMessageRole.Function:
|
|
30
|
+
return 'tool';
|
|
31
|
+
default:
|
|
32
|
+
return 'user';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
async request(
|
|
25
37
|
request: string,
|
|
26
38
|
chatReadableStream: ChatReadableStream,
|
|
@@ -29,14 +41,11 @@ export abstract class BaseLanguageModel {
|
|
|
29
41
|
): Promise<any> {
|
|
30
42
|
const provider = this.initializeProvider(options);
|
|
31
43
|
const clientId = options.clientId;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// 如果没有传入 clientId,则不使用工具
|
|
35
|
-
if (clientId) {
|
|
36
|
-
const registry = this.toolInvocationRegistryManager.getRegistry(clientId);
|
|
37
|
-
allFunctions = options.noTool ? [] : registry.getAllFunctions();
|
|
44
|
+
if (!clientId) {
|
|
45
|
+
throw new Error('clientId is required');
|
|
38
46
|
}
|
|
39
|
-
|
|
47
|
+
const registry = this.toolInvocationRegistryManager.getRegistry(clientId);
|
|
48
|
+
const allFunctions = options.noTool ? [] : registry.getAllFunctions();
|
|
40
49
|
return this.handleStreamingRequest(
|
|
41
50
|
provider,
|
|
42
51
|
request,
|
|
@@ -44,10 +53,11 @@ export abstract class BaseLanguageModel {
|
|
|
44
53
|
chatReadableStream,
|
|
45
54
|
options.history || [],
|
|
46
55
|
options.modelId,
|
|
56
|
+
options.temperature,
|
|
57
|
+
options.topP,
|
|
58
|
+
options.topK,
|
|
47
59
|
options.providerOptions,
|
|
48
60
|
options.trimTexts,
|
|
49
|
-
options.system,
|
|
50
|
-
options.maxTokens,
|
|
51
61
|
cancellationToken,
|
|
52
62
|
);
|
|
53
63
|
}
|
|
@@ -64,19 +74,18 @@ export abstract class BaseLanguageModel {
|
|
|
64
74
|
|
|
65
75
|
protected abstract getModelIdentifier(provider: any, modelId?: string): any;
|
|
66
76
|
|
|
67
|
-
protected abstract getModelInfo(modelId: string): ModelInfo | undefined;
|
|
68
|
-
|
|
69
77
|
protected async handleStreamingRequest(
|
|
70
78
|
provider: any,
|
|
71
79
|
request: string,
|
|
72
80
|
tools: ToolRequest[],
|
|
73
81
|
chatReadableStream: ChatReadableStream,
|
|
74
|
-
history:
|
|
82
|
+
history: IChatMessage[] = [],
|
|
75
83
|
modelId?: string,
|
|
84
|
+
temperature?: number,
|
|
85
|
+
topP?: number,
|
|
86
|
+
topK?: number,
|
|
76
87
|
providerOptions?: Record<string, any>,
|
|
77
88
|
trimTexts?: [string, string],
|
|
78
|
-
systemPrompt?: string,
|
|
79
|
-
maxTokens?: number,
|
|
80
89
|
cancellationToken?: CancellationToken,
|
|
81
90
|
): Promise<any> {
|
|
82
91
|
try {
|
|
@@ -89,20 +98,24 @@ export abstract class BaseLanguageModel {
|
|
|
89
98
|
});
|
|
90
99
|
}
|
|
91
100
|
|
|
92
|
-
const messages: CoreMessage[] = [
|
|
93
|
-
|
|
101
|
+
const messages: CoreMessage[] = [
|
|
102
|
+
...history.map((msg) => ({
|
|
103
|
+
role: this.convertChatMessageRole(msg.role) as any, // 这个 SDK 包里的类型不太好完全对应,
|
|
104
|
+
content: msg.content,
|
|
105
|
+
})),
|
|
106
|
+
{ role: 'user', content: request },
|
|
107
|
+
];
|
|
94
108
|
const stream = streamText({
|
|
95
109
|
model: this.getModelIdentifier(provider, modelId),
|
|
110
|
+
maxTokens: 4096,
|
|
96
111
|
tools: aiTools,
|
|
97
112
|
messages,
|
|
98
113
|
abortSignal: abortController.signal,
|
|
99
114
|
experimental_toolCallStreaming: true,
|
|
100
115
|
maxSteps: 12,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
topK: modelInfo?.topK || 1,
|
|
105
|
-
system: systemPrompt,
|
|
116
|
+
temperature,
|
|
117
|
+
topP: topP || 0.8,
|
|
118
|
+
topK: topK || 1,
|
|
106
119
|
providerOptions,
|
|
107
120
|
});
|
|
108
121
|
|
|
@@ -4,7 +4,6 @@ import { Injectable } from '@opensumi/di';
|
|
|
4
4
|
import { IAIBackServiceOption } from '@opensumi/ide-core-common';
|
|
5
5
|
import { AINativeSettingSectionsId } from '@opensumi/ide-core-common/lib/settings/ai-native';
|
|
6
6
|
|
|
7
|
-
import { ModelInfo, deepSeekModels } from '../../common';
|
|
8
7
|
import { BaseLanguageModel } from '../base-language-model';
|
|
9
8
|
|
|
10
9
|
export const DeepSeekModelIdentifier = Symbol('DeepSeekModelIdentifier');
|
|
@@ -20,11 +19,7 @@ export class DeepSeekModel extends BaseLanguageModel {
|
|
|
20
19
|
return createDeepSeek({ apiKey });
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
protected getModelIdentifier(provider: DeepSeekProvider
|
|
24
|
-
return provider(
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
protected getModelInfo(modelId: string): ModelInfo | undefined {
|
|
28
|
-
return deepSeekModels[modelId];
|
|
22
|
+
protected getModelIdentifier(provider: DeepSeekProvider) {
|
|
23
|
+
return provider('deepseek-chat');
|
|
29
24
|
}
|
|
30
25
|
}
|
|
@@ -10,11 +10,11 @@ import { RPCService } from '@opensumi/ide-connection';
|
|
|
10
10
|
import { ILogger } from '@opensumi/ide-core-common';
|
|
11
11
|
import { INodeLogger } from '@opensumi/ide-core-node';
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { ISumiMCPServerBackend } from '../../common';
|
|
14
|
+
import { MCPServerDescription, MCPServerManager } from '../../common/mcp-server-manager';
|
|
15
15
|
import { IToolInvocationRegistryManager, ToolInvocationRegistryManager } from '../../common/tool-invocation-registry';
|
|
16
16
|
import { IMCPServerProxyService, MCPTool } from '../../common/types';
|
|
17
|
-
import {
|
|
17
|
+
import { IMCPServer } from '../mcp-server';
|
|
18
18
|
import { MCPServerManagerImpl } from '../mcp-server-manager-impl';
|
|
19
19
|
|
|
20
20
|
// 每个 BrowserTab 都对应了一个 SumiMCPServerBackend 实例
|
|
@@ -55,6 +55,7 @@ export class SumiMCPServerBackend extends RPCService<IMCPServerProxyService> imp
|
|
|
55
55
|
}
|
|
56
56
|
// 获取 MCP 工具
|
|
57
57
|
const tools = await this.client.$getMCPTools();
|
|
58
|
+
this.logger.log('[Node backend] SUMI MCP tools', tools);
|
|
58
59
|
return tools;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -80,10 +81,10 @@ export class SumiMCPServerBackend extends RPCService<IMCPServerProxyService> imp
|
|
|
80
81
|
}));
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
public async initBuiltinMCPServer(
|
|
84
|
+
public async initBuiltinMCPServer() {
|
|
84
85
|
const builtinMCPServer = new BuiltinMCPServer(this, this.logger);
|
|
85
86
|
this.mcpServerManager.setClientId(this.clientId);
|
|
86
|
-
await this.mcpServerManager.initBuiltinServer(builtinMCPServer
|
|
87
|
+
await this.mcpServerManager.initBuiltinServer(builtinMCPServer);
|
|
87
88
|
this.client?.$updateMCPServers();
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -129,72 +130,12 @@ export class SumiMCPServerBackend extends RPCService<IMCPServerProxyService> imp
|
|
|
129
130
|
|
|
130
131
|
return this.server;
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
async getServers() {
|
|
134
|
-
const servers = Array.from(this.mcpServerManager.getServers().entries());
|
|
135
|
-
const serverInfos = await Promise.all(
|
|
136
|
-
servers.map(async ([serverName, server]) => {
|
|
137
|
-
let toolNames: string[] = [];
|
|
138
|
-
if (server.isStarted()) {
|
|
139
|
-
// 只获取正在运行的 MCP Server 的工具列表
|
|
140
|
-
const toolsResponse = await server.getTools();
|
|
141
|
-
toolNames = toolsResponse.tools.map((tool) => tool.name);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// OpenSumi 内置的 MCP Server
|
|
145
|
-
if (serverName === BUILTIN_MCP_SERVER_NAME) {
|
|
146
|
-
return {
|
|
147
|
-
name: server.getServerName(),
|
|
148
|
-
isStarted: server.isStarted(),
|
|
149
|
-
type: 'builtin rpc',
|
|
150
|
-
tools: toolNames,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// 第三方 Stdio 类型的 MCP Server
|
|
155
|
-
if (server instanceof StdioMCPServerImpl) {
|
|
156
|
-
return {
|
|
157
|
-
name: server.getServerName(),
|
|
158
|
-
isStarted: server.isStarted(),
|
|
159
|
-
type: 'stdio',
|
|
160
|
-
command: server.command + ' ' + (server.args?.join(' ') || ''),
|
|
161
|
-
tools: toolNames,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// TODO SSE 类型的 MCP Server
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
name: server.getServerName(),
|
|
169
|
-
isStarted: server.isStarted(),
|
|
170
|
-
type: '[MOCK] stdio',
|
|
171
|
-
command: '[MOCK] npx sumi-ide-mcp-server',
|
|
172
|
-
tools: toolNames,
|
|
173
|
-
};
|
|
174
|
-
}),
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
// 将 builtin server 放在第一位
|
|
178
|
-
const builtinServer = serverInfos.find((server) => server.name === BUILTIN_MCP_SERVER_NAME);
|
|
179
|
-
const otherServers = serverInfos.filter((server) => server.name !== BUILTIN_MCP_SERVER_NAME);
|
|
180
|
-
return builtinServer ? [builtinServer, ...otherServers] : otherServers;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
async startServer(serverName: string) {
|
|
184
|
-
await this.mcpServerManager.startServer(serverName);
|
|
185
|
-
this.client?.$updateMCPServers();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
async stopServer(serverName: string) {
|
|
189
|
-
await this.mcpServerManager.stopServer(serverName);
|
|
190
|
-
this.client?.$updateMCPServers();
|
|
191
|
-
}
|
|
192
133
|
}
|
|
193
134
|
|
|
194
135
|
export const TokenBuiltinMCPServer = Symbol('TokenBuiltinMCPServer');
|
|
195
136
|
|
|
196
137
|
export class BuiltinMCPServer implements IMCPServer {
|
|
197
|
-
private started: boolean =
|
|
138
|
+
private started: boolean = true;
|
|
198
139
|
|
|
199
140
|
constructor(private readonly sumiMCPServer: SumiMCPServerBackend, private readonly logger: ILogger) {}
|
|
200
141
|
|
|
@@ -203,7 +144,7 @@ export class BuiltinMCPServer implements IMCPServer {
|
|
|
203
144
|
}
|
|
204
145
|
|
|
205
146
|
getServerName(): string {
|
|
206
|
-
return
|
|
147
|
+
return 'sumi-builtin';
|
|
207
148
|
}
|
|
208
149
|
|
|
209
150
|
async start(): Promise<void> {
|
|
@@ -241,6 +182,7 @@ export class BuiltinMCPServer implements IMCPServer {
|
|
|
241
182
|
throw new Error('MCP Server not started');
|
|
242
183
|
}
|
|
243
184
|
const tools = await this.sumiMCPServer.getMCPTools();
|
|
185
|
+
this.logger.debug('[BuiltinMCPServer] getTools', tools);
|
|
244
186
|
return { tools } as any;
|
|
245
187
|
}
|
|
246
188
|
|
|
@@ -2,12 +2,13 @@ import { ToolExecutionOptions } from 'ai';
|
|
|
2
2
|
|
|
3
3
|
import { ILogger } from '@opensumi/ide-core-common';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { MCPServerDescription, MCPServerManager, MCPTool } from '../common/mcp-server-manager';
|
|
6
6
|
import { IToolInvocationRegistryManager, ToolRequest } from '../common/tool-invocation-registry';
|
|
7
7
|
import { getToolName } from '../common/utils';
|
|
8
8
|
|
|
9
9
|
import { BuiltinMCPServer } from './mcp/sumi-mcp-server';
|
|
10
|
-
import {
|
|
10
|
+
import { IMCPServer, MCPServerImpl } from './mcp-server';
|
|
11
|
+
|
|
11
12
|
// 这应该是 Browser Tab 维度的,每个 Tab 对应一个 MCPServerManagerImpl
|
|
12
13
|
export class MCPServerManagerImpl implements MCPServerManager {
|
|
13
14
|
protected servers: Map<string, IMCPServer> = new Map();
|
|
@@ -15,10 +16,6 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
15
16
|
// 当前实例对应的 clientId
|
|
16
17
|
private clientId: string;
|
|
17
18
|
|
|
18
|
-
getServers(): Map<string, IMCPServer> {
|
|
19
|
-
return this.servers;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
19
|
constructor(
|
|
23
20
|
private readonly toolInvocationRegistryManager: IToolInvocationRegistryManager,
|
|
24
21
|
private readonly logger: ILogger,
|
|
@@ -28,20 +25,13 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
28
25
|
this.clientId = clientId;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
|
-
private unregisterServerTools(serverName: string) {
|
|
32
|
-
const registry = this.toolInvocationRegistryManager.getRegistry(this.clientId);
|
|
33
|
-
registry.unregisterProviderTools(serverName);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
28
|
async stopServer(serverName: string): Promise<void> {
|
|
37
29
|
const server = this.servers.get(serverName);
|
|
38
30
|
if (!server) {
|
|
39
31
|
throw new Error(`MCP server "${serverName}" not found.`);
|
|
40
32
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.unregisterServerTools(serverName);
|
|
44
|
-
this.logger.log(`MCP server "${serverName}" stopped and tools unregistered.`);
|
|
33
|
+
server.stop();
|
|
34
|
+
this.logger.log(`MCP server "${serverName}" stopped.`);
|
|
45
35
|
}
|
|
46
36
|
|
|
47
37
|
async getStartedServers(): Promise<string[]> {
|
|
@@ -73,7 +63,6 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
73
63
|
throw new Error(`MCP server "${serverName}" not found.`);
|
|
74
64
|
}
|
|
75
65
|
await server.start();
|
|
76
|
-
await this.registerTools(serverName);
|
|
77
66
|
}
|
|
78
67
|
|
|
79
68
|
async getServerNames(): Promise<string[]> {
|
|
@@ -133,7 +122,7 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
133
122
|
if (existingServer) {
|
|
134
123
|
existingServer.update(command, args, env);
|
|
135
124
|
} else {
|
|
136
|
-
const newServer = new
|
|
125
|
+
const newServer = new MCPServerImpl(name, command, args, env, this.logger);
|
|
137
126
|
this.servers.set(name, newServer);
|
|
138
127
|
}
|
|
139
128
|
}
|
|
@@ -142,23 +131,16 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
142
131
|
this.servers.set(server.getServerName(), server);
|
|
143
132
|
}
|
|
144
133
|
|
|
145
|
-
|
|
146
|
-
async initBuiltinServer(builtinMCPServer: BuiltinMCPServer, enabled: boolean = true): Promise<void> {
|
|
134
|
+
async initBuiltinServer(builtinMCPServer: BuiltinMCPServer): Promise<void> {
|
|
147
135
|
this.addOrUpdateServerDirectly(builtinMCPServer);
|
|
148
|
-
|
|
149
|
-
await builtinMCPServer.start();
|
|
150
|
-
await this.registerTools(builtinMCPServer.getServerName());
|
|
151
|
-
}
|
|
136
|
+
await this.registerTools(builtinMCPServer.getServerName());
|
|
152
137
|
}
|
|
153
138
|
|
|
154
139
|
async addExternalMCPServers(servers: MCPServerDescription[]): Promise<void> {
|
|
155
140
|
for (const server of servers) {
|
|
156
141
|
this.addOrUpdateServer(server);
|
|
157
|
-
if (!server.enabled) {
|
|
158
|
-
// 如果是 enabled 为 false 的 server,则不进行启动
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
142
|
await this.startServer(server.name);
|
|
143
|
+
await this.registerTools(server.name);
|
|
162
144
|
}
|
|
163
145
|
}
|
|
164
146
|
|
|
@@ -166,10 +148,7 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
166
148
|
const server = this.servers.get(name);
|
|
167
149
|
if (server) {
|
|
168
150
|
server.stop();
|
|
169
|
-
// 移除服务器时,也需要从注册表中移除该服务器的所有工具
|
|
170
|
-
this.unregisterServerTools(name);
|
|
171
151
|
this.servers.delete(name);
|
|
172
|
-
this.logger.log(`MCP server "${name}" removed and tools unregistered.`);
|
|
173
152
|
} else {
|
|
174
153
|
this.logger.warn(`MCP server "${name}" not found.`);
|
|
175
154
|
}
|
package/src/node/mcp-server.ts
CHANGED
|
@@ -4,12 +4,20 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
|
|
|
4
4
|
|
|
5
5
|
import { ILogger } from '@opensumi/ide-core-common';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export interface IMCPServer {
|
|
8
|
+
isStarted(): boolean;
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
getServerName(): string;
|
|
11
|
+
callTool(toolName: string, toolCallId: string, arg_string: string): ReturnType<Client['callTool']>;
|
|
12
|
+
getTools(): ReturnType<Client['listTools']>;
|
|
13
|
+
update(command: string, args?: string[], env?: { [key: string]: string }): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
}
|
|
8
16
|
|
|
9
|
-
export class
|
|
17
|
+
export class MCPServerImpl implements IMCPServer {
|
|
10
18
|
private name: string;
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
private command: string;
|
|
20
|
+
private args?: string[];
|
|
13
21
|
private client: Client;
|
|
14
22
|
private env?: { [key: string]: string };
|
|
15
23
|
private started: boolean = false;
|
|
@@ -108,17 +116,12 @@ export class StdioMCPServerImpl implements IMCPServer {
|
|
|
108
116
|
this.env = env;
|
|
109
117
|
}
|
|
110
118
|
|
|
111
|
-
|
|
119
|
+
stop(): void {
|
|
112
120
|
if (!this.started || !this.client) {
|
|
113
121
|
return;
|
|
114
122
|
}
|
|
115
123
|
this.logger?.log(`Stopping MCP server "${this.name}"`);
|
|
116
|
-
|
|
117
|
-
await this.client.close();
|
|
118
|
-
} catch (error) {
|
|
119
|
-
this.logger?.error(`Failed to stop MCP server "${this.name}":`, error);
|
|
120
|
-
}
|
|
121
|
-
this.logger?.log(`MCP server "${this.name}" stopped`);
|
|
124
|
+
this.client.close();
|
|
122
125
|
this.started = false;
|
|
123
126
|
}
|
|
124
127
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { OpenAIProvider, createOpenAI } from '@ai-sdk/openai';
|
|
2
|
-
import { LanguageModelV1 } from 'ai';
|
|
3
2
|
|
|
4
3
|
import { Injectable } from '@opensumi/di';
|
|
5
4
|
import { AINativeSettingSectionsId, IAIBackServiceOption } from '@opensumi/ide-core-common';
|
|
6
5
|
|
|
7
|
-
import { ModelInfo, openAiNativeModels } from '../../common/model';
|
|
8
6
|
import { BaseLanguageModel } from '../base-language-model';
|
|
7
|
+
export const DeepSeekModelIdentifier = Symbol('DeepSeekModelIdentifier');
|
|
9
8
|
|
|
10
9
|
@Injectable()
|
|
11
10
|
export class OpenAIModel extends BaseLanguageModel {
|
|
@@ -16,14 +15,11 @@ export class OpenAIModel extends BaseLanguageModel {
|
|
|
16
15
|
}
|
|
17
16
|
return createOpenAI({
|
|
18
17
|
apiKey,
|
|
18
|
+
baseURL: options.baseURL || 'https://dashscope.aliyuncs.com/compatible-mode/v1',
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
protected getModelIdentifier(provider: OpenAIProvider, modelId
|
|
23
|
-
return provider(modelId
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
protected getModelInfo(modelId: string): ModelInfo | undefined {
|
|
27
|
-
return openAiNativeModels[modelId];
|
|
22
|
+
protected getModelIdentifier(provider: OpenAIProvider, modelId?: string) {
|
|
23
|
+
return provider(modelId || 'qwen-max');
|
|
28
24
|
}
|
|
29
25
|
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
padding: 20px;
|
|
3
|
-
color: var(--foreground);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.header {
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
align-items: flex-start;
|
|
10
|
-
margin-bottom: 24px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.title {
|
|
14
|
-
margin: 0 0 8px 0;
|
|
15
|
-
font-size: 24px;
|
|
16
|
-
font-weight: 600;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.description {
|
|
20
|
-
margin: 0;
|
|
21
|
-
color: var(--descriptionForeground);
|
|
22
|
-
font-size: 14px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.addButton {
|
|
26
|
-
padding: 8px 16px;
|
|
27
|
-
border-radius: 4px;
|
|
28
|
-
background-color: var(--button-primary-background);
|
|
29
|
-
color: var(--button-primary-foreground);
|
|
30
|
-
border: none;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
font-size: 13px;
|
|
33
|
-
|
|
34
|
-
&:hover {
|
|
35
|
-
background-color: var(--button-primary-hover-background);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.serversList {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
gap: 12px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.serverItem {
|
|
46
|
-
padding: 16px;
|
|
47
|
-
border-radius: 8px;
|
|
48
|
-
background-color: var(--editorWidget-background);
|
|
49
|
-
border: 1px solid var(--border-color);
|
|
50
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
51
|
-
transition: all 0.2s ease;
|
|
52
|
-
|
|
53
|
-
&:hover {
|
|
54
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
55
|
-
border-color: var(--focusBorder);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.serverHeader {
|
|
60
|
-
display: flex;
|
|
61
|
-
justify-content: space-between;
|
|
62
|
-
align-items: center;
|
|
63
|
-
margin-bottom: 12px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.serverTitleRow {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: 8px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.serverName {
|
|
73
|
-
margin: 0;
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
font-weight: 500;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.serverStatus,
|
|
79
|
-
.serverType {
|
|
80
|
-
font-size: 12px;
|
|
81
|
-
padding: 2px 8px;
|
|
82
|
-
border-radius: 12px;
|
|
83
|
-
font-weight: 500;
|
|
84
|
-
display: inline-flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.serverType {
|
|
89
|
-
background-color: var(--editor-background);
|
|
90
|
-
color: var(--descriptionForeground);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.running {
|
|
94
|
-
background-color: var(--notification-info-background);
|
|
95
|
-
color: var(--notification-info-foreground);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.stopped {
|
|
99
|
-
background-color: var(--notification-error-background);
|
|
100
|
-
color: var(--notification-error-foreground);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.serverActions {
|
|
104
|
-
display: flex;
|
|
105
|
-
gap: 4px;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.iconButton {
|
|
109
|
-
padding: 4px;
|
|
110
|
-
border: none;
|
|
111
|
-
background: none;
|
|
112
|
-
color: var(--icon-foreground);
|
|
113
|
-
cursor: pointer;
|
|
114
|
-
border-radius: 4px;
|
|
115
|
-
|
|
116
|
-
&:hover {
|
|
117
|
-
background-color: var(--list-hover-background);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.serverDetail {
|
|
122
|
-
margin-top: 12px;
|
|
123
|
-
padding: 12px;
|
|
124
|
-
border-radius: 6px;
|
|
125
|
-
background-color: var(--editor-background);
|
|
126
|
-
font-size: 13px;
|
|
127
|
-
|
|
128
|
-
&:not(:last-child) {
|
|
129
|
-
margin-bottom: 8px;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.detailRow {
|
|
134
|
-
display: flex;
|
|
135
|
-
gap: 8px;
|
|
136
|
-
margin-bottom: 4px;
|
|
137
|
-
align-items: center;
|
|
138
|
-
|
|
139
|
-
&:last-child {
|
|
140
|
-
margin-bottom: 0;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.detailLabel {
|
|
145
|
-
color: var(--descriptionForeground);
|
|
146
|
-
min-width: 70px;
|
|
147
|
-
height: 24px;
|
|
148
|
-
display: flex;
|
|
149
|
-
align-items: center;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.detailContent {
|
|
153
|
-
color: var(--foreground);
|
|
154
|
-
word-break: break-all;
|
|
155
|
-
flex: 1;
|
|
156
|
-
background-color: var(--editor-background);
|
|
157
|
-
padding: 4px 8px;
|
|
158
|
-
border-radius: 4px;
|
|
159
|
-
font-family: var(--monaco-monospace-font);
|
|
160
|
-
min-height: 24px;
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
gap: 8px;
|
|
164
|
-
flex-wrap: wrap;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.toolTag {
|
|
168
|
-
display: inline-flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
padding: 2px 8px;
|
|
171
|
-
background-color: var(--editorWidget-background);
|
|
172
|
-
color: var(--button-secondary-foreground);
|
|
173
|
-
border-radius: 12px;
|
|
174
|
-
font-size: 12px;
|
|
175
|
-
font-weight: 500;
|
|
176
|
-
transition: all 0.2s ease;
|
|
177
|
-
border: 1px solid var(--border-color);
|
|
178
|
-
}
|