@opensumi/cli-engine 3.8.3-next-1747282011.0 → 3.8.3-next-1747291904.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
|
@@ -31601,7 +31601,7 @@ User's intention: ${g.instructions}
|
|
|
31601
31601
|
Provide the complete updated code.
|
|
31602
31602
|
`,{...this.chatProxyService.getRequestOptions(),trimTexts:["<updated-code>","</updated-code>"],system:"You are a coding assistant that helps merge code updates, ensuring every modification is fully integrated."})}}};t.ApplyService=_,n.__decorate([(0,r.Autowired)(a.IEditorDocumentModelService),n.__metadata("design:type",Object)],_.prototype,"modelService",void 0),n.__decorate([(0,r.Autowired)(o.AIBackSerivcePath),n.__metadata("design:type",Object)],_.prototype,"aiBackService",void 0),n.__decorate([(0,r.Autowired)(p.ChatProxyServiceToken),n.__metadata("design:type",m.ChatProxyService)],_.prototype,"chatProxyService",void 0),t.ApplyService=_=n.__decorate([(0,r.Injectable)()],_)},74055:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentService=void 0;const n=e(85608),r=n.__importDefault(e(66652)),o=e(76003),a=e(43718),p=e(46044),v=e(73307),m=e(29770);let _=class extends a.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new a.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new a.Emitter,this.onDidSendMessage=this._onDidSendMessage.event,this.addDispose(this._onDidChangeAgents),this.addDispose(this.llmContextService.onDidContextFilesChangeEvent(g=>{g.version!==this.contextVersion&&(this.contextVersion=g.version,this.shouldUpdateContext=!0)}))}registerAgent(g){if(this.agents.has(g.id))throw new Error(`Already registered an agent with id ${g.id}`);return this.agents.set(g.id,{agent:g,commands:[]}),this._onDidChangeAgents.fire(),(0,a.toDisposable)(()=>{this.agents.delete(g.id)&&this._onDidChangeAgents.fire()})}async updateAgent(g,l){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g} registered`);h.agent.metadata={...h.agent.metadata,...l},h.commands=await h.agent.provideSlashCommands(a.CancellationToken.None),l.isDefault&&(this.defaultAgentId=g);const u=await h.agent.provideChatWelcomeMessage(a.CancellationToken.None);if(u){const{content:d,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(d,E)}this._onDidChangeAgents.fire()}getAgents(){return Array.from(this.agents.values(),g=>g.agent)}hasAgent(g){return this.agents.has(g)}getDefaultAgentId(){return this.defaultAgentId}getAgent(g){const l=this.agents.get(g);return l?.agent}async invokeAgent(g,l,h,u,d){const E=this.agents.get(g);if(!E)throw new Error(`No agent with id ${g}`);if(this.initialUserMessageMap.has(l.sessionId))(this.shouldUpdateContext||l.regenerate||u.length===0)&&(l.message=await this.provideContextMessage(l.message,l.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(l.sessionId,l.message);const c=l.message;l.message=await this.provideContextMessage(c,l.sessionId)}return await E.agent.invoke(l,h,u,d)}async provideContextMessage(g,l){const h=await this.llmContextService.serialize(),u=await this.promptProvider.provideContextPrompt(h,g);return this.aiReporter.send({msgType:a.AIServiceType.Chat,actionType:a.ActionTypeEnum.ContextEnhance,actionSource:a.ActionSourceEnum.Chat,sessionId:l,message:u}),u}populateChatInput(g,l){this.aiChatService.sendMessage({...l,agentId:g,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:g,commands:l})=>l.map(h=>({...h,agentId:g.id}))))}async getFollowups(g,l,h){const u=this.agents.get(g);if(!u)throw new Error(`No agent with id ${g}`);return u.agent.provideFollowups?u.agent.provideFollowups(l,h):[]}async getSampleQuestions(g,l){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(l):[]}async getAllSampleQuestions(){const g=await Promise.all(Array.from(this.agents.values()).map(async({agent:l})=>{try{return await this.getSampleQuestions(l.id,a.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(g)}sendMessage(g){this._onDidSendMessage.fire(g)}parseMessage(g,l){var h;const u={agentId:"",command:"",message:g};let d=l;const E=this.getAgents(),f=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),c=u.message.match(f);if(c){const y=E.find(b=>b.id.toLowerCase()===c[1].toLowerCase());if(!y)return u;d=y.id,u.agentId=d,u.message=u.message.replace(c[0],"")}if(d){const y=(h=this.agents.get(d))===null||h===void 0?void 0:h.commands;if(y?.length){const b=new RegExp(`^/\\s?(${y.map(S=>S.name).join("|")})(?:\\s+|$)`,"i"),A=u.message.match(b);if(A){const S=y.find(D=>D.name.toLowerCase()===A[1].toLowerCase());if(!S)return u;u.command=S.name,u.message=u.message.replace(A[0],"")}}}return u}};t.ChatAgentService=_,n.__decorate([(0,o.Autowired)(a.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(a.IAIReporter),n.__metadata("design:type",Object)],_.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(p.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"llmContextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],_.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(a.ChatServiceToken),n.__metadata("design:type",m.ChatService)],_.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(a.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],_.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=_=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],_)},84543:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),a=e(19413),p=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(_){return this.componentsMap.set(_.id,_),this.componentsDeferredMap.has(_.id)&&(this.componentsDeferredMap.get(_.id).resolve(_),this.componentsDeferredMap.delete(_.id)),{dispose:()=>{this.componentsMap.get(_.id)===_&&(this.componentsMap.delete(_.id),this.componentsDeferredMap.delete(_.id))}}}getChatComponent(_){return this.componentsMap.has(_)?this.componentsMap.get(_):(this.componentsDeferredMap.has(_)||this.componentsDeferredMap.set(_,new o.Deferred),null)}getChatComponentDeferred(_){return this.componentsDeferredMap.get(_)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(_=>_.id!==p.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(a.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},98987:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatEditSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),a=e(54414),p=e(96689),v=e(73974);let m=class{constructor(){this._onDidChangeContent=new o.Emitter,this.onDidChangeContent=this._onDidChangeContent.event}handlesScheme(s){return s===v.BaseApplyService.CHAT_EDITING_SOURCE_RESOLVER_SCHEME}async provideEditorDocumentModelContent(s,g){const{id:l,side:h}=s.getParsedQuery(),d=this.baseApplyService.getSessionCodeBlocks().find(f=>f.toolCallId===l);return(h==="left"?d?.originalCode:d?.updatedCode)||""}isReadonly(s){return!0}onDidDisposeModel(){}};t.ChatEditSchemeDocumentProvider=m,n.__decorate([(0,r.Autowired)(p.IEditorDocumentModelService),n.__metadata("design:type",Object)],m.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,r.Autowired)(a.WorkbenchEditorService),n.__metadata("design:type",a.WorkbenchEditorService)],m.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],m.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(o.IApplicationService),n.__metadata("design:type",Object)],m.prototype,"applicationService",void 0),n.__decorate([(0,r.Autowired)(v.BaseApplyService),n.__metadata("design:type",v.BaseApplyService)],m.prototype,"baseApplyService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ChatEditSchemeDocumentProvider=m=n.__decorate([(0,r.Injectable)()],m)},61282:(x,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),a=e(76003),p=e(41869),v=e(43718),m=e(19413),_=e(44260),s=e(42033),g=20;class l extends v.LRUCache{disposeKey(d){const E=this.get(d);E&&E.dispose(),this.delete(d)}dispose(){this.forEach(d=>{d.dispose()}),this.clear()}}let h=class extends v.Disposable{fromJSON(d){return d.filter(E=>E.history.messages.length>0).map(E=>{const f=new s.ChatModel({sessionId:E.sessionId,history:new _.MsgHistoryManager(E.history),modelId:E.modelId}),c=E.requests.map(y=>new s.ChatRequestModel(y.requestId,f,y.message,new s.ChatResponseModel(y.requestId,f,y.message.agentId,{responseContents:y.response.responseContents,isComplete:!0,responseText:y.response.responseText,responseParts:y.response.responseParts,errorDetails:y.response.errorDetails,followups:y.response.followups,isCanceled:y.response.isCanceled})));return f.restoreRequests(c),f})}constructor(){super(),n.set(this,this.registerDispose(new l(g))),r.set(this,this.registerDispose(new v.DisposableMap)),this.storageInitEmitter=new v.Emitter,this.onStorageInit=this.storageInitEmitter.event}async init(){this._chatStorage=await this.storageProvider(v.STORAGE_NAMESPACE.CHAT);const d=this._chatStorage.get("sessionModels",[]);this.fromJSON(d).forEach(f=>{o.__classPrivateFieldGet(this,n,"f").set(f.sessionId,f),this.listenSession(f)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){const d=new s.ChatModel;return o.__classPrivateFieldGet(this,n,"f").set(d.sessionId,d),this.listenSession(d),d}getSession(d){return o.__classPrivateFieldGet(this,n,"f").get(d)}clearSession(d){var E;if(!o.__classPrivateFieldGet(this,n,"f").get(d))throw new Error(`Unknown session: ${d}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(d),(E=o.__classPrivateFieldGet(this,r,"f").get(d))===null||E===void 0||E.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(d),this.saveSessions()}createRequest(d,E,f,c,y){const b=this.getSession(d);if(!b)throw new Error(`Unknown session: ${d}`);if(!o.__classPrivateFieldGet(this,r,"f").has(d))return b.addRequest({prompt:E,agentId:f,command:c,images:y})}async sendRequest(d,E,f){const c=this.getSession(d);if(!c)throw new Error(`Unknown session: ${d}`);const y=c.modelId,b=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);if(!y)c.modelId=b;else if(y!==b)throw new Error("Model changed unexpectedly");const A=new v.CancellationTokenSource,S=A.token;o.__classPrivateFieldGet(this,r,"f").set(c.sessionId,A);const D=S.onCancellationRequested(()=>{E.response.cancel()}),I=this.preferenceService.get(v.AINativeSettingSectionsId.ContextWindow),w=c.getMessageHistory(I);try{const T=O=>{S.isCancellationRequested||c.acceptResponseProgress(E,O)},R={sessionId:d,requestId:E.requestId,message:E.message.prompt,command:E.message.command,images:E.message.images,regenerate:f},P=await this.chatAgentService.invokeAgent(E.message.agentId,R,T,w,S);S.isCancellationRequested||(P.errorDetails&&E.response.setErrorDetails(P.errorDetails),this.chatAgentService.getFollowups(E.message.agentId,d,v.CancellationToken.None).then(M=>{E.response.setFollowups(M),E.response.complete()}))}finally{D.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(c.sessionId),this.saveSessions()}}listenSession(d){this.addDispose(d.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(d){var E;(E=o.__classPrivateFieldGet(this,r,"f").get(d))===null||E===void 0||E.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(d),this.saveSessions()}};t.ChatManagerService=h,n=new WeakMap,r=new WeakMap,o.__decorate([(0,a.Autowired)(a.INJECTOR_TOKEN),o.__metadata("design:type",a.Injector)],h.prototype,"injector",void 0),o.__decorate([(0,a.Autowired)(m.IChatAgentService),o.__metadata("design:type",Object)],h.prototype,"chatAgentService",void 0),o.__decorate([(0,a.Autowired)(v.StorageProvider),o.__metadata("design:type",Function)],h.prototype,"storageProvider",void 0),o.__decorate([(0,a.Autowired)(p.PreferenceService),o.__metadata("design:type",Object)],h.prototype,"preferenceService",void 0),o.__decorate([(0,v.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],h.prototype,"saveSessions",null),t.ChatManagerService=h=o.__decorate([(0,a.Injectable)(),o.__metadata("design:paramtypes",[])],h)},42033:(x,t,e)=>{"use strict";var n,r,o,a,p,v,m,_,s,g,l,h,u,d,E,f,c;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatSlashCommandItemModel=t.ChatWelcomeMessageModel=t.ChatModel=t.ChatRequestModel=t.ChatResponseModel=void 0;const y=e(85608),b=e(76003),A=e(43718),S=e(90684),D=e(19413),I=e(44260);class w extends A.Disposable{get responseParts(){return y.__classPrivateFieldGet(this,r,"f")}get responseContents(){return y.__classPrivateFieldGet(this,o,"f")}get isComplete(){return y.__classPrivateFieldGet(this,a,"f")}get isCanceled(){return y.__classPrivateFieldGet(this,p,"f")}get requestId(){return y.__classPrivateFieldGet(this,v,"f")}get responseText(){return y.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return y.__classPrivateFieldGet(this,_,"f")}get followups(){return y.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return y.__classPrivateFieldGet(this,g,"f").event}constructor(k,F,L,B){super(),n.add(this),this.session=F,this.agentId=L,r.set(this,[]),o.set(this,[]),a.set(this,!1),p.set(this,!1),v.set(this,void 0),m.set(this,""),_.set(this,void 0),s.set(this,void 0),g.set(this,this.registerDispose(new A.Emitter)),y.__classPrivateFieldSet(this,v,k,"f"),B&&(y.__classPrivateFieldSet(this,o,B.responseContents,"f"),y.__classPrivateFieldSet(this,r,B.responseParts||[],"f"),y.__classPrivateFieldSet(this,m,B.responseText,"f"),y.__classPrivateFieldSet(this,a,B.isComplete,"f"),y.__classPrivateFieldSet(this,p,B.isCanceled,"f"),y.__classPrivateFieldSet(this,_,B.errorDetails,"f"),y.__classPrivateFieldSet(this,s,B.followups,"f"))}updateContent(k,F){var L;const B=y.__classPrivateFieldGet(this,r,"f").length-1;if(k.kind==="content"||k.kind==="markdownContent"){const U=y.__classPrivateFieldGet(this,r,"f")[B];!U||U.kind!=="markdownContent"?k.kind==="content"?y.__classPrivateFieldGet(this,r,"f").push({content:new S.MarkdownString(k.content),kind:"markdownContent"}):y.__classPrivateFieldGet(this,r,"f").push(k):k.kind==="markdownContent"?y.__classPrivateFieldGet(this,r,"f")[B]={content:new S.MarkdownString(U.content.value+k.content.value),kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[B]={content:new S.MarkdownString(U.content.value+k.content,U.content),kind:"markdownContent"},y.__classPrivateFieldGet(this,n,"m",l).call(this)}else if(k.kind==="reasoning"){const U=y.__classPrivateFieldGet(this,r,"f")[B];!U||U.kind!=="reasoning"?y.__classPrivateFieldGet(this,r,"f").push({content:k.content.replace(/^<think>/,""),kind:"reasoning"}):y.__classPrivateFieldGet(this,r,"f")[B]={content:U.content+k.content,kind:"reasoning"},y.__classPrivateFieldGet(this,n,"m",l).call(this)}else if(k.kind==="asyncContent"){const U=y.__classPrivateFieldGet(this,r,"f").push(k)-1;y.__classPrivateFieldGet(this,n,"m",l).call(this),(L=k.resolvedContent)===null||L===void 0||L.then(W=>{typeof W=="string"?y.__classPrivateFieldGet(this,r,"f")[U]={content:new S.MarkdownString(W),kind:"markdownContent"}:(0,S.isMarkdownString)(W)?y.__classPrivateFieldGet(this,r,"f")[U]={content:W,kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[U]=W,y.__classPrivateFieldGet(this,n,"m",l).call(this,F)})}else if(k.kind==="treeData"||k.kind==="component")y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",l).call(this,F);else if(k.kind==="toolCall"){const U=y.__classPrivateFieldGet(this,r,"f").find(W=>W.kind==="toolCall"&&W.content.id===k.content.id);U?U.content=k.content:y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",l).call(this,F)}}complete(){y.__classPrivateFieldSet(this,a,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}cancel(){y.__classPrivateFieldSet(this,a,!0,"f"),y.__classPrivateFieldSet(this,p,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}reset(){y.__classPrivateFieldSet(this,o,[],"f"),y.__classPrivateFieldSet(this,r,[],"f"),y.__classPrivateFieldSet(this,m,"","f"),y.__classPrivateFieldSet(this,p,!1,"f"),y.__classPrivateFieldSet(this,a,!1,"f"),y.__classPrivateFieldSet(this,_,void 0,"f"),y.__classPrivateFieldSet(this,s,void 0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setErrorDetails(k){y.__classPrivateFieldSet(this,_,k,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setFollowups(k){y.__classPrivateFieldSet(this,s,k,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}toJSON(){return{isCanceled:this.isCanceled,responseContents:this.responseContents,responseText:this.responseText,responseParts:this.responseParts,errorDetails:this.errorDetails,followups:this.followups}}}t.ChatResponseModel=w,r=new WeakMap,o=new WeakMap,a=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,_=new WeakMap,s=new WeakMap,g=new WeakMap,n=new WeakSet,l=function(k){y.__classPrivateFieldSet(this,m,y.__classPrivateFieldGet(this,r,"f").map(L=>L.kind==="asyncContent"?L.content:L.kind==="treeData"||L.kind==="component"?"":L.kind==="toolCall"?L.content.function.name:L.kind==="reasoning"?"":L.content.value).join(`
|
|
31603
31603
|
|
|
31604
|
-
`),"f");const F=[];for(const L of y.__classPrivateFieldGet(this,r,"f")){const B=F[F.length-1];L.kind==="markdownContent"&&B?.kind==="markdownContent"?F[F.length-1]={content:new S.MarkdownString(B.content.value+L.content.value,{isTrusted:B.content.isTrusted}),kind:"markdownContent"}:F.push(L)}y.__classPrivateFieldSet(this,o,F,"f"),k||y.__classPrivateFieldGet(this,g,"f").fire()};class T{get requestId(){return y.__classPrivateFieldGet(this,h,"f")}constructor(k,F,L,B){this.session=F,this.message=L,this.response=B,h.set(this,void 0),y.__classPrivateFieldSet(this,h,k,"f")}toJSON(){return{requestId:this.requestId,message:this.message,response:this.response}}}t.ChatRequestModel=T,h=new WeakMap;class R extends A.Disposable{constructor(k){var F,L;super(),this.requestIdPool=0,u.set(this,void 0),d.set(this,new Map),E.set(this,0),f.set(this,void 0),y.__classPrivateFieldSet(this,u,(F=k?.sessionId)!==null&&F!==void 0?F:(0,A.uuid)(),"f"),this.history=(L=k?.history)!==null&&L!==void 0?L:new I.MsgHistoryManager,y.__classPrivateFieldSet(this,f,k?.modelId,"f")}get sessionId(){return y.__classPrivateFieldGet(this,u,"f")}get requests(){return Array.from(y.__classPrivateFieldGet(this,d,"f").values())}restoreRequests(k){y.__classPrivateFieldSet(this,d,new Map(k.map(F=>[F.requestId,F])),"f"),this.requestIdPool=k.length}get slicedMessageCount(){return y.__classPrivateFieldGet(this,E,"f")}get modelId(){return y.__classPrivateFieldGet(this,f,"f")}set modelId(k){y.__classPrivateFieldSet(this,f,k,"f")}getMessageHistory(k){var F,L;const B=[];for(const U of this.requests)if(U.response.isComplete){B.push({role:"user",content:!((F=U.message.images)===null||F===void 0)&&F.length?[{type:"text",text:U.message.prompt},...U.message.images.map(W=>({type:"image",image:new URL(W)}))]:U.message.prompt});for(const W of U.response.responseParts)W.kind==="treeData"||W.kind==="component"||(W.kind!=="toolCall"?B.push({role:"assistant",content:[{type:"text",text:W.kind==="markdownContent"?W.content.value:W.content}]}):(B[B.length-1].role!=="assistant"&&B.push({role:"assistant",content:[]}),B[B.length-1].content.push({type:"tool-call",toolCallId:W.content.id,toolName:W.content.function.name,args:JSON.parse(W.content.function.arguments||"{}")}),B.push({role:"tool",content:[{type:"tool-result",toolCallId:W.content.id,toolName:W.content.function.name,result:JSON.parse(W.content.result||"{}")}]})))}if(k)for(;y.__classPrivateFieldGet(this,E,"f")<B.length&&!(JSON.stringify(B.slice(y.__classPrivateFieldGet(this,E,"f"))).length/3<=k);)y.__classPrivateFieldSet(this,E,(L=y.__classPrivateFieldGet(this,E,"f"),L++,L),"f");return B.slice(y.__classPrivateFieldGet(this,E,"f"))}addRequest(k){const F=k,L=`${this.sessionId}_request_${this.requestIdPool++}`,B=new w(L,this,F.agentId),U=new T(L,this,F,B);return y.__classPrivateFieldGet(this,d,"f").set(L,U),U}acceptResponseProgress(k,F,L){if(k.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");const{kind:B}=F;["content","markdownContent","asyncContent","treeData","component","toolCall","reasoning"].includes(B)?k.response.updateContent(F,L):console.error(`Couldn't handle progress: ${JSON.stringify(F)}`)}getRequest(k){return y.__classPrivateFieldGet(this,d,"f").get(k)}dispose(){super.dispose(),y.__classPrivateFieldGet(this,d,"f").forEach(k=>k.response.dispose())}toJSON(){return{sessionId:this.sessionId,modelId:this.modelId,history:this.history,requests:this.requests}}}t.ChatModel=R,u=new WeakMap,d=new WeakMap,E=new WeakMap,f=new WeakMap;let P=c=class extends A.Disposable{get id(){return this._id}constructor(k,F){super(),this.content=k,this.sampleQuestions=F,this._id="welcome_"+c.nextId++}};t.ChatWelcomeMessageModel=P,P.nextId=0,t.ChatWelcomeMessageModel=P=c=y.__decorate([(0,b.Injectable)({multiple:!0}),y.__metadata("design:paramtypes",[Object,Array])],P);let O=class extends A.Disposable{constructor(k,F,L){super(),this.chatCommand=k,this.command=F,this.agentId=L}get name(){return this.chatCommand.name}get isShortcut(){return!!this.chatCommand.isShortcut}get icon(){return this.chatCommand.icon}get description(){return this.chatCommand.description}get tooltip(){return this.chatCommand.tooltip}get nameWithSlash(){return this.name.startsWith(D.SLASH_SYMBOL)?this.name:`${D.SLASH_SYMBOL} ${this.name}`}};t.ChatSlashCommandItemModel=O,t.ChatSlashCommandItemModel=O=y.__decorate([(0,b.Injectable)({multiple:!0}),y.__metadata("design:paramtypes",[Object,String,String])],O)},42995:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMultiDiffSource=t.ChatMultiDiffResolver=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(64335),v=e(73974);let m=n=class{canHandleUri(l){return l.scheme===n.CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME}resolveDiffSource(l){return Promise.resolve(new s(this.baseApplyService,this.appConfig))}};t.ChatMultiDiffResolver=m,m.CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME="chat-editing-multi-diff-source",r.__decorate([(0,o.Autowired)(v.BaseApplyService),r.__metadata("design:type",v.BaseApplyService)],m.prototype,"baseApplyService",void 0),r.__decorate([(0,o.Autowired)(a.AppConfig),r.__metadata("design:type",Object)],m.prototype,"appConfig",void 0),t.ChatMultiDiffResolver=m=n=r.__decorate([(0,o.Injectable)()],m);const _=(g,l,h)=>a.URI.from({scheme:v.BaseApplyService.CHAT_EDITING_SOURCE_RESOLVER_SCHEME,path:g,query:a.URI.stringifyQuery({id:l,side:h})});class s{constructor(l,h){this.baseApplyService=l,this.appConfig=h,this.resources=(()=>{const u=this.baseApplyService,d=this.appConfig;return{get value(){return u.getSessionCodeBlocks().filter(E=>E.status==="success"||E.status==="pending").reduce((E,f)=>{const c=E.find(y=>y.relativePath===f.relativePath);return c?(f.version<c.oldVersion&&(c.oldVersion=f.version,c.oldBlockId=f.toolCallId),f.version>c.newVersion&&(c.newVersion=f.version,c.newBlockId=f.toolCallId)):E.push({relativePath:f.relativePath,oldBlockId:f.toolCallId,newBlockId:f.toolCallId,oldVersion:f.version,newVersion:f.version}),E},[]).map(E=>{const f=a.path.join(d.workspaceDir,E.relativePath);return new p.MultiDiffEditorItem(_(f,E.oldBlockId,"left"),_(f,E.newBlockId,"right"),a.URI.file(f))})},onDidChange:this.baseApplyService.onCodeBlockUpdate}})()}}t.ChatMultiDiffSource=s},51081:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatProxyService=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(43718),v=e(27284),m=e(9447),_=e(72665),s=e(93062),g=e(19413),l=e(34817),h=e(29770),u=e(11735);let d=n=class extends p.Disposable{constructor(){super(...arguments),this.chatDeferred=new p.Deferred}getRequestOptions(){const f=this.preferenceService.get(v.AINativeSettingSectionsId.LLMModelSelection),c=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);let y="",b="";f==="deepseek"?y=this.preferenceService.get(v.AINativeSettingSectionsId.DeepseekApiKey,""):f==="openai"?y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""):f==="anthropic"?y=this.preferenceService.get(v.AINativeSettingSectionsId.AnthropicApiKey,""):(y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""),b=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiBaseURL,""));const A=this.preferenceService.get(v.AINativeSettingSectionsId.MaxTokens),S=this.chatAgentService.getAgent(n.AGENT_ID);return{clientId:this.applicationService.clientId,model:f,modelId:c,apiKey:y,baseURL:b,maxTokens:A,system:S?.metadata.systemPrompt}}registerDefaultAgent(){this.chatAgentViewService.registerChatComponent({id:"toolCall",component:l.ChatToolRender,initialProps:{}}),this.addDispose(this.chatAgentService.registerAgent({id:n.AGENT_ID,metadata:{systemPrompt:this.preferenceService.get(v.AINativeSettingSectionsId.SystemPrompt,`You are a powerful AI coding assistant working in OpenSumi, a top IDE framework. You collaborate with a USER to solve coding tasks, which may involve creating, modifying, or debugging code, or answering questions. When the USER sends a message, relevant context (e.g., open files, cursor position, edit history, linter errors) may be attached. Use this information as needed.
|
|
31604
|
+
`),"f");const F=[];for(const L of y.__classPrivateFieldGet(this,r,"f")){const B=F[F.length-1];L.kind==="markdownContent"&&B?.kind==="markdownContent"?F[F.length-1]={content:new S.MarkdownString(B.content.value+L.content.value,{isTrusted:B.content.isTrusted}),kind:"markdownContent"}:F.push(L)}y.__classPrivateFieldSet(this,o,F,"f"),k||y.__classPrivateFieldGet(this,g,"f").fire()};class T{get requestId(){return y.__classPrivateFieldGet(this,h,"f")}constructor(k,F,L,B){this.session=F,this.message=L,this.response=B,h.set(this,void 0),y.__classPrivateFieldSet(this,h,k,"f")}toJSON(){return{requestId:this.requestId,message:this.message,response:this.response}}}t.ChatRequestModel=T,h=new WeakMap;class R extends A.Disposable{constructor(k){var F,L;super(),this.requestIdPool=0,u.set(this,void 0),d.set(this,new Map),E.set(this,0),f.set(this,void 0),y.__classPrivateFieldSet(this,u,(F=k?.sessionId)!==null&&F!==void 0?F:(0,A.uuid)(),"f"),this.history=(L=k?.history)!==null&&L!==void 0?L:new I.MsgHistoryManager,y.__classPrivateFieldSet(this,f,k?.modelId,"f")}get sessionId(){return y.__classPrivateFieldGet(this,u,"f")}get requests(){return Array.from(y.__classPrivateFieldGet(this,d,"f").values())}restoreRequests(k){y.__classPrivateFieldSet(this,d,new Map(k.map(F=>[F.requestId,F])),"f"),this.requestIdPool=k.length}get slicedMessageCount(){return y.__classPrivateFieldGet(this,E,"f")}get modelId(){return y.__classPrivateFieldGet(this,f,"f")}set modelId(k){y.__classPrivateFieldSet(this,f,k,"f")}getMessageHistory(k){var F,L;const B=[];for(const U of this.requests)if(U.response.isComplete){B.push({role:"user",content:!((F=U.message.images)===null||F===void 0)&&F.length?[{type:"text",text:U.message.prompt},...U.message.images.map(W=>({type:"image",image:new URL(W)}))]:U.message.prompt});for(const W of U.response.responseParts)W.kind==="treeData"||W.kind==="component"||(W.kind!=="toolCall"?B.push({role:"assistant",content:[{type:"text",text:W.kind==="markdownContent"?W.content.value:W.content}]}):(B[B.length-1].role!=="assistant"&&B.push({role:"assistant",content:[]}),B[B.length-1].content.push({type:"tool-call",toolCallId:W.content.id,toolName:W.content.function.name,args:(()=>{try{return JSON.parse(W.content.function.arguments||"{}")}catch(j){return console.error("Failed to parse tool call arguments:",j),{}}})()}),B.push({role:"tool",content:[{type:"tool-result",toolCallId:W.content.id,toolName:W.content.function.name,result:(()=>{try{return JSON.parse(W.content.result||"{}")}catch(j){return console.error("Failed to parse tool result:",j),{}}})()}]})))}if(k)for(;y.__classPrivateFieldGet(this,E,"f")<B.length&&!(JSON.stringify(B.slice(y.__classPrivateFieldGet(this,E,"f"))).length/3<=k);)y.__classPrivateFieldSet(this,E,(L=y.__classPrivateFieldGet(this,E,"f"),L++,L),"f");return B.slice(y.__classPrivateFieldGet(this,E,"f"))}addRequest(k){const F=k,L=`${this.sessionId}_request_${this.requestIdPool++}`,B=new w(L,this,F.agentId),U=new T(L,this,F,B);return y.__classPrivateFieldGet(this,d,"f").set(L,U),U}acceptResponseProgress(k,F,L){if(k.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");const{kind:B}=F;["content","markdownContent","asyncContent","treeData","component","toolCall","reasoning"].includes(B)?k.response.updateContent(F,L):console.error(`Couldn't handle progress: ${JSON.stringify(F)}`)}getRequest(k){return y.__classPrivateFieldGet(this,d,"f").get(k)}dispose(){super.dispose(),y.__classPrivateFieldGet(this,d,"f").forEach(k=>k.response.dispose())}toJSON(){return{sessionId:this.sessionId,modelId:this.modelId,history:this.history,requests:this.requests}}}t.ChatModel=R,u=new WeakMap,d=new WeakMap,E=new WeakMap,f=new WeakMap;let P=c=class extends A.Disposable{get id(){return this._id}constructor(k,F){super(),this.content=k,this.sampleQuestions=F,this._id="welcome_"+c.nextId++}};t.ChatWelcomeMessageModel=P,P.nextId=0,t.ChatWelcomeMessageModel=P=c=y.__decorate([(0,b.Injectable)({multiple:!0}),y.__metadata("design:paramtypes",[Object,Array])],P);let O=class extends A.Disposable{constructor(k,F,L){super(),this.chatCommand=k,this.command=F,this.agentId=L}get name(){return this.chatCommand.name}get isShortcut(){return!!this.chatCommand.isShortcut}get icon(){return this.chatCommand.icon}get description(){return this.chatCommand.description}get tooltip(){return this.chatCommand.tooltip}get nameWithSlash(){return this.name.startsWith(D.SLASH_SYMBOL)?this.name:`${D.SLASH_SYMBOL} ${this.name}`}};t.ChatSlashCommandItemModel=O,t.ChatSlashCommandItemModel=O=y.__decorate([(0,b.Injectable)({multiple:!0}),y.__metadata("design:paramtypes",[Object,String,String])],O)},42995:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMultiDiffSource=t.ChatMultiDiffResolver=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(64335),v=e(73974);let m=n=class{canHandleUri(l){return l.scheme===n.CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME}resolveDiffSource(l){return Promise.resolve(new s(this.baseApplyService,this.appConfig))}};t.ChatMultiDiffResolver=m,m.CHAT_EDITING_MULTI_DIFF_SOURCE_RESOLVER_SCHEME="chat-editing-multi-diff-source",r.__decorate([(0,o.Autowired)(v.BaseApplyService),r.__metadata("design:type",v.BaseApplyService)],m.prototype,"baseApplyService",void 0),r.__decorate([(0,o.Autowired)(a.AppConfig),r.__metadata("design:type",Object)],m.prototype,"appConfig",void 0),t.ChatMultiDiffResolver=m=n=r.__decorate([(0,o.Injectable)()],m);const _=(g,l,h)=>a.URI.from({scheme:v.BaseApplyService.CHAT_EDITING_SOURCE_RESOLVER_SCHEME,path:g,query:a.URI.stringifyQuery({id:l,side:h})});class s{constructor(l,h){this.baseApplyService=l,this.appConfig=h,this.resources=(()=>{const u=this.baseApplyService,d=this.appConfig;return{get value(){return u.getSessionCodeBlocks().filter(E=>E.status==="success"||E.status==="pending").reduce((E,f)=>{const c=E.find(y=>y.relativePath===f.relativePath);return c?(f.version<c.oldVersion&&(c.oldVersion=f.version,c.oldBlockId=f.toolCallId),f.version>c.newVersion&&(c.newVersion=f.version,c.newBlockId=f.toolCallId)):E.push({relativePath:f.relativePath,oldBlockId:f.toolCallId,newBlockId:f.toolCallId,oldVersion:f.version,newVersion:f.version}),E},[]).map(E=>{const f=a.path.join(d.workspaceDir,E.relativePath);return new p.MultiDiffEditorItem(_(f,E.oldBlockId,"left"),_(f,E.newBlockId,"right"),a.URI.file(f))})},onDidChange:this.baseApplyService.onCodeBlockUpdate}})()}}t.ChatMultiDiffSource=s},51081:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatProxyService=void 0;const r=e(85608),o=e(76003),a=e(41869),p=e(43718),v=e(27284),m=e(9447),_=e(72665),s=e(93062),g=e(19413),l=e(34817),h=e(29770),u=e(11735);let d=n=class extends p.Disposable{constructor(){super(...arguments),this.chatDeferred=new p.Deferred}getRequestOptions(){const f=this.preferenceService.get(v.AINativeSettingSectionsId.LLMModelSelection),c=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);let y="",b="";f==="deepseek"?y=this.preferenceService.get(v.AINativeSettingSectionsId.DeepseekApiKey,""):f==="openai"?y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""):f==="anthropic"?y=this.preferenceService.get(v.AINativeSettingSectionsId.AnthropicApiKey,""):(y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""),b=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiBaseURL,""));const A=this.preferenceService.get(v.AINativeSettingSectionsId.MaxTokens),S=this.chatAgentService.getAgent(n.AGENT_ID);return{clientId:this.applicationService.clientId,model:f,modelId:c,apiKey:y,baseURL:b,maxTokens:A,system:S?.metadata.systemPrompt}}registerDefaultAgent(){this.chatAgentViewService.registerChatComponent({id:"toolCall",component:l.ChatToolRender,initialProps:{}}),this.addDispose(this.chatAgentService.registerAgent({id:n.AGENT_ID,metadata:{systemPrompt:this.preferenceService.get(v.AINativeSettingSectionsId.SystemPrompt,`You are a powerful AI coding assistant working in OpenSumi, a top IDE framework. You collaborate with a USER to solve coding tasks, which may involve creating, modifying, or debugging code, or answering questions. When the USER sends a message, relevant context (e.g., open files, cursor position, edit history, linter errors) may be attached. Use this information as needed.
|
|
31605
31605
|
|
|
31606
31606
|
<tool_calling>
|
|
31607
31607
|
You have access to tools to assist with tasks. Follow these rules:
|
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-1747291904.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-1747291904.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.8.3-next-1747291904.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.8.3-next-1747291904.0",
|
|
32
|
+
"@opensumi/ide-express-file-server": "3.8.3-next-1747291904.0",
|
|
33
|
+
"@opensumi/ide-extension": "3.8.3-next-1747291904.0",
|
|
34
|
+
"@opensumi/ide-i18n": "3.8.3-next-1747291904.0",
|
|
35
|
+
"@opensumi/ide-main-layout": "3.8.3-next-1747291904.0",
|
|
36
|
+
"@opensumi/ide-startup": "3.8.3-next-1747291904.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": "1a964e39edcbba69a49d9eb5b2d857509e6fa696"
|
|
76
76
|
}
|