@opensumi/ide-ai-native 3.8.3-next-1741752385.0 → 3.8.3-next-1741763277.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.
Files changed (111) hide show
  1. package/lib/browser/chat/chat-model.d.ts +2 -2
  2. package/lib/browser/chat/chat-model.d.ts.map +1 -1
  3. package/lib/browser/chat/chat-model.js +18 -1
  4. package/lib/browser/chat/chat-model.js.map +1 -1
  5. package/lib/browser/components/ChatReply.d.ts.map +1 -1
  6. package/lib/browser/components/ChatReply.js +35 -17
  7. package/lib/browser/components/ChatReply.js.map +1 -1
  8. package/lib/browser/components/ChatThinking.js +1 -1
  9. package/lib/browser/components/ChatThinking.js.map +1 -1
  10. package/lib/browser/components/WelcomeMsg.js +1 -1
  11. package/lib/browser/components/WelcomeMsg.js.map +1 -1
  12. package/lib/browser/components/components.module.less +24 -0
  13. package/lib/browser/contrib/inline-completions/prompt/matcher.js +2 -2
  14. package/lib/browser/contrib/inline-completions/prompt/similarSnippets.d.ts +1 -1
  15. package/lib/browser/contrib/inline-completions/prompt/similarSnippets.js +2 -2
  16. package/lib/browser/contrib/intelligent-completions/view/default.d.ts.map +1 -1
  17. package/lib/browser/contrib/intelligent-completions/view/default.js.map +1 -1
  18. package/lib/browser/mcp/config/components/mcp-config.view.d.ts.map +1 -1
  19. package/lib/browser/mcp/config/components/mcp-config.view.js +28 -18
  20. package/lib/browser/mcp/config/components/mcp-config.view.js.map +1 -1
  21. package/lib/browser/mcp/config/components/mcp-server-form.d.ts.map +1 -1
  22. package/lib/browser/mcp/config/components/mcp-server-form.js +33 -25
  23. package/lib/browser/mcp/config/components/mcp-server-form.js.map +1 -1
  24. package/lib/browser/mcp/mcp-server.feature.registry.js +1 -1
  25. package/lib/browser/mcp/mcp-server.feature.registry.js.map +1 -1
  26. package/lib/browser/mcp/tools/components/ExpandableFileList.d.ts.map +1 -1
  27. package/lib/browser/mcp/tools/components/ExpandableFileList.js +3 -1
  28. package/lib/browser/mcp/tools/components/ExpandableFileList.js.map +1 -1
  29. package/lib/browser/mcp/tools/components/Terminal.d.ts.map +1 -1
  30. package/lib/browser/mcp/tools/components/Terminal.js +6 -5
  31. package/lib/browser/mcp/tools/components/Terminal.js.map +1 -1
  32. package/lib/browser/mcp/tools/components/computeAnsiLogString.d.ts +4 -0
  33. package/lib/browser/mcp/tools/components/computeAnsiLogString.d.ts.map +1 -0
  34. package/lib/browser/mcp/tools/components/computeAnsiLogString.js +22 -0
  35. package/lib/browser/mcp/tools/components/computeAnsiLogString.js.map +1 -0
  36. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.d.ts +18 -0
  37. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.d.ts.map +1 -0
  38. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.js +69 -0
  39. package/lib/browser/mcp/tools/components/filterEraseMultipleLine.js.map +1 -0
  40. package/lib/browser/mcp/tools/components/index.module.less +8 -5
  41. package/lib/browser/mcp/tools/createNewFileWithText.d.ts.map +1 -1
  42. package/lib/browser/mcp/tools/createNewFileWithText.js +1 -0
  43. package/lib/browser/mcp/tools/createNewFileWithText.js.map +1 -1
  44. package/lib/browser/mcp/tools/editFile.d.ts.map +1 -1
  45. package/lib/browser/mcp/tools/editFile.js +1 -0
  46. package/lib/browser/mcp/tools/editFile.js.map +1 -1
  47. package/lib/browser/mcp/tools/fileSearch.d.ts.map +1 -1
  48. package/lib/browser/mcp/tools/fileSearch.js +1 -0
  49. package/lib/browser/mcp/tools/fileSearch.js.map +1 -1
  50. package/lib/browser/mcp/tools/getDiagnosticsByPath.d.ts.map +1 -1
  51. package/lib/browser/mcp/tools/getDiagnosticsByPath.js +2 -1
  52. package/lib/browser/mcp/tools/getDiagnosticsByPath.js.map +1 -1
  53. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.d.ts.map +1 -1
  54. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.js +2 -0
  55. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.js.map +1 -1
  56. package/lib/browser/mcp/tools/grepSearch.d.ts.map +1 -1
  57. package/lib/browser/mcp/tools/grepSearch.js +1 -0
  58. package/lib/browser/mcp/tools/grepSearch.js.map +1 -1
  59. package/lib/browser/mcp/tools/listDir.d.ts.map +1 -1
  60. package/lib/browser/mcp/tools/listDir.js +1 -0
  61. package/lib/browser/mcp/tools/listDir.js.map +1 -1
  62. package/lib/browser/mcp/tools/readFile.d.ts.map +1 -1
  63. package/lib/browser/mcp/tools/readFile.js +1 -0
  64. package/lib/browser/mcp/tools/readFile.js.map +1 -1
  65. package/lib/browser/mcp/tools/runTerminalCmd.d.ts.map +1 -1
  66. package/lib/browser/mcp/tools/runTerminalCmd.js +1 -0
  67. package/lib/browser/mcp/tools/runTerminalCmd.js.map +1 -1
  68. package/lib/browser/types.d.ts +1 -0
  69. package/lib/browser/types.d.ts.map +1 -1
  70. package/lib/browser/widget/inline-diff/inline-diff-manager.d.ts.map +1 -1
  71. package/lib/browser/widget/inline-diff/inline-diff-manager.js.map +1 -1
  72. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts.map +1 -1
  73. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js +10 -5
  74. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js.map +1 -1
  75. package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
  76. package/lib/common/prompts/context-prompt-provider.js +4 -2
  77. package/lib/common/prompts/context-prompt-provider.js.map +1 -1
  78. package/lib/node/base-language-model.d.ts.map +1 -1
  79. package/lib/node/base-language-model.js +6 -0
  80. package/lib/node/base-language-model.js.map +1 -1
  81. package/package.json +24 -23
  82. package/src/browser/chat/chat-model.ts +19 -2
  83. package/src/browser/components/ChatReply.tsx +61 -18
  84. package/src/browser/components/ChatThinking.tsx +1 -1
  85. package/src/browser/components/WelcomeMsg.tsx +1 -1
  86. package/src/browser/components/components.module.less +24 -0
  87. package/src/browser/contrib/inline-completions/prompt/matcher.ts +2 -2
  88. package/src/browser/contrib/inline-completions/prompt/similarSnippets.ts +2 -2
  89. package/src/browser/contrib/intelligent-completions/view/default.ts +0 -1
  90. package/src/browser/mcp/config/components/mcp-config.view.tsx +23 -12
  91. package/src/browser/mcp/config/components/mcp-server-form.tsx +68 -54
  92. package/src/browser/mcp/mcp-server.feature.registry.ts +1 -1
  93. package/src/browser/mcp/tools/components/ExpandableFileList.tsx +4 -1
  94. package/src/browser/mcp/tools/components/Terminal.tsx +4 -6
  95. package/src/browser/mcp/tools/components/computeAnsiLogString.ts +24 -0
  96. package/src/browser/mcp/tools/components/filterEraseMultipleLine.ts +71 -0
  97. package/src/browser/mcp/tools/components/index.module.less +8 -5
  98. package/src/browser/mcp/tools/createNewFileWithText.ts +1 -0
  99. package/src/browser/mcp/tools/editFile.ts +1 -0
  100. package/src/browser/mcp/tools/fileSearch.ts +1 -0
  101. package/src/browser/mcp/tools/getDiagnosticsByPath.ts +2 -1
  102. package/src/browser/mcp/tools/getOpenEditorFileDiagnostics.ts +2 -0
  103. package/src/browser/mcp/tools/grepSearch.ts +1 -0
  104. package/src/browser/mcp/tools/listDir.ts +1 -0
  105. package/src/browser/mcp/tools/readFile.ts +1 -0
  106. package/src/browser/mcp/tools/runTerminalCmd.ts +1 -0
  107. package/src/browser/types.ts +1 -0
  108. package/src/browser/widget/inline-diff/inline-diff-manager.tsx +0 -1
  109. package/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx +9 -5
  110. package/src/common/prompts/context-prompt-provider.ts +6 -2
  111. package/src/node/base-language-model.ts +5 -0
