@opensumi/ide-ai-native 3.9.1-next-1749003325.0 → 3.9.1-next-1749007675.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 (146) hide show
  1. package/lib/browser/chat/chat-manager.service.d.ts +1 -0
  2. package/lib/browser/chat/chat-manager.service.d.ts.map +1 -1
  3. package/lib/browser/chat/chat-manager.service.js +8 -3
  4. package/lib/browser/chat/chat-manager.service.js.map +1 -1
  5. package/lib/browser/chat/chat-model.d.ts +3 -1
  6. package/lib/browser/chat/chat-model.d.ts.map +1 -1
  7. package/lib/browser/chat/chat-model.js +48 -17
  8. package/lib/browser/chat/chat-model.js.map +1 -1
  9. package/lib/browser/chat/chat-proxy.service.d.ts +2 -0
  10. package/lib/browser/chat/chat-proxy.service.d.ts.map +1 -1
  11. package/lib/browser/chat/chat-proxy.service.js +57 -50
  12. package/lib/browser/chat/chat-proxy.service.js.map +1 -1
  13. package/lib/browser/chat/chat.feature.registry.d.ts +4 -1
  14. package/lib/browser/chat/chat.feature.registry.d.ts.map +1 -1
  15. package/lib/browser/chat/chat.feature.registry.js +6 -0
  16. package/lib/browser/chat/chat.feature.registry.js.map +1 -1
  17. package/lib/browser/chat/chat.view.d.ts.map +1 -1
  18. package/lib/browser/chat/chat.view.js +29 -12
  19. package/lib/browser/chat/chat.view.js.map +1 -1
  20. package/lib/browser/components/ChatMentionInput.d.ts.map +1 -1
  21. package/lib/browser/components/ChatMentionInput.js +30 -141
  22. package/lib/browser/components/ChatMentionInput.js.map +1 -1
  23. package/lib/browser/components/ChatToolRender.module.less +0 -1
  24. package/lib/browser/components/components.module.less +7 -9
  25. package/lib/browser/components/mention-input/mention-input.d.ts.map +1 -1
  26. package/lib/browser/components/mention-input/mention-input.js +14 -161
  27. package/lib/browser/components/mention-input/mention-input.js.map +1 -1
  28. package/lib/browser/components/mention-input/mention-input.module.less +1 -165
  29. package/lib/browser/components/mention-input/types.d.ts +1 -16
  30. package/lib/browser/components/mention-input/types.d.ts.map +1 -1
  31. package/lib/browser/components/mention-input/types.js +0 -1
  32. package/lib/browser/components/mention-input/types.js.map +1 -1
  33. package/lib/browser/components/utils.d.ts +2 -2
  34. package/lib/browser/context/llm-context.service.d.ts +2 -21
  35. package/lib/browser/context/llm-context.service.d.ts.map +1 -1
  36. package/lib/browser/context/llm-context.service.js +20 -162
  37. package/lib/browser/context/llm-context.service.js.map +1 -1
  38. package/lib/browser/contrib/intelligent-completions/decoration/additions-deletions.decoration.d.ts.map +1 -1
  39. package/lib/browser/contrib/intelligent-completions/decoration/additions-deletions.decoration.js.map +1 -1
  40. package/lib/browser/contrib/intelligent-completions/diff-computer.js +1 -1
  41. package/lib/browser/contrib/intelligent-completions/diff-computer.js.map +1 -1
  42. package/lib/browser/contrib/terminal/terminal.feature.registry.js.map +1 -1
  43. package/lib/browser/index.d.ts.map +1 -1
  44. package/lib/browser/index.js +0 -7
  45. package/lib/browser/index.js.map +1 -1
  46. package/lib/browser/mcp/base-apply.service.d.ts +2 -2
  47. package/lib/browser/mcp/base-apply.service.d.ts.map +1 -1
  48. package/lib/browser/mcp/base-apply.service.js.map +1 -1
  49. package/lib/browser/mcp/tools/getDiagnosticsByPath.js.map +1 -1
  50. package/lib/browser/mcp/tools/getOpenEditorFileDiagnostics.js.map +1 -1
  51. package/lib/browser/mcp/tools/handlers/ListDir.js.map +1 -1
  52. package/lib/browser/mcp/tools/runTerminalCmd.js.map +1 -1
  53. package/lib/browser/model/msg-history-manager.d.ts +39 -1
  54. package/lib/browser/model/msg-history-manager.d.ts.map +1 -1
  55. package/lib/browser/model/msg-history-manager.js +170 -3
  56. package/lib/browser/model/msg-history-manager.js.map +1 -1
  57. package/lib/browser/preferences/schema.d.ts.map +1 -1
  58. package/lib/browser/preferences/schema.js +0 -5
  59. package/lib/browser/preferences/schema.js.map +1 -1
  60. package/lib/browser/types.d.ts +8 -1
  61. package/lib/browser/types.d.ts.map +1 -1
  62. package/lib/browser/types.js.map +1 -1
  63. package/lib/browser/widget/inline-stream-diff/live-preview.component.d.ts.map +1 -1
  64. package/lib/browser/widget/inline-stream-diff/live-preview.component.js.map +1 -1
  65. package/lib/common/index.d.ts +0 -2
  66. package/lib/common/index.d.ts.map +1 -1
  67. package/lib/common/index.js +0 -2
  68. package/lib/common/index.js.map +1 -1
  69. package/lib/common/llm-context.d.ts +0 -19
  70. package/lib/common/llm-context.d.ts.map +1 -1
  71. package/lib/common/llm-context.js.map +1 -1
  72. package/lib/common/prompts/context-prompt-provider.d.ts +2 -0
  73. package/lib/common/prompts/context-prompt-provider.d.ts.map +1 -1
  74. package/lib/common/prompts/context-prompt-provider.js +29 -35
  75. package/lib/common/prompts/context-prompt-provider.js.map +1 -1
  76. package/lib/common/types.d.ts +0 -7
  77. package/lib/common/types.d.ts.map +1 -1
  78. package/lib/node/base-language-model.d.ts.map +1 -1
  79. package/lib/node/base-language-model.js.map +1 -1
  80. package/package.json +24 -25
  81. package/src/browser/chat/chat-manager.service.ts +15 -6
  82. package/src/browser/chat/chat-model.ts +56 -19
  83. package/src/browser/chat/chat-proxy.service.ts +81 -68
  84. package/src/browser/chat/chat.feature.registry.ts +17 -1
  85. package/src/browser/chat/chat.view.tsx +28 -22
  86. package/src/browser/components/ChatMentionInput.tsx +35 -169
  87. package/src/browser/components/ChatToolRender.module.less +0 -1
  88. package/src/browser/components/components.module.less +7 -9
  89. package/src/browser/components/mention-input/mention-input.module.less +1 -165
  90. package/src/browser/components/mention-input/mention-input.tsx +32 -257
  91. package/src/browser/components/mention-input/types.ts +0 -16
  92. package/src/browser/context/llm-context.service.ts +21 -182
  93. package/src/browser/contrib/intelligent-completions/decoration/additions-deletions.decoration.ts +1 -1
  94. package/src/browser/contrib/intelligent-completions/diff-computer.ts +1 -1
  95. package/src/browser/contrib/terminal/terminal.feature.registry.ts +1 -1
  96. package/src/browser/index.ts +0 -8
  97. package/src/browser/mcp/base-apply.service.ts +1 -0
  98. package/src/browser/mcp/tools/getDiagnosticsByPath.ts +1 -1
  99. package/src/browser/mcp/tools/getOpenEditorFileDiagnostics.ts +1 -1
  100. package/src/browser/mcp/tools/handlers/ListDir.ts +1 -1
  101. package/src/browser/mcp/tools/runTerminalCmd.ts +1 -1
  102. package/src/browser/model/msg-history-manager.ts +230 -3
  103. package/src/browser/preferences/schema.ts +0 -5
  104. package/src/browser/types.ts +12 -0
  105. package/src/browser/widget/inline-stream-diff/live-preview.component.tsx +1 -0
  106. package/src/common/index.ts +0 -3
  107. package/src/common/llm-context.ts +0 -23
  108. package/src/common/prompts/context-prompt-provider.ts +40 -55
  109. package/src/common/types.ts +0 -8
  110. package/src/node/base-language-model.ts +1 -0
  111. package/lib/browser/components/mention-input/mention-select.d.ts +0 -28
  112. package/lib/browser/components/mention-input/mention-select.d.ts.map +0 -1
  113. package/lib/browser/components/mention-input/mention-select.js +0 -136
  114. package/lib/browser/components/mention-input/mention-select.js.map +0 -1
  115. package/lib/browser/components/mention-input/mention-select.module.less +0 -297
  116. package/lib/browser/rules/rules.contribution.d.ts +0 -29
  117. package/lib/browser/rules/rules.contribution.d.ts.map +0 -1
  118. package/lib/browser/rules/rules.contribution.js +0 -94
  119. package/lib/browser/rules/rules.contribution.js.map +0 -1
  120. package/lib/browser/rules/rules.module.less +0 -175
  121. package/lib/browser/rules/rules.service.d.ts +0 -25
  122. package/lib/browser/rules/rules.service.d.ts.map +0 -1
  123. package/lib/browser/rules/rules.service.js +0 -180
  124. package/lib/browser/rules/rules.service.js.map +0 -1
  125. package/lib/browser/rules/rules.view.d.ts +0 -3
  126. package/lib/browser/rules/rules.view.d.ts.map +0 -1
  127. package/lib/browser/rules/rules.view.js +0 -76
  128. package/lib/browser/rules/rules.view.js.map +0 -1
  129. package/lib/common/MDC_PARSER_README.md +0 -171
  130. package/lib/common/mdc-parser.d.ts +0 -60
  131. package/lib/common/mdc-parser.d.ts.map +0 -1
  132. package/lib/common/mdc-parser.js +0 -246
  133. package/lib/common/mdc-parser.js.map +0 -1
  134. package/lib/common/prompts/system-prompt.d.ts +0 -2
  135. package/lib/common/prompts/system-prompt.d.ts.map +0 -1
  136. package/lib/common/prompts/system-prompt.js +0 -5
  137. package/lib/common/prompts/system-prompt.js.map +0 -1
  138. package/src/browser/components/mention-input/mention-select.module.less +0 -297
  139. package/src/browser/components/mention-input/mention-select.tsx +0 -256
  140. package/src/browser/rules/rules.contribution.ts +0 -105
  141. package/src/browser/rules/rules.module.less +0 -175
  142. package/src/browser/rules/rules.service.ts +0 -189
  143. package/src/browser/rules/rules.view.tsx +0 -127
  144. package/src/common/MDC_PARSER_README.md +0 -171
  145. package/src/common/mdc-parser.ts +0 -295
  146. package/src/common/prompts/system-prompt.ts +0 -2
