@opensumi/cli-engine 3.9.1-next-1755745798.0 → 3.9.1-next-1755755826.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.
@@ -33111,7 +33111,7 @@ ${u.applyResult.diagnosticInfos.map(c=>`Line ${c.startLineNumber}: ${c.message.s
33111
33111
  Please fix the linter errors if it is clear how to (or you can easily figure out how to). Do not make uneducated guesses. And do not loop more than 3 times on fixing linter errors on the same file.`:""}`:u.status==="cancelled"?"User cancelled the edit.":"The apply model made no changes to the file."}]}}};t.EditFileTool=s,n.__decorate([(0,o.Autowired)(m.EditFileHandler),n.__metadata("design:type",m.EditFileHandler)],s.prototype,"editFileHandler",void 0),t.EditFileTool=s=n.__decorate([(0,l.Domain)(_.MCPServerContribution)],s)},80173:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),l=e(79240),_=e(43718),v=e(87863),m=e(84660),p=e(51500),s=e(19413),g=e(59347),a=e(77633),h=e(95292),u=r.z.object({query:r.z.string().describe("Fuzzy filename to search for"),explanation:r.z.string().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}),c=10;let E=class{registerMCPServer(d){d.registerMCPTool(this.getToolDefinition()),d.registerToolComponent("file_search",h.FileSearchToolComponent)}getToolDefinition(){return{name:"file_search",label:"Search Files",order:6,description:"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.",inputSchema:u,handler:this.handler.bind(this)}}async handler(d,y){var b;if(!d.query)throw new Error("No fileSearch parameters provided. Need to give a query.");const A=this.workspaceService.tryGetRoots();if(!A||A.length===0)throw new Error("Cannot determine project directory");const S=this.normalizeQuery(d.query),D=await this.fileSearchService.find(S,{rootUris:[new _.URI(A[0].uri).codeUri.fsPath],excludePatterns:Object.keys(v.defaultFilesWatcherExcludes),limit:100,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0}),I=D.slice(0,c).map(R=>({uri:_.URI.parse(R).codeUri.fsPath,isDirectory:!1})),w=this.chatInternalService.sessionModel.history.getMessages(),T=(b=w[w.length-1])===null||b===void 0?void 0:b.id;return T&&this.chatInternalService.sessionModel.history.setMessageAdditional(T,{[d.toolCallId]:{files:I}}),y.appendLine(`Found ${I.length} files matching "${d.query}"`),{content:[{type:"text",text:`${I.map(R=>R.uri).join(`
33112
33112
  `)}
33113
33113
  ${D.length>c?`
33114
- Found ${D.length} files matching "${d.query}", only return the first ${c} results`:""}`}]}}normalizeQuery(d){const y=d.trim().replace(/\s/g,"");return(0,l.getValidateInput)(y)}};t.FileSearchTool=E,n.__decorate([(0,o.Autowired)(p.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(m.FileSearchServicePath),n.__metadata("design:type",Object)],E.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(s.IChatInternalService),n.__metadata("design:type",g.ChatInternalService)],E.prototype,"chatInternalService",void 0),t.FileSearchTool=E=n.__decorate([(0,_.Domain)(a.MCPServerContribution)],E)},30645:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetDiagnosticsTool=void 0;const n=e(85608),r=e(75995),o=e(76003),l=e(43718),_=e(57517),v=e(14951),m=e(55126),p=e(51500),s=e(77633),g=r.z.object({filePathInProject:r.z.string().describe("The relative path to the file to get diagnostics for")});let a=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"get_diagnostics_by_path",label:"Get Diagnostics By Path",order:9,description:`Retrieves diagnostic information (errors, warnings, etc.) from a specific file in the project. Use this tool to get information about problems in any project file. IMPORTANT: This tool should be called after any code generation or modification operations to verify and fix potential issues. Requires a filePathInProject parameter specifying the target file path relative to project root. Returns a JSON-formatted list of diagnostics, where each entry contains: - path: The file path where the diagnostic was found - line: The line number (1-based) of the diagnostic - severity: The severity level ("error", "warning", "information", or "hint") - message: The diagnostic message Returns an empty list ([]) if no diagnostics are found or the file doesn't exist. Best Practice: Always check diagnostics after code generation to ensure code quality and fix any issues immediately. Use this tool in combination with get_open_in_editor_file_diagnostics to verify all affected files after code changes. Diagnostic Severity Handling Guidelines: - "error": Must be fixed immediately as they indicate critical issues that will prevent code from working correctly. - "warning": For user code, preserve unless the warning indicates a clear improvement opportunity. For generated code, optimize to remove warnings. - "information"/"hint": For user code, preserve as they might reflect intentional patterns. For generated code, optimize if it improves code quality without changing functionality.`,inputSchema:g,handler:this.handler.bind(this)}}async checkFilePath(u,c){const E=this.workspaceService.tryGetRoots();if(!E||E.length===0)throw c.appendLine("Error: Cannot determine project directory"),new Error("Cannot determine project directory");if(u.startsWith("..")||u.startsWith("/"))throw c.appendLine("Error: File is outside of project scope"),new Error("File is outside of project scope");const f=l.URI.parse(E[0].uri),d=l.URI.file(l.path.join(f.codeUri.fsPath,u));if(!await this.fileServiceClient.access(d.toString()))throw c.appendLine(`Error: File does not exist: ${d.toString()}`),new Error("File does not exist");return d}async ensureModelCreated(u){if(!this.modelService.getAllModels().some(E=>E.uri.isEqual(u))){const E=new l.Deferred;this.markerService.getManager().onMarkerChanged(f=>{f.some(d=>d===u.toString())&&E.resolve()}),await this.modelService.createModelReference(u),await new Promise(f=>setTimeout(f,4e3)).then(()=>{E.resolve()}),await E.promise}}async handler(u,c){try{const E=await this.checkFilePath(u.filePathInProject,c);await this.ensureModelCreated(E);const d=this.markerService.getManager().getMarkers({resource:E.toString()}).map(b=>({path:u.filePathInProject,line:b.startLineNumber,severity:this.getSeverityString(b.severity),message:b.message})),y=JSON.stringify(d,null,2);return c.appendLine(`Found ${d.length} diagnostics in ${u.filePathInProject}`),{content:[{type:"text",text:y}]}}catch(E){return c.appendLine(`Error getting diagnostics: ${E}`),{content:[{type:"text",text:"[]"}],isError:!0}}}getSeverityString(u){switch(u){case l.MarkerSeverity.Error:return"error";case l.MarkerSeverity.Warning:return"warning";case l.MarkerSeverity.Info:return"information";case l.MarkerSeverity.Hint:return"hint";default:return"unknown"}}};t.GetDiagnosticsTool=a,n.__decorate([(0,o.Autowired)(p.IWorkspaceService),n.__metadata("design:type",Object)],a.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],a.prototype,"fileServiceClient",void 0),n.__decorate([(0,o.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],a.prototype,"modelService",void 0),n.__decorate([(0,o.Autowired)(m.IMarkerService),n.__metadata("design:type",Object)],a.prototype,"markerService",void 0),t.GetDiagnosticsTool=a=n.__decorate([(0,l.Domain)(s.MCPServerContribution)],a)},39855:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrepSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),l=e(43718),_=e(13439),v=e(51495),m=e(51500),p=e(19413),s=e(59347),g=e(77633),a=e(95292),h=r.z.object({query:r.z.string().describe("The regex pattern to search for"),case_sensitive:r.z.boolean().optional().describe("Whether the search should be case sensitive"),include_pattern:r.z.string().optional().describe('Glob pattern for files to include (e.g. "*.ts" for TypeScript files)'),exclude_pattern:r.z.string().optional().describe("Glob pattern for files to exclude"),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}).transform(E=>({query:E.query,caseSensitive:E.case_sensitive,includePattern:E.include_pattern,excludePattern:E.exclude_pattern,explanation:E.explanation})),u=50;let c=class{registerMCPServer(f){f.registerMCPTool(this.getToolDefinition()),f.registerToolComponent("grep_search",a.GrepSearchToolComponent)}getToolDefinition(){return{name:"grep_search",label:"Search Contents",order:4,description:`Fast text-based regex search that finds exact pattern matches within files or directories, utilizing the ripgrep command for efficient searching.
33114
+ Found ${D.length} files matching "${d.query}", only return the first ${c} results`:""}`}]}}normalizeQuery(d){const y=d.trim().replace(/\s/g,"");return(0,l.getValidateInput)(y)}};t.FileSearchTool=E,n.__decorate([(0,o.Autowired)(p.IWorkspaceService),n.__metadata("design:type",Object)],E.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(m.FileSearchServicePath),n.__metadata("design:type",Object)],E.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(s.IChatInternalService),n.__metadata("design:type",g.ChatInternalService)],E.prototype,"chatInternalService",void 0),t.FileSearchTool=E=n.__decorate([(0,_.Domain)(a.MCPServerContribution)],E)},30645:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetDiagnosticsTool=void 0;const n=e(85608),r=e(75995),o=e(76003),l=e(43718),_=e(57517),v=e(14951),m=e(55126),p=e(51500),s=e(77633),g=r.z.object({filePathInProject:r.z.string().describe("The relative path to the file to get diagnostics for")});let a=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition())}getToolDefinition(){return{name:"get_diagnostics_by_path",label:"Get Diagnostics By Path",order:9,description:`Retrieves diagnostic information (errors, warnings, etc.) from a specific file in the project. Use this tool to get information about problems in any project file. IMPORTANT: This tool should be called after any code generation or modification operations to verify and fix potential issues. Requires a filePathInProject parameter specifying the target file path relative to project root. Returns a JSON-formatted list of diagnostics, where each entry contains: - path: The file path where the diagnostic was found - line: The line number (1-based) of the diagnostic - severity: The severity level ("error", "warning", "information", or "hint") - message: The diagnostic message Returns an empty list ([]) if no diagnostics are found or the file doesn't exist. Best Practice: Always check diagnostics after code generation to ensure code quality and fix any issues immediately. Use this tool in combination with get_open_in_editor_file_diagnostics to verify all affected files after code changes. Diagnostic Severity Handling Guidelines: - "error": Must be fixed immediately as they indicate critical issues that will prevent code from working correctly. - "warning": For user code, preserve unless the warning indicates a clear improvement opportunity. For generated code, optimize to remove warnings. - "information"/"hint": For user code, preserve as they might reflect intentional patterns. For generated code, optimize if it improves code quality without changing functionality.`,inputSchema:g,handler:this.handler.bind(this)}}async checkFilePath(u,c){const E=this.workspaceService.tryGetRoots();if(!E||E.length===0)throw c.appendLine("Error: Cannot determine project directory"),new Error("Cannot determine project directory");const d=l.URI.parse(E[0].uri).codeUri.fsPath,y=l.path.resolve(d,u),b=l.path.relative(d,y);if(b.startsWith("..")||l.path.isAbsolute(b))throw c.appendLine("Error: File is outside of project scope"),new Error("File is outside of project scope");const A=l.URI.file(y);if(!await this.fileServiceClient.access(A.toString()))throw c.appendLine(`Error: File does not exist: ${A.toString()}`),new Error("File does not exist");return A}async ensureModelCreated(u){if(!this.modelService.getAllModels().some(E=>E.uri.isEqual(u))){const E=new l.Deferred,f=this.markerService.getManager().onMarkerChanged(y=>{y.some(b=>b===u.toString())&&E.resolve()});await this.modelService.createModelReference(u);const d=setTimeout(()=>{E.resolve()},4e3);await E.promise.finally(()=>{f.dispose(),clearTimeout(d)})}}async handler(u,c){try{const E=await this.checkFilePath(u.filePathInProject,c);await this.ensureModelCreated(E);const d=this.markerService.getManager().getMarkers({resource:E.toString()}).map(b=>({path:u.filePathInProject,line:b.startLineNumber,severity:this.getSeverityString(b.severity),message:b.message})),y=JSON.stringify(d,null,2);return c.appendLine(`Found ${d.length} diagnostics in ${u.filePathInProject}`),{content:[{type:"text",text:y}]}}catch(E){return c.appendLine(`Error getting diagnostics: ${E}`),{content:[{type:"text",text:"[]"}],isError:!0}}}getSeverityString(u){switch(u){case l.MarkerSeverity.Error:return"error";case l.MarkerSeverity.Warning:return"warning";case l.MarkerSeverity.Info:return"information";case l.MarkerSeverity.Hint:return"hint";default:return"unknown"}}};t.GetDiagnosticsTool=a,n.__decorate([(0,o.Autowired)(p.IWorkspaceService),n.__metadata("design:type",Object)],a.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],a.prototype,"fileServiceClient",void 0),n.__decorate([(0,o.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],a.prototype,"modelService",void 0),n.__decorate([(0,o.Autowired)(m.IMarkerService),n.__metadata("design:type",Object)],a.prototype,"markerService",void 0),t.GetDiagnosticsTool=a=n.__decorate([(0,l.Domain)(s.MCPServerContribution)],a)},39855:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrepSearchTool=void 0;const n=e(85608),r=e(75995),o=e(76003),l=e(43718),_=e(13439),v=e(51495),m=e(51500),p=e(19413),s=e(59347),g=e(77633),a=e(95292),h=r.z.object({query:r.z.string().describe("The regex pattern to search for"),case_sensitive:r.z.boolean().optional().describe("Whether the search should be case sensitive"),include_pattern:r.z.string().optional().describe('Glob pattern for files to include (e.g. "*.ts" for TypeScript files)'),exclude_pattern:r.z.string().optional().describe("Glob pattern for files to exclude"),explanation:r.z.string().optional().describe("One sentence explanation as to why this tool is being used, and how it contributes to the goal.")}).transform(E=>({query:E.query,caseSensitive:E.case_sensitive,includePattern:E.include_pattern,excludePattern:E.exclude_pattern,explanation:E.explanation})),u=50;let c=class{registerMCPServer(f){f.registerMCPTool(this.getToolDefinition()),f.registerToolComponent("grep_search",a.GrepSearchToolComponent)}getToolDefinition(){return{name:"grep_search",label:"Search Contents",order:4,description:`Fast text-based regex search that finds exact pattern matches within files or directories, utilizing the ripgrep command for efficient searching.
33115
33115
  Results will be formatted in the style of ripgrep and can be configured to include line numbers and content.
33116
33116
  To avoid overwhelming output, the results are capped at 50 matches.
33117
33117
  Use the include or exclude patterns to filter the search scope by file type or specific paths.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/cli-engine",
3
- "version": "3.9.1-next-1755745798.0",
3
+ "version": "3.9.1-next-1755755826.0",
4
4
  "description": "Integration engine runtime for opensumi-cli and opensumi extension",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -26,14 +26,14 @@
26
26
  "dependencies": {
27
27
  "@koa/cors": "^5.0.0",
28
28
  "@opensumi/di": "^1.8.0",
29
- "@opensumi/ide-core-browser": "3.9.1-next-1755745798.0",
30
- "@opensumi/ide-core-common": "3.9.1-next-1755745798.0",
31
- "@opensumi/ide-core-node": "3.9.1-next-1755745798.0",
32
- "@opensumi/ide-express-file-server": "3.9.1-next-1755745798.0",
33
- "@opensumi/ide-extension": "3.9.1-next-1755745798.0",
34
- "@opensumi/ide-i18n": "3.9.1-next-1755745798.0",
35
- "@opensumi/ide-main-layout": "3.9.1-next-1755745798.0",
36
- "@opensumi/ide-startup": "3.9.1-next-1755745798.0",
29
+ "@opensumi/ide-core-browser": "3.9.1-next-1755755826.0",
30
+ "@opensumi/ide-core-common": "3.9.1-next-1755755826.0",
31
+ "@opensumi/ide-core-node": "3.9.1-next-1755755826.0",
32
+ "@opensumi/ide-express-file-server": "3.9.1-next-1755755826.0",
33
+ "@opensumi/ide-extension": "3.9.1-next-1755755826.0",
34
+ "@opensumi/ide-i18n": "3.9.1-next-1755755826.0",
35
+ "@opensumi/ide-main-layout": "3.9.1-next-1755755826.0",
36
+ "@opensumi/ide-startup": "3.9.1-next-1755755826.0",
37
37
  "chalk": "^4.1.2",
38
38
  "ejs": "^3.1.7",
39
39
  "ip": "^1.1.8",
@@ -72,5 +72,5 @@
72
72
  "webpack": "^5.90.0",
73
73
  "webpack-cli": "^5.1.4"
74
74
  },
75
- "gitHead": "3656dd7227b2d2f0f313acfcd5438ec448bf1e6d"
75
+ "gitHead": "266d2174884e0216b388fa145dc114053c25cd11"
76
76
  }