@opensumi/ide-ai-native 3.8.3-next-1744969919.0 → 3.8.3-next-1745295615.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/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 +0 -11
- package/lib/browser/chat/chat-manager.service.js.map +1 -1
- package/lib/browser/chat/chat-model.d.ts +0 -4
- package/lib/browser/chat/chat-model.d.ts.map +1 -1
- package/lib/browser/chat/chat-model.js +2 -11
- package/lib/browser/chat/chat-model.js.map +1 -1
- package/lib/browser/chat/chat.view.d.ts.map +1 -1
- package/lib/browser/chat/chat.view.js +1 -6
- package/lib/browser/chat/chat.view.js.map +1 -1
- package/lib/browser/components/ChatMentionInput.d.ts +0 -2
- package/lib/browser/components/ChatMentionInput.d.ts.map +1 -1
- package/lib/browser/components/ChatMentionInput.js +2 -3
- package/lib/browser/components/ChatMentionInput.js.map +1 -1
- package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -1
- package/lib/browser/components/mention-input/mention-input.js +1 -1
- package/lib/browser/components/mention-input/mention-input.js.map +1 -1
- package/lib/browser/components/mention-input/types.d.ts +0 -1
- package/lib/browser/components/mention-input/types.d.ts.map +1 -1
- package/lib/browser/components/mention-input/types.js.map +1 -1
- package/lib/browser/contrib/inline-completions/prompt/importedFiles.d.ts.map +1 -1
- package/lib/browser/contrib/inline-completions/prompt/importedFiles.js +2 -1
- package/lib/browser/contrib/inline-completions/prompt/importedFiles.js.map +1 -1
- package/lib/browser/contrib/inline-completions/prompt/languages.d.ts +4 -0
- package/lib/browser/contrib/inline-completions/prompt/languages.d.ts.map +1 -0
- package/lib/browser/contrib/inline-completions/prompt/languages.js +67 -0
- package/lib/browser/contrib/inline-completions/prompt/languages.js.map +1 -0
- package/lib/browser/contrib/merge-conflict/index.d.ts.map +1 -1
- package/lib/browser/contrib/merge-conflict/index.js +2 -5
- package/lib/browser/contrib/merge-conflict/index.js.map +1 -1
- package/lib/browser/model/msg-history-manager.d.ts +0 -1
- package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
- package/lib/browser/model/msg-history-manager.js +0 -3
- package/lib/browser/model/msg-history-manager.js.map +1 -1
- package/lib/common/index.d.ts +2 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/mcp-server-manager.d.ts +4 -1
- package/lib/common/mcp-server-manager.d.ts.map +1 -1
- package/lib/common/mcp-server-manager.js.map +1 -1
- package/lib/common/types.d.ts +6 -0
- package/lib/common/types.d.ts.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.d.ts +2 -0
- package/lib/node/mcp/sumi-mcp-server.d.ts.map +1 -1
- package/lib/node/mcp/sumi-mcp-server.js +6 -0
- package/lib/node/mcp/sumi-mcp-server.js.map +1 -1
- package/lib/node/mcp-server-manager-impl.d.ts +1 -0
- package/lib/node/mcp-server-manager-impl.d.ts.map +1 -1
- package/lib/node/mcp-server-manager-impl.js +5 -2
- package/lib/node/mcp-server-manager-impl.js.map +1 -1
- package/lib/node/mcp-server.sse.d.ts +6 -1
- package/lib/node/mcp-server.sse.d.ts.map +1 -1
- package/lib/node/mcp-server.sse.js +7 -2
- package/lib/node/mcp-server.sse.js.map +1 -1
- package/lib/node/mcp-server.stdio.d.ts +2 -0
- package/lib/node/mcp-server.stdio.d.ts.map +1 -1
- package/lib/node/mcp-server.stdio.js +3 -0
- package/lib/node/mcp-server.stdio.js.map +1 -1
- package/package.json +23 -23
- package/src/browser/chat/chat-manager.service.ts +0 -12
- package/src/browser/chat/chat-model.ts +1 -13
- package/src/browser/chat/chat.view.tsx +0 -7
- package/src/browser/components/ChatMentionInput.tsx +2 -5
- package/src/browser/components/mention-input/mention-input.tsx +0 -1
- package/src/browser/components/mention-input/types.ts +0 -1
- package/src/browser/contrib/inline-completions/prompt/importedFiles.ts +3 -1
- package/src/browser/contrib/inline-completions/prompt/languages.ts +65 -0
- package/src/browser/contrib/merge-conflict/index.ts +2 -3
- package/src/browser/model/msg-history-manager.ts +0 -4
- package/src/common/index.ts +2 -1
- package/src/common/mcp-server-manager.ts +4 -1
- package/src/common/types.ts +7 -0
- package/src/node/mcp/sumi-mcp-server.ts +8 -0
- package/src/node/mcp-server-manager-impl.ts +6 -2
- package/src/node/mcp-server.sse.ts +15 -2
- package/src/node/mcp-server.stdio.ts +4 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const LANGUAGE_TO_SUFFIX: {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
} = {
|
|
4
|
+
abap: '.abap',
|
|
5
|
+
bat: '.bat',
|
|
6
|
+
bibtex: '.bib',
|
|
7
|
+
c: '.c',
|
|
8
|
+
clojure: '.clj',
|
|
9
|
+
coffeescript: '.coffee',
|
|
10
|
+
cpp: '.cpp',
|
|
11
|
+
csharp: '.cs',
|
|
12
|
+
css: '.css',
|
|
13
|
+
'cuda-cpp': '.cu',
|
|
14
|
+
dart: '.dart',
|
|
15
|
+
diff: '.diff',
|
|
16
|
+
dockerfile: '.dockerfile',
|
|
17
|
+
fsharp: '.fs',
|
|
18
|
+
go: '.go',
|
|
19
|
+
groovy: '.groovy',
|
|
20
|
+
haml: '.haml',
|
|
21
|
+
handlebars: '.handlebars',
|
|
22
|
+
hlsl: '.hlsl',
|
|
23
|
+
html: '.html',
|
|
24
|
+
ini: '.ini',
|
|
25
|
+
jade: '.jade',
|
|
26
|
+
java: '.java',
|
|
27
|
+
javascript: '.js',
|
|
28
|
+
javascriptreact: '.jsx',
|
|
29
|
+
json: '.json',
|
|
30
|
+
julia: '.jl',
|
|
31
|
+
latex: '.tex',
|
|
32
|
+
less: '.less',
|
|
33
|
+
lua: '.lua',
|
|
34
|
+
makefile: '.make',
|
|
35
|
+
markdown: '.md',
|
|
36
|
+
'objective-c': '.m',
|
|
37
|
+
'objective-cpp': '.mm',
|
|
38
|
+
perl: '.pl',
|
|
39
|
+
perl6: '.6pl',
|
|
40
|
+
php: '.php',
|
|
41
|
+
plaintext: '.txt',
|
|
42
|
+
powershell: '.ps1',
|
|
43
|
+
pug: '.pug',
|
|
44
|
+
python: '.py',
|
|
45
|
+
r: '.r',
|
|
46
|
+
razor: '.cshtml',
|
|
47
|
+
ruby: '.rb',
|
|
48
|
+
rust: '.rs',
|
|
49
|
+
sass: '.sass',
|
|
50
|
+
scss: '.scss',
|
|
51
|
+
shaderlab: '.shader',
|
|
52
|
+
shellscript: '.sh',
|
|
53
|
+
slim: '.slim',
|
|
54
|
+
sql: '.sql',
|
|
55
|
+
stylus: '.styl',
|
|
56
|
+
swift: '.swift',
|
|
57
|
+
tex: '.tex',
|
|
58
|
+
typescript: '.ts',
|
|
59
|
+
typescriptreact: '.tsx',
|
|
60
|
+
vb: '.vb',
|
|
61
|
+
vue: '.vue',
|
|
62
|
+
xml: '.xml',
|
|
63
|
+
xsl: '.xsl',
|
|
64
|
+
yaml: '.yaml',
|
|
65
|
+
};
|
|
@@ -439,9 +439,8 @@ export class MergeConflictContribution
|
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
private getCacheResolvedConflicts(currentUri?: string) {
|
|
442
|
-
currentUri = currentUri || this.getModel()?.uri.toString();
|
|
443
442
|
if (!currentUri) {
|
|
444
|
-
|
|
443
|
+
currentUri = this.getModel().uri.toString();
|
|
445
444
|
}
|
|
446
445
|
const cache = this.cacheResolvedConflicts.get(currentUri);
|
|
447
446
|
if (cache) {
|
|
@@ -943,7 +942,7 @@ export class MergeConflictContribution
|
|
|
943
942
|
* 刷新 codelens
|
|
944
943
|
*/
|
|
945
944
|
private updateCodeLens() {
|
|
946
|
-
if (this.getModel()
|
|
945
|
+
if (this.getModel().uri) {
|
|
947
946
|
// @ts-ignore
|
|
948
947
|
languageFeaturesService.codeLensProvider._onDidChange.fire();
|
|
949
948
|
}
|
package/src/common/index.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { DESIGN_MENUBAR_CONTAINER_VIEW_ID } from '@opensumi/ide-design/lib/common/constants';
|
|
16
16
|
import { IPosition, ITextModel, InlineCompletionContext } from '@opensumi/ide-monaco/lib/common';
|
|
17
17
|
|
|
18
|
-
import { MCPServerDescription } from './mcp-server-manager';
|
|
18
|
+
import { IMCPServer, MCPServerDescription } from './mcp-server-manager';
|
|
19
19
|
import { IPartialEditEvent, MCPTool } from './types';
|
|
20
20
|
|
|
21
21
|
import type { CoreMessage } from 'ai';
|
|
@@ -151,6 +151,7 @@ export interface ISumiMCPServerBackend {
|
|
|
151
151
|
$addOrUpdateServer(description: MCPServerDescription): void;
|
|
152
152
|
$removeServer(name: string): void;
|
|
153
153
|
$syncServer(name: string): Promise<void>;
|
|
154
|
+
$getMCPServerByName(name: string): IMCPServer | undefined;
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
export const SumiMCPServerProxyServicePath = 'SumiMCPServerProxyServicePath';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
2
|
|
|
3
|
-
import { MCP_SERVER_TYPE } from './types';
|
|
3
|
+
import { MCP_SERVER_TYPE, SSEClientTransportOptions } from './types';
|
|
4
4
|
|
|
5
5
|
export interface IMCPServer {
|
|
6
6
|
isStarted(): boolean;
|
|
@@ -8,6 +8,7 @@ export interface IMCPServer {
|
|
|
8
8
|
getServerName(): string;
|
|
9
9
|
callTool(toolName: string, toolCallId: string, arg_string: string): ReturnType<Client['callTool']>;
|
|
10
10
|
getTools(): ReturnType<Client['listTools']>;
|
|
11
|
+
getClient(): Client | null;
|
|
11
12
|
update(command: string, args?: string[], env?: { [key: string]: string }): void;
|
|
12
13
|
stop(): void;
|
|
13
14
|
}
|
|
@@ -32,6 +33,7 @@ export interface MCPServerManager {
|
|
|
32
33
|
registerTools(serverName: string): Promise<void>;
|
|
33
34
|
addExternalMCPServers(servers: MCPServerDescription[]): void;
|
|
34
35
|
getServers(): Map<string, IMCPServer>;
|
|
36
|
+
getServerByName(name: string): IMCPServer | undefined;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export type MCPTool = Awaited<ReturnType<MCPServerManager['getTools']>>['tools'][number];
|
|
@@ -76,6 +78,7 @@ export interface SSEMCPServerDescription extends BaseMCPServerDescription {
|
|
|
76
78
|
* The host of the MCP server.
|
|
77
79
|
*/
|
|
78
80
|
serverHost: string;
|
|
81
|
+
transportOptions?: SSEClientTransportOptions;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
export interface BuiltinMCPServerDescription {
|
package/src/common/types.ts
CHANGED
|
@@ -60,6 +60,10 @@ export class SumiMCPServerBackend extends RPCService<IMCPServerProxyService> imp
|
|
|
60
60
|
return tools;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
$getMCPServerByName(name: string) {
|
|
64
|
+
return this.mcpServerManager.getServerByName(name);
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
async callMCPTool(name: string, args: any) {
|
|
64
68
|
if (!this.client) {
|
|
65
69
|
throw new Error('SUMI MCP RPC Client not initialized');
|
|
@@ -232,6 +236,10 @@ export class BuiltinMCPServer implements IMCPServer {
|
|
|
232
236
|
return BUILTIN_MCP_SERVER_NAME;
|
|
233
237
|
}
|
|
234
238
|
|
|
239
|
+
getClient(): Client | null {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
|
|
235
243
|
async start(): Promise<void> {
|
|
236
244
|
if (this.started) {
|
|
237
245
|
return;
|
|
@@ -92,6 +92,10 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
92
92
|
return Array.from(this.servers.keys());
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
getServerByName(name: string): IMCPServer | undefined {
|
|
96
|
+
return this.servers.get(name);
|
|
97
|
+
}
|
|
98
|
+
|
|
95
99
|
private convertToToolRequest(tool: MCPTool, serverName: string): ToolRequest {
|
|
96
100
|
const id = getToolName(tool.name, serverName);
|
|
97
101
|
|
|
@@ -153,11 +157,11 @@ export class MCPServerManagerImpl implements MCPServerManager {
|
|
|
153
157
|
this.servers.set(name, newServer);
|
|
154
158
|
}
|
|
155
159
|
} else if (description.type === MCP_SERVER_TYPE.SSE) {
|
|
156
|
-
const { name, serverHost } = description;
|
|
160
|
+
const { name, serverHost, transportOptions } = description;
|
|
157
161
|
if (existingServer) {
|
|
158
162
|
existingServer.update(serverHost);
|
|
159
163
|
} else {
|
|
160
|
-
const newServer = new SSEMCPServer(name, serverHost, this.logger);
|
|
164
|
+
const newServer = new SSEMCPServer(name, serverHost, this.logger, transportOptions);
|
|
161
165
|
this.servers.set(name, newServer);
|
|
162
166
|
}
|
|
163
167
|
}
|
|
@@ -6,17 +6,25 @@ import { ILogger } from '@opensumi/ide-core-common';
|
|
|
6
6
|
|
|
7
7
|
import pkg from '../../package.json';
|
|
8
8
|
import { IMCPServer } from '../common/mcp-server-manager';
|
|
9
|
+
import { SSEClientTransportOptions } from '../common/types';
|
|
9
10
|
|
|
10
11
|
global.EventSource = EventSource as any;
|
|
11
12
|
export class SSEMCPServer implements IMCPServer {
|
|
12
13
|
private name: string;
|
|
13
14
|
public serverHost: string;
|
|
15
|
+
private transportOptions?: SSEClientTransportOptions;
|
|
14
16
|
private client: Client;
|
|
15
17
|
private started: boolean = false;
|
|
16
18
|
|
|
17
|
-
constructor(
|
|
19
|
+
constructor(
|
|
20
|
+
name: string,
|
|
21
|
+
serverHost: string,
|
|
22
|
+
private readonly logger?: ILogger,
|
|
23
|
+
private readonly options?: SSEClientTransportOptions,
|
|
24
|
+
) {
|
|
18
25
|
this.name = name;
|
|
19
26
|
this.serverHost = serverHost;
|
|
27
|
+
this.transportOptions = options;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
isStarted(): boolean {
|
|
@@ -27,6 +35,10 @@ export class SSEMCPServer implements IMCPServer {
|
|
|
27
35
|
return this.name;
|
|
28
36
|
}
|
|
29
37
|
|
|
38
|
+
getClient(): Client | null {
|
|
39
|
+
return this.client;
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
async start(): Promise<void> {
|
|
31
43
|
if (this.started) {
|
|
32
44
|
return;
|
|
@@ -35,7 +47,8 @@ export class SSEMCPServer implements IMCPServer {
|
|
|
35
47
|
|
|
36
48
|
const SSEClientTransport = (await import('@modelcontextprotocol/sdk/client/sse.js')).SSEClientTransport;
|
|
37
49
|
|
|
38
|
-
const transport = new SSEClientTransport(new URL(this.serverHost));
|
|
50
|
+
const transport = new SSEClientTransport(new URL(this.serverHost), this.transportOptions);
|
|
51
|
+
|
|
39
52
|
transport.onerror = (error) => {
|
|
40
53
|
this.logger?.error('Transport Error:', error);
|
|
41
54
|
};
|