@@ -1,10 +1,10 @@
1
+ import { DataContent } from 'ai';
2
+
1
3
  import { Autowired, Injectable } from '@opensumi/di';
2
- import { PreferenceService } from '@opensumi/ide-core-browser';
3
4
  import { AppConfig } from '@opensumi/ide-core-browser/lib/react-providers/config-provider';
4
- import { AINativeSettingSectionsId, IApplicationService, RulesServiceToken } from '@opensumi/ide-core-common';
5
5
  import { WithEventBus } from '@opensumi/ide-core-common/lib/event-bus/event-decorator';
6
6
  import { MarkerSeverity } from '@opensumi/ide-core-common/lib/types/markers/markers';
7
- import { Emitter, OperatingSystem, URI, parseGlob } from '@opensumi/ide-core-common/lib/utils';
7
+ import { Emitter, URI } from '@opensumi/ide-core-common/lib/utils';
8
8
  import {
9
9
  EditorDocumentModelCreationEvent,
10
10
  EditorDocumentModelRemovalEvent,
@@ -15,12 +15,8 @@ import { EditorSelectionChangeEvent } from '@opensumi/ide-editor/lib/browser/typ
15
15
  import { FileType, IFileServiceClient } from '@opensumi/ide-file-service';
16
16
  import { IMarkerService } from '@opensumi/ide-markers/lib/common/types';
17
17
  import { Range } from '@opensumi/ide-monaco';
18
- import { ITerminalApiService } from '@opensumi/ide-terminal-next';
19
- import { isString, match } from '@opensumi/ide-utils';
20
18
 
21
19
  import { AttachFileContext, FileContext, LLMContextService, SerializedContext } from '../../common/llm-context';
22
- import { ProjectRule } from '../../common/types';
23
- import { RulesService } from '../rules/rules.service';
24
20
 
25
21
  @Injectable()
26
22
  export class LLMContextServiceImpl extends WithEventBus implements LLMContextService {
@@ -36,18 +32,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
36
32
  @Autowired(IFileServiceClient)
37
33
  protected readonly fileService: IFileServiceClient;
38
34
 
39
- @Autowired(RulesServiceToken)
40
- protected readonly rulesService: RulesService;
41
-
42
- @Autowired(PreferenceService)
43
- protected readonly preferenceService: PreferenceService;
44
-
45
- @Autowired(ITerminalApiService)
46
- protected readonly terminalService: ITerminalApiService;
47
-
48
- @Autowired(IApplicationService)
49
- protected readonly applicationService: IApplicationService;
50
-
51
35
  private isAutoCollecting = false;
52
36
 
53
37
  private contextVersion = 0;
@@ -57,13 +41,11 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
57
41
  private readonly maxViewFilesLimit = 20;
58
42
  private attachedFiles: FileContext[] = [];
59
43
  private attachedFolders: FileContext[] = [];
60
- private attachedRules: ProjectRule[] = [];
61
44
  private readonly recentlyViewFiles: FileContext[] = [];
62
45
  private readonly onDidContextFilesChangeEmitter = new Emitter<{
63
46
  viewed: FileContext[];
64
47
  attached: FileContext[];
65
48
  attachedFolders: FileContext[];
66
- attachedRules: ProjectRule[];
67
49
  version: number;
68
50
  }>();
69
51
  private hasUserManualReference = false;
@@ -98,24 +80,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
98
80
  }
99
81
  }