@@ -96,7 +96,7 @@
96
96
  }
97
97
 
98
98
  .header {
99
- padding: 8px 12px;
99
+ padding: 4px;
100
100
  background-color: var(--design-block-background);
101
101
  border-bottom: 1px solid var(--vscode-commandCenter-inactiveBorder);
102
102
  cursor: pointer;
@@ -104,7 +104,7 @@
104
104
  align-items: center;
105
105
  gap: 4px;
106
106
  color: var(--design-text-foreground);
107
- font-size: 12px;
107
+ font-size: 11px;
108
108
  }
109
109
 
110
110
  .fileList {
@@ -162,14 +162,17 @@
162
162
  .command_title {
163
163
  display: flex;
164
164
  align-items: center;
165
+ font-size: 11px;
165
166
  span {
166
167
  margin-left: 5px;
167
168
  }
168
169
  }
169
170
 
170
171
  .command_content {
171
- padding: 4px;
172
- font-size: 12px;
172
+ max-height: 200px;
173
+ overflow-y: auto;
174
+ padding: 2px 4px;
175
+ font-size: 11px;
173
176
  color: var(--design-text-foreground);
174
177
  margin: 0px;
175
178
  background-color: var(--terminal-background);
@@ -178,7 +181,7 @@
178
181
  overflow: auto;
179
182
 
180
183
  code {
181
- font-size: 12px;
184
+ font-size: 11px;
182
185
  white-space: pre;
183
186
  }
184
187
  }
@@ -35,6 +35,7 @@ export class CreateNewFileWithTextTool implements MCPServerContribution {
35
35
  return {
36
36
  name: 'create_new_file_with_text',
37
37
  label: 'Create File',
38
+ order: 7,
38
39
  description:
39
40
  'Creates a new file at the specified path within the project directory and populates it with the provided text. ' +
40
41
  'Use this tool to generate new files in your project structure. ' +
@@ -46,6 +46,7 @@ export class EditFileTool implements MCPServerContribution {
46
46
  return {
47
47
  name: 'edit_file',
48
48
  label: 'Edit File',
49
+ order: 5,
49
50
  description: `Use this tool to propose an edit to an existing file.
50
51
  This will be read by a less intelligent model, which will quickly apply the edit. You should make it clear what the edit is, while also minimizing the unchanged code you write.
51
52
  When writing the edit, you should specify each edit in sequence, with the special comment \`// ... existing code ...\` to represent unchanged code in between edited lines.
@@ -41,6 +41,7 @@ export class FileSearchTool implements MCPServerContribution {
41
41
  return {
42
42
  name: 'file_search',
43
43
  label: 'Search Files',
44
+ order: 6,
44
45
  description:
45
46
  "Fast file search based on fuzzy matching against file path. Use if you know part of the file path but don't know where it's located exactly. Response will be capped to 10 results. Make your query more specific if need to filter results further.",
46
47
  inputSchema,
@@ -29,7 +29,8 @@ export class GetDiagnosticsByPathTool implements MCPServerContribution {
29
29
  getToolDefinition(): MCPToolDefinition {
30
30
  return {
31
31
  name: 'get_diagnostics_by_path',
32
- label: 'Get Diagnostics',
32
+ label: 'Get Diagnostics By Path',
33
+ order: 9,
33
34
  description:
34
35
  'Retrieves diagnostic information (errors, warnings, etc.) from a specific file in the project. ' +
35
36
  'Use this tool to get information about problems in any project file. ' +
@@ -31,6 +31,8 @@ export class GetOpenEditorFileDiagnosticsTool implements MCPServerContribution {
31
31
  getToolDefinition(): MCPToolDefinition {
32
32
  return {
33
33
  name: 'get_open_in_editor_file_diagnostics',
34
+ label: 'Get Current Editor Diagnostics',
35
+ order: 8,
34
36
  description:
35
37
  'Retrieves diagnostic information (errors, warnings, etc.) from the currently active file in VS Code editor. ' +
36
38
  'Use this tool to get information about problems in your current file. ' +
@@ -48,6 +48,7 @@ export class GrepSearchTool implements MCPServerContribution {
48
48
  return {
49
49
  name: 'grep_search',
50
50
  label: 'Search Contents',
51
+ order: 4,
51
52
  description:
52
53
  // TODO: 支持语义化搜索后需要描述清楚优劣势
53
54
  'Fast text-based regex search that finds exact pattern matches within files or directories, utilizing the ripgrep command for efficient searching.\nResults will be formatted in the style of ripgrep and can be configured to include line numbers and content.\nTo avoid overwhelming output, the results are capped at 50 matches.\nUse the include or exclude patterns to filter the search scope by file type or specific paths.\n\nThis is best for finding exact text matches or regex patterns.',
@@ -41,6 +41,7 @@ export class ListDirTool implements MCPServerContribution {
41
41
  return {
42
42
  name: 'list_dir',
43
43
  label: 'List Directory',
44
+ order: 3,
44
45
  description:
45
46
  'List the contents of a directory. The quick tool to use for discovery, before using more targeted tools like semantic search or file reading. Useful to try to understand the file structure before diving deeper into specific files. Can be used to explore the codebase.',
46
47
  inputSchema,
@@ -38,6 +38,7 @@ export class ReadFileTool implements MCPServerContribution {
38
38
  return {
39
39
  name: 'read_file',
40
40
  label: 'Read File',
41
+ order: 1,
41
42
  description: `Read the contents of a file (and the outline).
42
43
 
43
44
  When using this tool to gather information, it's your responsibility to ensure you have the COMPLETE context. Each time you call this command you should:
@@ -33,6 +33,7 @@ export class RunTerminalCommandTool implements MCPServerContribution {
33
33
  return {
34
34
  name: 'run_terminal_cmd',
35
35
  label: 'Run Command',
36
+ order: 2,
36
37
  description:
37
38
  "PROPOSE a command to run on behalf of the user.\nIf you have this tool, note that you DO have the ability to run commands directly on the USER's system.\n\nAdhere to these rules:\n1. Based on the contents of the conversation, you will be told if you are in the same shell as a previous step or a new shell.\n2. If in a new shell, you should `cd` to the right directory and do necessary setup in addition to running the command.\n3. If in the same shell, the state will persist, no need to do things like `cd` to the same directory.\n4. For ANY commands that would use a pager, you should append ` | cat` to the command (or whatever is appropriate). You MUST do this for: git, less, head, tail, more, etc.\n5. For commands that are long running/expected to run indefinitely until interruption, please run them in the background. To run jobs in the background, set `is_background` to true rather than changing the details of the command.\n6. Dont include any newlines in the command.",
38
39
  inputSchema,
@@ -350,6 +350,7 @@ export interface MCPLogger {
350
350
  export interface MCPToolDefinition {
351
351
  name: string;
352
352
  label?: string;
353
+ order?: number;
353
354
  description: string;
354
355
  inputSchema: ZodSchema<any>; // JSON Schema
355
356
  handler: (
@@ -3,7 +3,6 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { Icon, Popover } from '@opensumi/ide-components';
4
4
  import { AppConfig, IDisposable, URI, localize, path, useInjectable } from '@opensumi/ide-core-browser';
5
5
  import { IResource, WorkbenchEditorService } from '@opensumi/ide-editor';
6
- import { Path } from '@opensumi/ide-utils/lib/path';
7
6
 
8
7
  import { BaseApplyService } from '../../mcp/base-apply.service';
9
8
 
@@ -326,11 +326,15 @@ export class LivePreviewDiffDecorationModel extends Disposable {
326
326
  let modifyContent: string;
327
327
  const removeContent = removedWidget?.getRemovedTextLines().join('\n') || '';
328
328
  const range = addedDec?.getRange();
329
- if (range) {
330
- modifyContent = model.getValueInRange({
331
- ...range,
332
- endColumn: model.getLineMaxColumn(range.endLineNumber),
333
- });
329
+ try {
330
+ if (range) {
331
+ modifyContent = model.getValueInRange({
332
+ ...range,
333
+ endColumn: model.getLineMaxColumn(range.endLineNumber),
334
+ });
335
+ }
336
+ } catch (error) {
337
+ modifyContent = '';
334
338
  }
335
339
  const discard = (decorationModel: LivePreviewDiffDecorationModel) => {
336
340
  // 只有点击行丢弃时才会上报
@@ -42,11 +42,15 @@ ${context.recentlyViewFiles.map((file, idx) => ` ${idx + 1}: ${file}`).join('
42
42
  `,
43
43
  )}
44
44
  </attached_files>
45
- ${currentModel ? `<current_opened_file>
45
+ ${
46
+ currentModel
47
+ ? `<current_opened_file>
46
48
  \`\`\`${currentModel.languageId} ${currentModel.uri.toString()}
47
49
  ${currentModel.getText()}
48
50
  \`\`\`
49
- </current_opened_file>` : ''}
51
+ </current_opened_file>`
52
+ : ''
53
+ }
50
54
  </additional_data>
51
55
  <user_query>
52
56
  ${userMessage}
@@ -185,6 +185,11 @@ export abstract class BaseLanguageModel {
185
185
  });
186
186
  } else if (chunk.type === 'error') {
187
187
  chatReadableStream.emitError(new Error(chunk.error as string));
188
+ } else if (chunk.type === 'reasoning') {
189
+ chatReadableStream.emitData({
190
+ kind: 'reasoning',
191
+ content: chunk.textDelta,
192
+ });
188
193
  }
189
194
  }
190
195