@opensumi/cli-engine 3.8.3-next-1742278701.0 → 3.8.3-next-1742282327.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/browser.js +1 -1
- package/package.json +10 -10
package/lib/browser/browser.js
CHANGED
|
@@ -31406,7 +31406,7 @@ Content: ${P.lineText||P.renderLineText}`).join(`
|
|
|
31406
31406
|
`).length}};t.ListDirHandler=v,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],v.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(c.IFileServiceClient),n.__metadata("design:type",Object)],v.prototype,"fileSystemService",void 0),t.ListDirHandler=v=n.__decorate([(0,r.Injectable)()],v)},707:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.FileHandler=void 0;const r=e(85608),o=e(76003),c=e(79240),p=e(41869),v=e(43718),m=e(57517),_=e(14951);let s=n=class{constructor(){this.fileResultMap=new Map}async findSimilarFiles(l,h){return(await this.fileSearchQuickCommandHandler.getQueryFiles(l,new Set,v.CancellationToken.None)).slice(0,h).map(d=>{var E;return(E=d.getUri())===null||E===void 0?void 0:E.codeUri.fsPath}).filter(Boolean)}createFileNotFoundError(l,h){const u=h.length>0?`Could not find file '${l}'. Did you mean one of:
|
|
31407
31407
|
${h.map(d=>`- ${d}`).join(`
|
|
31408
31408
|
`)}`:`Could not find file '${l}' in the workspace.`;return new Error(JSON.stringify({clientVisibleErrorMessage:u,modelVisibleErrorMessage:u,actualErrorMessage:`File not found: ${l}`}))}createFileTooLargeError(l,h){return new Error(JSON.stringify({clientVisibleErrorMessage:`File is too large, >${l}MB`,modelVisibleErrorMessage:`The file is too large to read, was >${l}MB`,actualErrorMessage:`File is too large to read, was >${l}MB, size: ${h} bytes`}))}trimContent(l,h){return l.slice(0,h).split(n.NEWLINE).slice(0,-1).join(n.NEWLINE)}getLineRange(l,h){var u,d;let E=(u=l.startLineOneIndexed)!==null&&u!==void 0?u:1,f=(d=l.endLineOneIndexedInclusive)!==null&&d!==void 0?d:E+n.MAX_LINES-1,a=!1,b=!1;return h?{start:E,end:f,didShorten:a,didSetDefault:b}:(l.endLineOneIndexedInclusive===void 0||l.startLineOneIndexed===void 0?(E=1,f=n.MAX_LINES,b=!0):l.endLineOneIndexedInclusive-l.startLineOneIndexed>n.MAX_LINES&&(f=l.startLineOneIndexed+n.MAX_LINES,a=!0),{start:E,end:f,didShorten:a,didSetDefault:b})}async readFile(l){if(!l)throw new Error("No read file parameters provided. Need to give at least the path.");const h=new v.URI(`${this.appConfig.workspaceDir}/${l.relativeWorkspacePath}`);if(!h){const f=await this.findSimilarFiles(l.relativeWorkspacePath,3);throw this.createFileNotFoundError(l.relativeWorkspacePath,f)}const u=(n.MAX_FILE_SIZE_BYTES/1e6).toFixed(2),d=await this.fileSystemService.getFileStat(h.toString());if(d?.size&&d.size>n.MAX_FILE_SIZE_BYTES)throw this.createFileTooLargeError(u,d.size);let E;try{E=await this.modelService.createModelReference(h);const f=E.instance.getMonacoModel().getValue(),a=f.split(n.NEWLINE),b=!(l.readEntireFile&&l.fileIsAllowedToBeReadEntirely),y=l.readEntireFile&&!l.fileIsAllowedToBeReadEntirely;let A=!1;if(b){const{start:w,end:T,didShorten:D,didSetDefault:I}=this.getLineRange(l,y),O=Math.max(w,1),M=Math.min(T,a.length);let R=a.slice(O-1,M).join(n.NEWLINE);return R.length>n.MAX_CHARS&&(A=!0,R=this.trimContent(R,n.MAX_CHARS)),D&&this.fileResultMap.set(l.relativeWorkspacePath,{content:R,startLineOneIndexed:O,endLineOneIndexedInclusive:M}),{contents:R,didDowngradeToLineRange:y,didShortenLineRange:D,didShortenCharRange:A,didSetDefaultLineRange:I,fullFileContents:f,startLineOneIndexed:O,endLineOneIndexedInclusive:M,relativeWorkspacePath:l.relativeWorkspacePath}}let S=f;return S.length>n.MAX_CHARS&&(A=!0,S=this.trimContent(S,n.MAX_CHARS)),{contents:S,fullFileContents:f,didDowngradeToLineRange:!1,didShortenCharRange:A}}finally{E?.dispose()}}getFileReadResult(l){return this.fileResultMap.get(l)}};t.FileHandler=s,s.MAX_FILE_SIZE_BYTES=2e6,s.MAX_LINES=250,s.MAX_CHARS=1e5,s.NEWLINE=`
|
|
31409
|
-
`,r.__decorate([(0,o.Autowired)(m.IEditorDocumentModelService),r.__metadata("design:type",Object)],s.prototype,"modelService",void 0),r.__decorate([(0,o.Autowired)(c.FileSearchQuickCommandHandler),r.__metadata("design:type",c.FileSearchQuickCommandHandler)],s.prototype,"fileSearchQuickCommandHandler",void 0),r.__decorate([(0,o.Autowired)(p.AppConfig),r.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(_.IFileServiceClient),r.__metadata("design:type",Object)],s.prototype,"fileSystemService",void 0),t.FileHandler=s=n=r.__decorate([(0,o.Injectable)()],s)},22559:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RunCommandHandler=t.inputSchema=void 0;const n=e(85608),r=n.__importDefault(e(75995)),o=e(76003),c=e(41869),p=e(6487),v=e(69448),m={italic:"\x1B[3m",reset:"\x1B[0m"};t.inputSchema=r.default.object({command:r.default.string().describe("The terminal command to execute"),is_background:r.default.boolean().describe("Whether the command should be run in the background"),explanation:r.default.string().describe("One sentence explanation as to why this command needs to be run and how it contributes to the goal."),require_user_approval:r.default.boolean().describe("Whether the user must approve the command before it is executed. Only set this to false if the command is safe and if it matches the user's requirements for commands that should be executed automatically.")});let _=class{constructor(){this.approvalDeferredMap=new Map,this.terminalId=0}getShellLaunchConfig(g){return{name:`MCP:Terminal_${this.terminalId++}`,cwd:this.appConfig.workspaceDir,args:["-c",g]}}async handler(g,l){if(l.appendLine(`Executing command: ${g.command}`),g.require_user_approval){const E=new v.Deferred;if(this.approvalDeferredMap.set(g.toolCallId,E),!await E.promise)return{isError:!1,content:[{type:"text",text:"User rejection"}]}}const h=await this.terminalController.createTerminalWithWidget({config:this.getShellLaunchConfig(g.command),closeWhenExited:!1});this.terminalController.showTerminalPanel();const u=[],d=new v.Deferred;return h.onOutput(E=>{u.push({type:"text",text:E.data.toString()})}),h.onExit(E=>{const f=E.code!==0;d.resolve({isError:f,content:u}),l.appendLine(`Command ${g.command} finished with exit code: ${E.code}`),h.term.writeln(`
|
|
31409
|
+
`,r.__decorate([(0,o.Autowired)(m.IEditorDocumentModelService),r.__metadata("design:type",Object)],s.prototype,"modelService",void 0),r.__decorate([(0,o.Autowired)(c.FileSearchQuickCommandHandler),r.__metadata("design:type",c.FileSearchQuickCommandHandler)],s.prototype,"fileSearchQuickCommandHandler",void 0),r.__decorate([(0,o.Autowired)(p.AppConfig),r.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(_.IFileServiceClient),r.__metadata("design:type",Object)],s.prototype,"fileSystemService",void 0),t.FileHandler=s=n=r.__decorate([(0,o.Injectable)()],s)},22559:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RunCommandHandler=t.inputSchema=void 0;const n=e(85608),r=n.__importDefault(e(75995)),o=e(76003),c=e(41869),p=e(6487),v=e(69448),m={italic:"\x1B[3m",reset:"\x1B[0m"};t.inputSchema=r.default.object({command:r.default.string().describe("The terminal command to execute"),is_background:r.default.boolean().describe("Whether the command should be run in the background"),explanation:r.default.string().describe("One sentence explanation as to why this command needs to be run and how it contributes to the goal."),require_user_approval:r.default.boolean().describe("Whether the user must approve the command before it is executed. Only set this to false if the command is safe and if it matches the user's requirements for commands that should be executed automatically.")});let _=class{constructor(){this.approvalDeferredMap=new Map,this.terminalId=0}getShellLaunchConfig(g){return{name:`MCP:Terminal_${this.terminalId++}`,cwd:this.appConfig.workspaceDir,args:["-c",g]}}async handler(g,l){if(l.appendLine(`Executing command: ${g.command}`),g.require_user_approval){const E=new v.Deferred;if(this.approvalDeferredMap.set(g.toolCallId,E),!await E.promise)return{isError:!1,content:[{type:"text",text:"User rejection"}]}}const h=await this.terminalController.createTerminalWithWidget({config:this.getShellLaunchConfig(g.command),closeWhenExited:!1});this.terminalController.showTerminalPanel();const u=[],d=new v.Deferred;return g.is_background&&d.resolve({isError:!1,content:[{type:"text",text:`Successful run command ${g.command} in background.`}]}),h.onOutput(E=>{u.push({type:"text",text:E.data.toString()})}),h.onExit(E=>{const f=E.code!==0;d.resolve({isError:f,content:u}),l.appendLine(`Command ${g.command} finished with exit code: ${E.code}`),h.term.writeln(`
|
|
31410
31410
|
${m.italic}> Command ${g.command} executed successfully. Terminal will close in ${3e3/1e3} seconds.${m.reset}
|
|
31411
31411
|
`),setTimeout(()=>{h.dispose(),this.terminalView.removeWidget(h.id)},3e3)}),d.promise}handleApproval(g,l){if(!this.approvalDeferredMap.has(g))return;const h=this.approvalDeferredMap.get(g);h?.resolve(l)}};t.RunCommandHandler=_,n.__decorate([(0,o.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],_.prototype,"terminalController",void 0),n.__decorate([(0,o.Autowired)(c.AppConfig),n.__metadata("design:type",Object)],_.prototype,"appConfig",void 0),n.__decorate([(0,o.Autowired)(p.ITerminalGroupViewService),n.__metadata("design:type",Object)],_.prototype,"terminalView",void 0),t.RunCommandHandler=_=n.__decorate([(0,o.Injectable)()],_)},82248:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDirTool=void 0;const n=e(85608),r=e(75995),o=e(76003),c=e(43718),p=e(19413),v=e(59347),m=e(77633),_=e(95292),s=e(64942),g=r.z.object({relative_workspace_path:r.z.string().describe("Path to list contents of, relative to the workspace root. Ex: './' is the root of the workspace"),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(h=>({relativeWorkspacePath:h.relative_workspace_path}));let l=class{registerMCPServer(u){u.registerMCPTool(this.getToolDefinition()),u.registerToolComponent("list_dir",_.ListDirToolComponent)}getToolDefinition(){return{name:"list_dir",label:"List Directory",order:3,description:"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.",inputSchema:g,handler:this.handler.bind(this)}}async handler(u,d){const E=await this.listDirHandler.handler(u),f=E.files.map(b=>({uri:`${this.listDirHandler.getWorkspaceDir()}/${E.directoryRelativeWorkspacePath}/${b.name}`,isDirectory:b.isDirectory})),a=this.chatInternalService.sessionModel.history.getMessages();return this.chatInternalService.sessionModel.history.setMessageAdditional(a[a.length-1].id,{[u.toolCallId]:{files:f,title:`Listed directory "${u.relativeWorkspacePath}"`,details:E.files.map(b=>{var y;return{type:b.isDirectory?"dir":"file",name:b.name,info:b.isDirectory?`${(y=b.numChildren)!==null&&y!==void 0?y:"?"} items`:`${b.size}KB, ${b.numLines} lines`,lastModified:b.lastModified}})}}),d.appendLine(`Listed ${f.length} files in directory "${u.relativeWorkspacePath}"`),{content:[{type:"text",text:`Contents of directory "${u.relativeWorkspacePath}":
|
|
31412
31412
|
${E.files.map(b=>{var y;return`[${b.isDirectory?"dir":"file"}] ${b.name} ${b.isDirectory?`(${(y=b.numChildren)!==null&&y!==void 0?y:"?"} items)`:`(${b.size}KB, ${b.numLines} lines)`} - ${new Date(b.lastModified).toLocaleString()}`}).join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/cli-engine",
|
|
3
|
-
"version": "3.8.3-next-
|
|
3
|
+
"version": "3.8.3-next-1742282327.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.8.3-next-
|
|
30
|
-
"@opensumi/ide-core-common": "3.8.3-next-
|
|
31
|
-
"@opensumi/ide-core-node": "3.8.3-next-
|
|
32
|
-
"@opensumi/ide-express-file-server": "3.8.3-next-
|
|
33
|
-
"@opensumi/ide-extension": "3.8.3-next-
|
|
34
|
-
"@opensumi/ide-i18n": "3.8.3-next-
|
|
35
|
-
"@opensumi/ide-main-layout": "3.8.3-next-
|
|
36
|
-
"@opensumi/ide-startup": "3.8.3-next-
|
|
29
|
+
"@opensumi/ide-core-browser": "3.8.3-next-1742282327.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.8.3-next-1742282327.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.8.3-next-1742282327.0",
|
|
32
|
+
"@opensumi/ide-express-file-server": "3.8.3-next-1742282327.0",
|
|
33
|
+
"@opensumi/ide-extension": "3.8.3-next-1742282327.0",
|
|
34
|
+
"@opensumi/ide-i18n": "3.8.3-next-1742282327.0",
|
|
35
|
+
"@opensumi/ide-main-layout": "3.8.3-next-1742282327.0",
|
|
36
|
+
"@opensumi/ide-startup": "3.8.3-next-1742282327.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": "
|
|
75
|
+
"gitHead": "5bb10b8a48fc1ac24b2fbfe7a9f14670875164c3"
|
|
76
76
|
}
|