100
82
 
101
- addRuleToContext(uri: URI): void {
102
- if (!uri) {
103
- return;
104
- }
105
-
106
- if (this.attachedRules.some((rule) => rule.path === uri.toString())) {
107
- return;
108
- }
109
-
110
- const rule = this.rulesService.projectRules.find((rule) => rule.path === uri.toString());
111
- if (!rule) {
112
- return;
113
- }
114
-
115
- this.attachedRules.push(rule);
116
- this.notifyContextChange();
117
- }
118
-
119
83
  addFileToContext(uri: URI, selection?: [number, number], isManual = false): void {
120
84
  if (!uri) {
121
85
  return;
@@ -153,7 +117,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
153
117
  this.attachedFiles = [];
154
118
  this.attachedFolders = [];
155
119
  this.hasUserManualReference = false;
156
- this.attachedRules = [];
157
120
  this.notifyContextChange();
158
121
  }
159
122
 
@@ -162,7 +125,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
162
125
  viewed: this.recentlyViewFiles,
163
126
  attached: this.attachedFiles,
164
127
  attachedFolders: this.attachedFolders,
165
- attachedRules: this.attachedRules,
166
128
  version: this.contextVersion++,
167
129
  };
168
130
  }
@@ -181,24 +143,6 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
181
143
  this.notifyContextChange();
