@opensumi/cli-engine 3.9.1-next-1755755826.0 → 3.9.1-next-1755767441.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 +10 -3
- package/package.json +10 -10
package/lib/browser/browser.js
CHANGED
|
@@ -10224,12 +10224,15 @@ html li {
|
|
|
10224
10224
|
}
|
|
10225
10225
|
.dcJZaa41dqWwmySAYJXD > pre {
|
|
10226
10226
|
margin-bottom: 10px;
|
|
10227
|
+
max-height: 400px;
|
|
10228
|
+
overflow-y: auto;
|
|
10227
10229
|
}
|
|
10228
10230
|
.dcJZaa41dqWwmySAYJXD .vrcvB4EZ8XAfuxQWufCX {
|
|
10229
10231
|
border-radius: 8px;
|
|
10230
10232
|
font-size: 12px;
|
|
10231
10233
|
padding: 28px 8px 8px 8px;
|
|
10232
10234
|
line-height: 18px;
|
|
10235
|
+
white-space: pre-wrap;
|
|
10233
10236
|
}
|
|
10234
10237
|
.dcJZaa41dqWwmySAYJXD .vrcvB4EZ8XAfuxQWufCX::-webkit-scrollbar {
|
|
10235
10238
|
width: auto;
|
|
@@ -10607,7 +10610,7 @@ html li {
|
|
|
10607
10610
|
.uVULfqu6nAfr8HZoqqnC.UsWZq8AFpMJxrmbVr7xj {
|
|
10608
10611
|
animation: none;
|
|
10609
10612
|
}
|
|
10610
|
-
`,"",{version:3,sources:["webpack://./../../packages/ai-native/lib/browser/components/components.module.less"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,aAAa;EACb,iBAAiB;EACjB,UAAU;EACV,WAAW;AACb;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,oCAAoC;EACpC,eAAe;EACf,oBAAoB;AACtB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,iBAAiB;AACnB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,8BAA8B;EAC9B,mBAAmB;EACnB,mBAAmB;EACnB,kBAAkB;EAClB,aAAa;EACb,WAAW;EACX,eAAe;EACf,oCAAoC;AACtC;AACA;EACE,cAAc;EACd,mBAAmB;EACnB,aAAa;EACb,qBAAqB;AACvB;AACA;EACE,wBAAwB;EACxB,iBAAiB;EACjB,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,uBAAuB;AACzB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,cAAc;AAChB;AACA;EACE,eAAe;AACjB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,kBAAkB;EAClB,kBAAkB;EAClB,yBAAyB;EACzB,wCAAwC;EACxC,oDAAoD;AACtD;AACA;EACE,wDAAwD;AAC1D;AACA;EACE,qBAAqB;EACrB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,8CAA8C;EAC9C,mCAAmC;EACnC,kBAAkB;EAClB,cAAc;EACd,YAAY;EACZ,iBAAiB;EACjB,eAAe;EACf,UAAU;AACZ;AACA;EACE,oCAAoC;EACpC,gBAAgB;AAClB;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,UAAU;EACV,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;EACE,qDAAqD;AACvD;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;AACf;AACA;EACE,+CAA+C;AACjD;AACA;EACE,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,8CAA8C;EAC9C,kBAAkB;EAClB,mKAAmK;AACrK;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,cAAc;EACd,eAAe;EACf,eAAe;EACf,SAAS;AACX;AACA;EACE,+CAA+C;AACjD;AACA;EACE,oBAAoB;AACtB;AACA;EACE,gDAAgD;AAClD;AACA;EACE,+CAA+C;EAC/C,kBAAkB;EAClB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,kBAAkB;AACpB;AACA;EACE,kBAAkB;EAClB,qBAAqB;EACrB,cAAc;EACd,iBAAiB;EACjB,8CAA8C;EAC9C,mCAAmC;AACrC;AACA;EACE,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,mBAAmB;
|
|
10613
|
+
`,"",{version:3,sources:["webpack://./../../packages/ai-native/lib/browser/components/components.module.less"],names:[],mappings:"AAAA;EACE,kBAAkB;EAClB,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,aAAa;EACb,iBAAiB;EACjB,UAAU;EACV,WAAW;AACb;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,oCAAoC;EACpC,eAAe;EACf,oBAAoB;AACtB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,iBAAiB;AACnB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,8BAA8B;EAC9B,mBAAmB;EACnB,mBAAmB;EACnB,kBAAkB;EAClB,aAAa;EACb,WAAW;EACX,eAAe;EACf,oCAAoC;AACtC;AACA;EACE,cAAc;EACd,mBAAmB;EACnB,aAAa;EACb,qBAAqB;AACvB;AACA;EACE,wBAAwB;EACxB,iBAAiB;EACjB,eAAe;AACjB;AACA;EACE,eAAe;AACjB;AACA;EACE,uBAAuB;AACzB;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,eAAe;AACjB;AACA;EACE,aAAa;EACb,cAAc;AAChB;AACA;EACE,eAAe;AACjB;AACA;EACE,oCAAoC;AACtC;AACA;EACE,kBAAkB;EAClB,kBAAkB;EAClB,yBAAyB;EACzB,wCAAwC;EACxC,oDAAoD;AACtD;AACA;EACE,wDAAwD;AAC1D;AACA;EACE,qBAAqB;EACrB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,8CAA8C;EAC9C,mCAAmC;EACnC,kBAAkB;EAClB,cAAc;EACd,YAAY;EACZ,iBAAiB;EACjB,eAAe;EACf,UAAU;AACZ;AACA;EACE,oCAAoC;EACpC,gBAAgB;AAClB;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,UAAU;EACV,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;EACE,qDAAqD;AACvD;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;AACf;AACA;EACE,+CAA+C;AACjD;AACA;EACE,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,YAAY;EACZ,aAAa;EACb,8CAA8C;EAC9C,kBAAkB;EAClB,mKAAmK;AACrK;AACA;EACE,SAAS;EACT,cAAc;AAChB;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,cAAc;EACd,eAAe;EACf,eAAe;EACf,SAAS;AACX;AACA;EACE,+CAA+C;AACjD;AACA;EACE,oBAAoB;AACtB;AACA;EACE,gDAAgD;AAClD;AACA;EACE,+CAA+C;EAC/C,kBAAkB;EAClB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,kBAAkB;AACpB;AACA;EACE,kBAAkB;EAClB,qBAAqB;EACrB,cAAc;EACd,iBAAiB;EACjB,8CAA8C;EAC9C,mCAAmC;AACrC;AACA;EACE,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,mBAAmB;EACnB,iBAAiB;EACjB,gBAAgB;AAClB;AACA;EACE,kBAAkB;EAClB,eAAe;EACf,yBAAyB;EACzB,iBAAiB;EACjB,qBAAqB;AACvB;AACA;EACE,WAAW;EACX,WAAW;AACb;AACA;EACE,aAAa;EACb,kBAAkB;EAClB,UAAU;EACV,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,eAAe;AACjB;AACA;EACE,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,iBAAiB;EACjB,cAAc;AAChB;AACA;EACE,yCAAyC;AAC3C;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,UAAU;EACV,iBAAiB;EACjB,cAAc;EACd,mDAAmD;EACnD,4BAA4B;EAC5B,oCAAoC;EACpC,eAAe;AACjB;AACA;EACE,kBAAkB;AACpB;AACA;EACE,YAAY;AACd;AACA;;CAEC;AACD;EACE,SAAS;EACT,0BAA0B;AAC5B;AACA;EACE,gBAAgB;AAClB;AACA;EACE,MAAM;AACR;AACA;EACE,cAAc;EACd,kBAAkB;EAClB,yBAAyB;EACzB,aAAa;AACf;AACA;EACE,WAAW;AACb;AACA;EACE,WAAW;EACX,6BAA6B;EAC7B,kEAAkE;EAClE,kCAAkC;EAClC,mGAAsF;AACxF;AACA;EACE;IACE,QAAQ;EACV;EACA;IACE,UAAU;EACZ;AACF;AACA;EACE;IACE,UAAU;EACZ;EACA;IACE,WAAW;EACb;AACF;AACA;EACE,kBAAkB;EAClB,WAAW;EACX,WAAW;EACX,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,WAAW;EACX,qBAAqB;EACrB,yBAAyB;EACzB,yDAAgD;EAChD,cAAc;EACd,kBAAkB;EAClB,wBAAwB;EACxB,MAAM;AACR;AACA;EACE,OAAO;EACP,qBAAqB;AACvB;AACA;EACE,SAAS;EACT,qBAAqB;AACvB;AACA;EACE,UAAU;EACV,qBAAqB;AACvB;AACA;EACE;;;IAGE,yBAAyB;EAC3B;EACA;IACE,sBAAsB;EACxB;AACF;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;AACV;AACA;EACE,UAAU;AACZ;AACA;EACE,aAAa;EACb,kBAAkB;EAClB,QAAQ;AACV;AACA;EACE,eAAe;EACf,wCAAwC;AAC1C;AACA;EACE,aAAa;EACb,sBAAsB;EACtB,kBAAkB;EAClB,iBAAiB;AACnB;AACA;EACE,cAAc;EACd,eAAe;AACjB;AACA;EACE,iBAAiB;AACnB;AACA;;;;;EAKE,wBAAwB;AAC1B;AACA;EACE,gBAAgB;EAChB,YAAY;EACZ,0CAA0C;AAC5C;AACA;EACE,gBAAgB;EAChB,iBAAiB;AACnB;AACA;EACE,cAAc;AAChB;AACA;EACE,aAAa;AACf;AACA;EACE,gBAAgB;AAClB;AACA;EACE,yCAAyC;EACzC,kBAAkB;EAClB,YAAY;EACZ,aAAa;AACf;AACA;;CAEC;AACD;EACE,eAAe;EACf,iBAAiB;AACnB;AACA;EACE,cAAc;AAChB;AACA;EACE,cAAc;AAChB;AACA;EACE,WAAW;EACX,iBAAiB;AACnB;AACA;EACE,aAAa;EACb,sBAAsB;AACxB;AACA;EACE,eAAe;EACf,cAAc;AAChB;AACA;EACE,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,eAAe;AACjB;AACA;EACE,aAAa;EACb,eAAe;EACf,mBAAmB;AACrB;AACA;EACE,gBAAgB;EAChB,aAAa;EACb,mBAAmB;AACrB;AACA;EACE,cAAc;AAChB;AACA;EACE,0CAA0C;AAC5C;AACA;EACE,yCAAyC;AAC3C;AACA;EACE,aAAa;EACb,mBAAmB;EACnB,QAAQ;EACR,kBAAkB;EAClB,gCAAgC;EAChC,8CAA8C;EAC9C,YAAY;EACZ,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,oCAAoC;AACtC;AACA;EACE,+CAA+C;AACjD;AACA;EACE,cAAc;AAChB;AACA;EACE,kBAAkB;EAClB,eAAe;EACf,oCAAoC;AACtC;AACA;;EAEE,eAAe;EACf,gBAAgB;AAClB;AACA;EACE,iBAAiB;EACjB,eAAe;EACf,mCAAmC;EACnC,0CAA0C;EAC1C,kBAAkB;AACpB;AACA;EACE,oBAAoB;EACpB,mBAAmB;EACnB,cAAc;EACd,aAAa;EACb,oDAAoD;EACpD,yCAAyC;EACzC,kBAAkB;EAClB,sBAAsB;EACtB,eAAe;EACf,eAAe;AACjB;AACA;EACE,eAAe;EACf,iBAAiB;AACnB;AACA;EACE,iBAAiB;EACjB,sBAAsB;EACtB,eAAe;EACf,qBAAqB;EACrB,gBAAgB;EAChB,uBAAuB;EACvB,cAAc;EACd,uBAAuB;EACvB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;AACvB;AACA;EACE,aAAa;EACb,QAAQ;EACR,iBAAiB;AACnB;AACA;EACE,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,kBAAkB;EAClB,yCAAyC;EACzC,YAAY;EACZ,oBAAoB;EACpB,mBAAmB;AACrB;AACA;EACE,WAAW;EACX,YAAY;EACZ,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,SAAS;EACT,WAAW;EACX,eAAe;EACf,YAAY;EACZ,SAAS;EACT,kBAAkB;EAClB,sCAAsC;EACtC,WAAW;EACX,YAAY;EACZ,aAAa;EACb,uBAAuB;EACvB,mBAAmB;EACnB,yCAAyC;AAC3C;AACA;EACE,eAAe;EACf,qBAAqB;AACvB;AACA;EACE,eAAe;EACf,8BAA8B;AAChC;AACA;EACE,qBAAqB;EACrB,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,gBAAgB;EAChB,gDAAgD;EAChD,yHAAyH;EACzH,0BAA0B;EAC1B,6BAA6B;EAC7B,qBAAqB;EACrB,qBAAqB;EACrB,kDAAmC;AACrC;AACA;EACE;IACE,yBAAyB;EAC3B;EACA;IACE,0BAA0B;EAC5B;AACF;AACA;EACE,eAAe;AACjB",sourcesContent:[`.thinking_container {
|
|
10611
10614
|
position: relative;
|
|
10612
10615
|
height: 100%;
|
|
10613
10616
|
}
|
|
@@ -10812,12 +10815,15 @@ html li {
|
|
|
10812
10815
|
}
|
|
10813
10816
|
.monaco_wrapper > pre {
|
|
10814
10817
|
margin-bottom: 10px;
|
|
10818
|
+
max-height: 400px;
|
|
10819
|
+
overflow-y: auto;
|
|
10815
10820
|
}
|
|
10816
10821
|
.monaco_wrapper .highlight_editor {
|
|
10817
10822
|
border-radius: 8px;
|
|
10818
10823
|
font-size: 12px;
|
|
10819
10824
|
padding: 28px 8px 8px 8px;
|
|
10820
10825
|
line-height: 18px;
|
|
10826
|
+
white-space: pre-wrap;
|
|
10821
10827
|
}
|
|
10822
10828
|
.monaco_wrapper .highlight_editor::-webkit-scrollbar {
|
|
10823
10829
|
width: auto;
|
|
@@ -32944,7 +32950,7 @@ ${JSON.stringify(r,null,2)}`);const l=n[o]();return new Language(INTERNAL,l)})}}
|
|
|
32944
32950
|
User's intention: ${c.instructions}
|
|
32945
32951
|
`:""}
|
|
32946
32952
|
Provide the complete updated code.
|
|
32947
|
-
`,{...await 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=h,n.__decorate([(0,r.Autowired)(l.CommandService),n.__metadata("design:type",Object)],h.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],h.prototype,"modelService",void 0),n.__decorate([(0,r.Autowired)(o.AIBackSerivcePath),n.__metadata("design:type",Object)],h.prototype,"aiBackService",void 0),n.__decorate([(0,r.Autowired)(p.ChatProxyServiceToken),n.__metadata("design:type",g.ChatProxyService)],h.prototype,"chatProxyService",void 0),t.ApplyService=h=n.__decorate([(0,r.Injectable)()],h)},74055:(P,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),l=e(43718),_=e(46044),v=e(73307),m=e(29770);let p=class extends l.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new l.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new l.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,l.toDisposable)(()=>{this.agents.delete(g.id)&&this._onDidChangeAgents.fire()})}async updateAgent(g,a){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g} registered`);h.agent.metadata={...h.agent.metadata,...a},h.commands=await h.agent.provideSlashCommands(l.CancellationToken.None),a.isDefault&&(this.defaultAgentId=g);const u=await h.agent.provideChatWelcomeMessage(l.CancellationToken.None);if(u){const{content:c,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(c,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 a=this.agents.get(g);return a?.agent}async invokeAgent(g,a,h,u,c){const E=this.agents.get(g);if(!E)throw new Error(`No agent with id ${g}`);if(this.initialUserMessageMap.has(a.sessionId))(this.shouldUpdateContext||a.regenerate||u.length===0)&&(a.message=await this.provideContextMessage(a.message,a.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(a.sessionId,a.message);const d=a.message;a.message=await this.provideContextMessage(d,a.sessionId)}return await E.agent.invoke(a,h,u,c)}async provideContextMessage(g,a){const h=await this.llmContextService.serialize(),u=await this.promptProvider.provideContextPrompt(h,g);return this.aiReporter.send({msgType:l.AIServiceType.Chat,actionType:l.ActionTypeEnum.ContextEnhance,actionSource:l.ActionSourceEnum.Chat,sessionId:a,message:u}),u}populateChatInput(g,a){this.aiChatService.sendMessage({...a,agentId:g,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:g,commands:a})=>a.map(h=>({...h,agentId:g.id}))))}async getFollowups(g,a,h){const u=this.agents.get(g);if(!u)throw new Error(`No agent with id ${g}`);return u.agent.provideFollowups?u.agent.provideFollowups(a,h):[]}async getSampleQuestions(g,a){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(a):[]}async getAllSampleQuestions(){const g=await Promise.all(Array.from(this.agents.values()).map(async({agent:a})=>{try{return await this.getSampleQuestions(a.id,l.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(g)}sendMessage(g){this._onDidSendMessage.fire(g)}parseMessage(g,a){var h;const u={agentId:"",command:"",message:g};let c=a;const E=this.getAgents(),f=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),d=u.message.match(f);if(d){const y=E.find(b=>b.id.toLowerCase()===d[1].toLowerCase());if(!y)return u;c=y.id,u.agentId=c,u.message=u.message.replace(d[0],"")}if(c){const y=(h=this.agents.get(c))===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=p,n.__decorate([(0,o.Autowired)(l.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(l.IAIReporter),n.__metadata("design:type",Object)],p.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(_.LLMContextServiceToken),n.__metadata("design:type",Object)],p.prototype,"llmContextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],p.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(l.ChatServiceToken),n.__metadata("design:type",m.ChatService)],p.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(l.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],p.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=p=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],p)},84543:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(19413),_=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(p){return this.componentsMap.set(p.id,p),this.componentsDeferredMap.has(p.id)&&(this.componentsDeferredMap.get(p.id).resolve(p),this.componentsDeferredMap.delete(p.id)),{dispose:()=>{this.componentsMap.get(p.id)===p&&(this.componentsMap.delete(p.id),this.componentsDeferredMap.delete(p.id))}}}getChatComponent(p){return this.componentsMap.has(p)?this.componentsMap.get(p):(this.componentsDeferredMap.has(p)||this.componentsDeferredMap.set(p,new o.Deferred),null)}getChatComponentDeferred(p){return this.componentsDeferredMap.get(p)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(p=>p.id!==_.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(l.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},98987:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatEditSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(54414),_=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:a,side:h}=s.getParsedQuery(),c=this.baseApplyService.getSessionCodeBlocks().find(f=>f.toolCallId===a);return(h==="left"?c?.originalCode:c?.updatedCode)||""}isReadonly(s){return!0}onDidDisposeModel(){}};t.ChatEditSchemeDocumentProvider=m,n.__decorate([(0,r.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],m.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,r.Autowired)(l.WorkbenchEditorService),n.__metadata("design:type",l.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:(P,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),l=e(76003),_=e(41869),v=e(43718),m=e(65677),p=e(19413),s=e(44260),g=e(42033),a=e(11735),h=20;class u extends v.LRUCache{disposeKey(f){const d=this.get(f);d&&d.dispose(),this.delete(f)}dispose(){this.forEach(f=>{f.dispose()}),this.clear()}}let c=class extends v.Disposable{fromJSON(f){return f.filter(d=>d.history.messages.length>0).map(d=>{const y=new g.ChatModel(this.chatFeatureRegistry,{sessionId:d.sessionId,history:new s.MsgHistoryManager(this.chatFeatureRegistry,d.history),modelId:d.modelId}),b=d.requests.map(A=>new g.ChatRequestModel(A.requestId,y,A.message,new g.ChatResponseModel(A.requestId,y,A.message.agentId,{responseContents:A.response.responseContents,isComplete:!0,responseText:A.response.responseText,responseParts:A.response.responseParts,errorDetails:A.response.errorDetails,followups:A.response.followups,isCanceled:A.response.isCanceled})));return y.restoreRequests(b),y})}constructor(){super(),n.set(this,this.registerDispose(new u(h))),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 f=this._chatStorage.get("sessionModels",[]);this.fromJSON(f).forEach(y=>{o.__classPrivateFieldGet(this,n,"f").set(y.sessionId,y),this.listenSession(y)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){const f=new g.ChatModel(this.chatFeatureRegistry);return o.__classPrivateFieldGet(this,n,"f").set(f.sessionId,f),this.listenSession(f),f}getSession(f){return o.__classPrivateFieldGet(this,n,"f").get(f)}clearSession(f){var d;if(!o.__classPrivateFieldGet(this,n,"f").get(f))throw new Error(`Unknown session: ${f}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(f),(d=o.__classPrivateFieldGet(this,r,"f").get(f))===null||d===void 0||d.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(f),this.saveSessions()}createRequest(f,d,y,b,A){const S=this.getSession(f);if(!S)throw new Error(`Unknown session: ${f}`);if(!o.__classPrivateFieldGet(this,r,"f").has(f))return S.addRequest({prompt:d,agentId:y,command:b,images:A})}async sendRequest(f,d,y){const b=this.getSession(f);if(!b)throw new Error(`Unknown session: ${f}`);const A=b.modelId,S=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);if(!A)b.modelId=S;else if(A!==S)throw new Error("Model changed unexpectedly");const D=new v.CancellationTokenSource,I=D.token;o.__classPrivateFieldGet(this,r,"f").set(b.sessionId,D);const w=I.onCancellationRequested(()=>{d.response.cancel()}),T=this.preferenceService.get(v.AINativeSettingSectionsId.ContextWindow),R=b.getMessageHistory(T);try{const M=k=>{I.isCancellationRequested||b.acceptResponseProgress(d,k)},O={sessionId:f,requestId:d.requestId,message:d.message.prompt,command:d.message.command,images:d.message.images,regenerate:y},x=await this.chatAgentService.invokeAgent(d.message.agentId,O,M,R,I);I.isCancellationRequested||(x.errorDetails&&d.response.setErrorDetails(x.errorDetails),this.chatAgentService.getFollowups(d.message.agentId,f,v.CancellationToken.None).then(F=>{d.response.setFollowups(F),d.response.complete()}))}finally{w.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(b.sessionId),this.saveSessions()}}listenSession(f){this.addDispose(f.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(f){var d;(d=o.__classPrivateFieldGet(this,r,"f").get(f))===null||d===void 0||d.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(f),this.saveSessions()}};t.ChatManagerService=c,n=new WeakMap,r=new WeakMap,o.__decorate([(0,l.Autowired)(l.INJECTOR_TOKEN),o.__metadata("design:type",l.Injector)],c.prototype,"injector",void 0),o.__decorate([(0,l.Autowired)(p.IChatAgentService),o.__metadata("design:type",Object)],c.prototype,"chatAgentService",void 0),o.__decorate([(0,l.Autowired)(v.StorageProvider),o.__metadata("design:type",Function)],c.prototype,"storageProvider",void 0),o.__decorate([(0,l.Autowired)(_.PreferenceService),o.__metadata("design:type",Object)],c.prototype,"preferenceService",void 0),o.__decorate([(0,l.Autowired)(m.ChatFeatureRegistryToken),o.__metadata("design:type",a.ChatFeatureRegistry)],c.prototype,"chatFeatureRegistry",void 0),o.__decorate([(0,v.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],c.prototype,"saveSessions",null),t.ChatManagerService=c=o.__decorate([(0,l.Injectable)(),o.__metadata("design:paramtypes",[])],c)},42033:(P,t,e)=>{"use strict";var n,r,o,l,_,v,m,p,s,g,a,h,u,c,E,f,d;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,l,"f")}get isCanceled(){return y.__classPrivateFieldGet(this,_,"f")}get requestId(){return y.__classPrivateFieldGet(this,v,"f")}get responseText(){return y.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return y.__classPrivateFieldGet(this,p,"f")}get followups(){return y.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return y.__classPrivateFieldGet(this,g,"f").event}constructor(k,F,L,N){super(),n.add(this),this.session=F,this.agentId=L,r.set(this,[]),o.set(this,[]),l.set(this,!1),_.set(this,!1),v.set(this,void 0),m.set(this,""),p.set(this,void 0),s.set(this,void 0),g.set(this,this.registerDispose(new A.Emitter)),y.__classPrivateFieldSet(this,v,k,"f"),N&&(y.__classPrivateFieldSet(this,o,N.responseContents,"f"),y.__classPrivateFieldSet(this,r,N.responseParts||[],"f"),y.__classPrivateFieldSet(this,m,N.responseText,"f"),y.__classPrivateFieldSet(this,l,N.isComplete,"f"),y.__classPrivateFieldSet(this,_,N.isCanceled,"f"),y.__classPrivateFieldSet(this,p,N.errorDetails,"f"),y.__classPrivateFieldSet(this,s,N.followups,"f"))}updateContent(k,F){var L;const N=y.__classPrivateFieldGet(this,r,"f").length-1;if(k.kind==="content"||k.kind==="markdownContent"){const U=y.__classPrivateFieldGet(this,r,"f")[N];!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")[N]={content:new S.MarkdownString(U.content.value+k.content.value),kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[N]={content:new S.MarkdownString(U.content.value+k.content,U.content),kind:"markdownContent"},y.__classPrivateFieldGet(this,n,"m",a).call(this)}else if(k.kind==="reasoning"){const U=y.__classPrivateFieldGet(this,r,"f")[N];!U||U.kind!=="reasoning"?y.__classPrivateFieldGet(this,r,"f").push({content:k.content.replace(/^<think>/,""),kind:"reasoning"}):y.__classPrivateFieldGet(this,r,"f")[N]={content:U.content+k.content,kind:"reasoning"},y.__classPrivateFieldGet(this,n,"m",a).call(this)}else if(k.kind==="asyncContent"){const U=y.__classPrivateFieldGet(this,r,"f").push(k)-1;y.__classPrivateFieldGet(this,n,"m",a).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",a).call(this,F)})}else if(k.kind==="treeData"||k.kind==="component")y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",a).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",a).call(this,F)}}complete(){y.__classPrivateFieldSet(this,l,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}cancel(){y.__classPrivateFieldSet(this,l,!0,"f"),y.__classPrivateFieldSet(this,_,!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,_,!1,"f"),y.__classPrivateFieldSet(this,l,!1,"f"),y.__classPrivateFieldSet(this,p,void 0,"f"),y.__classPrivateFieldSet(this,s,void 0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setErrorDetails(k){y.__classPrivateFieldSet(this,p,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,l=new WeakMap,_=new WeakMap,v=new WeakMap,m=new WeakMap,p=new WeakMap,s=new WeakMap,g=new WeakMap,n=new WeakSet,a=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(`
|
|
32953
|
+
`,{...await 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=h,n.__decorate([(0,r.Autowired)(l.CommandService),n.__metadata("design:type",Object)],h.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],h.prototype,"modelService",void 0),n.__decorate([(0,r.Autowired)(o.AIBackSerivcePath),n.__metadata("design:type",Object)],h.prototype,"aiBackService",void 0),n.__decorate([(0,r.Autowired)(p.ChatProxyServiceToken),n.__metadata("design:type",g.ChatProxyService)],h.prototype,"chatProxyService",void 0),t.ApplyService=h=n.__decorate([(0,r.Injectable)()],h)},74055:(P,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),l=e(43718),_=e(46044),v=e(73307),m=e(29770);let p=class extends l.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new l.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new l.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,l.toDisposable)(()=>{this.agents.delete(g.id)&&this._onDidChangeAgents.fire()})}async updateAgent(g,a){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g} registered`);h.agent.metadata={...h.agent.metadata,...a},h.commands=await h.agent.provideSlashCommands(l.CancellationToken.None),a.isDefault&&(this.defaultAgentId=g);const u=await h.agent.provideChatWelcomeMessage(l.CancellationToken.None);if(u){const{content:c,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(c,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 a=this.agents.get(g);return a?.agent}async invokeAgent(g,a,h,u,c){const E=this.agents.get(g);if(!E)throw new Error(`No agent with id ${g}`);if(this.initialUserMessageMap.has(a.sessionId))(this.shouldUpdateContext||a.regenerate||u.length===0)&&(a.message=await this.provideContextMessage(a.message,a.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(a.sessionId,a.message);const d=a.message;a.message=await this.provideContextMessage(d,a.sessionId)}return await E.agent.invoke(a,h,u,c)}async provideContextMessage(g,a){const h=await this.llmContextService.serialize(),u=await this.promptProvider.provideContextPrompt(h,g);return this.aiReporter.send({msgType:l.AIServiceType.Chat,actionType:l.ActionTypeEnum.ContextEnhance,actionSource:l.ActionSourceEnum.Chat,sessionId:a,message:u}),u}populateChatInput(g,a){this.aiChatService.sendMessage({...a,agentId:g,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:g,commands:a})=>a.map(h=>({...h,agentId:g.id}))))}async getFollowups(g,a,h){const u=this.agents.get(g);if(!u)throw new Error(`No agent with id ${g}`);return u.agent.provideFollowups?u.agent.provideFollowups(a,h):[]}async getSampleQuestions(g,a){const h=this.agents.get(g);if(!h)throw new Error(`No agent with id ${g}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(a):[]}async getAllSampleQuestions(){const g=await Promise.all(Array.from(this.agents.values()).map(async({agent:a})=>{try{return await this.getSampleQuestions(a.id,l.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(g)}sendMessage(g){this._onDidSendMessage.fire(g)}parseMessage(g,a){var h;const u={agentId:"",command:"",message:g};let c=a;const E=this.getAgents(),f=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),d=u.message.match(f);if(d){const y=E.find(b=>b.id.toLowerCase()===d[1].toLowerCase());if(!y)return u;c=y.id,u.agentId=c,u.message=u.message.replace(d[0],"")}if(c){const y=(h=this.agents.get(c))===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=p,n.__decorate([(0,o.Autowired)(l.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(l.IAIReporter),n.__metadata("design:type",Object)],p.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(_.LLMContextServiceToken),n.__metadata("design:type",Object)],p.prototype,"llmContextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],p.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(l.ChatServiceToken),n.__metadata("design:type",m.ChatService)],p.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(l.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],p.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=p=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],p)},84543:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),l=e(19413),_=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(p){return this.componentsMap.set(p.id,p),this.componentsDeferredMap.has(p.id)&&(this.componentsDeferredMap.get(p.id).resolve(p),this.componentsDeferredMap.delete(p.id)),{dispose:()=>{this.componentsMap.get(p.id)===p&&(this.componentsMap.delete(p.id),this.componentsDeferredMap.delete(p.id))}}}getChatComponent(p){return this.componentsMap.has(p)?this.componentsMap.get(p):(this.componentsDeferredMap.has(p)||this.componentsDeferredMap.set(p,new o.Deferred),null)}getChatComponentDeferred(p){return this.componentsDeferredMap.get(p)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(p=>p.id!==_.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(l.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},98987:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatEditSchemeDocumentProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(54414),_=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:a,side:h}=s.getParsedQuery(),c=this.baseApplyService.getSessionCodeBlocks().find(f=>f.toolCallId===a);return(h==="left"?c?.originalCode:c?.updatedCode)||""}isReadonly(s){return!0}onDidDisposeModel(){}};t.ChatEditSchemeDocumentProvider=m,n.__decorate([(0,r.Autowired)(_.IEditorDocumentModelService),n.__metadata("design:type",Object)],m.prototype,"editorDocumentModelService",void 0),n.__decorate([(0,r.Autowired)(l.WorkbenchEditorService),n.__metadata("design:type",l.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:(P,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),l=e(76003),_=e(41869),v=e(43718),m=e(65677),p=e(19413),s=e(44260),g=e(42033),a=e(11735),h=20;class u extends v.LRUCache{disposeKey(f){const d=this.get(f);d&&d.dispose(),this.delete(f)}dispose(){this.forEach(f=>{f.dispose()}),this.clear()}}let c=class extends v.Disposable{fromJSON(f){return f.filter(d=>d.history.messages.length>0).map(d=>{const y=new g.ChatModel(this.chatFeatureRegistry,{sessionId:d.sessionId,history:new s.MsgHistoryManager(this.chatFeatureRegistry,d.history),modelId:d.modelId}),b=d.requests.map(A=>new g.ChatRequestModel(A.requestId,y,A.message,new g.ChatResponseModel(A.requestId,y,A.message.agentId,{responseContents:A.response.responseContents,isComplete:!0,responseText:A.response.responseText,responseParts:A.response.responseParts,errorDetails:A.response.errorDetails,followups:A.response.followups,isCanceled:A.response.isCanceled})));return y.restoreRequests(b),y})}constructor(){super(),n.set(this,this.registerDispose(new u(h))),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 f=this._chatStorage.get("sessionModels",[]);this.fromJSON(f).forEach(y=>{o.__classPrivateFieldGet(this,n,"f").set(y.sessionId,y),this.listenSession(y)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){const f=new g.ChatModel(this.chatFeatureRegistry);return o.__classPrivateFieldGet(this,n,"f").set(f.sessionId,f),this.listenSession(f),f}getSession(f){return o.__classPrivateFieldGet(this,n,"f").get(f)}clearSession(f){var d;if(!o.__classPrivateFieldGet(this,n,"f").get(f))throw new Error(`Unknown session: ${f}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(f),(d=o.__classPrivateFieldGet(this,r,"f").get(f))===null||d===void 0||d.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(f),this.saveSessions()}createRequest(f,d,y,b,A){const S=this.getSession(f);if(!S)throw new Error(`Unknown session: ${f}`);if(!o.__classPrivateFieldGet(this,r,"f").has(f))return S.addRequest({prompt:d,agentId:y,command:b,images:A})}async sendRequest(f,d,y){const b=this.getSession(f);if(!b)throw new Error(`Unknown session: ${f}`);const A=b.modelId,S=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);if(!A)b.modelId=S;else if(A!==S)throw new Error("Model changed unexpectedly");const D=new v.CancellationTokenSource,I=D.token;o.__classPrivateFieldGet(this,r,"f").set(b.sessionId,D);const w=I.onCancellationRequested(()=>{d.response.cancel()}),T=this.preferenceService.get(v.AINativeSettingSectionsId.ContextWindow),R=b.getMessageHistory(T);try{const M=k=>{I.isCancellationRequested||b.acceptResponseProgress(d,k)},O={sessionId:f,requestId:d.requestId,message:d.message.prompt,command:d.message.command,images:d.message.images,regenerate:y},x=await this.chatAgentService.invokeAgent(d.message.agentId,O,M,R,I);I.isCancellationRequested||(x.errorDetails&&d.response.setErrorDetails(x.errorDetails),this.chatAgentService.getFollowups(d.message.agentId,f,v.CancellationToken.None).then(F=>{d.response.setFollowups(F),d.response.complete()}))}finally{w.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(b.sessionId),this.saveSessions()}}listenSession(f){this.addDispose(f.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(f){var d;(d=o.__classPrivateFieldGet(this,r,"f").get(f))===null||d===void 0||d.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(f),this.saveSessions()}};t.ChatManagerService=c,n=new WeakMap,r=new WeakMap,o.__decorate([(0,l.Autowired)(l.INJECTOR_TOKEN),o.__metadata("design:type",l.Injector)],c.prototype,"injector",void 0),o.__decorate([(0,l.Autowired)(p.IChatAgentService),o.__metadata("design:type",Object)],c.prototype,"chatAgentService",void 0),o.__decorate([(0,l.Autowired)(v.StorageProvider),o.__metadata("design:type",Function)],c.prototype,"storageProvider",void 0),o.__decorate([(0,l.Autowired)(_.PreferenceService),o.__metadata("design:type",Object)],c.prototype,"preferenceService",void 0),o.__decorate([(0,l.Autowired)(m.ChatFeatureRegistryToken),o.__metadata("design:type",a.ChatFeatureRegistry)],c.prototype,"chatFeatureRegistry",void 0),o.__decorate([(0,v.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],c.prototype,"saveSessions",null),t.ChatManagerService=c=o.__decorate([(0,l.Injectable)(),o.__metadata("design:paramtypes",[])],c)},42033:(P,t,e)=>{"use strict";var n,r,o,l,_,v,m,p,s,g,a,h,u,c,E,f,d;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,l,"f")}get isCanceled(){return y.__classPrivateFieldGet(this,_,"f")}get requestId(){return y.__classPrivateFieldGet(this,v,"f")}get responseText(){return y.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return y.__classPrivateFieldGet(this,p,"f")}get followups(){return y.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return y.__classPrivateFieldGet(this,g,"f").event}constructor(k,F,L,N){super(),n.add(this),this.session=F,this.agentId=L,r.set(this,[]),o.set(this,[]),l.set(this,!1),_.set(this,!1),v.set(this,void 0),m.set(this,""),p.set(this,void 0),s.set(this,void 0),g.set(this,this.registerDispose(new A.Emitter)),y.__classPrivateFieldSet(this,v,k,"f"),N&&(y.__classPrivateFieldSet(this,o,N.responseContents,"f"),y.__classPrivateFieldSet(this,r,N.responseParts||[],"f"),y.__classPrivateFieldSet(this,m,N.responseText,"f"),y.__classPrivateFieldSet(this,l,N.isComplete,"f"),y.__classPrivateFieldSet(this,_,N.isCanceled,"f"),y.__classPrivateFieldSet(this,p,N.errorDetails,"f"),y.__classPrivateFieldSet(this,s,N.followups,"f"))}updateContent(k,F){var L;const N=y.__classPrivateFieldGet(this,r,"f").length-1;if(k.kind==="content"||k.kind==="markdownContent"){const U=y.__classPrivateFieldGet(this,r,"f")[N];!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")[N]={content:new S.MarkdownString(U.content.value+k.content.value),kind:"markdownContent"}:y.__classPrivateFieldGet(this,r,"f")[N]={content:new S.MarkdownString(U.content.value+k.content,U.content),kind:"markdownContent"},y.__classPrivateFieldGet(this,n,"m",a).call(this)}else if(k.kind==="reasoning"){const U=y.__classPrivateFieldGet(this,r,"f")[N];!U||U.kind!=="reasoning"?y.__classPrivateFieldGet(this,r,"f").push({content:k.content.replace(/^<think>/,""),kind:"reasoning"}):y.__classPrivateFieldGet(this,r,"f")[N]={content:U.content+k.content,kind:"reasoning"},y.__classPrivateFieldGet(this,n,"m",a).call(this)}else if(k.kind==="asyncContent"){const U=y.__classPrivateFieldGet(this,r,"f").push(k)-1;y.__classPrivateFieldGet(this,n,"m",a).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",a).call(this,F)})}else if(k.kind==="treeData"||k.kind==="component")y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",a).call(this,F);else if(k.kind==="toolCall"){const U=y.__classPrivateFieldGet(this,r,"f").findIndex(W=>W.kind==="toolCall"&&W.content.id===k.content.id);U!==-1?y.__classPrivateFieldGet(this,r,"f")[U]={kind:"toolCall",content:{...k.content}}:y.__classPrivateFieldGet(this,r,"f").push(k),y.__classPrivateFieldGet(this,n,"m",a).call(this,F)}}complete(){y.__classPrivateFieldSet(this,l,!0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}cancel(){y.__classPrivateFieldSet(this,l,!0,"f"),y.__classPrivateFieldSet(this,_,!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,_,!1,"f"),y.__classPrivateFieldSet(this,l,!1,"f"),y.__classPrivateFieldSet(this,p,void 0,"f"),y.__classPrivateFieldSet(this,s,void 0,"f"),y.__classPrivateFieldGet(this,g,"f").fire()}setErrorDetails(k){y.__classPrivateFieldSet(this,p,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,l=new WeakMap,_=new WeakMap,v=new WeakMap,m=new WeakMap,p=new WeakMap,s=new WeakMap,g=new WeakMap,n=new WeakSet,a=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(`
|
|
32948
32954
|
|
|
32949
32955
|
`),"f");const F=[];for(const L of y.__classPrivateFieldGet(this,r,"f")){const N=F[F.length-1];L.kind==="markdownContent"&&N?.kind==="markdownContent"?F[F.length-1]={content:new S.MarkdownString(N.content.value+L.content.value,{isTrusted:N.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,N){this.session=F,this.message=L,this.response=N,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,F){var L,N;super(),this.chatFeatureRegistry=k,this.requestIdPool=0,u.set(this,void 0),c.set(this,new Map),E.set(this,0),f.set(this,void 0),y.__classPrivateFieldSet(this,u,(L=F?.sessionId)!==null&&L!==void 0?L:(0,A.uuid)(),"f"),this.history=(N=F?.history)!==null&&N!==void 0?N:new I.MsgHistoryManager(this.chatFeatureRegistry),y.__classPrivateFieldSet(this,f,F?.modelId,"f")}get sessionId(){return y.__classPrivateFieldGet(this,u,"f")}get requests(){return Array.from(y.__classPrivateFieldGet(this,c,"f").values())}restoreRequests(k){y.__classPrivateFieldSet(this,c,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")}processMemorySummaries(){const k=this.history.getMemorySummaries();if(k.length===0)return[];const F=k.map(L=>{try{const N=JSON.parse(L.content);return N.memory||N.content||L.content}catch{return L.content}}).filter(L=>L&&L!=="no_memory_needed").filter((L,N,U)=>U.indexOf(L)===N);return F.length>0?[{role:"system",content:`\u4EE5\u4E0B\u662F\u4E4B\u524D\u5BF9\u8BDD\u7684\u603B\u7ED3\uFF1A
|
|
32950
32956
|
`+F.join(`
|
|
@@ -32955,7 +32961,8 @@ User's intention: ${c.instructions}
|
|
|
32955
32961
|
`);let O=0,x=!1;for(let k=0;k<M.length;k++){const F=M[k].trim();if(typeof O>"u"&&F.match(/^\s*\|/)){const L=F.match(/(\|[^\|]+)(?=\||$)/g);L&&(O=L.length)}else if(typeof O=="number")if(F.match(/^\s*\|/)&&k===M.length-1)x=!0;else return}if(O>0){const k=x?M.slice(0,-1).join(`
|
|
32956
32962
|
`):R,F=!!k.match(/\|\s*$/),L=k+(F?"":"|")+`
|
|
32957
32963
|
|${" --- |".repeat(O)}`;return _.marked.lexer(L)}}function I(T){return T.reduce((R,M)=>R+M.raw,"")}function w(T){var R;for(const{type:M,raw:O}of(R=T.tokens)!==null&&R!==void 0?R:[]){if(M!=="text")continue;const x=O.split(`
|
|
32958
|
-
`),k=x[x.length-1],F=[{condition:k.includes("`"),action:c},{condition:k.includes("**"),action:b},{condition:k.match(/\*\w/),action:E},{condition:k.match(/(^|\s)__\w/),action:A},{condition:k.match(/(^|\s)_\w/),action:f},{condition:k.match(/(^|\s)\[.*\]\(\w*/),action:d},{condition:k.match(/(^|\s)\[\w/),action:y}];for(const L of F)if(L.condition)return L.action(T)}}},49601:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMentionInput=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(46541),l=e(41869),_=e(81878),v=e(43718),m=e(92323),p=e(87863),s=e(54414),g=e(47720),a=e(83890),h=e(29037),u=e(72665),c=e(52416),E=e(7443),f=e(51500),d=e(19413),y=e(27397),b=e(92819),A=n.__importDefault(e(6960)),S=e(96086),D=e(44692),I=T=>{const{onSend:R,disabled:M=!1,contextService:O}=T,[x,k]=(0,r.useState)(T.value||""),[F,L]=(0,r.useState)(T.images||[]),N=(0,l.useInjectable)(d.IChatInternalService),U=(0,l.useInjectable)(m.CommandService),W=(0,l.useInjectable)(g.FileSearchServicePath),j=(0,l.useInjectable)(l.RecentFilesManager),Q=(0,l.useInjectable)(f.IWorkspaceService),G=(0,l.useInjectable)(s.WorkbenchEditorService),Z=(0,l.useInjectable)(l.LabelService),$=(0,l.useInjectable)(E.IconService),V=(0,l.useInjectable)(u.IMessageService),H=(0,l.useInjectable)(v.ChatFeatureRegistryToken),K=(0,l.useInjectable)(h.OutlineTreeService),Y=(0,r.useRef)([]),X=(0,l.useInjectable)(l.PreferenceService),re=(0,l.useInjectable)(v.RulesServiceToken),oe=r.default.useCallback(()=>{U.executeCommand(y.MCPConfigCommands.OPEN_MCP_CONFIG.id)},[U]),he=r.default.useCallback(()=>{U.executeCommand(b.RulesCommands.OPEN_RULES_FILE.id)},[U]);(0,r.useEffect)(()=>{T.value!==x&&k(T.value||"")},[T.value]);const me=(0,r.useCallback)(async(Me,Be=[])=>{Me||(Me=(await K.resolveChildren())[0]);const De=await K.resolveChildren(Me);for(const _e of De)Be.push(_e),a.OutlineCompositeTreeNode.is(_e)&&await me(_e,Be);return Be},[K]),q=async(Me,Be)=>{const De=new Set,_e=new v.URI(Be);for(const ke of Me){const Te=new v.URI(ke),We=await Q.asRelativePath(Te);if(We?.path){const pe=We.path.split("/").filter(Boolean);for(let ie=0;ie<pe.length;ie++){const le=pe.slice(0,ie+1).join("/"),Se=_e.resolve(le).codeUri.fsPath;Se!==Be&&!Be.startsWith(Se)&&De.add(Se)}}else ke!==Be&&!Be.startsWith(ke)&&De.add(ke)}return Promise.all(Array.from(De).map(async ke=>{const Te=new v.URI(ke),We=await Q.asRelativePath(Te);return{id:Te.codeUri.fsPath,type:D.MentionType.FOLDER,text:Te.displayName,value:Te.codeUri.fsPath,description:We?.root?We.path:"",contextId:Te.codeUri.fsPath,icon:(0,_.getIcon)("folder")}}))},be=[{id:D.MentionType.FILE,type:D.MentionType.FILE,text:"File",icon:(0,_.getIcon)("file"),getHighestLevelItems:()=>{const Me=G.currentEditor,Be=Me?.currentUri;return Be?[{id:Be.codeUri.fsPath,type:D.MentionType.FILE,text:Be.displayName,value:Be.codeUri.fsPath,description:`(${(0,v.localize)("aiNative.chat.defaultContextFile")})`,contextId:Be.codeUri.fsPath,icon:Z.getIcon(Be)}]:[]},getItems:async Me=>{if(Me){const Be=(await Q.roots).map(_e=>new v.URI(_e.uri).codeUri.fsPath.toString()),De=await W.find(Me,{rootUris:Be,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10});return Promise.all(De.map(async _e=>{var ke;const Te=new v.URI(_e),We=(ke=await Q.asRelativePath(Te.parent))===null||ke===void 0?void 0:ke.path;return{id:Te.codeUri.fsPath,type:D.MentionType.FILE,text:Te.displayName,value:Te.codeUri.fsPath,description:We||"",contextId:Te.codeUri.fsPath,icon:Z.getIcon(Te)}}))}else{const Be=await j.getMostRecentlyOpenedFiles();return Promise.all(Be.map(async De=>{var _e;const ke=new v.URI(De),Te=(_e=await Q.asRelativePath(ke.parent))===null||_e===void 0?void 0:_e.path;return{id:ke.codeUri.fsPath,type:D.MentionType.FILE,text:ke.displayName,value:ke.codeUri.fsPath,description:Te||"",contextId:ke.codeUri.fsPath,icon:Z.getIcon(ke)}}))}}},{id:D.MentionType.FOLDER,type:D.MentionType.FOLDER,text:"Folder",icon:(0,_.getIcon)("folder"),getHighestLevelItems:()=>{var Me,Be;const De=G.currentEditor,_e=(Me=De?.currentUri)===null||Me===void 0?void 0:Me.parent;return _e?_e.toString()===((Be=Q.workspace)===null||Be===void 0?void 0:Be.uri)?[]:[{id:_e.codeUri.fsPath,type:D.MentionType.FOLDER,text:_e.displayName,value:_e.codeUri.fsPath,description:`(${(0,v.localize)("aiNative.chat.defaultContextFolder")})`,contextId:_e.codeUri.fsPath,icon:(0,_.getIcon)("folder")}]:[]},getItems:async Me=>{var Be,De;let _e=[];if(Me){const ke=(await Q.roots).map(pe=>new v.URI(pe.uri).codeUri.fsPath.toString()),Te=await W.find(Me,{rootUris:ke,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,excludePatterns:Object.keys(p.defaultFilesWatcherExcludes),limit:10}),We=Array.from(new Set(Te.map(pe=>new v.URI(pe).parent.toString()).filter(pe=>{var ie;return pe!==((ie=Q.workspace)===null||ie===void 0?void 0:ie.uri.toString())})));return await q(We,((De=Q.workspace)===null||De===void 0?void 0:De.uri.toString())||"")}else{const ke=await j.getMostRecentlyOpenedFiles(),Te=Array.from(new Set(ke.map(We=>new v.URI(We).parent.codeUri.fsPath).filter(We=>{var pe;return We!==((pe=Q.workspace)===null||pe===void 0?void 0:pe.uri.toString())&&We!=="/"})));_e=await q(Te,((Be=Q.workspace)===null||Be===void 0?void 0:Be.uri.toString())||"")}return _e.filter(Boolean).filter(ke=>{var Te;return ke.id!==new v.URI((Te=Q.workspace)===null||Te===void 0?void 0:Te.uri).codeUri.fsPath})}},{id:"code",type:"code",text:"Code",icon:(0,_.getIcon)("codebraces"),getHighestLevelItems:()=>[],getItems:async Me=>{if(!Me||Y.current.length===0){const Be=K.currentUri;if(!Be)return[];const De=await me();return Y.current=await Promise.all(De.map(async _e=>{var ke;const Te=await Q.asRelativePath(Be);return{id:_e.raw.id,type:D.MentionType.CODE,text:_e.raw.name,symbol:_e.raw,value:_e.raw.id,description:`${Te?.root?Te.path:""}:L${_e.raw.range.startLineNumber}-${_e.raw.range.endLineNumber}`,kind:_e.raw.kind,contextId:`${(ke=K.currentUri)===null||ke===void 0?void 0:ke.codeUri.fsPath}:L${_e.raw.range.startLineNumber}-${_e.raw.range.endLineNumber}`,icon:(0,l.getSymbolIcon)(_e.raw.kind)+" outline-icon"}})),Y.current}else return Me=Me.toLocaleLowerCase(),Y.current.sort((Be,De)=>Be.text.toLocaleLowerCase().includes(Me)&&De.text.toLocaleLowerCase().includes(Me)?0:Be.text.toLocaleLowerCase().includes(Me)?-1:De.text.toLocaleLowerCase().includes(Me)?1:0)}},{id:D.MentionType.RULE,type:D.MentionType.RULE,text:"Rule",icon:(0,_.getIcon)("rules"),getHighestLevelItems:()=>[],getItems:async Me=>{const De=(await re.projectRules).map(ke=>{const Te=new v.URI(ke.path);return{id:Te.codeUri.fsPath,type:D.MentionType.RULE,text:Te.displayName,value:Te.codeUri.fsPath,contextId:Te.codeUri.fsPath,description:ke.description,icon:(0,_.getIcon)("rules")}});if(!Me)return De.slice(0,10);const _e=Me.toLocaleLowerCase();return De.filter(ke=>ke.text.toLocaleLowerCase().includes(_e)).sort((ke,Te)=>{var We,pe;const ie=ke.text.toLocaleLowerCase(),le=Te.text.toLocaleLowerCase(),Se=((We=ke.description)===null||We===void 0?void 0:We.toLocaleLowerCase())||"",ye=((pe=Te.description)===null||pe===void 0?void 0:pe.toLocaleLowerCase())||"",Ue=ie.includes(_e),Ye=le.includes(_e),Ve=Se.includes(_e),pt=ye.includes(_e);return Ue&&Ye?ie.localeCompare(le):Ue&&!Ye?-1:!Ue&&Ye?1:Ve&&pt?ie.localeCompare(le):Ve&&!pt?-1:!Ve&&pt?1:ie.localeCompare(le)}).slice(0,10)}}],ge=(0,r.useMemo)(()=>({modelOptions:[{value:"qwen-plus-latest",label:"Qwen 3",iconClass:$.fromIcon("","https://img.alicdn.com/imgextra/i3/O1CN01LFMrZj28YrnrzeebY_!!6000000007945-55-tps-16-16.svg",c.IconType.Background),tags:["\u601D\u8003\u94FE","\u64C5\u957F\u4EE3\u7801"],description:"\u9AD8\u6027\u80FD\u4EE3\u7801\u6A21\u578B\uFF0C\u652F\u6301\u601D\u8003\u94FE"},{label:"Claude 4 Sonnet",value:"claude_sonnet4",iconClass:$.fromIcon("","https://img.alicdn.com/imgextra/i3/O1CN01p0mziz1Nsl40lp1HO_!!6000000001626-55-tps-92-65.svg",c.IconType.Background),tags:["\u591A\u6A21\u6001","\u957F\u4E0A\u4E0B\u6587\u7406\u89E3","\u601D\u8003\u6A21\u5F0F"],description:"\u9AD8\u6027\u80FD\u6A21\u578B\uFF0C\u652F\u6301\u591A\u6A21\u6001\u8F93\u5165"},{label:"DeepSeek R1",value:"DeepSeek-R1-0528",iconClass:$.fromIcon("","https://img.alicdn.com/imgextra/i3/O1CN01ClcK2w1JwdxcbAB3a_!!6000000001093-55-tps-30-30.svg",c.IconType.Background),tags:["\u601D\u8003\u6A21\u5F0F","\u957F\u4E0A\u4E0B\u6587\u7406\u89E3"],description:"\u4E13\u4E1A\u521B\u4F5C\uFF0C\u652F\u6301\u591A\u6A21\u6001\u8F93\u5165"}],defaultModel:T.sessionModelId||X.get(v.AINativeSettingSectionsId.ModelID)||"deepseek-r1",buttons:[{id:"mcp-server",icon:"mcp",title:"MCP Server",onClick:oe,position:D.FooterButtonPosition.LEFT},{id:"rules",icon:"rules",title:"Rules",onClick:he,position:D.FooterButtonPosition.LEFT},{id:"upload-image",icon:"image",title:(0,v.localize)("aiNative.chat.imageUpload"),onClick:()=>{const Me=document.createElement("input");Me.type="file",Me.accept="image/*",Me.onchange=Be=>{const De=Be.target.files;De?.length&&Oe(Array.from(De))},Me.click()},position:D.FooterButtonPosition.LEFT}],showModelSelector:!0,disableModelSelector:T.disableModelSelector}),[$,oe,he,T.disableModelSelector,T.sessionModelId]),te=(0,r.useCallback)(()=>{N.cancelRequest()},[]),fe=(0,r.useCallback)(async(Me,Be)=>{M||(R(Me,F.map(De=>De.toString()),void 0,void 0,Be),L(T.images||[]))},[R,F,M]),Oe=(0,r.useCallback)(async Me=>{const Be=["image/jpeg","image/jpg","image/png","image/webp","image/gif"];if(Me.filter(We=>!Be.includes(We.type)).length>0){V.error("Only JPG, PNG, WebP and GIF images are supported");return}const _e=H.getImageUploadProvider();if(!_e){V.error("No image upload provider found");return}const ke=await Promise.all(Me.map(We=>_e.imageUpload(We))),Te=[...F,...ke];L(Te)},[F]),Pe=(0,r.useCallback)(Me=>{L(F.filter((Be,De)=>De!==Me))},[F]);return r.default.createElement("div",{className:A.default.chat_input_container},F.length>0&&r.default.createElement(w,{images:F,onDelete:Pe}),r.default.createElement(S.MentionInput,{mentionItems:be,onSend:fe,onStop:te,loading:M,labelService:Z,workspaceService:Q,placeholder:(0,v.localize)("aiNative.chat.input.placeholder.default"),footerConfig:ge,onImageUpload:Oe,contextService:O}))};t.ChatMentionInput=I;const w=({images:T,onDelete:R})=>r.default.createElement("div",null,r.default.createElement("div",{className:A.default.thumbnail_container},T.map((M,O)=>r.default.createElement("div",{key:O,className:A.default.thumbnail},r.default.createElement(o.Image,{src:M.toString()}),r.default.createElement("button",{onClick:()=>R(O),className:A.default.delete_button},r.default.createElement(_.Icon,{iconClass:"codicon codicon-close"}))))))},15016:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(48412),_=e(91416),v=e(78569),m=e(72871),p=e(41869),s=e(81878),g=e(89195),a=e(43718),h=e(52416),u=e(90684),c=e(19413),E=e(56474),f=e(17319),d=n.__importDefault(e(6960)),y=I=>{const w=(0,p.useInjectable)(p.LabelService),T=(0,p.useInjectable)(p.CommandService),R=(L,N,U)=>{let W=w.getIcon(L,{isDirectory:N});return N&&U&&(W+=" expanded"),W},M=(0,o.useMemo)(()=>{const L=N=>{const U=typeof N.type=="number"?N.type===a.FileType.Directory:!!N.children,W=new a.URI(N.uri);return{label:N.label,iconClassName:R(W,U,U),expandable:!0,expanded:!0,children:U?(N.children||[]).map(L):null,uri:W}};return(I.treeData.children||[]).map(L)},[I.treeData]),[O,x]=(0,o.useState)(22),k=(0,o.useRef)(null),F=L=>{k.current=L;const N=()=>{let U=L.getModel().root.branchSize;U<1?U=1:U>20&&(U=20),x(U*22)};N(),L.onDidUpdate(N)};return M.length?o.default.createElement("div",{className:d.default.tree_container},o.default.createElement(_.BasicRecycleTree,{height:O,treeData:M,onContextMenu:L=>L.preventDefault(),onClick:(L,N)=>{!k.current||!N||(v.BasicCompositeTreeNode.is(N)?N.raw.iconClassName=R(N.raw.uri,!0,N.expanded):T.executeCommand(p.EDITOR_COMMANDS.OPEN_RESOURCE.id,N.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:F,treeName:I.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},b=I=>{const{toolCall:w,messageId:T}=I,R=(0,p.useInjectable)(a.ChatAgentViewServiceToken),[M,O]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const x=R.getChatComponent("toolCall");if(x){const{component:F,initialProps:L}=x;O(o.default.createElement(F,{...L,value:w,messageId:T}));return}O(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),R.getChatComponentDeferred("toolCall").promise.then(({component:F,initialProps:L})=>{O(o.default.createElement(F,{...L,value:w,messageId:T}))})},[w.state]),M},A=I=>{const w=(0,p.useInjectable)(a.ChatAgentViewServiceToken),[T,R]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const M=w.getChatComponent(I.component);if(M){const{component:x,initialProps:k}=M;R(o.default.createElement(x,{...k,value:I.value,messageId:I.messageId}));return}R(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),w.getChatComponentDeferred(I.component).promise.then(({component:x,initialProps:k})=>{R(o.default.createElement(x,{...k,value:I.value}))})},[I.component,I.value]),T},S=I=>{var w,T;const{relationId:R,request:M,startTime:O=0,onRegenerate:x,onDidChange:k,onDone:F,agentId:L,command:N,history:U,msgId:W}=I,[,j]=(0,o.useReducer)(ge=>(ge+1)%1e6,0),Q=(0,p.useInjectable)(a.IAIReporter),G=(0,p.useInjectable)(h.IIconService),Z=(0,p.useInjectable)(p.IContextKeyService),$=(0,p.useInjectable)(c.IChatInternalService),V=(0,p.useInjectable)(a.ChatServiceToken),H=(0,p.useInjectable)(c.IChatAgentService),K=(0,p.useInjectable)(a.ChatRenderRegistryToken),[Y,X]=(0,o.useState)(M.response.isComplete?new Set(M.response.responseContents.map((ge,te)=>ge.kind==="reasoning"?te:-1).filter(ge=>ge!==-1)):new Set);(0,o.useEffect)(()=>{M.response.isComplete&&X(new Set(M.response.responseContents.map((ge,te)=>ge.kind==="reasoning"?te:-1).filter(ge=>ge!==-1)))},[M.response.isComplete]),(0,o.useEffect)(()=>{const ge=new p.DisposableCollection;return ge.push(M.response.onDidChange(()=>{U.updateAssistantMessage(W,{content:M.response.responseText}),M.response.isComplete&&(F&&F(),Q.end(R,{assistantMessage:M.response.responseText,replytime:Date.now()-O,success:!0,isStop:!1,command:N,agentId:L,messageId:W,sessionId:$.sessionModel.sessionId})),(0,o.startTransition)(()=>{k?.(),j()})})),()=>ge.dispose()},[R,k,F]);const re=(0,o.useCallback)(()=>{M.response.reset(),x?.()},[x]),oe=(0,o.useCallback)(ge=>{if(K.chatAIRoleRender){const te=K.chatAIRoleRender;return o.default.createElement(te,{content:ge.value})}return o.default.createElement(E.ChatMarkdown,{markdown:ge,fillInIncompleteTokens:!0})},[K,K.chatAIRoleRender]),he=ge=>o.default.createElement(y,{treeData:ge}),me=ge=>o.default.createElement("div",{className:d.default.placeholder},o.default.createElement(s.Icon,{iconClass:G.fromString("$(codicon/sync~spin)")}),o.default.createElement("div",{className:d.default.placeholder_content},oe(ge))),q=o.default.useMemo(()=>M.response.responseContents.map((ge,te)=>{let fe;if(ge.kind==="asyncContent")fe=me(new u.MarkdownString(ge.content));else if(ge.kind==="treeData")fe=he(ge.treeData);else if(ge.kind==="component")fe=o.default.createElement(A,{component:ge.component,value:ge.value,messageId:W});else if(ge.kind==="toolCall")fe=o.default.createElement(b,{toolCall:ge.content,messageId:W});else if(ge.kind==="reasoning"){const Oe=te===M.response.responseContents.length-1&&!M.response.isComplete;fe=o.default.createElement("div",{className:(0,r.default)(d.default.reasoning,{[d.default.thinking]:Oe})},o.default.createElement(l.Button,{size:"small",type:"secondary",className:d.default.thinking,onClick:()=>{Oe||(Y.has(te)?Y.delete(te):Y.add(te),X(new Set(Y)))}},o.default.createElement(s.Icon,{iconClass:"codicon codicon-sparkle"}),o.default.createElement("span",{style:{marginLeft:4},className:Oe?d.default.shiny_text:""},(0,a.localize)("aiNative.chat.thinking")),Oe?null:Y.has(te)?o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-right"}):o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-down"})),Y.has(te)?null:o.default.createElement("div",{className:d.default.reasoning_content},oe(new u.MarkdownString(ge.content))))}else fe=oe(ge.content);return o.default.createElement(o.Fragment,{key:`${ge.kind}-${te}`},fe)}),[M.response.responseContents,Y]),be=o.default.useMemo(()=>M.response.followups?M.response.followups.map((ge,te)=>{let fe=null;if(ge.kind==="reply"){const Oe=o.default.createElement("a",{onClick:()=>{V.sendMessage({...H.parseMessage(ge.message),reportExtra:{actionSource:a.ActionSourceEnum.Chat,actionType:a.ActionTypeEnum.Followup}})}},ge.title||ge.message);fe=ge.tooltip?o.default.createElement(m.Tooltip,{title:ge.tooltip},Oe):Oe}else ge.when&&!Z.match(ge.when)&&(fe=null),fe=o.default.createElement(l.Button,{type:"default"},ge.title);return fe&&o.default.createElement(o.Fragment,{key:te},fe)}):null,[M.response.followups]);return M.response.isComplete?o.default.createElement(f.ChatThinkingResult,{hasMessage:M.response.responseParts.length>0||M.response.responseContents.length>0||!!(!((w=M.response.errorDetails)===null||w===void 0)&&w.message),onRegenerate:re,requestId:M.requestId},o.default.createElement("div",{className:d.default.ai_chat_response_container},!((T=M.response.errorDetails)===null||T===void 0)&&T.message?o.default.createElement("div",{className:d.default.error},o.default.createElement(s.Icon,{className:(0,s.getIcon)("close-circle")}),o.default.createElement("span",null,M.response.errorDetails.message)):o.default.createElement(o.default.Fragment,null,q,be?.length!==0&&o.default.createElement("div",{className:d.default.followups},be)))):o.default.createElement(f.ChatThinking,{message:M.response.responseText},q)};t.ChatReply=S;const D=I=>{const{chunk:w}=I,T=(0,p.useInjectable)(a.ChatRenderRegistryToken),R=o.default.useMemo(()=>{let M;if(w.kind==="component")M=o.default.createElement(A,{component:w.component,value:w.value});else{let O=o.default.createElement(E.ChatMarkdown,{markdown:w.content,fillInIncompleteTokens:!0});if(T.chatAIRoleRender){const x=T.chatAIRoleRender;O=o.default.createElement(x,{content:w.content})}M=O}return M},[w]);return o.default.createElement(f.ChatThinkingResult,{hasMessage:!0,requestId:I.requestId,showRegenerate:!1},o.default.createElement("div",{className:d.default.ai_chat_response_container},R))};t.ChatNotify=D},17319:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),l=e(89195),_=e(68974),v=e(43718),m=e(19413),p=n.__importDefault(e(6960)),s=a=>{const{children:h,message:u,thinkingText:c}=a,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),f=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),d=(0,r.useMemo)(()=>Array.isArray(h)?h.length===0:!h,[h]),y=(0,r.useCallback)(()=>d?f?r.default.createElement(f,{thinkingText:c}):r.default.createElement("span",{className:p.default.thinking_text},c||"Thinking..."):h,[u,h,c,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:p.default.content},y()),r.default.createElement("div",{className:p.default.thinking_container},r.default.createElement("div",{className:p.default.stop},!f&&r.default.createElement("span",{className:p.default.progress_bar},d&&r.default.createElement(_.Progress,{loading:!0,wrapperClassName:p.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const g=({children:a,message:h,onRegenerate:u,requestId:c,hasMessage:E=!0,showRegenerate:f})=>{const d=(0,o.useInjectable)(m.IChatInternalService),[y,b]=(0,r.useState)(d.latestRequestId),A=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const T=d.onChangeRequestId(R=>{b(R)});return()=>T.dispose()},[d]);const S=(0,r.useMemo)(()=>A.chatThinkingResultRender,[A,A.chatThinkingResultRender]),D=(0,r.useCallback)(()=>{u&&u()},[u]),I=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const T=(0,v.localize)("aiNative.chat.stop.immediately");return S?r.default.createElement(S,{thinkingResult:T}):r.default.createElement("span",null,T)}return a},[h,E,a]),w=(0,r.useMemo)(()=>(0,v.isUndefined)(f)?y===c&&!!c:!!f,[y,c,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:p.default.content},I()),r.default.createElement("div",{className:p.default.thinking_container},r.default.createElement("div",{className:p.default.bottom_container},r.default.createElement("div",{className:p.default.reset},w?r.default.createElement(l.EnhanceIcon,{icon:"refresh",wrapperClassName:p.default.text_btn,className:p.default.transform,onClick:D,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:p.default.thumbs},r.default.createElement(l.Thumbs,{relationId:c,wrapperClassName:p.default.icon_btn})))))};t.ChatThinkingResult=g},34817:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),_=e(81878),v=e(89195),m=e(43718),p=e(33783),s=e(98864),g=e(77633),a=e(25834),h=n.__importDefault(e(16796)),u=e(78112),c=E=>{var f,d,y;const{value:b,messageId:A}=E,[S,D]=(0,o.useState)(!1),I=(0,l.useInjectable)(g.TokenMCPServerRegistry);if(!b||!b.function||!b.id)return null;const w=((f=I.getMCPTool(b.function.name))===null||f===void 0?void 0:f.label)||b.function.name,T=w.split(s.TOOL_NAME_SEPARATOR),R=T.length>=3?T[2]:w,M=I.getToolComponent(b.function.name),O=L=>{switch(L){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:L||"Unknown",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-question"})}}},x=()=>{var L;try{return b.state!=="complete"&&b.state!=="result"?{}:JSON.parse(((L=b.function)===null||L===void 0?void 0:L.arguments)||"{}")}catch{return{}}},k=()=>{D(!S)},F=O(b.state);return M&&(b.state==="complete"||b.state==="result")?o.default.createElement(M,{state:b.state,args:x(),result:b.result,index:b.index,messageId:A,toolCallId:b.id}):o.default.createElement("div",{className:h.default.chat_tool_render},o.default.createElement("div",{className:h.default.tool_header,onClick:k},o.default.createElement("div",{className:h.default.tool_name},o.default.createElement(_.Icon,{iconClass:`codicon codicon-chevron-${S?"down":"right"}`}),o.default.createElement(_.Icon,{size:"small",iconClass:(0,r.default)("codicon codicon-tools",h.default.tool_icon)}),o.default.createElement("span",{className:h.default.tool_label},o.default.createElement("span",{className:h.default.tool_prefix},"Called MCP Tool"),o.default.createElement("span",{className:h.default.tool_name,title:R},R))),b.state&&o.default.createElement("div",{className:h.default.tool_state},o.default.createElement("span",{className:h.default.state_icon},F.icon))),o.default.createElement("div",{className:(0,r.default)(h.default.tool_content,{[h.default.expanded]:S})},((d=b?.function)===null||d===void 0?void 0:d.arguments)&&o.default.createElement("div",{className:h.default.tool_arguments},o.default.createElement("div",{className:h.default.section_label},(0,p.localize)("ai.native.mcp.tool.arguments"),":"),o.default.createElement(a.CodeEditorWithHighlight,{input:(y=b?.function)===null||y===void 0?void 0:y.arguments,language:"json",relationId:(0,m.uuid)(4)})),b?.result&&o.default.createElement("div",{className:h.default.tool_result},o.default.createElement("div",{className:h.default.section_label},(0,p.localize)("ai.native.mcp.tool.results"),":"),o.default.createElement(u.ChatToolResult,{result:b.result,relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=c},78112:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolResult=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(33783),l=e(25834),_=n.__importDefault(e(48091)),v=({result:m,relationId:p})=>{const s=r.default.useCallback(h=>{try{return JSON.parse(h).content||[]}catch{return[{type:"text",text:h}]}},[]),g=r.default.useCallback((h,u)=>{switch(h.type){case"text":return h.text?r.default.createElement("div",{key:`text-${u}`,className:_.default.text_content},r.default.createElement(l.CodeEditorWithHighlight,{input:h.text,language:"text",relationId:p||""})):null;case"image":return h.data?r.default.createElement("div",{key:`image-${u}`,className:_.default.image_content},r.default.createElement("img",{src:`data:${h.mimeType||"image/png"};base64,${h.data}`,alt:(0,o.localize)("aiNative.chat.result.image")})):null;default:return null}},[p]),a=r.default.useMemo(()=>s(m),[m,s]);return a.length?r.default.createElement("div",{className:_.default.result_container},a.map((h,u)=>g(h,u))):null};t.ChatToolResult=v},29039:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),l=e(43718),_=e(19413),v=m=>{const{userMessage:p,relationId:s,requestId:g,renderContent:a,startTime:h,agentId:u,command:c}=m,E=(0,o.useInjectable)(_.IChatInternalService),f=(0,o.useInjectable)(l.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(g),f.end(s,{message:p,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:c})},[a,g,s]),r.createElement("div",null,a({userMessage:p}))};t.SlashCustomRender=v},86556:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),l=e(81878),_=e(4246),v=e(43718),m=e(90684);e(41937);const p=e(19413),s=e(56474),g=e(17319),a=e(78048),h=n.__importDefault(e(6960)),u=()=>{var c,E;const f=(0,o.useInjectable)(v.ChatServiceToken),d=(0,o.useInjectable)(p.IChatAgentService),y=(0,o.useInjectable)(v.ChatFeatureRegistryToken),b=(0,o.useInjectable)(v.ChatRenderRegistryToken),[A,S]=r.useState([]);(0,o.useUpdateOnEvent)(y.onDidWelcomeMessageChange);const D=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return[];const{sampleQuestions:R=[]}=y.chatWelcomeMessageModel;return R.map(a.extractIcon)},[(c=y.chatWelcomeMessageModel)===null||c===void 0?void 0:c.sampleQuestions]),I=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return"";const{content:R}=y.chatWelcomeMessageModel;return R},[(E=y.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const R=d.onDidChangeAgents(async()=>{const O=(await d.getAllSampleQuestions()).map(a.extractIcon);S(O)});return()=>R.dispose()},[]),!I)return r.createElement(g.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const w=r.useMemo(()=>D.concat(A),[D,A]);return r.useMemo(()=>{if(b.chatWelcomeRender){const R=b.chatWelcomeRender;return r.createElement(R,{message:I,sampleQuestions:w})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(I)?r.createElement(s.ChatMarkdown,{key:"welcome",markdown:I}):I),r.createElement("div",{className:h.default.chat_container_content},w.map((R,M)=>{const O=r.createElement("a",{className:h.default.link_item,onClick:(0,_.withPrevented)(()=>{f.sendMessage({...d.parseMessage(R.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},R.icon?r.createElement(l.Icon,{className:R.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,R.title));return R.tooltip?r.createElement(l.Tooltip,{title:R.tooltip,key:M},O):r.createElement(r.Fragment,{key:M},O)})))},[b.chatWelcomeRender,I,w])};t.WelcomeMessage=u},83933:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},96086:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionInput=t.WHITE_SPACE_TEXT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),_=e(81878),v=e(89195),m=e(70392),p=n.__importDefault(e(97599)),s=e(80732),g=e(37412),a=e(44692);t.WHITE_SPACE_TEXT=" ";const h=({mentionItems:u=[],onSend:c,onStop:E,loading:f=!1,mentionKeyword:d=a.MENTION_KEYWORD,onSelectionChange:y,onImageUpload:b,labelService:A,workspaceService:S,placeholder:D="Ask anything, @ to mention",footerConfig:I={buttons:[],showModelSelector:!1},contextService:w})=>{const T=o.useRef(null),[R,M]=o.useState({active:!1,startPos:null,filter:"",position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),[O,x]=o.useState(I.defaultModel||""),[k,F]=o.useState({}),[L,N]=o.useState([]),[U,W]=o.useState(-1),[j,Q]=o.useState(""),[G,Z]=o.useState(!1),[$,V]=o.useState({files:[],folders:[],rules:[]}),H=o.useRef([]),K=()=>R.level===0?u:R.parentType?R.loading?k[R.parentType]||[]:k[R.parentType]||[]:[],X=((ie,le)=>{const[Se,ye]=o.useState(ie);return o.useEffect(()=>{const Ue=setTimeout(()=>{ye(ie)},le);return()=>{clearTimeout(Ue)}},[ie,le]),Se})(R.secondLevelFilter,300);o.useEffect(()=>{x(I.defaultModel||"")},[I.defaultModel]),o.useEffect(()=>{if(R.level===1&&R.parentType&&X!==void 0){const ie=u.find(Se=>Se.id===R.parentType);if(!ie)return;M(Se=>({...Se,loading:!0})),(async()=>{try{const Se=[];if(ie.getHighestLevelItems){const ye=ie.getHighestLevelItems();for(const Ue of ye)Se.some(Ye=>Ye.id===Ue.id)||Se.push(Ue);F(Ue=>({...Ue,[R.parentType]:ye}))}if(ie.getItems)try{const ye=await ie.getItems(X),Ue=[...Se];for(const Ye of ye)Ue.some(Ve=>Ve.id===Ye.id)||Ue.push(Ye);F(Ye=>({...Ye,[R.parentType]:Ue}))}catch{M(Ue=>({...Ue,loading:!1}))}M(ye=>({...ye,loading:!1}))}catch{M(ye=>({...ye,loading:!1}))}})()}},[X,R.level,R.parentType]),o.useEffect(()=>{const ie=w?.onDidContextFilesChangeEvent(({attached:le,attachedFolders:Se,attachedRules:ye})=>{V({files:le,folders:Se,rules:ye})});return()=>{ie?.dispose()}},[]);const re=ie=>{const le=window.getSelection();if(!le||!le.rangeCount)return 0;const Se=le.getRangeAt(0),ye=Se.cloneRange();return ye.selectNodeContents(ie),ye.setEnd(Se.endContainer,Se.endOffset),ye.toString().length},oe=()=>{if(G&&(Z(!1),W(-1)),T.current){const ye=Array.from(T.current.querySelectorAll(`.${p.default.mention_tag}`)).map(Ye=>({id:Ye.getAttribute("data-id")||"",type:Ye.getAttribute("data-type")||"",contextId:Ye.getAttribute("data-context-id")||""}));H.current.filter(Ye=>!ye.some(Ve=>Ve.id===Ye.id&&Ve.type===Ye.type&&Ve.contextId===Ye.contextId)).forEach(Ye=>{if(Ye.contextId){const Ve=new m.URI(Ye.contextId);Ye.type===a.MentionType.FILE?Te(a.MentionType.FILE,Ve):Ye.type===a.MentionType.FOLDER?Te(a.MentionType.FOLDER,Ve):Ye.type===a.MentionType.RULE&&Te(a.MentionType.RULE,Ve)}}),H.current=ye}const ie=window.getSelection();if(!ie||!ie.rangeCount||!T.current)return;const le=T.current.textContent||"",Se=re(T.current);if(le[Se-1]===d&&!R.active&&!R.inlineSearchActive&&M({active:!0,startPos:Se,filter:d,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),R.active&&R.level===0&&R.startPos!==null)if(Se<R.startPos)M(ye=>({...ye,active:!1}));else{const ye=le.substring(R.startPos-1,Se);M(Ue=>({...Ue,filter:ye,activeIndex:0}))}if(R.inlineSearchActive&&R.inlineSearchStartPos!==null&&R.parentType){const ye=u.find(Ve=>Ve.id===R.parentType);if(!ye)return;const Ue=`@${ye.type}:`,Ye=R.inlineSearchStartPos-Ue.length;if(Ye>=0&&Se>Ye+Ue.length){const Ve=le.substring(Ye+Ue.length,Se);Ve!==R.secondLevelFilter&&M(pt=>({...pt,secondLevelFilter:Ve,active:!0,activeIndex:0}))}else Se<=Ye&&M(Ve=>({...Ve,inlineSearchActive:!1,active:!1}))}if(T.current&&(T.current.scrollHeight>=120?T.current.style.overflowY="auto":T.current.style.overflowY="hidden"),T.current){const ye=T.current.innerHTML;(ye===""||ye==="<br>"||ye==="<br/>")&&(T.current.innerHTML="")}},he=ie=>{if(ie.key==="Escape"&&(R.active||R.inlineSearchActive)){R.level>0?M(Se=>({...Se,level:0,activeIndex:0,secondLevelFilter:"",inlineSearchActive:!1})):M(Se=>({...Se,active:!1,inlineSearchActive:!1})),ie.preventDefault();return}if((ie.key==="Backspace"||ie.key==="Delete")&&T.current&&(!T.current.textContent||T.current.textContent.trim()==="")&&w?.cleanFileContext(),ie.key===a.MENTION_KEYWORD&&!R.active&&!R.inlineSearchActive&&T.current){const Se=re(T.current);M({active:!0,startPos:Se+1,filter:d,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1})}if((ie.key==="ArrowUp"||ie.key==="ArrowDown")&&!ie.shiftKey&&!ie.ctrlKey&&!ie.metaKey&&!ie.altKey){if(!R.active&&!R.inlineSearchActive&&T.current&&L.length>0){const Se=T.current.innerHTML;if(!Se||Se==="<br>"||G&&U>=0&&L[L.length-1-U]===Se){ie.preventDefault(),G||(Q(Se),Z(!0));let Ue=U;ie.key==="ArrowUp"?Ue=Math.min(L.length-1,U+1):Ue=Math.max(-1,U-1),W(Ue),Ue===-1?T.current.innerHTML=j:T.current.innerHTML=L[L.length-1-Ue];const Ye=document.createRange();Ye.selectNodeContents(T.current),Ye.collapse(!1);const Ve=window.getSelection();Ve&&(Ve.removeAllRanges(),Ve.addRange(Ye));return}}}else G&&ie.key!=="ArrowUp"&&ie.key!=="ArrowDown"&&(Z(!1),W(-1));if(ie.key==="Enter"){if(ie.nativeEvent.isComposing)return;if(!ie.shiftKey&&(ie.preventDefault(),!R.active)){fe();return}}if(!R.active)return;let le=K();if(R.level===0&&R.filter&&R.filter.length>1){const Se=R.filter.substring(1).toLowerCase();le=le.filter(ye=>ye.text.toLowerCase().includes(Se))}le.length!==0&&(ie.key==="ArrowDown"?(M(Se=>({...Se,activeIndex:(Se.activeIndex+1)%le.length})),ie.preventDefault()):ie.key==="ArrowUp"?(M(Se=>({...Se,activeIndex:(Se.activeIndex-1+le.length)%le.length})),ie.preventDefault()):(ie.key==="Enter"||ie.key==="Tab")&&le.length>0&&(ge(le[R.activeIndex]),ie.preventDefault()))},me=()=>{},q=async ie=>{const le=ie.clipboardData.items,Se=[];for(let lt=0;lt<le.length;lt++)if(le[lt].kind===a.MentionType.FILE&&le[lt].type.startsWith("image/")){const wt=le[lt].getAsFile();wt&&Se.push(wt)}if(ie.preventDefault(),Se.length>0&&b){await b(Se);return}const Ue=ie.clipboardData.getData("text/plain").replace(/\t/g," ").replace(/\n\s*\n/g,`
|
|
32964
|
+
`),k=x[x.length-1],F=[{condition:k.includes("`"),action:c},{condition:k.includes("**"),action:b},{condition:k.match(/\*\w/),action:E},{condition:k.match(/(^|\s)__\w/),action:A},{condition:k.match(/(^|\s)_\w/),action:f},{condition:k.match(/(^|\s)\[.*\]\(\w*/),action:d},{condition:k.match(/(^|\s)\[\w/),action:y}];for(const L of F)if(L.condition)return L.action(T)}}},49601:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMentionInput=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(46541),l=e(41869),_=e(81878),v=e(43718),m=e(92323),p=e(87863),s=e(54414),g=e(47720),a=e(83890),h=e(29037),u=e(72665),c=e(52416),E=e(7443),f=e(51500),d=e(19413),y=e(27397),b=e(92819),A=n.__importDefault(e(6960)),S=e(96086),D=e(44692),I=T=>{const{onSend:R,disabled:M=!1,contextService:O}=T,[x,k]=(0,r.useState)(T.value||""),[F,L]=(0,r.useState)(T.images||[]),N=(0,l.useInjectable)(d.IChatInternalService),U=(0,l.useInjectable)(m.CommandService),W=(0,l.useInjectable)(g.FileSearchServicePath),j=(0,l.useInjectable)(l.RecentFilesManager),Q=(0,l.useInjectable)(f.IWorkspaceService),G=(0,l.useInjectable)(s.WorkbenchEditorService),Z=(0,l.useInjectable)(l.LabelService),$=(0,l.useInjectable)(E.IconService),V=(0,l.useInjectable)(u.IMessageService),H=(0,l.useInjectable)(v.ChatFeatureRegistryToken),K=(0,l.useInjectable)(h.OutlineTreeService),Y=(0,r.useRef)([]),X=(0,l.useInjectable)(l.PreferenceService),re=(0,l.useInjectable)(v.RulesServiceToken),oe=r.default.useCallback(()=>{U.executeCommand(y.MCPConfigCommands.OPEN_MCP_CONFIG.id)},[U]),he=r.default.useCallback(()=>{U.executeCommand(b.RulesCommands.OPEN_RULES_FILE.id)},[U]);(0,r.useEffect)(()=>{T.value!==x&&k(T.value||"")},[T.value]);const me=(0,r.useCallback)(async(Me,Be=[])=>{Me||(Me=(await K.resolveChildren())[0]);const De=await K.resolveChildren(Me);for(const _e of De)Be.push(_e),a.OutlineCompositeTreeNode.is(_e)&&await me(_e,Be);return Be},[K]),q=async(Me,Be)=>{const De=new Set,_e=new v.URI(Be);for(const ke of Me){const Te=new v.URI(ke),We=await Q.asRelativePath(Te);if(We?.path){const pe=We.path.split("/").filter(Boolean);for(let ie=0;ie<pe.length;ie++){const le=pe.slice(0,ie+1).join("/"),Se=_e.resolve(le).codeUri.fsPath;Se!==Be&&!Be.startsWith(Se)&&De.add(Se)}}else ke!==Be&&!Be.startsWith(ke)&&De.add(ke)}return Promise.all(Array.from(De).map(async ke=>{const Te=new v.URI(ke),We=await Q.asRelativePath(Te);return{id:Te.codeUri.fsPath,type:D.MentionType.FOLDER,text:Te.displayName,value:Te.codeUri.fsPath,description:We?.root?We.path:"",contextId:Te.codeUri.fsPath,icon:(0,_.getIcon)("folder")}}))},be=[{id:D.MentionType.FILE,type:D.MentionType.FILE,text:"File",icon:(0,_.getIcon)("file"),getHighestLevelItems:()=>{const Me=G.currentEditor,Be=Me?.currentUri;return Be?[{id:Be.codeUri.fsPath,type:D.MentionType.FILE,text:Be.displayName,value:Be.codeUri.fsPath,description:`(${(0,v.localize)("aiNative.chat.defaultContextFile")})`,contextId:Be.codeUri.fsPath,icon:Z.getIcon(Be)}]:[]},getItems:async Me=>{if(Me){const Be=(await Q.roots).map(_e=>new v.URI(_e.uri).codeUri.fsPath.toString()),De=await W.find(Me,{rootUris:Be,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10});return Promise.all(De.map(async _e=>{var ke;const Te=new v.URI(_e),We=(ke=await Q.asRelativePath(Te.parent))===null||ke===void 0?void 0:ke.path;return{id:Te.codeUri.fsPath,type:D.MentionType.FILE,text:Te.displayName,value:Te.codeUri.fsPath,description:We||"",contextId:Te.codeUri.fsPath,icon:Z.getIcon(Te)}}))}else{const Be=await j.getMostRecentlyOpenedFiles();return Promise.all(Be.map(async De=>{var _e;const ke=new v.URI(De),Te=(_e=await Q.asRelativePath(ke.parent))===null||_e===void 0?void 0:_e.path;return{id:ke.codeUri.fsPath,type:D.MentionType.FILE,text:ke.displayName,value:ke.codeUri.fsPath,description:Te||"",contextId:ke.codeUri.fsPath,icon:Z.getIcon(ke)}}))}}},{id:D.MentionType.FOLDER,type:D.MentionType.FOLDER,text:"Folder",icon:(0,_.getIcon)("folder"),getHighestLevelItems:()=>{var Me,Be;const De=G.currentEditor,_e=(Me=De?.currentUri)===null||Me===void 0?void 0:Me.parent;return _e?_e.toString()===((Be=Q.workspace)===null||Be===void 0?void 0:Be.uri)?[]:[{id:_e.codeUri.fsPath,type:D.MentionType.FOLDER,text:_e.displayName,value:_e.codeUri.fsPath,description:`(${(0,v.localize)("aiNative.chat.defaultContextFolder")})`,contextId:_e.codeUri.fsPath,icon:(0,_.getIcon)("folder")}]:[]},getItems:async Me=>{var Be,De;let _e=[];if(Me){const ke=(await Q.roots).map(pe=>new v.URI(pe.uri).codeUri.fsPath.toString()),Te=await W.find(Me,{rootUris:ke,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,excludePatterns:Object.keys(p.defaultFilesWatcherExcludes),limit:10}),We=Array.from(new Set(Te.map(pe=>new v.URI(pe).parent.toString()).filter(pe=>{var ie;return pe!==((ie=Q.workspace)===null||ie===void 0?void 0:ie.uri.toString())})));return await q(We,((De=Q.workspace)===null||De===void 0?void 0:De.uri.toString())||"")}else{const ke=await j.getMostRecentlyOpenedFiles(),Te=Array.from(new Set(ke.map(We=>new v.URI(We).parent.codeUri.fsPath).filter(We=>{var pe;return We!==((pe=Q.workspace)===null||pe===void 0?void 0:pe.uri.toString())&&We!=="/"})));_e=await q(Te,((Be=Q.workspace)===null||Be===void 0?void 0:Be.uri.toString())||"")}return _e.filter(Boolean).filter(ke=>{var Te;return ke.id!==new v.URI((Te=Q.workspace)===null||Te===void 0?void 0:Te.uri).codeUri.fsPath})}},{id:"code",type:"code",text:"Code",icon:(0,_.getIcon)("codebraces"),getHighestLevelItems:()=>[],getItems:async Me=>{if(!Me||Y.current.length===0){const Be=K.currentUri;if(!Be)return[];const De=await me();return Y.current=await Promise.all(De.map(async _e=>{var ke;const Te=await Q.asRelativePath(Be);return{id:_e.raw.id,type:D.MentionType.CODE,text:_e.raw.name,symbol:_e.raw,value:_e.raw.id,description:`${Te?.root?Te.path:""}:L${_e.raw.range.startLineNumber}-${_e.raw.range.endLineNumber}`,kind:_e.raw.kind,contextId:`${(ke=K.currentUri)===null||ke===void 0?void 0:ke.codeUri.fsPath}:L${_e.raw.range.startLineNumber}-${_e.raw.range.endLineNumber}`,icon:(0,l.getSymbolIcon)(_e.raw.kind)+" outline-icon"}})),Y.current}else return Me=Me.toLocaleLowerCase(),Y.current.sort((Be,De)=>Be.text.toLocaleLowerCase().includes(Me)&&De.text.toLocaleLowerCase().includes(Me)?0:Be.text.toLocaleLowerCase().includes(Me)?-1:De.text.toLocaleLowerCase().includes(Me)?1:0)}},{id:D.MentionType.RULE,type:D.MentionType.RULE,text:"Rule",icon:(0,_.getIcon)("rules"),getHighestLevelItems:()=>[],getItems:async Me=>{const De=(await re.projectRules).map(ke=>{const Te=new v.URI(ke.path);return{id:Te.codeUri.fsPath,type:D.MentionType.RULE,text:Te.displayName,value:Te.codeUri.fsPath,contextId:Te.codeUri.fsPath,description:ke.description,icon:(0,_.getIcon)("rules")}});if(!Me)return De.slice(0,10);const _e=Me.toLocaleLowerCase();return De.filter(ke=>ke.text.toLocaleLowerCase().includes(_e)).sort((ke,Te)=>{var We,pe;const ie=ke.text.toLocaleLowerCase(),le=Te.text.toLocaleLowerCase(),Se=((We=ke.description)===null||We===void 0?void 0:We.toLocaleLowerCase())||"",ye=((pe=Te.description)===null||pe===void 0?void 0:pe.toLocaleLowerCase())||"",Ue=ie.includes(_e),Ye=le.includes(_e),Ve=Se.includes(_e),pt=ye.includes(_e);return Ue&&Ye?ie.localeCompare(le):Ue&&!Ye?-1:!Ue&&Ye?1:Ve&&pt?ie.localeCompare(le):Ve&&!pt?-1:!Ve&&pt?1:ie.localeCompare(le)}).slice(0,10)}}],ge=(0,r.useMemo)(()=>({modelOptions:[{value:"qwen-plus-latest",label:"Qwen 3",iconClass:$.fromIcon("","https://img.alicdn.com/imgextra/i3/O1CN01LFMrZj28YrnrzeebY_!!6000000007945-55-tps-16-16.svg",c.IconType.Background),tags:["\u601D\u8003\u94FE","\u64C5\u957F\u4EE3\u7801"],description:"\u9AD8\u6027\u80FD\u4EE3\u7801\u6A21\u578B\uFF0C\u652F\u6301\u601D\u8003\u94FE"},{label:"Claude 4 Sonnet",value:"claude_sonnet4",iconClass:$.fromIcon("","https://img.alicdn.com/imgextra/i3/O1CN01p0mziz1Nsl40lp1HO_!!6000000001626-55-tps-92-65.svg",c.IconType.Background),tags:["\u591A\u6A21\u6001","\u957F\u4E0A\u4E0B\u6587\u7406\u89E3","\u601D\u8003\u6A21\u5F0F"],description:"\u9AD8\u6027\u80FD\u6A21\u578B\uFF0C\u652F\u6301\u591A\u6A21\u6001\u8F93\u5165"},{label:"DeepSeek R1",value:"DeepSeek-R1-0528",iconClass:$.fromIcon("","https://img.alicdn.com/imgextra/i3/O1CN01ClcK2w1JwdxcbAB3a_!!6000000001093-55-tps-30-30.svg",c.IconType.Background),tags:["\u601D\u8003\u6A21\u5F0F","\u957F\u4E0A\u4E0B\u6587\u7406\u89E3"],description:"\u4E13\u4E1A\u521B\u4F5C\uFF0C\u652F\u6301\u591A\u6A21\u6001\u8F93\u5165"}],defaultModel:T.sessionModelId||X.get(v.AINativeSettingSectionsId.ModelID)||"deepseek-r1",buttons:[{id:"mcp-server",icon:"mcp",title:"MCP Server",onClick:oe,position:D.FooterButtonPosition.LEFT},{id:"rules",icon:"rules",title:"Rules",onClick:he,position:D.FooterButtonPosition.LEFT},{id:"upload-image",icon:"image",title:(0,v.localize)("aiNative.chat.imageUpload"),onClick:()=>{const Me=document.createElement("input");Me.type="file",Me.accept="image/*",Me.onchange=Be=>{const De=Be.target.files;De?.length&&Oe(Array.from(De))},Me.click()},position:D.FooterButtonPosition.LEFT}],showModelSelector:!0,disableModelSelector:T.disableModelSelector}),[$,oe,he,T.disableModelSelector,T.sessionModelId]),te=(0,r.useCallback)(()=>{N.cancelRequest()},[]),fe=(0,r.useCallback)(async(Me,Be)=>{M||(R(Me,F.map(De=>De.toString()),void 0,void 0,Be),L(T.images||[]))},[R,F,M]),Oe=(0,r.useCallback)(async Me=>{const Be=["image/jpeg","image/jpg","image/png","image/webp","image/gif"];if(Me.filter(We=>!Be.includes(We.type)).length>0){V.error("Only JPG, PNG, WebP and GIF images are supported");return}const _e=H.getImageUploadProvider();if(!_e){V.error("No image upload provider found");return}const ke=await Promise.all(Me.map(We=>_e.imageUpload(We))),Te=[...F,...ke];L(Te)},[F]),Pe=(0,r.useCallback)(Me=>{L(F.filter((Be,De)=>De!==Me))},[F]);return r.default.createElement("div",{className:A.default.chat_input_container},F.length>0&&r.default.createElement(w,{images:F,onDelete:Pe}),r.default.createElement(S.MentionInput,{mentionItems:be,onSend:fe,onStop:te,loading:M,labelService:Z,workspaceService:Q,placeholder:(0,v.localize)("aiNative.chat.input.placeholder.default"),footerConfig:ge,onImageUpload:Oe,contextService:O}))};t.ChatMentionInput=I;const w=({images:T,onDelete:R})=>r.default.createElement("div",null,r.default.createElement("div",{className:A.default.thumbnail_container},T.map((M,O)=>r.default.createElement("div",{key:O,className:A.default.thumbnail},r.default.createElement(o.Image,{src:M.toString()}),r.default.createElement("button",{onClick:()=>R(O),className:A.default.delete_button},r.default.createElement(_.Icon,{iconClass:"codicon codicon-close"}))))))},15016:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(48412),_=e(91416),v=e(78569),m=e(72871),p=e(41869),s=e(81878),g=e(89195),a=e(43718),h=e(52416),u=e(90684),c=e(19413),E=e(56474),f=e(17319),d=n.__importDefault(e(6960)),y=I=>{const w=(0,p.useInjectable)(p.LabelService),T=(0,p.useInjectable)(p.CommandService),R=(L,N,U)=>{let W=w.getIcon(L,{isDirectory:N});return N&&U&&(W+=" expanded"),W},M=(0,o.useMemo)(()=>{const L=N=>{const U=typeof N.type=="number"?N.type===a.FileType.Directory:!!N.children,W=new a.URI(N.uri);return{label:N.label,iconClassName:R(W,U,U),expandable:!0,expanded:!0,children:U?(N.children||[]).map(L):null,uri:W}};return(I.treeData.children||[]).map(L)},[I.treeData]),[O,x]=(0,o.useState)(22),k=(0,o.useRef)(null),F=L=>{k.current=L;const N=()=>{let U=L.getModel().root.branchSize;U<1?U=1:U>20&&(U=20),x(U*22)};N(),L.onDidUpdate(N)};return M.length?o.default.createElement("div",{className:d.default.tree_container},o.default.createElement(_.BasicRecycleTree,{height:O,treeData:M,onContextMenu:L=>L.preventDefault(),onClick:(L,N)=>{!k.current||!N||(v.BasicCompositeTreeNode.is(N)?N.raw.iconClassName=R(N.raw.uri,!0,N.expanded):T.executeCommand(p.EDITOR_COMMANDS.OPEN_RESOURCE.id,N.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:F,treeName:I.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},b=I=>{const{toolCall:w,messageId:T}=I,R=(0,p.useInjectable)(a.ChatAgentViewServiceToken),[M,O]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const x=R.getChatComponent("toolCall");if(x){const{component:F,initialProps:L}=x;O(o.default.createElement(F,{...L,value:w,messageId:T}));return}O(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),R.getChatComponentDeferred("toolCall").promise.then(({component:F,initialProps:L})=>{O(o.default.createElement(F,{...L,value:w,messageId:T}))})},[w]),M},A=I=>{const w=(0,p.useInjectable)(a.ChatAgentViewServiceToken),[T,R]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const M=w.getChatComponent(I.component);if(M){const{component:x,initialProps:k}=M;R(o.default.createElement(x,{...k,value:I.value,messageId:I.messageId}));return}R(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),w.getChatComponentDeferred(I.component).promise.then(({component:x,initialProps:k})=>{R(o.default.createElement(x,{...k,value:I.value}))})},[I.component,I.value]),T},S=I=>{var w,T;const{relationId:R,request:M,startTime:O=0,onRegenerate:x,onDidChange:k,onDone:F,agentId:L,command:N,history:U,msgId:W}=I,[,j]=(0,o.useReducer)(ge=>(ge+1)%1e6,0),Q=(0,p.useInjectable)(a.IAIReporter),G=(0,p.useInjectable)(h.IIconService),Z=(0,p.useInjectable)(p.IContextKeyService),$=(0,p.useInjectable)(c.IChatInternalService),V=(0,p.useInjectable)(a.ChatServiceToken),H=(0,p.useInjectable)(c.IChatAgentService),K=(0,p.useInjectable)(a.ChatRenderRegistryToken),[Y,X]=(0,o.useState)(M.response.isComplete?new Set(M.response.responseContents.map((ge,te)=>ge.kind==="reasoning"?te:-1).filter(ge=>ge!==-1)):new Set);(0,o.useEffect)(()=>{M.response.isComplete&&X(new Set(M.response.responseContents.map((ge,te)=>ge.kind==="reasoning"?te:-1).filter(ge=>ge!==-1)))},[M.response.isComplete]),(0,o.useEffect)(()=>{const ge=new p.DisposableCollection;return ge.push(M.response.onDidChange(()=>{U.updateAssistantMessage(W,{content:M.response.responseText}),M.response.isComplete&&(F&&F(),Q.end(R,{assistantMessage:M.response.responseText,replytime:Date.now()-O,success:!0,isStop:!1,command:N,agentId:L,messageId:W,sessionId:$.sessionModel.sessionId})),(0,o.startTransition)(()=>{k?.(),j()})})),()=>ge.dispose()},[R,k,F]);const re=(0,o.useCallback)(()=>{M.response.reset(),x?.()},[x]),oe=(0,o.useCallback)(ge=>{if(K.chatAIRoleRender){const te=K.chatAIRoleRender;return o.default.createElement(te,{content:ge.value})}return o.default.createElement(E.ChatMarkdown,{markdown:ge,fillInIncompleteTokens:!0})},[K,K.chatAIRoleRender]),he=ge=>o.default.createElement(y,{treeData:ge}),me=ge=>o.default.createElement("div",{className:d.default.placeholder},o.default.createElement(s.Icon,{iconClass:G.fromString("$(codicon/sync~spin)")}),o.default.createElement("div",{className:d.default.placeholder_content},oe(ge))),q=o.default.useMemo(()=>M.response.responseContents.map((ge,te)=>{let fe;if(ge.kind==="asyncContent")fe=me(new u.MarkdownString(ge.content));else if(ge.kind==="treeData")fe=he(ge.treeData);else if(ge.kind==="component")fe=o.default.createElement(A,{component:ge.component,value:ge.value,messageId:W});else if(ge.kind==="toolCall")fe=o.default.createElement(b,{toolCall:ge.content,messageId:W});else if(ge.kind==="reasoning"){const Oe=te===M.response.responseContents.length-1&&!M.response.isComplete;fe=o.default.createElement("div",{className:(0,r.default)(d.default.reasoning,{[d.default.thinking]:Oe})},o.default.createElement(l.Button,{size:"small",type:"secondary",className:d.default.thinking,onClick:()=>{Oe||(Y.has(te)?Y.delete(te):Y.add(te),X(new Set(Y)))}},o.default.createElement(s.Icon,{iconClass:"codicon codicon-sparkle"}),o.default.createElement("span",{style:{marginLeft:4},className:Oe?d.default.shiny_text:""},(0,a.localize)("aiNative.chat.thinking")),Oe?null:Y.has(te)?o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-right"}):o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-down"})),Y.has(te)?null:o.default.createElement("div",{className:d.default.reasoning_content},oe(new u.MarkdownString(ge.content))))}else fe=oe(ge.content);return o.default.createElement(o.Fragment,{key:`${ge.kind}-${te}`},fe)}),[M.response.responseContents,Y]),be=o.default.useMemo(()=>M.response.followups?M.response.followups.map((ge,te)=>{let fe=null;if(ge.kind==="reply"){const Oe=o.default.createElement("a",{onClick:()=>{V.sendMessage({...H.parseMessage(ge.message),reportExtra:{actionSource:a.ActionSourceEnum.Chat,actionType:a.ActionTypeEnum.Followup}})}},ge.title||ge.message);fe=ge.tooltip?o.default.createElement(m.Tooltip,{title:ge.tooltip},Oe):Oe}else ge.when&&!Z.match(ge.when)&&(fe=null),fe=o.default.createElement(l.Button,{type:"default"},ge.title);return fe&&o.default.createElement(o.Fragment,{key:te},fe)}):null,[M.response.followups]);return M.response.isComplete?o.default.createElement(f.ChatThinkingResult,{hasMessage:M.response.responseParts.length>0||M.response.responseContents.length>0||!!(!((w=M.response.errorDetails)===null||w===void 0)&&w.message),onRegenerate:re,requestId:M.requestId},o.default.createElement("div",{className:d.default.ai_chat_response_container},!((T=M.response.errorDetails)===null||T===void 0)&&T.message?o.default.createElement("div",{className:d.default.error},o.default.createElement(s.Icon,{className:(0,s.getIcon)("close-circle")}),o.default.createElement("span",null,M.response.errorDetails.message)):o.default.createElement(o.default.Fragment,null,q,be?.length!==0&&o.default.createElement("div",{className:d.default.followups},be)))):o.default.createElement(f.ChatThinking,{message:M.response.responseText},q)};t.ChatReply=S;const D=I=>{const{chunk:w}=I,T=(0,p.useInjectable)(a.ChatRenderRegistryToken),R=o.default.useMemo(()=>{let M;if(w.kind==="component")M=o.default.createElement(A,{component:w.component,value:w.value});else{let O=o.default.createElement(E.ChatMarkdown,{markdown:w.content,fillInIncompleteTokens:!0});if(T.chatAIRoleRender){const x=T.chatAIRoleRender;O=o.default.createElement(x,{content:w.content})}M=O}return M},[w]);return o.default.createElement(f.ChatThinkingResult,{hasMessage:!0,requestId:I.requestId,showRegenerate:!1},o.default.createElement("div",{className:d.default.ai_chat_response_container},R))};t.ChatNotify=D},17319:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),l=e(89195),_=e(68974),v=e(43718),m=e(19413),p=n.__importDefault(e(6960)),s=a=>{const{children:h,message:u,thinkingText:c}=a,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),f=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),d=(0,r.useMemo)(()=>Array.isArray(h)?h.length===0:!h,[h]),y=(0,r.useCallback)(()=>d?f?r.default.createElement(f,{thinkingText:c}):r.default.createElement("span",{className:p.default.thinking_text},c||"Thinking..."):h,[u,h,c,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:p.default.content},y()),r.default.createElement("div",{className:p.default.thinking_container},r.default.createElement("div",{className:p.default.stop},!f&&r.default.createElement("span",{className:p.default.progress_bar},d&&r.default.createElement(_.Progress,{loading:!0,wrapperClassName:p.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const g=({children:a,message:h,onRegenerate:u,requestId:c,hasMessage:E=!0,showRegenerate:f})=>{const d=(0,o.useInjectable)(m.IChatInternalService),[y,b]=(0,r.useState)(d.latestRequestId),A=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const T=d.onChangeRequestId(R=>{b(R)});return()=>T.dispose()},[d]);const S=(0,r.useMemo)(()=>A.chatThinkingResultRender,[A,A.chatThinkingResultRender]),D=(0,r.useCallback)(()=>{u&&u()},[u]),I=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const T=(0,v.localize)("aiNative.chat.stop.immediately");return S?r.default.createElement(S,{thinkingResult:T}):r.default.createElement("span",null,T)}return a},[h,E,a]),w=(0,r.useMemo)(()=>(0,v.isUndefined)(f)?y===c&&!!c:!!f,[y,c,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:p.default.content},I()),r.default.createElement("div",{className:p.default.thinking_container},r.default.createElement("div",{className:p.default.bottom_container},r.default.createElement("div",{className:p.default.reset},w?r.default.createElement(l.EnhanceIcon,{icon:"refresh",wrapperClassName:p.default.text_btn,className:p.default.transform,onClick:D,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:p.default.thumbs},r.default.createElement(l.Thumbs,{relationId:c,wrapperClassName:p.default.icon_btn})))))};t.ChatThinkingResult=g},34817:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),_=e(81878),v=e(89195),m=e(43718),p=e(33783),s=e(98864),g=e(77633),a=e(25834),h=n.__importDefault(e(16796)),u=e(78112),c=E=>{var f,d;const{value:y,messageId:b}=E,[A,S]=(0,o.useState)(!1),D=(0,l.useInjectable)(g.TokenMCPServerRegistry);if(!y||!y.function||!y.id)return null;const I=((f=D.getMCPTool(y.function.name))===null||f===void 0?void 0:f.label)||y.function.name,w=I.split(s.TOOL_NAME_SEPARATOR),T=w.length>=3?w[2]:I,R=D.getToolComponent(y.function.name),M=N=>{switch(N){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:N||"Unknown",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-question"})}}},O=()=>{var N,U;try{const W=((N=y.function)===null||N===void 0?void 0:N.arguments)||"{}";return(y.state==="streaming-start"||y.state==="streaming")&&!W.endsWith("}")?W:JSON.parse(W)}catch{return((U=y.function)===null||U===void 0?void 0:U.arguments)||"{}"}},x=()=>{var N,U;try{const W=((N=y.function)===null||N===void 0?void 0:N.arguments)||"{}";if((y.state==="streaming-start"||y.state==="streaming")&&!W.endsWith("}"))return k(W);const j=JSON.parse(W);return JSON.stringify(j,null,2)}catch{const j=((U=y.function)===null||U===void 0?void 0:U.arguments)||"{}";return k(j)}},k=N=>N.replace(/\\n/g,`
|
|
32965
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\\\/g,"\\").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\f/g,"\f").replace(/\\b/g,"\b").replace(/\\v/g,"\v").replace(/\\0/g,"\0"),F=()=>{S(!A)},L=M(y.state);return R&&(y.state==="complete"||y.state==="result")?o.default.createElement(R,{state:y.state,args:O(),result:y.result,index:y.index,messageId:b,toolCallId:y.id}):o.default.createElement("div",{className:h.default.chat_tool_render},o.default.createElement("div",{className:h.default.tool_header,onClick:F},o.default.createElement("div",{className:h.default.tool_name},o.default.createElement(_.Icon,{iconClass:`codicon codicon-chevron-${A?"down":"right"}`}),o.default.createElement(_.Icon,{size:"small",iconClass:(0,r.default)("codicon codicon-tools",h.default.tool_icon)}),o.default.createElement("span",{className:h.default.tool_label},o.default.createElement("span",{className:h.default.tool_prefix},"Called MCP Tool"),o.default.createElement("span",{className:h.default.tool_name,title:T},T))),y.state&&o.default.createElement("div",{className:h.default.tool_state},o.default.createElement("span",{className:h.default.state_icon},L.icon))),o.default.createElement("div",{className:(0,r.default)(h.default.tool_content,{[h.default.expanded]:A})},((d=y?.function)===null||d===void 0?void 0:d.arguments)&&o.default.createElement("div",{className:h.default.tool_arguments},o.default.createElement("div",{className:h.default.section_label},(0,p.localize)("ai.native.mcp.tool.arguments"),":"),o.default.createElement(a.CodeEditorWithHighlight,{input:x(),language:"json",relationId:(0,m.uuid)(4)})),y?.result&&o.default.createElement("div",{className:h.default.tool_result},o.default.createElement("div",{className:h.default.section_label},(0,p.localize)("ai.native.mcp.tool.results"),":"),o.default.createElement(u.ChatToolResult,{result:y.result,relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=c},78112:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolResult=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(33783),l=e(25834),_=n.__importDefault(e(48091)),v=({result:m,relationId:p})=>{const s=r.default.useCallback(h=>{try{return JSON.parse(h).content||[]}catch{return[{type:"text",text:h}]}},[]),g=r.default.useCallback((h,u)=>{switch(h.type){case"text":return h.text?r.default.createElement("div",{key:`text-${u}`,className:_.default.text_content},r.default.createElement(l.CodeEditorWithHighlight,{input:h.text,language:"text",relationId:p||""})):null;case"image":return h.data?r.default.createElement("div",{key:`image-${u}`,className:_.default.image_content},r.default.createElement("img",{src:`data:${h.mimeType||"image/png"};base64,${h.data}`,alt:(0,o.localize)("aiNative.chat.result.image")})):null;default:return null}},[p]),a=r.default.useMemo(()=>s(m),[m,s]);return a.length?r.default.createElement("div",{className:_.default.result_container},a.map((h,u)=>g(h,u))):null};t.ChatToolResult=v},29039:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),l=e(43718),_=e(19413),v=m=>{const{userMessage:p,relationId:s,requestId:g,renderContent:a,startTime:h,agentId:u,command:c}=m,E=(0,o.useInjectable)(_.IChatInternalService),f=(0,o.useInjectable)(l.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(g),f.end(s,{message:p,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:c})},[a,g,s]),r.createElement("div",null,a({userMessage:p}))};t.SlashCustomRender=v},86556:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),l=e(81878),_=e(4246),v=e(43718),m=e(90684);e(41937);const p=e(19413),s=e(56474),g=e(17319),a=e(78048),h=n.__importDefault(e(6960)),u=()=>{var c,E;const f=(0,o.useInjectable)(v.ChatServiceToken),d=(0,o.useInjectable)(p.IChatAgentService),y=(0,o.useInjectable)(v.ChatFeatureRegistryToken),b=(0,o.useInjectable)(v.ChatRenderRegistryToken),[A,S]=r.useState([]);(0,o.useUpdateOnEvent)(y.onDidWelcomeMessageChange);const D=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return[];const{sampleQuestions:R=[]}=y.chatWelcomeMessageModel;return R.map(a.extractIcon)},[(c=y.chatWelcomeMessageModel)===null||c===void 0?void 0:c.sampleQuestions]),I=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return"";const{content:R}=y.chatWelcomeMessageModel;return R},[(E=y.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const R=d.onDidChangeAgents(async()=>{const O=(await d.getAllSampleQuestions()).map(a.extractIcon);S(O)});return()=>R.dispose()},[]),!I)return r.createElement(g.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const w=r.useMemo(()=>D.concat(A),[D,A]);return r.useMemo(()=>{if(b.chatWelcomeRender){const R=b.chatWelcomeRender;return r.createElement(R,{message:I,sampleQuestions:w})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(I)?r.createElement(s.ChatMarkdown,{key:"welcome",markdown:I}):I),r.createElement("div",{className:h.default.chat_container_content},w.map((R,M)=>{const O=r.createElement("a",{className:h.default.link_item,onClick:(0,_.withPrevented)(()=>{f.sendMessage({...d.parseMessage(R.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},R.icon?r.createElement(l.Icon,{className:R.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,R.title));return R.tooltip?r.createElement(l.Tooltip,{title:R.tooltip,key:M},O):r.createElement(r.Fragment,{key:M},O)})))},[b.chatWelcomeRender,I,w])};t.WelcomeMessage=u},83933:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},96086:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionInput=t.WHITE_SPACE_TEXT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(41869),_=e(81878),v=e(89195),m=e(70392),p=n.__importDefault(e(97599)),s=e(80732),g=e(37412),a=e(44692);t.WHITE_SPACE_TEXT=" ";const h=({mentionItems:u=[],onSend:c,onStop:E,loading:f=!1,mentionKeyword:d=a.MENTION_KEYWORD,onSelectionChange:y,onImageUpload:b,labelService:A,workspaceService:S,placeholder:D="Ask anything, @ to mention",footerConfig:I={buttons:[],showModelSelector:!1},contextService:w})=>{const T=o.useRef(null),[R,M]=o.useState({active:!1,startPos:null,filter:"",position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),[O,x]=o.useState(I.defaultModel||""),[k,F]=o.useState({}),[L,N]=o.useState([]),[U,W]=o.useState(-1),[j,Q]=o.useState(""),[G,Z]=o.useState(!1),[$,V]=o.useState({files:[],folders:[],rules:[]}),H=o.useRef([]),K=()=>R.level===0?u:R.parentType?R.loading?k[R.parentType]||[]:k[R.parentType]||[]:[],X=((ie,le)=>{const[Se,ye]=o.useState(ie);return o.useEffect(()=>{const Ue=setTimeout(()=>{ye(ie)},le);return()=>{clearTimeout(Ue)}},[ie,le]),Se})(R.secondLevelFilter,300);o.useEffect(()=>{x(I.defaultModel||"")},[I.defaultModel]),o.useEffect(()=>{if(R.level===1&&R.parentType&&X!==void 0){const ie=u.find(Se=>Se.id===R.parentType);if(!ie)return;M(Se=>({...Se,loading:!0})),(async()=>{try{const Se=[];if(ie.getHighestLevelItems){const ye=ie.getHighestLevelItems();for(const Ue of ye)Se.some(Ye=>Ye.id===Ue.id)||Se.push(Ue);F(Ue=>({...Ue,[R.parentType]:ye}))}if(ie.getItems)try{const ye=await ie.getItems(X),Ue=[...Se];for(const Ye of ye)Ue.some(Ve=>Ve.id===Ye.id)||Ue.push(Ye);F(Ye=>({...Ye,[R.parentType]:Ue}))}catch{M(Ue=>({...Ue,loading:!1}))}M(ye=>({...ye,loading:!1}))}catch{M(ye=>({...ye,loading:!1}))}})()}},[X,R.level,R.parentType]),o.useEffect(()=>{const ie=w?.onDidContextFilesChangeEvent(({attached:le,attachedFolders:Se,attachedRules:ye})=>{V({files:le,folders:Se,rules:ye})});return()=>{ie?.dispose()}},[]);const re=ie=>{const le=window.getSelection();if(!le||!le.rangeCount)return 0;const Se=le.getRangeAt(0),ye=Se.cloneRange();return ye.selectNodeContents(ie),ye.setEnd(Se.endContainer,Se.endOffset),ye.toString().length},oe=()=>{if(G&&(Z(!1),W(-1)),T.current){const ye=Array.from(T.current.querySelectorAll(`.${p.default.mention_tag}`)).map(Ye=>({id:Ye.getAttribute("data-id")||"",type:Ye.getAttribute("data-type")||"",contextId:Ye.getAttribute("data-context-id")||""}));H.current.filter(Ye=>!ye.some(Ve=>Ve.id===Ye.id&&Ve.type===Ye.type&&Ve.contextId===Ye.contextId)).forEach(Ye=>{if(Ye.contextId){const Ve=new m.URI(Ye.contextId);Ye.type===a.MentionType.FILE?Te(a.MentionType.FILE,Ve):Ye.type===a.MentionType.FOLDER?Te(a.MentionType.FOLDER,Ve):Ye.type===a.MentionType.RULE&&Te(a.MentionType.RULE,Ve)}}),H.current=ye}const ie=window.getSelection();if(!ie||!ie.rangeCount||!T.current)return;const le=T.current.textContent||"",Se=re(T.current);if(le[Se-1]===d&&!R.active&&!R.inlineSearchActive&&M({active:!0,startPos:Se,filter:d,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),R.active&&R.level===0&&R.startPos!==null)if(Se<R.startPos)M(ye=>({...ye,active:!1}));else{const ye=le.substring(R.startPos-1,Se);M(Ue=>({...Ue,filter:ye,activeIndex:0}))}if(R.inlineSearchActive&&R.inlineSearchStartPos!==null&&R.parentType){const ye=u.find(Ve=>Ve.id===R.parentType);if(!ye)return;const Ue=`@${ye.type}:`,Ye=R.inlineSearchStartPos-Ue.length;if(Ye>=0&&Se>Ye+Ue.length){const Ve=le.substring(Ye+Ue.length,Se);Ve!==R.secondLevelFilter&&M(pt=>({...pt,secondLevelFilter:Ve,active:!0,activeIndex:0}))}else Se<=Ye&&M(Ve=>({...Ve,inlineSearchActive:!1,active:!1}))}if(T.current&&(T.current.scrollHeight>=120?T.current.style.overflowY="auto":T.current.style.overflowY="hidden"),T.current){const ye=T.current.innerHTML;(ye===""||ye==="<br>"||ye==="<br/>")&&(T.current.innerHTML="")}},he=ie=>{if(ie.key==="Escape"&&(R.active||R.inlineSearchActive)){R.level>0?M(Se=>({...Se,level:0,activeIndex:0,secondLevelFilter:"",inlineSearchActive:!1})):M(Se=>({...Se,active:!1,inlineSearchActive:!1})),ie.preventDefault();return}if((ie.key==="Backspace"||ie.key==="Delete")&&T.current&&(!T.current.textContent||T.current.textContent.trim()==="")&&w?.cleanFileContext(),ie.key===a.MENTION_KEYWORD&&!R.active&&!R.inlineSearchActive&&T.current){const Se=re(T.current);M({active:!0,startPos:Se+1,filter:d,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1})}if((ie.key==="ArrowUp"||ie.key==="ArrowDown")&&!ie.shiftKey&&!ie.ctrlKey&&!ie.metaKey&&!ie.altKey){if(!R.active&&!R.inlineSearchActive&&T.current&&L.length>0){const Se=T.current.innerHTML;if(!Se||Se==="<br>"||G&&U>=0&&L[L.length-1-U]===Se){ie.preventDefault(),G||(Q(Se),Z(!0));let Ue=U;ie.key==="ArrowUp"?Ue=Math.min(L.length-1,U+1):Ue=Math.max(-1,U-1),W(Ue),Ue===-1?T.current.innerHTML=j:T.current.innerHTML=L[L.length-1-Ue];const Ye=document.createRange();Ye.selectNodeContents(T.current),Ye.collapse(!1);const Ve=window.getSelection();Ve&&(Ve.removeAllRanges(),Ve.addRange(Ye));return}}}else G&&ie.key!=="ArrowUp"&&ie.key!=="ArrowDown"&&(Z(!1),W(-1));if(ie.key==="Enter"){if(ie.nativeEvent.isComposing)return;if(!ie.shiftKey&&(ie.preventDefault(),!R.active)){fe();return}}if(!R.active)return;let le=K();if(R.level===0&&R.filter&&R.filter.length>1){const Se=R.filter.substring(1).toLowerCase();le=le.filter(ye=>ye.text.toLowerCase().includes(Se))}le.length!==0&&(ie.key==="ArrowDown"?(M(Se=>({...Se,activeIndex:(Se.activeIndex+1)%le.length})),ie.preventDefault()):ie.key==="ArrowUp"?(M(Se=>({...Se,activeIndex:(Se.activeIndex-1+le.length)%le.length})),ie.preventDefault()):(ie.key==="Enter"||ie.key==="Tab")&&le.length>0&&(ge(le[R.activeIndex]),ie.preventDefault()))},me=()=>{},q=async ie=>{const le=ie.clipboardData.items,Se=[];for(let lt=0;lt<le.length;lt++)if(le[lt].kind===a.MentionType.FILE&&le[lt].type.startsWith("image/")){const wt=le[lt].getAsFile();wt&&Se.push(wt)}if(ie.preventDefault(),Se.length>0&&b){await b(Se);return}const Ue=ie.clipboardData.getData("text/plain").replace(/\t/g," ").replace(/\n\s*\n/g,`
|
|
32959
32966
|
|
|
32960
32967
|
`).replace(/[ \t]+$/gm,""),Ye=window.getSelection();if(!Ye||!Ye.rangeCount)return;const Ve=Ye.getRangeAt(0);Ve.deleteContents();const pt=Ue.split(`
|
|
32961
32968
|
`),vt=document.createDocumentFragment();pt.forEach((lt,wt)=>{const at=lt.replace(/^[ ]+/g,st=>{const At=document.createElement("span");return At.innerHTML="\xA0".repeat(st.length),At.innerHTML}),tt=document.createElement("span");for(tt.innerHTML=at;tt.firstChild;)vt.appendChild(tt.firstChild);wt<pt.length-1&&vt.appendChild(document.createElement("br"))});const xt=vt.lastChild;if(Ve.insertNode(vt),xt&&xt.parentNode){const lt=document.createRange();lt.setStartAfter(xt),Ye.removeAllRanges(),Ye.addRange(lt)}oe()};o.useEffect(()=>{if(T.current){D&&!T.current.textContent&&T.current.setAttribute("data-placeholder",D);const ie=Array.from(T.current.querySelectorAll(`.${p.default.mention_tag}`)).map(le=>({id:le.getAttribute("data-id")||"",type:le.getAttribute("data-type")||"",contextId:le.getAttribute("data-context-id")||""}));H.current=ie}},[D]);const be=ie=>{var le;R.active&&!(!((le=document.querySelector(`.${p.default.mention_panel}`))===null||le===void 0)&&le.contains(ie.target))&&M(Se=>({...Se,active:!1,inlineSearchActive:!1}))};o.useEffect(()=>(document.addEventListener("click",be,!0),()=>{document.removeEventListener("click",be,!0)}),[R.active]);const ge=(ie,le=!1)=>{var Se;if(!T.current)return;if(ie.getItems){const tt=window.getSelection();if(!tt||!tt.rangeCount)return;if(R.level===0&&R.startPos!==null){let st,At,Ut;const _n=document.createTreeWalker(T.current,NodeFilter.SHOW_TEXT);let Ln=0,ui;for(;ui=_n.nextNode();){const Rn=((Se=ui.textContent)===null||Se===void 0?void 0:Se.length)||0;if(R.startPos-1>=Ln&&R.startPos-1<Ln+Rn){st=ui,At=R.startPos-1-Ln;const ln=le?R.startPos+R.filter.length-1:re(T.current);Ut=Math.min(ln-Ln,Rn);break}Ln+=Rn}if(st){const Rn=document.createRange();Rn.setStart(st,At),Rn.setEnd(st,Ut),Rn.deleteContents();const ln=document.createTextNode(`${d}${ie.type}:`);Rn.insertNode(ln);const Un=document.createRange();Un.setStartAfter(ln),Un.setEndAfter(ln),tt.removeAllRanges(),tt.addRange(Un),M(rn=>({...rn,active:!0,level:1,parentType:ie.id,inlineSearchActive:!0,inlineSearchStartPos:re(T.current),secondLevelFilter:"",activeIndex:0})),T.current.focus();return}}return}const ye=window.getSelection();if(!ye||!ye.rangeCount)return;if(R.inlineSearchActive&&R.parentType&&R.inlineSearchStartPos!==null){const tt=u.find(Ut=>Ut.id===R.parentType);if(!tt)return;const st=`${d}${tt.type}:`,At=R.inlineSearchStartPos-st.length;if(At>=0){let ct=function($e){if($e.nodeType===3)rn.push({node:$e,start:ln,end:ln+$e.textContent.length}),ln+=$e.textContent.length;else if($e.nodeType===1){const Re=$e.childNodes||[];for(const Le of Array.from(Re))ct(Le)}};const Ut=document.createElement("span");if(Ut.className=p.default.mention_tag,Ut.dataset.id=ie.id,Ut.dataset.type=ie.type,Ut.dataset.contextId=ie.contextId||"",Ut.contentEditable="false",ie.type===a.MentionType.FILE||ie.type===a.MentionType.FOLDER){const $e=document.createElement("span");$e.className=(0,r.default)(p.default.mention_icon,ie.type===a.MentionType.FILE?A?.getIcon(new m.URI(ie.text)):(0,_.getIcon)("folder")),Ut.appendChild($e),ie.type===a.MentionType.FOLDER?w?.addFolderToContext(new m.URI(ie.contextId),!0):w?.addFileToContext(new m.URI(ie.contextId),void 0,!0)}else if(ie.type===a.MentionType.CODE){const $e=document.createElement("span");$e.className=(0,r.default)(p.default.mention_icon,ie.kind&&(0,l.getSymbolIcon)(ie.kind)+" outline-icon"),Ut.appendChild($e),ie.symbol&&w?.addFileToContext(new m.URI(ie.contextId),[ie.symbol.range.startLineNumber,ie.symbol.range.endLineNumber],!0)}else if(ie.type===a.MentionType.RULE){const $e=document.createElement("span");$e.className=(0,r.default)(p.default.mention_icon,(0,_.getIcon)("rules")),Ut.appendChild($e),w?.addRuleToContext(new m.URI(ie.contextId),!0)}const _n=S?.workspace;let Ln=ie.text;_n&&ie.contextId&&(Ln=ie.contextId.replace(new m.URI(_n.uri).codeUri.fsPath,"").slice(1));const ui=document.createTextNode(Ln);Ut.appendChild(ui);const Rn=document.createRange();let ln=0,Un=!1;const rn=[];ct(T.current);for(const $e of rn){if(At>=$e.start&&At<=$e.end){const Re=At-$e.start;Rn.setStart($e.node,Re),Un=!0}if(Un){const Re=le?At+st.length+R.secondLevelFilter.length:re(T.current);if(Re>=$e.start&&Re<=$e.end){const Le=Re-$e.start;Rn.setEnd($e.node,Le);break}}}if(Un){Rn.deleteContents(),Rn.insertNode(Ut);const $e=document.createRange();$e.setStartAfter(Ut),$e.setEndAfter(Ut),ye.removeAllRanges(),ye.addRange($e);const Re=document.createTextNode("\xA0");$e.insertNode(Re),$e.setStartAfter(Re),$e.setEndAfter(Re),ye.removeAllRanges(),ye.addRange($e)}M($e=>({...$e,active:!1,inlineSearchActive:!1})),T.current.focus();return}}const Ue=document.createElement("span");if(Ue.className=p.default.mention_tag,Ue.dataset.id=ie.id,Ue.dataset.type=ie.type,Ue.dataset.contextId=ie.contextId||"",Ue.contentEditable="false",ie.type===a.MentionType.FILE||ie.type==="folder"){const tt=document.createElement("span");tt.className=(0,r.default)(p.default.mention_icon,ie.type===a.MentionType.FILE?A?.getIcon(new m.URI(ie.text)):(0,_.getIcon)("folder")),Ue.appendChild(tt)}const Ye=S?.workspace;let Ve=ie.text;Ye&&ie.contextId&&(Ve=ie.contextId.replace(new m.URI(Ye.uri).codeUri.fsPath,"").slice(1));const pt=document.createTextNode(Ve);Ue.appendChild(pt);let vt=0,xt=!1;const lt=[];function wt(tt){if(tt.nodeType===3)lt.push({node:tt,start:vt,end:vt+tt.textContent.length}),vt+=tt.textContent.length;else if(tt.nodeType===1){const st=tt.childNodes;for(const At of Array.from(st))wt(At)}}wt(T.current);const at=document.createRange();if(R.startPos!==null)for(const tt of lt){if(R.startPos-1>=tt.start&&R.startPos-1<=tt.end){const st=R.startPos-1-tt.start;at.setStart(tt.node,st),xt=!0}if(xt){const st=le?R.startPos+R.filter.length-1:re(T.current);if(st>=tt.start&&st<=tt.end){const At=st-tt.start;at.setEnd(tt.node,At);break}}}if(xt){at.deleteContents(),at.insertNode(Ue);const tt=document.createRange();tt.setStartAfter(Ue),tt.setEndAfter(Ue),ye.removeAllRanges(),ye.addRange(tt);const st=document.createTextNode("\xA0");tt.insertNode(st),tt.setStartAfter(st),tt.setEndAfter(st),ye.removeAllRanges(),ye.addRange(tt)}M(tt=>({...tt,active:!1})),T.current.focus()},te=o.useCallback(ie=>{x(ie),y?.(ie)},[O,y]),fe=()=>{if(!T.current)return;const ie=T.current.innerHTML;if(!ie)return;const le=document.createElement("div");le.innerHTML=ie,le.querySelectorAll(`.${p.default.mention_tag}`).forEach(Ue=>{var Ye;const Ve=Ue.getAttribute("data-context-id");if(Ve){const pt=document.createTextNode(`{{${d}${Ue.getAttribute("data-type")}:${Ve}}}`);(Ye=Ue.parentNode)===null||Ye===void 0||Ye.replaceChild(pt,Ue)}});let ye=le.innerHTML;ye=ye.trim().replaceAll(t.WHITE_SPACE_TEXT," "),ie&&(N(Ue=>[...Ue,ie]),W(-1),Z(!1)),c&&c(ye,{model:O,...I}),T.current.innerHTML="",T.current&&(T.current.style.overflowY="hidden",T.current.style.height="auto")},Oe=o.useCallback(()=>{w?.cleanFileContext()},[w]),Pe=o.useCallback(()=>{if(!T.current)return;T.current.focus();const ie=window.getSelection();if(!ie)return;const le=document.createRange();if(!T.current.textContent||T.current.textContent.trim()==="")T.current.innerHTML="@",le.setStart(T.current.firstChild||T.current,1),le.setEnd(T.current.firstChild||T.current,1);else{const ye=document.createTextNode(" @");le.selectNodeContents(T.current),le.collapse(!1),le.insertNode(ye),le.setStartAfter(ye),le.setEndAfter(ye)}ie.removeAllRanges(),ie.addRange(le);const Se=re(T.current);M({active:!0,startPos:Se,filter:"@",position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1})},[]),Me=o.useCallback(()=>{E&&E()},[E]),Be=o.useCallback(ie=>(I.buttons||[]).filter(le=>le.position===ie).map(le=>o.createElement(_.Popover,{key:le.id,overlayClassName:p.default.popover_icon,id:`ai-chat-${le.id}`,position:_.PopoverPosition.top,title:le.title},o.createElement(v.EnhanceIcon,{className:(0,r.default)(le.icon?(0,_.getIcon)(le.icon):le.iconClass,p.default[`${le.id}_logo`]),tabIndex:0,role:"button",ariaLabel:le.title,onClick:le.onClick}))),[I.buttons]),De=o.useMemo(()=>$.files.length>0||$.folders.length>0||$.rules.length>0,[$]),_e=o.useCallback(ie=>I.disableModelSelector?o.createElement(_.Popover,{id:"ai-chat-model-selector",title:(0,l.localize)("aiNative.chat.modelSelector.disableTip"),position:_.PopoverPosition.top},ie):ie,[I.disableModelSelector]),ke=o.useMemo(()=>I.extendedModelOptions?I.extendedModelOptions.map(ie=>({...ie,selected:ie.value===O})):(I.modelOptions||[]).map(ie=>{const le={...ie};return le.selected=ie.value===O,le}),[I.modelOptions,I.extendedModelOptions,O]),Te=o.useCallback((ie,le)=>{ie===a.MentionType.FILE?w?.removeFileFromContext(le,!0):ie===a.MentionType.FOLDER?w?.removeFolderFromContext(le):ie===a.MentionType.RULE&&w?.removeRuleFromContext(le)},[w]),We=ie=>decodeURIComponent(ie.split("/").pop()||"Unknown Rule"),pe=o.useCallback(()=>o.createElement("div",{className:p.default.context_preview_container},o.createElement("span",{className:(0,r.default)(p.default.context_preview_title,De&&p.default.has_context),onClick:Pe},De?"":(0,l.localize)("aiNative.chat.context.title")),$.files.map((ie,le)=>o.createElement("div",{key:`file-${le}`,className:p.default.context_preview_item,"data-type":a.MentionType.FILE},o.createElement(_.Icon,{iconClass:(0,r.default)(A?.getIcon(ie.uri)||a.MentionType.FILE,p.default.context_preview_item_icon,p.default.icon)}),o.createElement(_.Icon,{iconClass:(0,r.default)(p.default.close_icon,(0,_.getIcon)("close")),onClick:()=>Te(a.MentionType.FILE,ie.uri)}),o.createElement("span",{className:p.default.context_preview_item_text},new m.URI(ie.uri.toString()).displayName))),$.folders.map((ie,le)=>o.createElement("div",{key:`folder-${le}`,className:p.default.context_preview_item,"data-type":"folder"},o.createElement(_.Icon,{iconClass:(0,r.default)((0,_.getIcon)("folder"),p.default.context_preview_item_icon,p.default.icon)}),o.createElement(_.Icon,{iconClass:(0,r.default)(p.default.close_icon,(0,_.getIcon)("close")),onClick:()=>Te(a.MentionType.FOLDER,ie.uri)}),o.createElement("span",{className:p.default.context_preview_item_text},new m.URI(ie.uri.toString()).displayName))),$.rules.map((ie,le)=>o.createElement("div",{key:`rule-${le}`,className:p.default.context_preview_item,"data-type":"rule"},o.createElement(_.Icon,{iconClass:(0,r.default)((0,_.getIcon)("rules"),p.default.context_preview_item_icon,p.default.icon)}),o.createElement(_.Icon,{iconClass:(0,r.default)(p.default.close_icon,(0,_.getIcon)("close")),onClick:()=>Te(a.MentionType.RULE,new m.URI(ie.path))}),o.createElement("span",{className:p.default.context_preview_item_text},We(ie.path).replace(".mdc",""))))),[Oe,De,$,A,w,Pe,Te]);return o.createElement("div",{className:p.default.input_container},pe(),R.active&&o.createElement("div",{className:p.default.mention_panel_container},o.createElement(s.MentionPanel,{items:K(),activeIndex:R.activeIndex,onSelectItem:ie=>ge(ie,!0),position:{top:0,left:0},filter:R.level===0?R.filter:R.secondLevelFilter,visible:!0,level:R.level,loading:R.loading})),o.createElement("div",{className:p.default.editor_area},o.createElement("div",{ref:T,className:p.default.editor,contentEditable:!0,onInput:oe,onKeyDown:he,onPaste:q,onCompositionEnd:me})),o.createElement("div",{className:p.default.footer},o.createElement("div",{className:p.default.left_control},I.showModelSelector&&_e(o.createElement(g.MentionSelect,{options:ke,value:O,onChange:te,className:p.default.model_selector,size:"small",disabled:I.disableModelSelector,showThinking:I.showThinking,thinkingEnabled:I.thinkingEnabled,onThinkingChange:I.onThinkingChange})),Be(a.FooterButtonPosition.LEFT)),o.createElement("div",{className:p.default.right_control},Be(a.FooterButtonPosition.RIGHT),o.createElement(_.Popover,{overlayClassName:p.default.popover_icon,id:"ai-chat-send",position:_.PopoverPosition.top,content:f?"Stop":"Send"},f?o.createElement(v.EnhanceIcon,{wrapperClassName:p.default.stop_logo,className:(0,r.default)((0,_.getIcon)("stop"),p.default.stop_logo_icon),tabIndex:0,role:"button",ariaLabel:"Stop",onClick:Me}):o.createElement(v.EnhanceIcon,{wrapperClassName:p.default.send_logo,className:(0,r.default)((0,_.getIcon)("send-outlined"),p.default.send_logo_icon),tabIndex:0,role:"button",onClick:fe,ariaLabel:"Send"})))))};t.MentionInput=h},40167:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(81878),_=n.__importDefault(e(97599)),v=({item:m,isActive:p,onClick:s})=>o.createElement("div",{className:`${_.default.mention_item} ${p?_.default.active:""}`,onClick:()=>s(m)},o.createElement("div",{className:_.default.mention_item_left},o.createElement(l.Icon,{className:(0,r.default)(_.default.mention_item_icon,m.icon)}),o.createElement("span",{className:_.default.mention_item_text},m.text),o.createElement("span",{className:_.default.mention_item_description},m.description)),m.getItems&&o.createElement(l.Icon,{className:(0,r.default)(_.default.mention_item_right,(0,l.getIcon)("arrowright"))}));t.MentionItem=v},80732:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionPanel=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(97599)),l=e(40167),_=({items:v,activeIndex:m,onSelectItem:p,position:s,filter:g,visible:a,level:h,loading:u=!1})=>{const c=r.useRef(null);if(r.useEffect(()=>{if(a&&c.current){const d=c.current.querySelector(`.${o.default.mention_item}.${o.default.active}`);d&&d.scrollIntoView({block:"nearest"})}},[m,a]),!a)return null;const f=(()=>{let d=v;if(h===0){if(g&&g.length>1){const y=g.substring(1).toLowerCase();d=v.filter(b=>b.text.toLowerCase().includes(y))}}else g&&g.length>0&&(d=v.filter(y=>y.text.toLowerCase().includes(g.toLowerCase())));return d})();return h===0&&f.length===0?null:r.createElement("div",{ref:c,className:o.default.mention_panel,style:{top:s.top,left:s.left}},u&&r.createElement("div",{className:o.default.loading_bar}),v.length>0?r.createElement("ul",{className:o.default.mention_list},v.map((d,y)=>r.createElement(l.MentionItem,{key:d.id,item:d,isActive:y===m,onClick:()=>p(d,!0)}))):r.createElement("div",{className:o.default.no_results},u?"\u6B63\u5728\u641C\u7D22...":"\u65E0\u5339\u914D\u7ED3\u679C"))};t.MentionPanel=_},37412:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionSelect=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),l=e(58998),_=e(81878),v=n.__importDefault(e(13163)),m=({enabled:s,onChange:g})=>o.default.createElement("div",{className:v.default.thinking_toggle,onClick:()=>g(!s)},o.default.createElement(_.Icon,{iconClass:(0,_.getIcon)(s?"check":"circle-outline"),className:(0,r.default)(v.default.thinking_icon,{[v.default.enabled]:s})}),o.default.createElement("span",{className:v.default.thinking_label},"Thinking")),p=({options:s,value:g,onChange:a,placeholder:h,disabled:u=!1,className:c,size:E="small",showThinking:f=!1,thinkingEnabled:d=!1,onThinkingChange:y})=>{const[b,A]=(0,o.useState)(!1),[S,D]=(0,o.useState)(-1),[I,w]=(0,o.useState)("up"),T=(0,o.useRef)(null),R=(0,o.useRef)(null),M=s.find(L=>L.selected)||s.find(L=>L.value===g),O=()=>{u||(A(!b),D(-1))},x=L=>{L.disabled||(a?.(L.value),A(!1),D(-1))},k=L=>{if(!u)switch(L.key){case"Enter":case" ":L.preventDefault(),b?S>=0&&x(s[S]):A(!0);break;case"Escape":L.preventDefault(),A(!1),D(-1);break;case"ArrowDown":L.preventDefault(),b?D(N=>N<s.length-1?N+1:0):A(!0);break;case"ArrowUp":L.preventDefault(),b&&D(N=>N>0?N-1:s.length-1);break}},F=()=>{A(!1),D(-1)};return(0,o.useEffect)(()=>{if(b&&T.current){const L=T.current.getBoundingClientRect(),N=window.innerHeight,U=Math.min(400,s.length*60),W=L.top,j=N-L.bottom;W<U&&j>W?w("down"):w("up")}},[b,s.length]),(0,o.useEffect)(()=>{if(b&&S>=0&&R.current){const L=R.current.children[S];L&&L.scrollIntoView({behavior:"smooth",block:"nearest"})}},[b,S]),o.default.createElement(l.ClickOutside,{onOutsideClick:F},o.default.createElement("div",{ref:T,className:(0,r.default)(v.default.mention_select,v.default[`size_${E}`],{[v.default.disabled]:u,[v.default.open]:b,[v.default.dropdown_up]:I==="up",[v.default.dropdown_down]:I==="down"},c),onClick:O,onKeyDown:k,tabIndex:u?-1:0,role:"combobox","aria-expanded":b,"aria-haspopup":"listbox"},o.default.createElement("div",{className:v.default.select_trigger},o.default.createElement("div",{className:v.default.select_content},M?o.default.createElement("div",{className:v.default.selected_option},o.default.createElement("span",{className:v.default.option_label},M.label),M.badge&&o.default.createElement("span",{className:v.default.option_badge,style:{backgroundColor:M.badgeColor}},M.badge)):o.default.createElement("span",{className:v.default.placeholder},h)),o.default.createElement(_.Icon,{iconClass:(0,_.getIcon)("down-arrow"),className:(0,r.default)(v.default.dropdown_arrow,{[v.default.open]:b})})),b&&o.default.createElement("div",{ref:R,className:v.default.dropdown,role:"listbox"},f&&y&&o.default.createElement("div",{className:v.default.thinking_section},o.default.createElement(m,{enabled:d,onChange:y}),o.default.createElement("div",{className:v.default.divider})),s.map((L,N)=>o.default.createElement("div",{key:L.value,className:(0,r.default)(v.default.option,{[v.default.active]:N===S,[v.default.selected]:L.selected||L.value===g,[v.default.disabled]:L.disabled}),onClick:()=>x(L),role:"option","aria-selected":L.selected||L.value===g},o.default.createElement("div",{className:v.default.option_main},o.default.createElement("div",{className:v.default.option_header},o.default.createElement("div",{className:v.default.option_title},L.icon&&o.default.createElement(_.Icon,{icon:L.icon,className:v.default.option_icon}),L.iconClass&&o.default.createElement(_.Icon,{iconClass:L.iconClass,className:v.default.option_icon}),o.default.createElement("span",{className:v.default.option_label},L.label),L.badge&&o.default.createElement("span",{className:v.default.option_badge,style:{backgroundColor:L.badgeColor}},L.badge))),L.description&&o.default.createElement("div",{className:v.default.option_description},L.description),L.tags&&L.tags.length>0&&o.default.createElement("div",{className:v.default.option_tags},L.tags.map((U,W)=>o.default.createElement("span",{key:W,className:v.default.tag},U)))))))))};t.MentionSelect=p},44692:(P,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MENTION_KEYWORD=t.MentionType=t.FooterButtonPosition=void 0;var e;(function(r){r.LEFT="left",r.RIGHT="right"})(e||(t.FooterButtonPosition=e={}));var n;(function(r){r.FILE="file",r.FOLDER="folder",r.CODE="code",r.RULE="rule"})(n||(t.MentionType=n={})),t.MENTION_KEYWORD="@"},78048:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),l=(m,p)=>o({...m,position:"right",title:r,className:p,role:1});t.createMessageByUser=l;const _=(m,p)=>o({...m,position:"left",title:"",className:p,role:2});t.createMessageByAI=_;const v=m=>{let{title:p}=m;const{message:s,tooltip:g}=m;let a=m.icon||"";if(!p)return{icon:a,title:s,message:s,tooltip:g};const h=p.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,c,E,f]=h,d=c?c.slice(0,-1):n.CODICON_OWNER;a=(0,n.getExternalIcon)(E,d),f&&(a+=` ${f.slice(1)}`),p=p.slice(u.length)}return{icon:a,title:p,message:s,tooltip:g}};t.extractIcon=v},19957:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(46044);let _=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=_,n.__decorate([(0,r.Autowired)(l.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"llmContextService",void 0),t.LlmContextContribution=_=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],_)},63536:(P,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(41869),l=e(11050),_=e(43718),v=e(25234),m=e(19083),p=e(86560),s=e(96689),g=e(82196),a=e(14951),h=e(6287),u=e(20868),c=e(6487),E=e(70392),f=e(23750);let d=class extends v.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxAttachFoldersLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.attachedFolders=[],this.attachedRules=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new p.Emitter,this.hasUserManualReference=!1,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(b,A,S){const D=A.findIndex(I=>{var w,T,R,M;return I.uri.toString()===b.uri.toString()&&((w=I.selection)===null||w===void 0?void 0:w[0])===((T=b.selection)===null||T===void 0?void 0:T[0])&&((R=I.selection)===null||R===void 0?void 0:R[1])===((M=b.selection)===null||M===void 0?void 0:M[1])});D>-1&&A.splice(D,1),A.push(b),A.length>S&&A.shift()}addFolderToList(b,A,S){const D=A.findIndex(I=>I.uri.toString()===b.uri.toString());D>-1&&A.splice(D,1),A.push(b),A.length>S&&A.shift()}addRuleToContext(b){if(!b||this.attachedRules.some(S=>S.path===b.toString()))return;const A=this.rulesService.projectRules.find(S=>S.path===b.toString());A&&(this.attachedRules.push(A),this.notifyContextChange())}addFileToContext(b,A,S=!1){if(!b)return;const D={uri:b,selection:A},I=S?this.attachedFiles:this.recentlyViewFiles,w=S?this.maxAttachFilesLimit:this.maxViewFilesLimit;S&&(this.docModelManager.createModelReference(b),this.hasUserManualReference=!0),this.addFileToList(D,I,w),this.notifyContextChange()}addFolderToContext(b){if(!b)return;const A={uri:b};this.addFolderToList(A,this.attachedFolders,this.maxAttachFoldersLimit),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles=[],this.attachedFolders=[],this.hasUserManualReference=!1,this.attachedRules=[],this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,attachedFolders:this.attachedFolders,attachedRules:this.attachedRules,version:this.contextVersion++}}removeFileFromContext(b,A=!1){const S=A?this.attachedFiles:this.recentlyViewFiles,D=S.findIndex(I=>I.uri.toString()===b.toString());D>-1&&S.splice(D,1),A&&this.attachedFiles.length===0&&(this.hasUserManualReference=!1),this.notifyContextChange()}removeFolderFromContext(b){const A=this.attachedFolders,S=A.findIndex(D=>D.uri.toString()===b.toString());S>-1&&A.splice(S,1),this.notifyContextChange()}removeRuleFromContext(b){const A=this.attachedRules,S=A.findIndex(D=>D.path===b.toString());S>-1&&A.splice(S,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(s.EditorDocumentModelCreationEvent,b=>{b.payload.uri.scheme==="file"&&this.addFileToContext(b.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(s.EditorDocumentModelRemovalEvent,b=>{b.payload.scheme==="file"&&this.removeFileFromContext(b.payload,!1)})),this.disposables.push(this.eventBus.on(s.EditorDocumentModelSavedEvent,b=>{b.payload.scheme})),this.disposables.push(this.eventBus.on(g.EditorSelectionChangeEvent,b=>{if(b.payload.selections.length>0){const A=[b.payload.selections[0].selectionStartLineNumber,b.payload.selections[0].positionLineNumber].sort();this.hasUserManualReference||(A[0]===A[1]?this.addFileToContext(b.payload.editorUri,void 0,!1):this.addFileToContext(b.payload.editorUri,A.sort((S,D)=>S-D),!1))}}))}stopAutoCollection(){this.dispose()}async serialize(){const b=this.getAllContextFiles(),A=p.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(b.viewed,A),attachedFiles:this.serializeAttachedFiles(b.attached,A),attachedFolders:await this.serializeAttachedFolders(b.attachedFolders),attachedRules:this.serializeAttachedRules(b.attachedRules),globalRules:this.serializeGlobalRules()}}async serializeAttachedFolders(b){const A=Array.from(new Set(b.map(I=>I.uri.toString()))),S="Here are some folder(s) I manually attached to my message:",D=await Promise.all(A.map(async I=>{const T=new p.URI(I).codeUri.fsPath,R=await this.getFormattedFolderStructure(T);return`Folder: ${T}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/cli-engine",
|
|
3
|
-
"version": "3.9.1-next-
|
|
3
|
+
"version": "3.9.1-next-1755767441.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-
|
|
30
|
-
"@opensumi/ide-core-common": "3.9.1-next-
|
|
31
|
-
"@opensumi/ide-core-node": "3.9.1-next-
|
|
32
|
-
"@opensumi/ide-express-file-server": "3.9.1-next-
|
|
33
|
-
"@opensumi/ide-extension": "3.9.1-next-
|
|
34
|
-
"@opensumi/ide-i18n": "3.9.1-next-
|
|
35
|
-
"@opensumi/ide-main-layout": "3.9.1-next-
|
|
36
|
-
"@opensumi/ide-startup": "3.9.1-next-
|
|
29
|
+
"@opensumi/ide-core-browser": "3.9.1-next-1755767441.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.9.1-next-1755767441.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.9.1-next-1755767441.0",
|
|
32
|
+
"@opensumi/ide-express-file-server": "3.9.1-next-1755767441.0",
|
|
33
|
+
"@opensumi/ide-extension": "3.9.1-next-1755767441.0",
|
|
34
|
+
"@opensumi/ide-i18n": "3.9.1-next-1755767441.0",
|
|
35
|
+
"@opensumi/ide-main-layout": "3.9.1-next-1755767441.0",
|
|
36
|
+
"@opensumi/ide-startup": "3.9.1-next-1755767441.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": "463414c243d699f050f26bb4461cb748e26edc2e"
|
|
76
76
|
}
|