182
144
  }
183
145
 
184
- removeFolderFromContext(uri: URI): void {
185
- const targetList = this.attachedFolders;
186
- const index = targetList.findIndex((folder) => folder.uri.toString() === uri.toString());
187
- if (index > -1) {
188
- targetList.splice(index, 1);
189
- }
190
- this.notifyContextChange();
191
- }
192
-
193
- removeRuleFromContext(uri: URI): void {
194
- const targetList = this.attachedRules;
195
- const index = targetList.findIndex((rule) => rule.path === uri.toString());
196
- if (index > -1) {
197
- targetList.splice(index, 1);
198
- }
199
- this.notifyContextChange();
200
- }
201
-
202
146
  startAutoCollection(): void {
203
147
  if (this.isAutoCollecting) {
204
148
  return;
@@ -273,35 +217,25 @@ export class LLMContextServiceImpl extends WithEventBus implements LLMContextSer
273
217
  return {
274
218
  recentlyViewFiles: this.serializeRecentlyViewFiles(files.viewed, workspaceRoot),
275
219
  attachedFiles: this.serializeAttachedFiles(files.attached, workspaceRoot),
276
- attachedFolders: await this.serializeAttachedFolders(files.attachedFolders),
277
- attachedRules: this.serializeAttachedRules(files.attachedRules),
278
- globalRules: this.serializeGlobalRules(),
220
+ attachedFolders: await this.serializeAttachedFolders(files.attachedFolders, workspaceRoot),
279
221
  };
280
222
  }
281
223
 
282
- private async serializeAttachedFolders(folders: FileContext[]): Promise<string[]> {
224
+ private async serializeAttachedFolders(folders: FileContext[], workspaceRoot: URI): Promise<string[]> {
283
225
  // 去重
284
226
  const folderPath = Array.from(new Set(folders.map((folder) => folder.uri.toString())));
285
- const header = 'Here are some folder(s) I manually attached to my message:';
286
- const folderSections = await Promise.all(
227
+ return Promise.all(
287
228
  folderPath.map(async (folder) => {
288
229
  const folderUri = new URI(folder);
289
- const absolutePath = folderUri.codeUri.fsPath;
290
- const folderStructure = await this.getFormattedFolderStructure(absolutePath);
291
-
292
- return `Folder: ${absolutePath}
293
- Contents of directory:
294
-
295
- ${folderStructure}`;
230
+ const root = workspaceRoot.relative(folderUri)?.toString() || '/';
231
+ return `\`\`\`\n${root}\n${(await this.getPartiaFolderStructure(folderUri.codeUri.fsPath))
232
+ .map((line) => `- ${line}`)
233
+ .join('\n')}\n\`\`\`\n`;
296
234
  }),
297
235
  );
298
- if (folderSections.length > 0) {
299
- return [header, ...folderSections, ''];
300
- }
301
- return [];
302
236
  }
303
237
 
304
- private async getFormattedFolderStructure(folder: string): Promise<string> {
238
+ private async getPartiaFolderStructure(folder: string, level = 2): Promise<string[]> {
305
239
  const result: string[] = [];
306
240
  try {
307
241
  const stat = await this.fileService.getFileStat(folder);
@@ -313,27 +247,28 @@ ${folderStructure}`;
313
247
  // 处理软链接
314
248
  const target = await this.fileService.getFileStat(child.realUri || child.uri);
315
249
  if (target) {
316
- result.push(`[link] ${relativePath} -> ${target}`);
250
+ result.push(`${relativePath} -> ${target} (symbolic link)`);
317
251
  } else {
318
- result.push(`[link] ${relativePath} (broken)`);
252
+ result.push(`${relativePath} (broken symbolic link)`);
319
253
  }
320
254
  continue;
321
255
  }
322
256
 
323
257
  if (child.type === FileType.Directory) {
324
- // 计算目录下的项目数量
325
- const childStat = await this.fileService.getFileStat(child.uri);
326
- const itemCount = childStat?.children?.length || 0;
327
- result.push(`[dir] ${relativePath}/ (${itemCount} items)`);
258
+ result.push(`${relativePath}/`);
259
+ if (level > 1) {
260
+ const subDirStructure = await this.getPartiaFolderStructure(child.uri, level - 1);
261
+ result.push(...subDirStructure.map((subEntry) => `${relativePath}/${subEntry}`));
262
+ }
328
263
  } else if (child.type === FileType.File) {
329
- result.push(`[file] ${relativePath}`);
264
+ result.push(relativePath);
330
265
  }
331
266
  }
332
267
  } catch {
333
- return '';
268
+ return result;
334
269
  }
335
270
 
336
- return result.join('\n');
271
+ return result;
337
272
  }
338
273
 
339
274
  private serializeRecentlyViewFiles(files: FileContext[], workspaceRoot: URI): string[] {
@@ -360,7 +295,6 @@ ${folderStructure}`;
360
295
  lineErrors: this.getFileErrors(file.uri),
361
296
  path: workspaceRoot.relative(file.uri)!.toString(),
362
297
  language: ref.instance.languageId!,
363
- selection: file.selection,
364
298
  };
365
299
  } catch (e) {
366
300
  return null;
@@ -376,99 +310,4 @@ ${folderStructure}`;
376
310
  })
377
311
  .map((marker) => marker.message);
378
312
  }
379
-
380
- private serializeGlobalRules(): string[] {
381
- const globalRules = this.preferenceService.get<string>(AINativeSettingSectionsId.GlobalRules);
382
- if (!globalRules) {
383
- return [];
384
- }
385
-
386
- const platform =
387
- this.applicationService.backendOS === OperatingSystem.Windows
388
- ? 'windows'
389
- : this.applicationService.backendOS === OperatingSystem.Linux
390
- ? 'linux'
391
- : 'darwin';
392
- const shell = this.preferenceService.get<string>('terminal.type', 'zsh');
393
- let shellName = shell;
394
- if (shell === 'default') {
395
- shellName = this.applicationService.backendOS === OperatingSystem.Windows ? 'cmd' : 'zsh';
396
- }
397
- const userInfoSection = `<user_info>
398
- The user's OS version is ${platform}. The absolute path of the user's workspace is ${this.appConfig.workspaceDir}. The user's shell is /bin/${shellName}.
399
- </user_info>`;
400
-
401
- const rulesSection = `
402
-
403
- <rules>
404
- The rules section has a number of possible rules/memories/context that you should consider. In each subsection, we provide instructions about what information the subsection contains and how you should consider/follow the contents of the subsection.
405
-
406
-
407
- <user_specific_rule description="This is a rule set by the user that the agent must follow.">
408
- ${globalRules}
409
- </user_specific_rule>
410
-
411
- </rules>`;
412
-
413
- return [userInfoSection, rulesSection];
414
- }
415
-
416
- private findApplicableRules(attachedRules: ProjectRule[]): ProjectRule[] {
417
- const otherRules = this.rulesService.projectRules.filter(
418
- (rule) => !attachedRules.some((attachedRule) => attachedRule.path === rule.path),
419
- );
420
- const requestedByAgentRules = otherRules.filter((rule) => rule.description);
421
- const alwaysApplyRules = otherRules.filter((rule) => rule.alwaysApply);
422
- const requestedByFileRules = this.findFileMatchingRules(otherRules);
423
-
424
- return [...requestedByFileRules, ...requestedByAgentRules, ...alwaysApplyRules];
425
- }
426
- private findFileMatchingRules(otherRules: ProjectRule[]): ProjectRule[] {
427
- const requestedByFileRules = otherRules.filter((rule) => rule.globs);
428
- const filePaths = this.attachedFiles.map((file) => file.uri.toString());
429
- const folderPaths = this.attachedFolders.map((folder) => folder.uri.toString());
430
-
431
- return requestedByFileRules.filter((rule) => {
432
- let globs = rule.globs;
433
- if (isString(globs)) {
434
- globs = this.normalizeGlobs(globs.split(','));
435
- } else {
436
- globs = this.normalizeGlobs(globs || []);
437
- }
438
- const patterns = globs.map((pattern) => parseGlob(pattern));
439
- return patterns.some((match) => filePaths.some((path) => match(path)) || folderPaths.some((path) => match(path)));
440
- });
441
- }
442
- private normalizeGlobs(globs: string | string[]): string[] {
443
- const globArray = isString(globs) ? globs.split(',') : globs || [];
444
- return globArray.map((glob) => {
445
- const p = glob.trim();
446
- return p.startsWith('**') ? p : `**/${p}`;
447
- });
448
- }
449
-
450
- private serializeAttachedRules(rules: ProjectRule[] = []): string[] {
451
- rules = this.findApplicableRules(rules);
452
- if (rules.length === 0) {
453
- return [];
454
- }
455
-
456
- const header =
457
- '\n<rules_context>\n\nRules are extra documentation provided by the user to help the AI understand the codebase.\nUse them if they seem useful to the users most recent query, but do not use them if they seem unrelated.\n\n';
458
-
459
- const rulesSections = rules
460
- .map((rule) => {
461
- const ruleName =
462
- rule.path
463
- .split('/')
464
- .pop()
465
- ?.replace(/.md(c)?$/, '') || 'Unnamed Rule';
466
- return `Rule Name: ${ruleName}\nDescription: \n${rule.description || rule.content}`;
467
- })
468
- .join('\n\n');
469
-
470
- const footer = '\n</rules_context>\n';
471
-
472
- return [header, rulesSections, footer];
473
- }
474
313
  }
@@ -1,4 +1,4 @@
1
- import { ICodeEditor, IRange, TrackedRangeStickiness } from '@opensumi/ide-monaco';
1
+ import { ICodeEditor, IModelDeltaDecoration, IRange, TrackedRangeStickiness } from '@opensumi/ide-monaco';
2
2
 
3
3
  import { EnhanceDecorationsCollection } from '../../../model/enhanceDecorationsCollection';
4
4
  import { REWRITE_DECORATION_INLINE_ADD } from '../../../widget/rewrite/rewrite-widget';
@@ -267,7 +267,7 @@ export const computeMultiLineDiffChanges = (
267
267
  lineNumber: number,
268
268
  eol: string,
269
269
  ) => {
270
- const rewriteDiffResult: IMultiLineDiffChangeResult[] =
270
+ let rewriteDiffResult: IMultiLineDiffChangeResult[] =
271
271
  rewriteDiffComputer.diff(originalContent, modifiedContent) || [];
272
272
  let multiLineDiffResult: IMultiLineDiffChangeResult[] =
273
273
  multiLineDiffComputer.diff(originalContent, modifiedContent) || [];
@@ -1,6 +1,6 @@
1
1
  import { Injectable } from '@opensumi/di';
2
2
  import { CancellationToken, Disposable } from '@opensumi/ide-core-common';
3
- import { IReadableStream, isReadableStream, listenGroupReadable } from '@opensumi/ide-utils/lib/stream';
3
+ import { IReadableStream, isReadableStream, listenGroupReadable, listenReadable } from '@opensumi/ide-utils/lib/stream';
4
4
 
5
5
  import { ITerminalCommandSuggestionDesc } from '../../../common/index';
6
6
  import {
@@ -17,7 +17,6 @@ import {
17
17
  IntelligentCompletionsRegistryToken,
18
18
  MCPConfigServiceToken,
19
19
  ProblemFixRegistryToken,
20
- RulesServiceToken,
21
20
  TerminalRegistryToken,
22
21
  } from '@opensumi/ide-core-common';
23
22
  import { FolderFilePreferenceProvider } from '@opensumi/ide-preferences/lib/browser/folder-file-preference-provider';
@@ -78,8 +77,6 @@ import { ListDirTool } from './mcp/tools/listDir';
78
77
  import { ReadFileTool } from './mcp/tools/readFile';
79
78
  import { RunTerminalCommandTool } from './mcp/tools/runTerminalCmd';
80
79
  import { AINativePreferencesContribution } from './preferences';
81
- import { RulesContribution } from './rules/rules.contribution';
82
- import { RulesService } from './rules/rules.service';
83
80
  import { AINativeCoreContribution, MCPServerContribution, TokenMCPServerRegistry } from './types';
84
81
  import { InlineChatFeatureRegistry } from './widget/inline-chat/inline-chat.feature.registry';
85
82
  import { InlineChatService } from './widget/inline-chat/inline-chat.service';
@@ -122,7 +119,6 @@ export class AINativeModule extends BrowserModule {
122
119
 
123
120
  // Context Service
124
121
  LlmContextContribution,
125
- RulesContribution,
126
122
  {
127
123
  token: LLMContextServiceToken,
128
124
  useClass: LLMContextServiceImpl,
@@ -220,10 +216,6 @@ export class AINativeModule extends BrowserModule {
220
216
  token: MCPConfigServiceToken,
221
217
  useClass: MCPConfigService,
222
218
  },
223
- {
224
- token: RulesServiceToken,
225
- useClass: RulesService,
226
- },
227
219
  {
228
220
  token: FolderFilePreferenceProvider,
229
221
  useClass: MCPFolderPreferenceProvider,
@@ -8,6 +8,7 @@ import {
8
8
  AppConfig,
9
9
  IAIReporter,
10
10
  IChatProgress,
11
+ IMarker,
11
12
  MarkerSeverity,
12
13
  OnEvent,
13
14
  WithEventBus,
@@ -2,7 +2,7 @@ import * as path from 'path';
2
2
 
3
3
  import { z } from 'zod';
4
4
 
5
- import { Autowired } from '@opensumi/di';
5
+ import { Autowired, Injectable } from '@opensumi/di';
6
6
  import { Domain, URI } from '@opensumi/ide-core-common';
7
7
  import { IWorkspaceService } from '@opensumi/ide-workspace';
8
8
  import { URI as MonacoURI } from '@opensumi/monaco-editor-core/esm/vs/base/common/uri';
@@ -2,7 +2,7 @@ import * as path from 'path';
2
2
 
3
3
  import { z } from 'zod';
4
4
 
5
- import { Autowired } from '@opensumi/di';
5
+ import { Autowired, Injectable } from '@opensumi/di';
6
6
  import { Domain, URI } from '@opensumi/ide-core-common';
7
7
  import { WorkbenchEditorService } from '@opensumi/ide-editor';
8
8
  import { IWorkspaceService } from '@opensumi/ide-workspace';
@@ -1,5 +1,5 @@
1
1
  import { Autowired, Injectable } from '@opensumi/di';
2
- import { AppConfig, URI } from '@opensumi/ide-core-browser';
2
+ import { AppConfig, Throttler, URI } from '@opensumi/ide-core-browser';
3
3
  import { IFileServiceClient } from '@opensumi/ide-file-service';
4
4
 
5
5
  /**
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
 
3
3
  import { Autowired } from '@opensumi/di';
4
4
  import { AppConfig } from '@opensumi/ide-core-browser';
5
- import { Domain } from '@opensumi/ide-core-common';
5
+ import { Deferred, Domain } from '@opensumi/ide-core-common';
6
6
  import { ITerminalController, ITerminalGroupViewService } from '@opensumi/ide-terminal-next/lib/common/controller';
7
7
 
8
8
  import { IMCPServerRegistry, MCPLogger, MCPServerContribution, MCPToolDefinition } from '../../types';