@opensumi/cli-engine 3.8.3-next-1741666419.0 → 3.8.3-next-1741673342.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/browser.js +1 -1
- package/package.json +10 -10
package/lib/browser/browser.js
CHANGED
|
@@ -30742,7 +30742,7 @@ Adhere to these rules:
|
|
|
30742
30742
|
6. Dont include any newlines in the command.`,inputSchema:_.inputSchema,handler:this.handler.bind(this)}}async handler(a,h){return this.runCommandHandler.handler(a,h)}};t.RunTerminalCommandTool=s,n.__decorate([(0,r.Autowired)(p.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],s.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(p.ITerminalGroupViewService),n.__metadata("design:type",Object)],s.prototype,"terminalView",void 0),n.__decorate([(0,r.Autowired)(_.RunCommandHandler),n.__metadata("design:type",_.RunCommandHandler)],s.prototype,"runCommandHandler",void 0),t.RunTerminalCommandTool=s=n.__decorate([(0,c.Domain)(v.MCPServerContribution)],s)},53617:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EnhanceDecorationsCollection=t.DeltaDecorations=void 0;const n=e(43718);class r{get isHidden(){return this._hidden}get codeEditor(){return this.metadata.codeEditor}get deltaData(){return this.metadata.deltaData}get id(){return this.metadata.id}get decorationId(){return this._decorationId}get editorDecoration(){return this.metadata.editorDecoration}get group(){return this._group}constructor(p){this.metadata=p,this._hidden=!1;const{editorDecoration:v,deltaData:m,isHidden:_,group:s}=p;(0,n.isUndefined)(m.length)?this.length=v.range.endLineNumber-v.range.startLineNumber:this.length=m.length,this.range=v.range,this.options=v.options,this.resumeRange=this.range,this._hidden=!!_,this._hidden&&this.hide(),(0,n.isDefined)(s)&&this.setGroup(s)}setGroup(p){this._group=p}setRange(p){this.range=p}getRange(){return this.range}dispose(){var p,v;this.hide(),(v=(p=this.deltaData).dispose)===null||v===void 0||v.call(p)}show(){this.codeEditor.changeDecorations(p=>{this._decorationId=p.addDecoration(this.range,this.options)})}hide(){this.resumeRange=this.range,this._hidden=!0,this._decorationId&&this.codeEditor.changeDecorations(p=>{p.removeDecoration(this._decorationId)})}resume(){this._hidden&&(this._hidden=!1,this.codeEditor.changeDecorations(p=>{this._decorationId=p.addDecoration(this.resumeRange,this.options)}))}}t.DeltaDecorations=r;class o extends n.Disposable{get model(){return this.codeEditor.getModel()}constructor(p){super(),this.codeEditor=p,this.deltaDecorations=[],this._onDidDecorationsChange=this.registerDispose(new n.Emitter),this.onDidDecorationsChange=this._onDidDecorationsChange.event,this.addDispose(this.codeEditor.onDidContentSizeChange(v=>{const{contentHeightChanged:m}=v;m&&this.flush()}))}flush(){this.deltaDecorations=this.deltaDecorations.map(p=>{const{decorationId:v,editorDecoration:{range:m}}=p,_=this.model.getDecorationRange(v);return p.setRange(_??m),p}),this._onDidDecorationsChange.fire(this.deltaDecorations)}delete(p){this.deltaDecorations=this.deltaDecorations.filter(v=>v.id!==p)}createDecorations(p){return new r(p)}set(p){this.clear(),this.deltaDecorations=p.map(v=>{const m=(0,n.uuid)(6),_=this.createDecorations({id:m,editorDecoration:v,codeEditor:this.codeEditor,isHidden:v.isHidden,group:v.group,deltaData:{dispose:()=>this.delete(m),length:v.length}});return _.show(),_})}getDecorations(){return this.deltaDecorations}getDecorationByGroup(p){return this.deltaDecorations.find(v=>v.group===p)}getDecorationByLineNumber(p){return this.deltaDecorations.find(v=>v.getRange().startLineNumber===p)}clear(){this.deltaDecorations.map(p=>p.dispose()),this.deltaDecorations=[]}}t.EnhanceDecorationsCollection=o},44260:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MsgHistoryManager=void 0;const n=e(43718);class r extends n.Disposable{constructor(c){super(),this.messageMap=new Map,this.messageAdditionalMap=new Map,this._onMessageChange=new n.Emitter,this.onMessageChange=this._onMessageChange.event,this._onMessageAdditionalChange=new n.Emitter,this.onMessageAdditionalChange=this._onMessageAdditionalChange.event,c&&(this.messageMap=new Map(c.messages.map(p=>[p.id,p])),this.messageAdditionalMap=new Map(Object.entries(c.additional)))}dispose(){this.clearMessages(),super.dispose()}clearMessages(){this.messageMap.clear(),this.messageAdditionalMap.clear()}doAddMessage(c){const p=(0,n.uuid)(6),v=this.messageMap.size,m={...c,id:p,order:v,type:c.type||"string"};return this.messageMap.set(p,m),this._onMessageChange.fire(this.getMessages()),p}get messageList(){return Array.from(this.messageMap.values()).sort((c,p)=>c.order-p.order)}get lastMessageId(){var c;const p=this.messageList;return(c=p[p.length-1])===null||c===void 0?void 0:c.id}getMessages(){return this.messageList}addUserMessage(c){return this.doAddMessage({...c,role:1})}addAssistantMessage(c){return this.doAddMessage({...c,role:2})}updateAssistantMessage(c,p){if(!this.messageMap.has(c))return;const v=this.messageMap.get(c);this.messageMap.set(c,{...v,content:p.content})}setMessageAdditional(c,p){if(!this.messageMap.has(c))return;const m={...this.messageAdditionalMap.get(c)||{},...p};this.messageAdditionalMap.set(c,m),this._onMessageAdditionalChange.fire(m)}getMessageAdditional(c){return this.messageAdditionalMap.get(c)||{}}get sessionAdditionals(){return this.messageAdditionalMap}toJSON(){return{messages:this.getMessages(),additional:Object.fromEntries(this.messageAdditionalMap.entries())}}}t.MsgHistoryManager=r},3841:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativePreferencesContribution=void 0;const n=e(85608),r=e(41869),o=e(83854);let c=class{constructor(){this.schema=o.aiNativePreferenceSchema}};t.AINativePreferencesContribution=c,t.AINativePreferencesContribution=c=n.__decorate([(0,r.Domain)(r.PreferenceContribution)],c)},83854:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aiNativePreferenceSchema=t.EInlineDiffPreviewMode=void 0;const n=e(41869),r=e(43718),o=e(40650);var c;(function(p){p.inlineLive="inlineLive",p.sideBySide="sideBySide"})(c||(t.EInlineDiffPreviewMode=c={})),t.aiNativePreferenceSchema={properties:{[n.AINativeSettingSectionsId.InlineDiffPreviewMode]:{type:"string",enum:[c.inlineLive,c.sideBySide],enumDescriptions:[(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.inlineLive"),(0,r.localize)("preference.ai.native.inlineDiff.preview.mode.sideBySide")],default:c.inlineLive},[n.AINativeSettingSectionsId.InlineChatAutoVisible]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InlineChatCodeActionEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.ChatVisibleType]:{type:"string",enum:["never","always","default"],default:"default"},[n.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime]:{type:"number",default:150},[n.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled]:{type:"boolean",default:!0},[n.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLintErrors]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsLineChange]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.CodeEditsRenderType]:{type:"string",default:o.CodeEditsRenderType.Default,enum:[o.CodeEditsRenderType.Legacy,o.CodeEditsRenderType.Default],description:(0,r.localize)("preference.ai.native.codeEdits.renderType")},[n.AINativeSettingSectionsId.LLMModelSelection]:{type:"string",default:"deepseek",enum:["deepseek","anthropic","openai","openai-compatible"],description:(0,r.localize)("preference.ai.native.llm.model.selection.description")},[n.AINativeSettingSectionsId.ModelID]:{type:"string",default:"deepseek-chat",description:(0,r.localize)("preference.ai.native.llm.model.id")},[n.AINativeSettingSectionsId.DeepseekApiKey]:{type:"string",default:"",description:(0,r.localize)("preference.ai.native.deepseek.apiKey.description")},[n.AINativeSettingSectionsId.AnthropicApiKey]:{type:"string",default:"",description:(0,r.localize)("preference.ai.native.anthropic.apiKey.description")},[n.AINativeSettingSectionsId.OpenaiApiKey]:{type:"string",default:"",description:(0,r.localize)("preference.ai.native.openai.apiKey.description")},[n.AINativeSettingSectionsId.OpenaiBaseURL]:{type:"string",default:"",description:(0,r.localize)("preference.ai.native.openai.baseURL.description")},[n.AINativeSettingSectionsId.ContextWindow]:{type:"number",description:(0,r.localize)("preference.ai.native.contextWindow.description")},[n.AINativeSettingSectionsId.MaxTokens]:{type:"number",description:(0,r.localize)("preference.ai.native.maxTokens.description")},[n.AINativeSettingSectionsId.MCPServers]:{type:"array",default:[],description:(0,r.localize)("preference.ai.native.mcp.servers.description"),items:{type:"object",required:["name","command","args"],properties:{name:{type:"string",description:(0,r.localize)("preference.ai.native.mcp.servers.name.description")},command:{type:"string",description:(0,r.localize)("preference.ai.native.mcp.servers.command.description")},type:{type:"string",enum:["stdio","sse"],enumDescriptions:[(0,r.localize)("preference.ai.native.mcp.servers.type.stdio"),(0,r.localize)("preference.ai.native.mcp.servers.type.sse")],description:(0,r.localize)("preference.ai.native.mcp.servers.type.description"),default:"stdio"},enabled:{type:"boolean",description:(0,r.localize)("preference.ai.native.mcp.servers.enabled.description"),default:!0},args:{type:"array",items:{type:"string"},default:[],description:(0,r.localize)("preference.ai.native.mcp.servers.args.description")},env:{type:"object",additionalProperties:{type:"string"},description:(0,r.localize)("preference.ai.native.mcp.servers.env.description"),default:{}}}}},[n.AINativeSettingSectionsId.CodeEditsTyping]:{type:"boolean",default:!1},[n.AINativeSettingSectionsId.SystemPrompt]:{type:"string",description:(0,r.localize)("preference.ai.native.chat.system.prompt.description")}}}},77633:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenMCPServerRegistry=t.MCPServerContribution=t.AINativeCoreContribution=t.TerminalSuggestionReadableStream=t.ERunStrategy=void 0;const n=e(93062);var r;(function(c){c.EXECUTE="EXECUTE",c.PREVIEW="PREVIEW"})(r||(t.ERunStrategy=r={}));class o extends n.SumiReadableStream{static create(){return new o}}t.TerminalSuggestionReadableStream=o,t.AINativeCoreContribution=Symbol("AINativeCoreContribution"),t.MCPServerContribution=Symbol("MCPServerContribution"),t.TokenMCPServerRegistry=Symbol("TokenMCPServerRegistry")},24522:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ttPolicy=t.renderLines=void 0;const n=e(85608),r=e(55405),o=n.__importStar(e(98236)),c=e(27357),p=e(31324),v=e(33892),m=e(24315),_=(s,f,a,h)=>{const u=h.get(p.EditorOption.disableMonospaceOptimizations),d=h.get(p.EditorOption.stopRenderingLineAfter),E="none",g=h.get(p.EditorOption.renderControlCharacters),l=h.get(p.EditorOption.fontLigatures),y=h.get(p.EditorOption.fontInfo),b=h.get(p.EditorOption.lineHeight),S=new v.StringBuilder(1e4);S.appendString('<div class="suggest-preview-text">');for(let T=0,D=a.length;T<D;T++){const I=a[T],R=I.content;S.appendString('<div class="view-line'),S.appendString('" style="top:'),S.appendString(String(T*b)),S.appendString('px;width:1000000px;">');const M=o.isBasicASCII(R),O=o.containsRTL(R);(0,m.renderViewLine)(new m.RenderLineInput(y.isMonospace&&!u,y.canUseHalfwidthRightwardsArrow,R,!1,M,O,0,I.lineTokens,I.decorations,f,0,y.spaceWidth,y.middotWidth,y.wsmiddotWidth,d,E,g,l!==p.EditorFontLigatures.OFF,null),S),S.appendString("</div>")}S.appendString("</div>"),(0,c.applyFontInfo)(s,y);const A=S.build(),w=t.ttPolicy?t.ttPolicy.createHTML(A):A;s.innerHTML=w};t.renderLines=_,t.ttPolicy=(0,r.createTrustedTypesPolicy)("editorGhostText",{createHTML:s=>s})},90614:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineResultAction=void 0;const r=e(85608).__importStar(e(14041)),o=e(66205),c=e(89195),p=e(43718),v=e(31031),m=({onResultClick:_})=>{const s=(0,r.useMemo)(()=>[{icon:"check",text:(0,p.localize)("aiNative.inline.chat.operate.check.title"),btnType:"default",onClick:()=>_(v.EResultKind.ACCEPT)},{icon:"discard",text:(0,p.localize)("aiNative.operate.discard.title"),onClick:()=>_(v.EResultKind.DISCARD)},{icon:"afresh",text:(0,p.localize)("aiNative.operate.afresh.title"),onClick:()=>_(v.EResultKind.REGENERATE)}],[_]);return r.default.createElement(o.ContentWidgetContainerPanel,{style:{transform:"translateY(4px)"}},r.default.createElement(c.AIInlineResult,{iconItems:s}))};t.InlineResultAction=m},40111:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatController=void 0;const n=e(43718),r=e(93062),o=e(98864);class c{static is(v){return v instanceof c&&typeof v.mountReadable=="function"}constructor(v){this.options=v,this._onData=new n.Emitter,this.onData=this._onData.event,this._onEnd=new n.Emitter,this.onEnd=this._onEnd.event,this._onAbort=new n.Emitter,this.onAbort=this._onAbort.event,this._onError=new n.Emitter,this.onError=this._onError.event,this._stream=null,this._listened=!1}calculateCodeBlocks(v){var m;return!((m=this.options)===null||m===void 0)&&m.enableCodeblockRender?(0,o.extractCodeBlocks)(v):v}mountReadable(v){this._stream=v}get isListened(){return this._listened}listen(){if(this._listened)return;if(!this._stream)throw new Error("No Stream mounted");this._listened=!0;const v=new n.ReplyResponse("");let m="";(0,r.listenReadable)(this._stream,{onData:_=>{m+=_.content;const s=this.calculateCodeBlocks(m);v.updateMessage(s),this._onData.fire(v)},onEnd:()=>{m?this._onEnd.fire():this._onError.fire(new n.ErrorResponse(new Error("No content")))},onError:_=>{n.AbortError.is(_)?this._onAbort.fire():this._onError.fire(new n.ErrorResponse(_))}})}}t.InlineChatController=c},51221:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatEditorController=void 0;const n=e(41869),r=e(43718),o=e(66482),c=e(54414),p=e(52902),v=e(77659),m=e(99906),_=e(89132),s=e(38890),f=e(40111),a=e(31031),h=e(26664);class u extends m.BaseAIMonacoEditorController{constructor(){super(...arguments),this.aiInlineChatDisposable=new r.Disposable,this.aiInlineChatOperationDisposable=new r.Disposable,this.inlineChatInUsing=!1}static get(E){return E.getContribution(u.ID)}get aiNativeConfigService(){return this.injector.get(n.AINativeConfigService)}get aiInlineChatService(){return this.injector.get(n.IAIInlineChatService)}get inlineChatFeatureRegistry(){return this.injector.get(r.InlineChatFeatureRegistryToken)}get preferenceService(){return this.injector.get(n.PreferenceService)}get aiReporter(){return this.injector.get(r.IAIReporter)}get workbenchEditorService(){return this.injector.get(c.WorkbenchEditorService)}get codeActionService(){return this.injector.get(_.CodeActionService)}get logger(){return this.injector.get(r.ILogger)}get contextKeyService(){return this.injector.get(n.IContextKeyService)}mount(){if(this.aiNativeContextKey=this.injector.get(v.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.inlineDiffController=s.InlineDiffController.get(this.monacoEditor),!this.monacoEditor)return this.featureDisposable;this.featureDisposable.addDispose(this.aiInlineChatService.onInlineChatVisible(l=>{l?this.showInlineChat(this.monacoEditor):(this.cancelToken(),this.disposeAllWidget())})),this.featureDisposable.addDispose(this.codeActionService.onCodeActionRun(({id:l,range:y})=>{const b=this.workbenchEditorService.currentEditor;b?.getId()===this.monacoEditor.getId()&&(this.monacoEditor.setSelection(y),this.showInlineChat(this.monacoEditor),this.aiInlineContentWidget&&this.aiInlineContentWidget.clickActionId(l,"codeAction"))})),this.featureDisposable.addDispose(this.monacoEditor.onWillChangeModel(()=>{this.disposeAllWidget()}));let E=!1;this.featureDisposable.addDispose(this.monacoEditor.onMouseDown(l=>{const b=l.target.detail;E=!1,!(b&&typeof b=="string"&&b===r.AIInlineChatContentWidgetId)&&this.aiInlineContentWidget&&!this.aiInlineContentWidget.isPersisted&&this.disposeAllWidget()})),this.featureDisposable.addDispose(this.monacoEditor.onMouseUp(l=>{const b=l.target.detail;b&&typeof b=="string"&&b===r.AIInlineChatContentWidgetId?E=!1:E=!0}));let g=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineChatAutoVisible,!0);return this.featureDisposable.addDispose(this.preferenceService.onSpecificPreferenceChange(r.AINativeSettingSectionsId.InlineChatAutoVisible,({newValue:l})=>{g=l})),this.featureDisposable.addDispose(r.Event.debounce(r.Event.any(this.monacoEditor.onDidChangeCursorSelection,this.monacoEditor.onMouseUp),(l,y)=>y,r.FRAME_THREE)(()=>{!g||!E||this.aiInlineContentWidget&&this.aiInlineContentWidget.isPersisted||this.showInlineChat(this.monacoEditor)})),this.featureDisposable}disposeAllWidget(){[this.aiInlineContentWidget,this.aiInlineChatDisposable,this.aiInlineChatOperationDisposable].forEach(E=>{E?.dispose()}),this.inlineChatInUsing=!1,this.cancelToken()}showInlineContentWidget(E,g){this.aiInlineContentWidget&&this.aiInlineContentWidget.dispose(),this.aiInlineContentWidget=this.injector.get(h.AIInlineContentWidget,[E]),this.aiInlineContentWidget.show({selection:g})}async showInlineChat(E){if(this.contextKeyService.getContextKeyValue(o.CONTEXT_IN_DEBUG_MODE_KEY)||this.aiNativeContextKey.inlineInputWidgetIsVisible.get()||this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()||!this.aiNativeConfigService.capabilities.supportsInlineChat||this.inlineChatInUsing)return;this.inlineChatInUsing=!0,this.disposeAllWidget();const b=E.getSelection();!b||b.isEmpty()||(this.showInlineContentWidget(E,b),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.onActionClick(({actionId:S,source:A})=>{const w=this.inlineChatFeatureRegistry.getEditorHandler(S),T=this.inlineChatFeatureRegistry.getAction(S);if(!w||!T)return;const D=this.getCrossSelection(E);if(!D)return;const I=()=>{const R=w.providerDiffPreviewStrategy?w.providerDiffPreviewStrategy:w.providePreviewStrategy;if(R)return R.bind(this,E,D,this.token)};this.runAction({monacoEditor:E,crossSelection:D,reporterFn:()=>this.aiReporter.start(T.name,{message:T.name,type:r.AIServiceType.InlineChat,source:A,runByCodeAction:A==="codeAction",actionSource:A==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:T.name}),execute:w.execute?w.execute.bind(this,E,D,this.token):void 0,providerPreview:I(),extraData:{actionSource:A==="codeAction"?r.ActionSourceEnum.CodeAction:r.ActionSourceEnum.InlineChat,actionType:T.name}})})))}getCrossSelection(E){const g=E.getSelection();if(!g){this.logger.error("No selection found, aborting inline chat action.");return}return g.setStartPosition(g.startLineNumber,1).setEndPosition(g.endLineNumber,E.getModel().getLineMaxColumn(g.endLineNumber))}convertInlineChatStatus(E,g){if(!this.aiInlineContentWidget)return;const{relationId:l,message:y,startTime:b,isRetry:S,isStop:A}=g;let w;E===a.EInlineChatStatus.DONE&&(w=this.inlineDiffController.getModifyContent()),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(E)),this.aiReporter.end(l,{message:y,success:E!==a.EInlineChatStatus.ERROR,replytime:Date.now()-b,isStop:A,isRetry:S,code:w,actionType:g?.actionType,actionSource:g?.actionSource})}visibleDiffWidget(E){const{monacoEditor:g,options:l,reportInfo:y}=E,{chatResponse:b}=l,{relationId:S,startTime:A,isRetry:w,actionType:T,actionSource:D}=y;if(f.InlineChatController.is(b))this.aiInlineChatOperationDisposable.addDispose([b.onError(R=>{this.convertInlineChatStatus(a.EInlineChatStatus.ERROR,{relationId:S,message:R.message||"",startTime:A,isRetry:w,actionSource:D,actionType:T})}),b.onAbort(()=>{this.convertInlineChatStatus(a.EInlineChatStatus.READY,{relationId:S,message:"abort",startTime:A,isRetry:w,isStop:!0,actionSource:D,actionType:T})}),b.onEnd(()=>{this.convertInlineChatStatus(a.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:w,actionSource:D,actionType:T})})]);else{if(this.aiInlineContentWidget&&this.aiInlineChatDisposable.disposed||r.CancelResponse.is(b)){this.convertInlineChatStatus(a.EInlineChatStatus.READY,{relationId:S,message:b.message||"",startTime:A,isRetry:w,isStop:!0,actionSource:D,actionType:T});return}if(r.ErrorResponse.is(b)){this.convertInlineChatStatus(a.EInlineChatStatus.ERROR,{relationId:S,message:b.message||"",startTime:A,isRetry:w,actionSource:D,actionType:T});return}this.convertInlineChatStatus(a.EInlineChatStatus.DONE,{relationId:S,message:"",startTime:A,isRetry:w,actionSource:D,actionType:T})}this.inlineDiffController.showPreviewerByStream(g,l).mountWidget(this.aiInlineContentWidget)}ensureInlineChatVisible(E,g){this.aiInlineContentWidget.disposed?this.showInlineContentWidget(E,g):this.aiInlineContentWidget.isHidden&&this.aiInlineContentWidget.resume()}async handleDiffPreviewStrategy(E){if(!this.aiInlineContentWidget)return;const{monacoEditor:g,strategy:l,crossSelection:y,relationId:b,isRetry:S,actionType:A,actionSource:w}=E,T=g.getModel();this.aiInlineChatOperationDisposable.dispose(),this.ensureInlineChatVisible(g,y),this.aiInlineChatDisposable.addDispose(this.aiInlineContentWidget.launchChatStatus(a.EInlineChatStatus.THINKING));const D=Date.now();if(this.token.isCancellationRequested){this.convertInlineChatStatus(a.EInlineChatStatus.READY,{relationId:b,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:w,actionType:A});return}const I=await l();if(r.CancelResponse.is(I)){this.convertInlineChatStatus(a.EInlineChatStatus.READY,{relationId:b,message:"abort",startTime:D,isRetry:S,isStop:!0,actionSource:w,actionType:A}),this.disposeAllWidget();return}this.aiInlineChatOperationDisposable.addDispose([this.aiInlineContentWidget.onResultClick(R=>{const M=this.inlineDiffController.getModifyContent(),O=this.inlineDiffController.getOriginContent();this.inlineDiffController.handleAction(R),R===a.EResultKind.ACCEPT?(this.aiReporter.end(b,{message:"accept",success:!0,isReceive:!0,isDrop:!1,code:M,originCode:O,actionType:r.ActionTypeEnum.Accept}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):R===a.EResultKind.DISCARD?(this.aiReporter.end(b,{message:"discard",success:!0,isDrop:!0,isReceive:!1,code:M,originCode:O,actionType:r.ActionTypeEnum.Discard}),(0,r.runWhenIdle)(()=>{this.disposeAllWidget()})):R===a.EResultKind.REGENERATE&&(this.aiReporter.end(b,{message:"regenerate",success:!0,isDrop:!0,isReceive:!1,code:M,originCode:O,actionType:r.ActionTypeEnum.Regenerate}),this.handleDiffPreviewStrategy({monacoEditor:g,strategy:l,crossSelection:y,relationId:b,isRetry:!0,actionSource:w,actionType:A}))}),this.aiInlineChatService.onThumbs(R=>{this.aiReporter.end(b,{isLike:R})}),this.inlineDiffController.onMaxLineCount(R=>{requestAnimationFrame(()=>{if(y.endLineNumber===T.getLineCount()){const M=g.getOption(p.monacoApi.editor.EditorOption.lineHeight);this.aiInlineContentWidget.setOffsetTop(M*R+12)}})})]),this.visibleDiffWidget({monacoEditor:g,options:{crossSelection:y,chatResponse:I},reportInfo:{relationId:b,startTime:D,isRetry:S,actionType:A,actionSource:w}})}async runAction(E){const{monacoEditor:g,crossSelection:l,reporterFn:y,execute:b,providerPreview:S,extraData:A}=E;if(b&&(await b(),this.disposeAllWidget()),S){const w=y();await this.handleDiffPreviewStrategy({monacoEditor:g,strategy:S,crossSelection:l,relationId:w,isRetry:!1,actionSource:A?.actionSource,actionType:A?.actionType})}}}t.InlineChatEditorController=u,u.ID="editor.contrib.ai.inline.chat"},2281:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57925),p=e(43718),v=e(89132),m=e(74353),_=e(86443);let s=class extends p.Disposable{constructor(){super(...arguments),this.actionsMap=new Map,this.editorHandlerMap=new Map,this.terminalHandlerMap=new Map}dispose(){super.dispose(),this.actionsMap.clear(),this.editorHandlerMap.clear(),this.terminalHandlerMap.clear()}collectActions(a){const{id:h}=a;return this.actionsMap.has(h)?(this.logger.warn(`InlineChatFeatureRegistry: id ${h} already exists`),!1):((0,p.isUndefined)(a.renderType)&&(a.renderType="button"),(0,p.isUndefined)(a.order)&&(a.order=0),this.actionsMap.set(h,a),!0)}removeCollectedActions(a){this.actionsMap.delete(a.id),this.codeActionService.deleteCodeActionById(a.id)}registerEditorInlineChat(a,h){return this.collectActions(a)&&(this.editorHandlerMap.set(a.id,h),this.codeActionService.registerCodeAction(a)),{dispose:()=>{this.removeCollectedActions(a)}}}unregisterEditorInlineChat(a){return this.removeCollectedActions(a)}registerTerminalInlineChat(a,h){return this.collectActions(a)&&((0,p.isUndefined)(h.triggerRules)&&(h.triggerRules="selection"),this.terminalHandlerMap.set(a.id,h)),{dispose:()=>{this.removeCollectedActions(a)}}}unregisterTerminalInlineChat(a){return this.removeCollectedActions(a)}registerInteractiveInput(a,h){const u=()=>{const d=String(this.inlineInputService.getSequenceKeyString());if(!d)return;const E={id:_.InteractiveInputModel.ID,name:(0,p.formatLocalize)("aiNative.inline.chat.operate.chat.title",d.toLocaleUpperCase()),renderType:"button",order:Number.MAX_SAFE_INTEGER};this.actionsMap.has(E.id)?this.actionsMap.set(E.id,E):this.collectActions(E)};return this.addDispose(p.Event.filter(this.keybindingRegistry.onKeybindingsChanged,({affectsCommands:d})=>d.includes(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id))(()=>u())),u(),this.inlineInputService.registerInlineInput(a,h)}getEditorActionButtons(){const a=Array.from(this.editorHandlerMap.keys()).filter(h=>{const u=this.actionsMap.get(h);return u&&u.renderType==="button"}).map(h=>this.actionsMap.get(h)).sort((h,u)=>h.order-u.order);return this.actionsMap.has(_.InteractiveInputModel.ID)&&a.push(this.actionsMap.get(_.InteractiveInputModel.ID)),a}getEditorActionMenus(){return Array.from(this.editorHandlerMap.keys()).filter(a=>{const h=this.actionsMap.get(a);return h&&h.renderType==="dropdown"}).map(a=>this.actionsMap.get(a))}getEditorHandler(a){return this.editorHandlerMap.get(a)}getTerminalHandler(a){return this.terminalHandlerMap.get(a)}getTerminalActions(){return Array.from(this.terminalHandlerMap.keys()).map(a=>this.actionsMap.get(a))}getAction(a){return this.actionsMap.get(a)}};t.InlineChatFeatureRegistry=s,n.__decorate([(0,r.Autowired)(o.Logger),n.__metadata("design:type",o.Logger)],s.prototype,"logger",void 0),n.__decorate([(0,r.Autowired)(v.CodeActionService),n.__metadata("design:type",v.CodeActionService)],s.prototype,"codeActionService",void 0),n.__decorate([(0,r.Autowired)(m.InlineInputService),n.__metadata("design:type",m.InlineInputService)],s.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],s.prototype,"keybindingRegistry",void 0),t.InlineChatFeatureRegistry=s=n.__decorate([(0,r.Injectable)()],s)},31031:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineChatService=t.EResultKind=t.EInlineChatStatus=void 0;const n=e(85608),r=e(76003),o=e(43718);var c=e(19413);Object.defineProperty(t,"EInlineChatStatus",{enumerable:!0,get:function(){return c.EInlineChatStatus}}),Object.defineProperty(t,"EResultKind",{enumerable:!0,get:function(){return c.EResultKind}});let p=class{constructor(){this._onInlineChatVisible=new o.Emitter,this.onInlineChatVisible=this._onInlineChatVisible.event,this._onThumbs=new o.Emitter,this.onThumbs=this._onThumbs.event}fireThumbsEvent(m){this._onThumbs.fire(m)}};t.InlineChatService=p,t.InlineChatService=p=n.__decorate([(0,r.Injectable)({multiple:!1})],p)},26664:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineContentWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),c=e(41869),p=e(89195),v=e(64102),m=e(43718),_=n.__importStar(e(20868)),s=e(62663),f=e(52659),a=e(77659),h=e(90614),u=e(74353),d=e(86443),E=n.__importDefault(e(26899)),g=e(31031),l=b=>{const{onClickActions:S,onClose:A,onChatStatus:w,onResultClick:T}=b,D=(0,c.useInjectable)(c.IAIInlineChatService),I=(0,c.useInjectable)(m.InlineChatFeatureRegistryToken),[R,M]=(0,r.useState)(g.EInlineChatStatus.READY);(0,r.useEffect)(()=>{const j=new m.Disposable;return j.addDispose(w(X=>M(X))),()=>{j.dispose()}},[w,D]),(0,r.useEffect)(()=>{R===g.EInlineChatStatus.ERROR&&A?.()},[A]);const O=(0,r.useMemo)(()=>R===g.EInlineChatStatus.THINKING,[R]),P=(0,r.useMemo)(()=>R===g.EInlineChatStatus.DONE,[R]),k=(0,r.useMemo)(()=>R===g.EInlineChatStatus.ERROR,[R]),F=(0,r.useMemo)(()=>I.getEditorActionButtons(),[I]),L=(0,r.useCallback)(j=>{S?.(j)},[S]),N=(0,r.useCallback)(()=>{A?.()},[A]),U=(0,r.useMemo)(()=>I.getEditorActionMenus().map(j=>new v.MenuNode({id:`ai.menu.operation.${j.id}`,label:j.name,className:E.default.more_operation_menu_item,execute:()=>{L(j.id)}})),[I]),W=(0,r.useCallback)(()=>F.length===0&&U.length===0||k?null:P?r.default.createElement(h.InlineResultAction,{onResultClick:T}):r.default.createElement(p.AIAction,{operationList:F,moreOperation:U,onClickItem:L,onClose:N,loading:O}),[F,U,T,R]);return r.default.createElement("div",{className:E.default.inline_chat_controller_box},W())};let y=class extends f.ReactInlineContentWidget{get status(){return this._status}get isPersisted(){return!this.isHidden&&this.status!==g.EInlineChatStatus.READY&&this.status!==g.EInlineChatStatus.ERROR}constructor(S){super(S),this.editor=S,this.allowEditorOverflow=!0,this._onActionClickEmitter=new m.Emitter,this.onActionClick=this._onActionClickEmitter.event,this._onStatusChange=new m.Emitter,this.onStatusChange=this._onStatusChange.event,this._onResultClick=new m.Emitter,this.onResultClick=this._onResultClick.event,this._status=g.EInlineChatStatus.READY,this.aiNativeContextKey=this.injector.get(a.AINativeContextKey,[this.editor.contextKeyService])}launchChatStatus(S){return(0,m.runWhenIdle)(()=>{this._status=S,this._onStatusChange.fire(S)})}dispose(){this.launchChatStatus(g.EInlineChatStatus.READY),super.dispose()}clickActionId(S,A){var w;if(S===d.InteractiveInputModel.ID&&(!((w=this.options)===null||w===void 0)&&w.selection)){this.hide(),this.inlineInputService.visibleBySelection(this.options.selection);return}this._onActionClickEmitter.fire({actionId:S,source:A})}renderView(){return r.default.createElement(l,{onClickActions:S=>this.clickActionId(S,"widget"),onClose:()=>this.dispose(),onChatStatus:this.onStatusChange.bind(this),onResultClick:S=>{this._onResultClick.fire(S)}})}async show(S){super.show(S),this.aiNativeContextKey.inlineChatIsVisible.set(!0)}getDomNode(){const S=super.getDomNode();return requestAnimationFrame(()=>{S.style.zIndex=(c.StackingLevel.FindWidget-1).toString()}),S}async hide(){this.aiNativeContextKey.inlineChatIsVisible.set(!1),super.hide()}setOptions(S){this.options=S}setOffsetTop(S){this.domNode.style.transform=`translateY(${S}px)`}id(){return m.AIInlineChatContentWidgetId}getPosition(){const S=super.getPosition();if(S)return S;if(!this.options)return null;const{selection:A}=this.options;if(!A)return null;const w=this.computePosition(A);return w||null}safeGetLineLastNonWhitespaceColumn(S){const A=this.editor.getModel();S<1&&(S=1);const w=A.getLineCount();return S>w&&(S=w),A.getLineLastNonWhitespaceColumn(S)}toAbovePosition(S,A){return{position:new _.Position(S,A),preference:[s.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE,s.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW]}}toBelowPosition(S,A){return{position:new _.Position(S,A),preference:[s.monacoBrowser.editor.ContentWidgetPositionPreference.BELOW,s.monacoBrowser.editor.ContentWidgetPositionPreference.ABOVE]}}recheckSelection(S){const A=S.getStartPosition(),w=S.getEndPosition(),D=this.editor.getModel().getLineCount(),I=Math.max(1,w.lineNumber-1),R=Math.min(D,w.lineNumber+1),M=A.with(I,1),O=w.with(R,this.safeGetLineLastNonWhitespaceColumn(R));if(D===1)return this.toBelowPosition(R,this.safeGetLineLastNonWhitespaceColumn(R));if(O.lineNumber===1&&w.lineNumber!==A.lineNumber)return this.computePosition(_.Selection.fromPositions(M,O));const P=this.safeGetLineLastNonWhitespaceColumn(I),k=this.safeGetLineLastNonWhitespaceColumn(R),F=this.safeGetLineLastNonWhitespaceColumn(w.lineNumber);return k>F&&k>P?this.computePosition(_.Selection.fromPositions(O,M)):this.computePosition(_.Selection.fromPositions(M,O))}isProtrudeAbove(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S-1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S-2)}isProtrudeBelow(S){const A=this.safeGetLineLastNonWhitespaceColumn(S);return A>=this.safeGetLineLastNonWhitespaceColumn(S+1)&&A>=this.safeGetLineLastNonWhitespaceColumn(S+2)}computePosition(S){const A=S.getStartPosition(),w=S.getEndPosition();let T=S.getPosition();const I=this.editor.getModel().getLineCount();if(A.lineNumber===w.lineNumber)return this.recheckSelection(S);w.lineNumber-A.lineNumber===1&&(T=w);const R=this.safeGetLineLastNonWhitespaceColumn(T.lineNumber);let M=T.lineNumber,O="below";if(T.equals(A)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(T.lineNumber-1),this.safeGetLineLastNonWhitespaceColumn(T.lineNumber-2))<=R)return this.toAbovePosition(T.lineNumber,R);for(let F=A.lineNumber;F<=w.lineNumber;F++){if(this.isProtrudeAbove(F)){M=F,O="above";break}if(this.isProtrudeBelow(F)){M=F,O="below";break}}}else if(T.equals(w)){if(Math.max(this.safeGetLineLastNonWhitespaceColumn(T.lineNumber+1),this.safeGetLineLastNonWhitespaceColumn(T.lineNumber+2))<=R)return this.toBelowPosition(T.lineNumber,R);for(let F=Math.min(I,w.lineNumber+1);F>=A.lineNumber;F--){if(this.isProtrudeBelow(F)){M=F,O="below";break}if(this.isProtrudeAbove(F)){M=F,O="above";break}}}const P=this.safeGetLineLastNonWhitespaceColumn(M)+1;return O==="below"?this.toBelowPosition(M,P):this.toAbovePosition(M,P)}};t.AIInlineContentWidget=y,n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],y.prototype,"injector",void 0),n.__decorate([(0,o.Autowired)(u.InlineInputService),n.__metadata("design:type",u.InlineInputService)],y.prototype,"inlineInputService",void 0),t.AIInlineContentWidget=y=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],y)},15989:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608);n.__exportStar(e(38890),t),n.__exportStar(e(49444),t),n.__exportStar(e(37679),t),n.__exportStar(e(51347),t)},95608:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffManager=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(97267),c=e(41869),p=e(54414),v=e(73974),m=n.__importDefault(e(69790)),_=f=>r.default.createElement(o.Popover,{content:f.content,id:f.id,onClick:f.onClick},r.default.createElement(o.Icon,{iconClass:f.icon,className:f.disabled?m.default.disabled:""})),s=f=>{var a,h;const{resource:u}=f,d=(0,c.useInjectable)(v.BaseApplyService),E=(0,c.useInjectable)(p.WorkbenchEditorService),g=(0,c.useInjectable)(c.AppConfig),[l,y]=(0,r.useState)(!0),[b,S]=(0,r.useState)(0),[A,w]=(0,r.useState)(0),[T,D]=(0,r.useState)(d.getPendingPaths()),I=(0,r.useMemo)(()=>c.path.relative(g.workspaceDir,u.uri.path.toString()),[u]);(0,r.useEffect)(()=>{const F=d.onCodeBlockUpdate(L=>{c.path.relative(g.workspaceDir,f.resource.uri.path.toString())===L.relativePath&&y(L.status==="pending");const N=d.getPendingPaths();D(N)});return()=>{F.dispose()}},[]);const R=(h=(a=d.currentPreviewer)===null||a===void 0?void 0:a.getNode())===null||h===void 0?void 0:h.livePreviewDiffDecorationModel;(0,r.useEffect)(()=>{let F;return R&&(S(R.partialEditWidgetCount),F=R.onPartialEditWidgetListChange(L=>{S(L.filter(N=>N.status==="pending").length)})),()=>{F?.dispose()}},[R]);const M=(0,r.useCallback)(F=>{const L=R?.revealSiblingChange(F);L!==void 0&&w(L)},[R]),O=(0,r.useCallback)(F=>{const L=T.indexOf(I);if(L===-1)return;const N=c.URI.file(c.path.join(g.workspaceDir,T[L+(F==="up"?-1:1)]));E.open(N)},[I,T]),P=(0,r.useMemo)(()=>b===0?"":` ${A+1} of ${b}`,[b,A]),k=(0,r.useMemo)(()=>I?` ${T.indexOf(I)+1} of ${T.length}`:"",[I,T]);return r.default.createElement("div",{className:m.default.inlineDiffManager,style:{display:l?"flex":"none"}},r.default.createElement("div",{className:m.default.mid},r.default.createElement(_,{icon:"codicon codicon-check",onClick:()=>d.processAll("accept",f.resource.uri),content:(0,c.localize)("aiNative.inlineDiff.acceptAll"),id:"inline-diff-manager-accept-all"}),r.default.createElement(_,{icon:"codicon codicon-close",onClick:()=>d.processAll("reject",f.resource.uri),content:(0,c.localize)("aiNative.inlineDiff.rejectAll"),id:"inline-diff-manager-reject-all"}),r.default.createElement(_,{icon:"codicon codicon-arrow-up",content:(0,c.localize)("aiNative.inlineDiff.up")+P,id:"inline-diff-manager-up",disabled:A===0,onClick:()=>M("up")}),r.default.createElement(_,{icon:"codicon codicon-arrow-down",content:(0,c.localize)("aiNative.inlineDiff.down")+P,id:"inline-diff-manager-down",disabled:A===b-1,onClick:()=>M("down")})),r.default.createElement("div",{className:m.default.right},r.default.createElement(_,{icon:"codicon codicon-arrow-left",onClick:()=>O("up"),disabled:T.length===0||T[0]===I,content:(0,c.localize)("aiNative.inlineDiff.left")+k,id:"inline-diff-manager-left"}),r.default.createElement(_,{icon:"codicon codicon-arrow-right",onClick:()=>O("down"),disabled:T.length===0||T[T.length-1]===I,content:(0,c.localize)("aiNative.inlineDiff.right")+k,id:"inline-diff-manager-right"})))};t.InlineDiffManager=s},49444:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LiveInlineDiffPreviewer=t.SideBySideInlineDiffWidget=t.BaseInlineDiffPreviewer=void 0;const r=e(85608),o=e(76003),c=e(43718),p=e(54414),v=e(20868),m=e(90052),_=e(77714),s=e(52451),f=e(43255),a=e(24347),h=e(11827),u=e(9491),d=e(31031),E=e(33062),g=e(37679);let l=class extends c.Disposable{constructor(A){super(),this.monacoEditor=A,this.inlineContentWidget=null,this.model=this.monacoEditor.getModel(),this.modelId=this.model.id,this.addDispose(c.Disposable.create(()=>{this.inlineContentWidget&&this.inlineContentWidget.dispose(),this.attachNode(void 0)}))}formatIndentation(A){const w=this.selection.startLineNumber,T=(0,_.getLeadingWhitespace)(this.model.getLineContent(w));if(A===_.empty||T===_.empty)return A;const{tabSize:D,insertSpaces:I}=this.model.getOptions(),R=this.model.getEOL(),M=(0,u.getSpaceCnt)(T,D);let O=(0,u.generateIndent)(M,D,I);const P=A.split(R),k=P[0];let F=!1;if(k){const N=(0,_.getLeadingWhitespace)(k);O===N?O="":O.length>N.length?O=O.slice(N.length):(O=N.slice(O.length),F=!0)}return P.map(N=>{if(F){const U=(0,_.getLeadingWhitespace)(N);return N=O+N.substring(U.length),N}return O+N}).join(R)}getNode(){return this.node}mountWidget(A){this.inlineContentWidget=A}layout(){var A,w;(A=this.inlineContentWidget)===null||A===void 0||A.setOptions({position:this.getPosition()}),(w=this.inlineContentWidget)===null||w===void 0||w.layoutContentWidget()}onReady(A){return A(),c.Disposable.NULL}create(A,w={disposeWhenEditorClosed:!0}){this.selection=A,this.node=this.createNode(w.reverse),this.node.setPreviewerOptions(w)}attachNode(A){this.node=A}show(A,w){}onLineCount(A){return this}setValue(A){}getValue(){return""}getOriginValue(){return""}onError(A){}onAbort(){}onEnd(){}revealFirstDiff(){}render(){}hide(){}resume(){}isModel(A){return this.model.uri.toString()===A}};t.BaseInlineDiffPreviewer=l,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],l.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(p.WorkbenchEditorService),r.__metadata("design:type",p.WorkbenchEditorService)],l.prototype,"editorService",void 0),t.BaseInlineDiffPreviewer=l=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],l);let y=n=class extends l{createNode(){const A=this.injector.get(g.InlineDiffWidget,[n.AI_DIFF_WIDGET_ID,{editor:this.monacoEditor,selection:this.selection}]);return A.create(),this.addDispose(A),A}mountWidget(A){super.mountWidget(A),A.addDispose(this)}getPosition(){return v.Position.lift({lineNumber:this.selection.endLineNumber+1,column:1})}layout(){var A;(A=this.inlineContentWidget)===null||A===void 0||A.setPositionPreference([m.ContentWidgetPositionPreference.BELOW]),super.layout()}onReady(A){return this.node?this.node.onReady(A.bind(this)):c.Disposable.NULL}show(A,w){var T;(T=this.node)===null||T===void 0||T.showByLine(A,w)}setValue(A){var w;const T=(w=this.node)===null||w===void 0?void 0:w.getModifiedModel();T?.setValue(this.formatIndentation(A))}getValue(){var A;return((A=this.node)===null||A===void 0?void 0:A.getModifiedModel()).getValue()}getOriginValue(){var A;return((A=this.node)===null||A===void 0?void 0:A.getOriginModel()).getValue()||""}handleAction(A){if(A===d.EResultKind.ACCEPT){const w=this.getValue();this.model.pushEditOperations(null,[{range:this.selection,text:w}],()=>null),this.model.pushStackElement()}}onLineCount(A){var w;return(w=this.node)===null||w===void 0||w.onMaxLineCount(A.bind(this)),this}onData(A){var w,T;const{message:D}=A,I=this.formatIndentation(D),R=(w=this.node)===null||w===void 0?void 0:w.getModifiedModel(),M=R.getEOL()===`\r
|
|
30743
30743
|
`?f.DefaultEndOfLine.CRLF:f.DefaultEndOfLine.LF,{textBuffer:O,disposable:P}=(0,a.createTextBuffer)(I,M),k=h.ModelService._computeEdits(R,O);R.pushEditOperations([],k,()=>[]),P.dispose(),(T=this.node)===null||T===void 0||T.layout()}onError(A){var w;(w=this.node)===null||w===void 0||w.layout()}onAbort(){var A;(A=this.node)===null||A===void 0||A.layout()}onEnd(){var A;(A=this.node)===null||A===void 0||A.layout()}};t.SideBySideInlineDiffWidget=y,y.AI_DIFF_WIDGET_ID="AI-DIFF-WIDGET",t.SideBySideInlineDiffWidget=y=n=r.__decorate([(0,o.Injectable)({multiple:!0})],y);let b=class extends l{listenNode(A){A.addDispose(A.onDidEditChange(()=>this.layout())),A.addDispose(A.onPartialEditWidgetListChange(T=>{var D;T.every(I=>I.isHidden)&&(this.dispose(),(D=this.inlineContentWidget)===null||D===void 0||D.dispose())}));const w=A.onDispose(()=>{this.dispose(),w.dispose()});this.addDispose(A)}createNode(A){let w;return A?w=this.injector.get(E.ReverseInlineStreamDiffHandler,[this.monacoEditor]):w=this.injector.get(E.InlineStreamDiffHandler,[this.monacoEditor]),w.initialize(this.selection),this.listenNode(w),w}getPosition(){var A;const w=(A=this.node)===null||A===void 0?void 0:A.getZone();return w?v.Position.lift({lineNumber:w.startLineNumber,column:1}):v.Position.lift({lineNumber:1,column:1})}handleAction(A){var w,T;switch(A){case d.EResultKind.ACCEPT:(w=this.node)===null||w===void 0||w.acceptAll();break;case d.EResultKind.DISCARD:case d.EResultKind.REGENERATE:(T=this.node)===null||T===void 0||T.rejectAll();break;default:break}}onLineCount(){return c.Disposable.NULL}layout(){var A,w,T;(A=this.inlineContentWidget)===null||A===void 0||A.setPositionPreference([m.ContentWidgetPositionPreference.ABOVE,m.ContentWidgetPositionPreference.BELOW]),super.layout();const D=this.getPosition();if(D&&this.inlineContentWidget){const I=(w=this.node)===null||w===void 0?void 0:w.livePreviewDiffDecorationModel.getRemovedWidgets();if(I?.length){const R=D.lineNumber,M=I[0];if(M)if(((T=M.getLastPosition())===null||T===void 0?void 0:T.lineNumber)<=R){const P=this.inlineContentWidget.getLineHeight(),k=M.height+1;this.inlineContentWidget.setOffsetTop(-P*k-4)}else this.inlineContentWidget.setOffsetTop(0)}else this.inlineContentWidget.setOffsetTop(0)}}render(){var A,w;(A=this.inlineContentWidget)===null||A===void 0||A.show(),(w=this.node)===null||w===void 0||w.rateRenderEditController()}hide(){var A,w;(A=this.inlineContentWidget)===null||A===void 0||A.hide(),(w=this.node)===null||w===void 0||w.hide()}resume(){var A,w;(A=this.inlineContentWidget)===null||A===void 0||A.show(),(w=this.node)===null||w===void 0||w.resume()}onData(A){var w;const{message:T}=A;(w=this.node)===null||w===void 0||w.addLinesToDiff(this.formatIndentation(T))}onAbort(){var A,w;const T=(A=this.node)===null||A===void 0?void 0:A.recompute(E.EComputerMode.default);T&&(T.activeLine=0,T.pendingRange=new s.LineRange(0,0),(w=this.node)===null||w===void 0||w.finallyRender(T))}onEnd(){var A,w;const T=(A=this.node)===null||A===void 0?void 0:A.recompute(E.EComputerMode.legacy);T&&((w=this.node)===null||w===void 0||w.pushRateFinallyDiffStack(T))}getValue(){var A;return((A=this.node)===null||A===void 0?void 0:A.getVirtualModelValue())||""}getOriginValue(){var A;return((A=this.node)===null||A===void 0?void 0:A.getOriginModelValue())||""}setValue(A){var w,T;const D=(w=this.node)===null||w===void 0?void 0:w.recompute(E.EComputerMode.legacy,this.formatIndentation(A));D&&((T=this.node)===null||T===void 0||T.finallyRender(D))}revealFirstDiff(){var A;(A=this.node)===null||A===void 0||A.revealFirstDiff()}};t.LiveInlineDiffPreviewer=b,t.LiveInlineDiffPreviewer=b=r.__decorate([(0,o.Injectable)({multiple:!0})],b)},37679:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(43144),c=n.__importDefault(e(25873)),p=e(76003),v=e(41869),m=n.__importStar(e(20868)),_=e(87822),s=e(34819),f=e(16781),a=n.__importDefault(e(69790)),h={fixedOverflowWidgets:!0,readOnly:!1,enableSplitViewResizing:!0,ignoreTrimWhitespace:!0,renderSideBySide:!0,lineNumbers:"on",glyphMargin:!0,scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,vertical:"hidden"},scrollBeyondLastLine:!1,renderMarginRevertIcon:!1,renderOverviewRuler:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,diffCodeLens:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,renderIndicators:!1,inDiffEditor:!0},u=r.default.memo(E=>{const{range:g,onMaxLineCount:l,editor:y,onReady:b}=E,S=(0,v.useInjectable)(v.MonacoService),A=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!g)return;const w=y.getModel();if(!w)return;const T=w.getValueInRange(g),D=S.createDiffEditor(A.current,{...h,lineDecorationsWidth:y.getLayoutInfo().decorationsWidth,lineNumbersMinChars:y.getOption(m.editor.EditorOption.lineNumbersMinChars)}),I=f.StandaloneServices.get(_.IModelService),R={languageId:w.getLanguageId(),onDidChange:v.Event.None},M=I.createModel(T,R,m.Uri.from({scheme:v.Schemes.inMemory,path:"inline-diff-widget/"+(0,v.randomString)(8)}),!0),O=I.createModel("",R,m.Uri.from({scheme:v.Schemes.inMemory,path:"inline-diff-widget/"+(0,v.randomString)(8)}),!0);D.setModel({original:M,modified:O}),D.revealLine(g.startLineNumber,m.editor.ScrollType.Immediate);const P=()=>{if(l){const k=M.getLineCount(),F=O.getLineCount();l(Math.max(k,F)+1)}};return b&&b({getModifiedModel:()=>O,getOriginModel:()=>M,layout:P}),P(),()=>{D&&D.dispose()}},[g,y]),r.default.createElement("div",{ref:A,className:a.default.diff_editor_widget})});let d=class extends s.ZoneWidget{setPreviewerOptions(g){this.previewerOptions=g}_fillContainer(g){this.setCssClass("inline-diff-widget"),this.root=c.default.createRoot(g);let l=null;if(this._resolveResultWidget)if(g.parentNode){const y=document.createElement("div");requestAnimationFrame(()=>{y.className=a.default.ai_diff_editor_resolve_result_widget;const b=this.editor.getLayoutInfo();y.style.width=`${b.contentWidth}px`,y.style.left=`${b.contentLeft}px`}),g.parentNode.appendChild(y),l=(0,o.createPortal)(this._resolveResultWidget,y),this.resultContainer=y}else throw new Error("[impossible path] container.parentNode is null");this.root.render(r.default.createElement(v.ConfigProvider,{value:this.configContext},r.default.createElement("div",{className:a.default.ai_diff_editor_container},r.default.createElement(u,{range:this.range,editor:this.editor,onMaxLineCount:y=>{y&&(this._relayout(y),this._onMaxLineCount.fire(y))},onReady:y=>{this.diffWidgetHandler=y,this._onReady.fire()}})),l))}computeResultWidgetWidth(){const g=this.editor.getLayoutInfo();return g.contentWidth+g.contentLeft}_onWidth(g){super._onWidth(g),requestAnimationFrame(()=>{this.resultContainer&&(this.resultContainer.style.width=`${this.computeResultWidgetWidth()}px`)})}getModifiedModel(){var g;return(g=this.diffWidgetHandler)===null||g===void 0?void 0:g.getModifiedModel()}getOriginModel(){var g;return(g=this.diffWidgetHandler)===null||g===void 0?void 0:g.getOriginModel()}layout(){var g;return(g=this.diffWidgetHandler)===null||g===void 0?void 0:g.layout()}constructor(g,l){super(l.editor,{showArrow:!1,showFrame:!1,arrowColor:void 0,frameColor:void 0,keepEditorSelection:!0,showInHiddenAreas:!0}),this.id=g,this._onMaxLineCount=new v.Emitter,this.onMaxLineCount=this._onMaxLineCount.event,this._onReady=new v.Emitter,this.onReady=this._onReady.event,this.diffWidgetHandler=null,this.resultContainer=null,this._resolveResultWidget=null;const{selection:y,hiddenArea:b,editor:S}=l;this.range=y,this.hiddenArea=b||y,S.setHiddenAreas([this.hiddenArea],this.id)}revealRange(g,l){}setContainerStyle(g){var l;const y=Object.keys(g);for(const b of y)Object.prototype.hasOwnProperty.call((l=this.container)===null||l===void 0?void 0:l.style,b)&&(this.container.style[b]=g[b])}addClassName(g){return this.setCssClass(g),this}dispose(){this.hide(),super.dispose()}hide(){this.editor.setHiddenAreas([],this.id),super.hide(),this.root&&this.root.unmount()}showByLine(g,l=20){this.editor._modelData.viewModel.coordinatesConverter.modelPositionIsVisible=()=>!0,super.show({startLineNumber:g,startColumn:1,endLineNumber:g,endColumn:Number.MAX_SAFE_INTEGER},l)}setResolveResultWidget(g){this._resolveResultWidget=g}};t.InlineDiffWidget=d,n.__decorate([(0,p.Autowired)(v.AppConfig),n.__metadata("design:type",Object)],d.prototype,"configContext",void 0),t.InlineDiffWidget=d=n.__decorate([(0,p.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[String,Object])],d)},38890:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffController=void 0;const n=e(41869),r=e(43718),o=e(28423),c=e(99906),p=e(83854),v=e(40111),m=e(49444);class _ extends c.BaseAIMonacoEditorController{constructor(){super(...arguments),this._onMaxLineCount=new r.Emitter,this.onMaxLineCount=this._onMaxLineCount.event}static get(f){return f.getContribution(_.ID)}get preferenceService(){return this.injector.get(n.PreferenceService)}mount(){return this.previewerStore=new Map,this.currentPreviewer=(0,o.observableValue)(this,void 0),this.modelChangeObs=(0,o.observableFromEvent)(this,this.monacoEditor.onDidChangeModel,()=>this.monacoEditor.getModel()),this.featureDisposable.addDispose((0,o.autorun)(f=>{const a=this.modelChangeObs.read(f);if(!a)return;const h=a.id,u=this.currentPreviewer.get();u&&u.modelId!==h&&!u.disposed&&u.hide();const d=this.previewerStore.get(a.id);(0,o.transaction)(E=>{d&&d.modelId===h?(this.currentPreviewer.set(d,E),d.resume()):this.currentPreviewer.set(void 0,E)})})),this.featureDisposable}getPreviewer(){return this.currentPreviewer.get()}renderDiff(f,a){var h;f&&(f.onData(a),((h=this.modelChangeObs.get())===null||h===void 0?void 0:h.id)===f.modelId&&f.render())}showPreviewerByStream(f,a){const{crossSelection:h,chatResponse:u}=a,d=new r.Disposable,E=this.createDiffPreviewer(f,h,a.previewerOptions),g=()=>{E.layout(),d.dispose()},l=new r.DisposableCollection;return d.addDispose(E.onReady(()=>{if(v.InlineChatController.is(u)){const y=u;l.pushAll([y.onData(b=>{r.ReplyResponse.is(b)&&this.renderDiff(E,b)}),y.onError(b=>{E.onError(b),g()}),y.onAbort(()=>{E.onAbort(),g()}),y.onEnd(()=>{E.onEnd(),g()})]),y.listen()}else E.setValue(u.message),g()})),E.onDispose(()=>{l.dispose()}),d.addDispose(l),E.layout(),E}createDiffPreviewer(f,a,h){const u=this.preferenceService.getValid(r.AINativeSettingSectionsId.InlineDiffPreviewMode,p.EInlineDiffPreviewMode.inlineLive);let d;return u===p.EInlineDiffPreviewMode.sideBySide?d=this.injector.get(m.SideBySideInlineDiffWidget,[f]):d=this.injector.get(m.LiveInlineDiffPreviewer,[f]),d.create(a,h),d.show(a.startLineNumber-1,a.endLineNumber-a.startLineNumber+2),d.addDispose(d.onLineCount(E=>this._onMaxLineCount.fire(E))),d.addDispose(r.Disposable.create(()=>{this.previewerStore.delete(d.modelId)})),(0,o.transaction)(E=>{this.currentPreviewer.set(d,E),this.previewerStore.set(d.modelId,d)}),d}handleAction(f){const a=this.getPreviewer();a&&a.handleAction(f)}getModifyContent(){const f=this.getPreviewer();if(f)return f.getValue()}getOriginContent(){const f=this.getPreviewer();if(f)return f.getOriginValue()}revealFirstDiff(){const f=this.getPreviewer();f&&f.revealFirstDiff()}}t.InlineDiffController=_,_.ID="editor.contrib.ai.inline.diff"},51347:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffService=void 0;const n=e(85608),r=e(76003),o=e(70392);let c=class{constructor(){this._partialEventEmitter=new o.Emitter,this.onPartialEdit=this._partialEventEmitter.event}firePartialEdit(v){this._partialEventEmitter.fire(v)}};t.InlineDiffService=c,t.InlineDiffService=c=n.__decorate([(0,r.Injectable)()],c)},53182:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintLineDecoration=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57925),p=e(43718),v=e(20868),m=e(60304),_=e(52416),s=e(75189),f="inline_hint_description",a="inline_hint_description_key";let h=class extends p.Disposable{constructor(d){super(),this.monacoEditor=d,this.colorRegister=(0,_.getColorRegistry)(),m.StandaloneServices.get(s.ICodeEditorService).registerDecorationType(f,a,{isWholeLine:!0}),this.addDispose(p.Disposable.create(()=>{this.monacoEditor.setDecorationsByType(f,a,[])}))}getSequenceKeyString(d="+"){var E;const l=(E=this.keybindingRegistry.getKeybindingsForCommand(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||E===void 0?void 0:E.resolved;return l?this.keybindingRegistry.acceleratorForSequence(l,d):""}async show(d){var E;const g=(0,p.formatLocalize)("aiNative.inline.hint.widget.placeholder",this.getSequenceKeyString("")),l=await this.themeService.getCurrentTheme(),y=this.colorRegister.resolveDefaultColor(_.inputPlaceholderForeground,l);this.monacoEditor.setDecorationsByType(f,a,[{range:v.Range.fromPositions(d),renderOptions:{after:{contentText:g,opacity:"0.5",color:(E=y?.toString())!==null&&E!==void 0?E:"",padding:"0 0 0 12px",width:"max-content",fontFamily:"-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif"}}}])}};t.InlineHintLineDecoration=h,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],h.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IThemeService),n.__metadata("design:type",Object)],h.prototype,"themeService",void 0),t.InlineHintLineDecoration=h=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],h)},77886:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineHintController=void 0;const n=e(85608),r=n.__importDefault(e(97331)),o=e(43718),c=n.__importStar(e(20868)),p=e(77659),v=e(99906),m=e(71863),_=e(19520),s=e(53182);class f extends v.BaseAIMonacoEditorController{static get(h){return h.getContribution(f.ID)}get inlineCompletionsService(){return this.injector.get(m.AICompletionsService)}mount(){return this.registerHintLineFeature(this.monacoEditor)}registerHintLineFeature(h){const u=new o.Disposable,d=this.injector.get(p.AINativeContextKey,[h.contextKeyService]),E=()=>{u.dispose()},g=y=>{const b=h.getModel();if(!b||y.lineNumber>b.getLineCount()||this.inlineCompletionsService.isVisibleCompletion)return;if(!b.getLineDecorations(y.lineNumber).some(w=>w.options.description===_.InlineInputPreviewDecorationID)){const w=this.injector.get(s.InlineHintLineDecoration,[h]),T=b.getLineContent(y.lineNumber);T?.trim()||w.show(y),d.inlineHintWidgetIsVisible.set(!0),u.addDispose(w.onDispose(()=>{d.inlineHintWidgetIsVisible.set(!1)})),u.addDispose(w)}},l=(0,r.default)(async y=>{E(),g(y)},100);return this.featureDisposable.addDispose(h.onDidChangeCursorPosition(y=>{l(y.position)})),this.featureDisposable.addDispose(h.onDidChangeModelContent(y=>{var b,S;l(new c.Position((b=y.changes[0])===null||b===void 0?void 0:b.range.endLineNumber,(S=y.changes[0])===null||S===void 0?void 0:S.range.endColumn))})),this.featureDisposable.addDispose(h.onDidFocusEditorWidget(()=>{const y=h.getPosition();y&&(E(),g(y))})),this.featureDisposable.addDispose(h.onDidBlurEditorWidget(()=>{E()})),this.featureDisposable.addDispose(this.inlineCompletionsService.onVisibleCompletion(y=>{y&&E()})),this.featureDisposable.addDispose(u),this.featureDisposable}}t.InlineHintController=f,f.ID="editor.contrib.ai.inline.hint"},32213:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputWidget=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(76003),c=e(41869),p=e(89195),v=e(43718),m=e(90052),_=e(90614),s=e(31031),f=e(26664),a=n.__importDefault(e(13185)),h=d=>{const{defaultValue:E,onClose:g,onInteractiveInputSend:l,onLayoutChange:y,onChatStatus:b,onResultClick:S,onValueChange:A}=d,[w,T]=(0,r.useState)(s.EInlineChatStatus.READY),D=(0,c.useInjectable)(c.AINativeConfigService);(0,r.useEffect)(()=>{const k=new v.Disposable;return k.addDispose(b(F=>T(F))),()=>{k.dispose()}},[b]);const I=(0,r.useMemo)(()=>w===s.EInlineChatStatus.THINKING,[w]),R=(0,r.useMemo)(()=>w===s.EInlineChatStatus.DONE,[w]),M=(0,r.useMemo)(()=>w===s.EInlineChatStatus.ERROR,[w]),O=(0,r.useCallback)(()=>{g?.()},[g]),P=(0,r.useCallback)(k=>{l?.(k)},[l]);return M?null:R?r.default.createElement(_.InlineResultAction,{onResultClick:S}):r.default.createElement(p.AIAction,{loadingShowOperation:!0,onClose:O,loading:I,customOperationRender:r.default.createElement(p.InteractiveInput,{autoFocus:!0,defaultValue:E,onValueChange:A,onHeightChange:k=>y(k),size:"small",placeholder:(0,v.localize)("aiNative.inline.chat.input.placeholder.default"),width:D.inlineChat.inputWidth,disabled:I,onSend:P})})};let u=class extends f.AIInlineContentWidget{constructor(E,g){super(E),this.editor=E,this.defaultValue=g,this.allowEditorOverflow=!0,this.positionPreference=[m.ContentWidgetPositionPreference.ABOVE],this._onSend=new v.Emitter,this.onSend=this._onSend.event,this._onClose=new v.Emitter,this.onClose=this._onClose.event,this._onValueChange=new v.Emitter,this.onValueChange=this._onValueChange.event}dispose(){super.dispose(),this.inlineInputService.hide()}id(){return v.AIInlineInputChatContentWidgetId}renderView(){return r.default.createElement("div",{className:a.default.input_wrapper},r.default.createElement(h,{defaultValue:this.defaultValue,onClose:()=>this._onClose.fire(),onChatStatus:this.onStatusChange.bind(this),onLayoutChange:()=>{this.editor.layoutContentWidget(this)},onValueChange:E=>{this._onValueChange.fire(E)},onInteractiveInputSend:E=>{this.launchChatStatus(s.EInlineChatStatus.THINKING),this._onSend.fire(E)},onResultClick:E=>{this._onResultClick.fire(E)}}))}};t.InlineInputWidget=u,t.InlineInputWidget=u=n.__decorate([(0,o.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object,String])],u)},89060:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputController=void 0;const r=e(85608),o=e(76003),c=e(43718),p=e(57517),v=r.__importStar(e(20868)),m=e(28423),_=e(75124),s=e(2261),f=e(52451),a=e(24347),h=e(77659),u=e(99906),d=e(77633),E=e(40111),g=e(31031),l=e(15989),y=e(19520),b=e(32213),S=r.__importDefault(e(13185)),A=e(74353),w=e(86443);let T=n=class extends u.BaseAIMonacoEditorController{static get(I){return I.getContribution(n.ID)}get inlineInputService(){return this.injector.get(A.InlineInputService)}get aiReporter(){return this.injector.get(c.IAIReporter)}get eventBus(){return this.injector.get(c.IEventBus)}get messageService(){return this.injector.get(_.MessageService)}mount(){return this.inputDisposable=new c.Disposable,this.aiNativeContextKey=this.injector.get(h.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.inlineDiffController=l.InlineDiffController.get(this.monacoEditor),this.inputValue=(0,m.observableValue)(this,""),this.modelChangeObs=(0,m.observableFromEvent)(this,this.monacoEditor.onDidChangeModel,()=>this.monacoEditor.getModel()),this.inlineInputWidgetStore=new Map,this.featureDisposable.addDispose(this.eventBus.on(p.EditorGroupCloseEvent,I=>{var R;if(!this.aiNativeContextKey.inlineInputWidgetIsStreaming.get())return;const O=I.payload.resource.uri.toString();if(((R=this.monacoEditor.getModel())===null||R===void 0?void 0:R.uri.toString())===O){this.hideInput();const k=(0,c.localize)("aiNative.inline.chat.generating.canceled");k&&this.messageService.info(k)}})),this.featureDisposable.addDispose(this.inlineInputService.onHidden(()=>{this.hideInput()})),this.featureDisposable.addDispose(this.inlineInputService.onInteractiveInputVisibleInPosition(async I=>{I?this.showInputInEmptyLine(I,this.monacoEditor):setTimeout(()=>this.monacoEditor.focus(),0)})),this.featureDisposable.addDispose(this.inlineInputService.onInteractiveInputVisibleInSelection(I=>{I&&this.showInputInSelection(I,this.monacoEditor)})),this.featureDisposable.addDispose(this.inputDisposable),this.featureDisposable}cancelToken(){super.cancelToken(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1)}hideInput(){this.inlineInputWidgetStore.delete(this.monacoEditor.getModel().id),this.inputDisposable.dispose()}async showInputInEmptyLine(I,R,M){const O=R.getModel();if(!O)return;const P=R.getSelection();if(P&&!P.isEmpty())return;this.inputValue.set(M||"",void 0),this.inlineInputWidgetStore.set(O.id,new w.InlineInputWidgetStoreInEmptyLine(I,M)),this.inputDisposable&&(this.inputDisposable.dispose(),this.inputDisposable=new c.Disposable);const k=R.createDecorationsCollection(),F=this.injector.get(b.InlineInputWidget,[R,this.inputValue.get()]);k.append([{range:v.Range.fromPositions(I),options:a.ModelDecorationOptions.register({description:y.InlineInputPreviewDecorationID,isWholeLine:!0,className:S.default.input_decoration_readable_container,inlineClassName:S.default.inline_chat_inserted_range})}]);const L=k.getRange(0);let N;L&&(N=f.LineRange.fromRange(L),F.show({position:L.getStartPosition()}),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!0)),this.inputDisposable.addDispose(F.onDispose(()=>{this.cancelToken(),k.clear(),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!1)})),this.inputDisposable.addDispose(F.onValueChange(U=>{this.inputValue.set(U,void 0);const W=this.inlineInputWidgetStore.get(O.id);W instanceof w.InlineInputWidgetStoreInEmptyLine&&W.setValue(U)})),this.inputDisposable.addDispose(F.onResultClick(async U=>{const W=()=>{const j=k.getRange(0);O.pushStackElement(),O.pushEditOperations(null,[s.EditOperation.delete(j)],()=>null),O.pushStackElement()};switch(U){case g.EResultKind.ACCEPT:this.hideInput();break;case g.EResultKind.DISCARD:W(),this.hideInput();break;case g.EResultKind.REGENERATE:W(),requestAnimationFrame(()=>{const X=k.getRange(0).getStartPosition();this.showInputInEmptyLine(X,R,this.inputValue.get())});break;default:break}})),this.inputDisposable.addDispose(c.Event.debounce(k.onDidChange.bind(k),()=>{},c.FRAME_THREE)(()=>{if(!k.getRange(0))return;const U=k.getRange(0),W=f.LineRange.fromRange(U);N.equals(W)||(F.setOptions({position:U.getStartPosition()}),F.layoutContentWidget()),N=W})),this.inputDisposable.addDispose(F.onClose(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()?this.cancelToken():this.hideInput()})),this.inputDisposable.addDispose(F.onSend(async U=>{R.focus();const W=this.inlineInputService.getInteractiveInputHandler(),j=R.getModel();if(!W||!j)return;F.launchChatStatus(g.EInlineChatStatus.THINKING);const X=await this.inlineInputService.getInteractiveInputStrategyHandler()(R,U),V=v.Selection.fromPositions(I);if(X===d.ERunStrategy.EXECUTE&&W.execute){W.execute(R,V,U,this.token),F.launchChatStatus(g.EInlineChatStatus.DONE),this.hideInput();return}if(X===d.ERunStrategy.PREVIEW&&W.providePreviewStrategy){const $=await W.providePreviewStrategy(R,V,U,this.token);if(c.CancelResponse.is($)){F.launchChatStatus(g.EInlineChatStatus.READY),this.hideInput();return}if(E.InlineChatController.is($)){const Y=$;let G;const z=this.registerDispose(new c.RunOnceScheduler(()=>{const K=k.getRange(0);K&&G&&j.pushEditOperations(null,[s.EditOperation.replace(K,G)],()=>null)},c.FRAME_FIVE));this.inputDisposable.addDispose([Y.onData(async K=>{c.ReplyResponse.is(K)&&(this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!0),G=K.message,z.isScheduled()||z.schedule())}),Y.onError(K=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),F.launchChatStatus(g.EInlineChatStatus.READY)}),Y.onAbort(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),j.pushStackElement(),F.launchChatStatus(g.EInlineChatStatus.DONE)}),Y.onEnd(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),j.pushStackElement(),F.launchChatStatus(g.EInlineChatStatus.DONE)})]),Y.listen()}}})),this.inputDisposable.addDispose(F)}async showInputInSelection(I,R,M){this.inputDisposable&&(this.inputDisposable.dispose(),this.inputDisposable=new c.Disposable);const O=R.getModel();if(!O)return;const P=R.createDecorationsCollection();P.set([{range:v.Range.fromPositions({lineNumber:I.startLineNumber,column:1},{lineNumber:I.endLineNumber,column:R.getModel().getLineMaxColumn(I.endLineNumber)}),options:a.ModelDecorationOptions.register({description:y.InlineInputPreviewDecorationID,isWholeLine:!0,className:S.default.input_decoration_pending_container})}]);const k=v.Selection.fromRange(P.getRange(0),I.getDirection());this.inputValue.set(M||"",void 0),this.inlineInputWidgetStore.set(O.id,new w.InlineInputWidgetStoreInSelection(k,M));const F=this.injector.get(b.InlineInputWidget,[R,this.inputValue.get()]);F.show({selection:k}),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!0),this.inputDisposable.addDispose(F.onDispose(()=>{this.cancelToken(),P.clear(),this.aiNativeContextKey.inlineInputWidgetIsVisible.set(!1)})),this.inputDisposable.addDispose(F.onValueChange(L=>{this.inputValue.set(L,void 0);const N=this.inlineInputWidgetStore.get(O.id);N instanceof w.InlineInputWidgetStoreInSelection&&N.setValue(L)})),this.inputDisposable.addDispose(F.onClose(()=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.get()?this.cancelToken():this.hideInput()})),this.inputDisposable.addDispose(F.onSend(async L=>{R.focus();const N=this.inlineInputService.getInteractiveInputHandler();if(!N)return;if(F.launchChatStatus(g.EInlineChatStatus.THINKING),await this.inlineInputService.getInteractiveInputStrategyHandler()(R,L)===d.ERunStrategy.PREVIEW&&N.providePreviewStrategy){const W=await N.providePreviewStrategy(R,k,L,this.token);if(c.CancelResponse.is(W)){P.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),F.launchChatStatus(g.EInlineChatStatus.DONE);return}if(E.InlineChatController.is(W)){const j=W;this.inputDisposable.addDispose([j.onData(V=>{P.clear(),c.ReplyResponse.is(V)&&this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!0)}),j.onError(V=>{this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),F.launchChatStatus(g.EInlineChatStatus.READY)}),j.onAbort(()=>{P.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),F.launchChatStatus(g.EInlineChatStatus.DONE)}),j.onEnd(()=>{P.clear(),this.aiNativeContextKey.inlineInputWidgetIsStreaming.set(!1),F.launchChatStatus(g.EInlineChatStatus.DONE)})]),this.inlineDiffController.showPreviewerByStream(R,{crossSelection:k,chatResponse:j}).mountWidget(F),j.listen()}}else P.clear(),F.launchChatStatus(g.EInlineChatStatus.READY),this.hideInput()})),this.inputDisposable.addDispose(F.onResultClick(L=>{this.inlineDiffController.handleAction(L),this.hideInput(),L===g.EResultKind.REGENERATE&&requestAnimationFrame(()=>{this.showInputInSelection(k,R,this.inputValue.get())})})),this.inputDisposable.addDispose(F)}};t.InlineInputController=T,T.ID="editor.contrib.ai.inline.input",t.InlineInputController=T=n=r.__decorate([(0,o.Injectable)()],T)},74353:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57925),p=e(43718),v=e(20868),m=e(85679),_=e(77633),s=e(86443);let f=class extends p.Disposable{constructor(){super(...arguments),this.interactiveInputModel=new s.InteractiveInputModel,this._onInteractiveInputVisibleInPosition=new p.Emitter,this.onInteractiveInputVisibleInPosition=this._onInteractiveInputVisibleInPosition.event,this._onInteractiveInputVisibleInSelection=new p.Emitter,this.onInteractiveInputVisibleInSelection=this._onInteractiveInputVisibleInSelection.event,this._onHidden=new p.Emitter,this.onHidden=this._onHidden.event}visibleByPosition(h){this._onInteractiveInputVisibleInPosition.fire(h)}visibleBySelection(h){this._onInteractiveInputVisibleInSelection.fire(h)}async visibleByNearestCodeBlock(h,u){const d=await this.findNearestCodeBlockWithPosition(h,u);d&&this.visibleBySelection(d)}hide(){this._onHidden.fire()}getInteractiveInputHandler(){return this.interactiveInputModel.handler()}getInteractiveInputStrategyHandler(){return this.interactiveInputModel.strategyHandler()}async findNearestCodeBlockWithPosition(h,u){const d=u.getModel(),E=d?.getOffsetAt(h),g=d?.getLanguageId(),l=this.languageParserService.createParser(g),y=await l?.findNearestCodeBlockWithPosition(d?.getValue()||"",E);if(y)return new v.Selection(y.range.start.line+1,y.range.start.character,y.range.end.line+1,y.range.end.character)}getSequenceKeyString(){var h;const d=(h=this.keybindingRegistry.getKeybindingsForCommand(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id)[0])===null||h===void 0?void 0:h.resolved;return d?this.keybindingRegistry.acceleratorForSequence(d,"+"):""}registerInlineInput(h,u){return this.interactiveInputModel.setHandler(u),h.handleStrategy?this.interactiveInputModel.setStrategyHandler(h.handleStrategy):this.interactiveInputModel.setStrategyHandler(()=>h.strategy||_.ERunStrategy.EXECUTE),this.interactiveInputModel}};t.InlineInputService=f,n.__decorate([(0,r.Autowired)(o.KeybindingRegistry),n.__metadata("design:type",Object)],f.prototype,"keybindingRegistry",void 0),n.__decorate([(0,r.Autowired)(m.LanguageParserService),n.__metadata("design:type",m.LanguageParserService)],f.prototype,"languageParserService",void 0),t.InlineInputService=f=n.__decorate([(0,r.Injectable)()],f)},86443:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputWidgetStoreInSelection=t.InlineInputWidgetStoreInEmptyLine=t.InteractiveInputModel=void 0;const n=e(89195),r=e(43718);class o{setHandler(m){this._handler=m}handler(){return this._handler}setStrategyHandler(m){this._strategyHandler=m}strategyHandler(){return this._strategyHandler}dispose(){this._handler=void 0}}t.InteractiveInputModel=o,o.ID=`${n.InteractiveInput.displayName}:${(0,r.uuid)(4)}`;class c{constructor(m,_){this.position=m,this.value=_}getPosition(){return this.position}setPosition(m){this.position=m}getValue(){return this.value}setValue(m){this.value=m}}t.InlineInputWidgetStoreInEmptyLine=c;class p{constructor(m,_){this.selection=m,this.value=_}getSelection(){return this.selection}setSelection(m){this.selection=m}getValue(){return this.value}setValue(m){this.value=m}}t.InlineInputWidgetStoreInSelection=p},76755:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffComputer=void 0;const n=e(9514),r=e(52451),o=e(37348),c=e(44781),p=e(68450),v=e(56702),m=e(89216),_=e(10438),s=e(30861),f=e(46739),a=(u,d,E=p.InfiniteTimeout.instance)=>{if(!u.length||!d.length)return p.DiffAlgorithmResult.trivial(u,d);const g=new _.Array2D(2*u.length+1,d.length+1),l=new _.Array2D(2*u.length+1,d.length+1);for(let D=0;D<=d.length;D++)g.set(0,D,D),l.set(0,D,D>0);for(let D=0;D<=2*u.length;D++)g.set(D,0,Math.floor((D+1)/2)),l.set(D,0,!1);for(let D=1;D<=d.length;D++)for(let I=1;I<=2*u.length;I++){if(!E.isValid())return p.DiffAlgorithmResult.trivialTimedOut(u,d);if(I%2===0){const R=g.get(I,D-1)+1,M=g.get(I-1,D),O=R<M;g.set(I,D,O?R:M),l.set(I,D,O)}else{const R=g.get(I-1,D)+.4,M=u.getElement(Math.floor(I/2))===d.getElement(D-1)?g.get(I-1,D-1):Number.MAX_VALUE,O=M<R;g.set(I,D,O?M:R),l.set(I,D,O)}}let y=Number.MAX_VALUE,b=-1;for(let D=0;D<=2*u.length;D++){const I=g.get(D,d.length);I<y&&(y=I,b=D)}const S=[];let A=b,w=d.length;A<=2*u.length-2&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor((A+1)/2),u.length),new o.OffsetRange(w,w)));let T;for(;A>=0&&w>=0;)l.get(A,w)?(A%2===0?T===void 0&&(T={originalLineIndex:Math.floor(A/2),modifiedLineIndex:w}):(T!==void 0&&((T.originalLineIndex!==Math.floor(A/2)+1||T.modifiedLineIndex!==w)&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,T.originalLineIndex),new o.OffsetRange(w,T.modifiedLineIndex))),T=void 0),A-=1),w-=1):(T=T||{originalLineIndex:Math.floor((A+1)/2),modifiedLineIndex:w},A-=1);return T!==void 0&&((T.originalLineIndex!==Math.floor(A/2)+1||T.modifiedLineIndex!==w)&&S.push(new p.SequenceDiff(new o.OffsetRange(Math.floor(A/2)+1,T.originalLineIndex),new o.OffsetRange(w,T.modifiedLineIndex))),T=void 0),S.reverse(),new p.DiffAlgorithmResult(S,!1)};class h extends v.DefaultLinesDiffComputer{computeDiff(d,E,g){if(d.length<=1&&(0,n.equals)(d,E,(P,k)=>P===k))return new s.LinesDiff([],[],!1);if(d.length===1&&d[0].length===0||E.length===1&&E[0].length===0)return new s.LinesDiff([new f.DetailedLineRangeMapping(new r.LineRange(1,d.length+1),new r.LineRange(1,E.length+1),[new f.RangeMapping(new c.Range(1,1,d.length,d[d.length-1].length+1),new c.Range(1,1,E.length,E[E.length-1].length+1))])],[],!1);const l=g.maxComputationTimeMs===0?p.InfiniteTimeout.instance:new p.DateTimeout(g.maxComputationTimeMs),y=new Map;function b(P){let k=y.get(P);return k===void 0&&(k=y.size,y.set(P,k)),k}const S=d.length*E.length<1e6&&g.onlyCareAboutPrefixOfOriginalLines,A=d.map(P=>b(S?P:P.trim())),w=E.map(P=>b(S?P:P.trim())),T=new m.LineSequence(A,d),D=new m.LineSequence(w,E),I=d.every(P=>P.trim().length===0);let R;S?I?R=p.DiffAlgorithmResult.trivial(T,D):R=a(T,D,l):T.length+D.length<1700?R=this.dynamicProgrammingDiffing.compute(T,D,l,(P,k)=>d[P]===E[k]?E[k].length===0?.1:1+Math.log(1+E[k].length):.99):R=this.myersDiffingAlgorithm.compute(T,D,l);const M=R.diffs,O=R.hitTimeout;if(S){const P=M.map(k=>new f.DetailedLineRangeMapping(new r.LineRange(k.seq1Range.start+1,k.seq1Range.endExclusive+1),new r.LineRange(k.seq2Range.start+1,k.seq2Range.endExclusive+1),[]));return new s.LinesDiff(P,[],O)}return super.computeDiff(d,E,g)}}t.InlineStreamDiffComputer=h},33062:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReverseInlineStreamDiffHandler=t.InlineStreamDiffHandler=t.BaseInlineStreamDiffHandler=t.EComputerMode=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(20868),p=e(60304),v=e(28423),m=e(52451),_=e(84968),s=e(46739),f=e(87822),a=e(99093),h=e(25539),u=e(76755),d=e(80715);var E;(function(S){S.legacy="legacy",S.default="default"})(E||(t.EComputerMode=E={}));const g=new u.InlineStreamDiffComputer;let l=class extends o.Disposable{get uri(){return this.savedModel.uri}constructor(A){super(),this.monacoEditor=A,this._onDidEditChange=this.registerDispose(new o.Emitter),this.onDidEditChange=this._onDidEditChange.event,this.onDiffFinishedEmitter=this.registerDispose(new o.Emitter),this.onDiffFinished=this.onDiffFinishedEmitter.event,this.undoRedoGroup=new h.UndoRedoGroup,this.finallyDiffModel=(0,v.observableValue)(this,void 0),this.currentEditLine=0,this.isEditing=!1;const w=p.StandaloneServices.get(f.IModelService),T=this.monacoEditor.getModel(),D=w.createModel("",null,o.Uri.from({scheme:o.Schemes.inMemory,path:"inline-stream-diff/"+(0,o.randomString)(8)}),!0);this.savedModel=T,this.virtualModel=D,this.livePreviewDiffDecorationModel=this.injector.get(d.LivePreviewDiffDecorationModel,[this.monacoEditor]),this.addDispose(this.livePreviewDiffDecorationModel),this.addDispose(this.virtualModel);const I=this.livePreviewDiffDecorationModel.onDispose(()=>{this.dispose(),I.dispose()})}setPreviewerOptions(A){this.previewerOptions=A,this.livePreviewDiffDecorationModel.setPreviewerOptions({partialEditWidgetOptions:{hideAcceptPartialEditWidget:A.hideAcceptPartialEditWidget},renderRemovedWidgetImmediately:A.renderRemovedWidgetImmediately})}getVirtualModelValue(){return this.virtualModel.getValue()}getOriginModelValue(){return this.rawSavedTextLines.join(`
|
|
30744
30744
|
`)}get onPartialEditWidgetListChange(){return this.livePreviewDiffDecorationModel.onPartialEditWidgetListChange}computeDiff(A,w,T=E.default){const D=(T===E.default?g:_.linesDiffComputers.getLegacy()).computeDiff(A,w,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1,onlyCareAboutPrefixOfOriginalLines:!0});let I=D.changes;D.hitTimeout&&(I=[new s.DetailedLineRangeMapping(new m.LineRange(1,A.length+1),new m.LineRange(1,w.length+1),void 0)]);const R=[];let M=[];for(const F of I)if(F.modified.endLineNumberExclusive===w.length+1&&T===E.default){if(M=A.slice(F.original.startLineNumber-1,F.original.endLineNumberExclusive-1),F.modified.isEmpty)continue;R.push({removedTextLines:[],removedLinesOriginalRange:new m.LineRange(F.original.startLineNumber,F.original.startLineNumber),addedRange:F.modified,relativeInnerChanges:void 0})}else R.push({removedTextLines:A.slice(F.original.startLineNumber-1,F.original.endLineNumberExclusive-1),removedLinesOriginalRange:F.original,addedRange:F.modified,relativeInnerChanges:F.innerChanges?F.innerChanges.map(L=>({originalRange:L.originalRange.delta(-F.original.startLineNumber+1),modifiedRange:L.modifiedRange.delta(-F.modified.startLineNumber+1)})):void 0});const O=[...w,...M];let P=0,k=new m.LineRange(1,1);return M.length>0&&(P=w.length+1,k=new m.LineRange(w.length+1,w.length+1+M.length)),{changes:R,newFullRangeTextLines:O,activeLine:P,pendingRange:k}}calculateAddedDecorationCollectionState(A){const w=this.getZone();return A.changes.map(D=>{const I=D.addedRange,R={lineNumber:w.startLineNumber+I.startLineNumber-1,column:1},M={lineNumber:w.startLineNumber+I.endLineNumberExclusive-2,column:1};return{startPosition:R,endPosition:M,len:I.endLineNumberExclusive-I.startLineNumber}})}renderPartialEditWidgets(A){const w=this.calculateAddedDecorationCollectionState(A);this.livePreviewDiffDecorationModel.touchPartialEditWidgets(w.map(T=>T.startPosition.lineNumber))}renderAddedRangeDecoration(A){const w=this.calculateAddedDecorationCollectionState(A);this.livePreviewDiffDecorationModel.touchAddedRange(w)}renderRemovedRangeDecoration(A){const{changes:w}=A,T=this.getZone();let D=0;const I=[];for(const R of w){const{removedTextLines:M,removedLinesOriginalRange:O,addedRange:P}=R;M.length>0&&I.push({position:{column:1,lineNumber:T.startLineNumber+O.startLineNumber-2-D},textLines:M.map((k,F)=>{var L;return{text:k,lineTokens:((L=this.rawOriginTextLinesTokens)===null||L===void 0?void 0:L[O.startLineNumber-1+F])||a.LineTokens.createEmpty(k,{encodeLanguageId:()=>0,decodeLanguageId:()=>"plaintext"})}})}),D+=O.length-P.length}this.livePreviewDiffDecorationModel.touchRemovedWidget(I,()=>{this._onDidEditChange.fire()})}pushStackElement(){const A=this.livePreviewDiffDecorationModel.createEditStackElement(this.undoRedoGroup);A.attachModel(this.livePreviewDiffDecorationModel),A.registerUndo(w=>{w.dispose()})}renderDiffEdits(A){const{activeLine:w,newFullRangeTextLines:T,pendingRange:D}=A,I=this.getZone(),R=this.getOriginalModel(),M=R.getEOL(),O=I.startLineNumber<I.endLineNumberExclusive?new c.Range(I.startLineNumber,1,I.endLineNumberExclusive-1,R.getLineMaxColumn(I.endLineNumberExclusive-1)):new c.Range(I.startLineNumber,1,I.startLineNumber,1),P=R.getValueInRange(O).split(M),k=_.linesDiffComputers.getDefault().computeDiff(P,T,{computeMoves:!1,maxComputationTimeMs:200,ignoreTrimWhitespace:!1}),F=[];if(k.hitTimeout){let L=T.join(M);O.isEmpty()&&(L+=M);const N={range:O,text:L,forceMoveMarkers:!1};F.push(N)}else for(const L of k.changes){let N=T.slice(L.modified.startLineNumber-1,L.modified.endLineNumberExclusive-1).join(M),U;L.original.isEmpty?(U=new c.Range(O.startLineNumber+L.original.startLineNumber-1,1,O.startLineNumber+L.original.startLineNumber-1,1),N+=M):L.modified.isEmpty?(U=new c.Range(O.startLineNumber+L.original.startLineNumber-1,1,O.startLineNumber+L.original.endLineNumberExclusive-1,1),N=null):U=new c.Range(O.startLineNumber+L.original.startLineNumber-1,1,O.startLineNumber+L.original.endLineNumberExclusive-2,R.getLineMaxColumn(O.startLineNumber+L.original.endLineNumberExclusive-2));const W={range:U,text:N,forceMoveMarkers:!1};F.push(W)}R.pushEditOperations(null,F,()=>null,this.undoRedoGroup),this.livePreviewDiffDecorationModel.updateZone(new m.LineRange(I.startLineNumber,I.startLineNumber+T.length)),w>0?this.livePreviewDiffDecorationModel.touchActiveLine(w):this.livePreviewDiffDecorationModel.clearActiveLine(),this.renderAddedRangeDecoration(A),D.length>0?this.livePreviewDiffDecorationModel.touchPendingRange(D):this.livePreviewDiffDecorationModel.clearPendingLine(),this.renderRemovedRangeDecoration(A),this._onDidEditChange.fire()}recompute(A,w){w&&this.virtualModel.setValue(w);const T=this.virtualModel.getLinesContent();return this.processDiffComputation(T,A)}async rateRenderEditController(){var A;if(this.isEditing===!1){for(this.isEditing=!0;this.currentEditLine<=this.virtualModel.getLinesContent().length;){if(this.disposed)return;const D=this.virtualModel.getLinesContent().slice(0,this.currentEditLine),I=this.processDiffComputation(D);this.savedModel.id===((A=this.monacoEditor.getModel())===null||A===void 0?void 0:A.id)&&this.renderDiffEdits(I),this.currentEditLine+=1,await(0,o.sleep)(o.FRAME_THREE)}const w=this.finallyDiffModel.get();w&&this.finallyRender(w),this.isEditing=!1}}addLinesToDiff(A,w=E.default){this.recompute(w,A)}pushRateFinallyDiffStack(A){(0,v.transaction)(w=>{this.finallyDiffModel.set(A,w),this.isEditing===!1&&this.finallyRender(A)})}finallyRender(A){var w;(0,v.transaction)(T=>{this.finallyDiffModel.set(A,T)}),this.savedModel.id===((w=this.monacoEditor.getModel())===null||w===void 0?void 0:w.id)&&(this.onDiffFinishedEmitter.fire(A),!this.livePreviewDiffDecorationModel.disposed&&(this.renderPartialEditWidgets(A),this.renderDiffEdits(A),this.pushStackElement(),this.monacoEditor.focus()))}hide(){this.livePreviewDiffDecorationModel.hide()}resume(){this.finallyDiffModel.get()||this.rateRenderEditController(),this.livePreviewDiffDecorationModel.resume()}acceptAll(){this.livePreviewDiffDecorationModel.acceptUnProcessed(),this.dispose()}rejectAll(){this.livePreviewDiffDecorationModel.discardUnProcessed(),this.dispose()}revealFirstDiff(){this.livePreviewDiffDecorationModel.revealFirstDiff()}getZone(){return this.livePreviewDiffDecorationModel.getZone()}getTotalCodeInfo(){return this.livePreviewDiffDecorationModel.getTotalCodeInfo()}};t.BaseInlineStreamDiffHandler=l,n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],l.prototype,"injector",void 0),t.BaseInlineStreamDiffHandler=l=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object])],l);let y=class extends l{initialize(A){const w=this.savedModel.getEOL(),T=A.getStartPosition(),D=A.getEndPosition();this.rawSavedTextLines=this.savedModel.getValueInRange(c.Range.fromPositions(T,D)).split(w);const I=m.LineRange.fromRangeInclusive(c.Range.fromPositions({lineNumber:A.startLineNumber,column:1},{lineNumber:A.endLineNumber,column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(I),this.rawOriginTextLinesTokens=this.rawSavedTextLines.map((R,M)=>{const O=T.lineNumber+M;return this.savedModel.tokenization.forceTokenization(O),this.savedModel.tokenization.getLineTokens(O)})}processDiffComputation(A,w){return this.computeDiff(this.rawSavedTextLines,A,w)}getOriginalModel(){return this.savedModel}};t.InlineStreamDiffHandler=y,t.InlineStreamDiffHandler=y=n.__decorate([(0,r.Injectable)({multiple:!0})],y);let b=class extends l{recompute(A,w){const T=super.recompute(A,w);return this.rawOriginTextLinesTokens=this.virtualModel.getLinesContent().map((D,I)=>{const R=I+1;return this.virtualModel.tokenization.forceTokenization(R),this.virtualModel.tokenization.getLineTokens(R)}),T}initialize(){const A=this.savedModel.getEOL();this.rawSavedTextLines=this.savedModel.getValue().split(A);const w=m.LineRange.fromRangeInclusive(c.Range.fromPositions({lineNumber:1,column:1},{lineNumber:this.virtualModel.getLineCount(),column:Number.MAX_SAFE_INTEGER}));this.livePreviewDiffDecorationModel.initialize(w)}getOriginalModel(){return this.virtualModel}processDiffComputation(A,w){return this.computeDiff(A,this.rawSavedTextLines,w)}};t.ReverseInlineStreamDiffHandler=b,t.ReverseInlineStreamDiffHandler=b=n.__decorate([(0,r.Injectable)({multiple:!0})],b)},22169:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineStreamDiffService=void 0;const n=e(85608),r=e(76003),o=e(43718);let c=class{constructor(){this._onAcceptDiscardPartialEdit=new o.Emitter,this.onAcceptDiscardPartialEdit=this._onAcceptDiscardPartialEdit.event}launchAcceptDiscardPartialEdit(v){this._onAcceptDiscardPartialEdit.fire(v)}};t.InlineStreamDiffService=c,t.InlineStreamDiffService=c=n.__decorate([(0,r.Injectable)()],c)},54362:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LivePreviewUndoRedoStackElement=void 0;const n=e(25539);class r{get type(){return n.UndoRedoElementType.Resource}get label(){return"Live.Preview.UndoRedo"}get code(){return"Live.Preview.UndoRedo"}get resource(){return this.model.uri}constructor(c){this.model=c,this.confirmBeforeUndo=!1}attachModel(c){this.decorationModel=c}registerUndo(c){this._undo=c}undo(){var c;(c=this._undo)===null||c===void 0||c.call(this,this.decorationModel)}registerRedo(c){this._redo=c}redo(){var c;(c=this._redo)===null||c===void 0||c.call(this,this.decorationModel)}}t.LivePreviewUndoRedoStackElement=r},8106:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.AddedRangeDecorationsCollection=t.RemovedZoneWidget=t.AcceptPartialEditWidget=t.PendingRangeDecoration=t.AddedRangeDecoration=t.ActiveLineDecoration=void 0;const r=e(85608),o=r.__importDefault(e(53373)),c=r.__importStar(e(14041)),p=r.__importDefault(e(25873)),v=e(76003),m=e(41869),_=e(57925),s=e(43718),f=e(52659),a=e(90052),h=e(31324),u=e(34819),d=e(53617),E=e(24522),g=r.__importDefault(e(71749));t.ActiveLineDecoration="activeLine-decoration",t.AddedRangeDecoration="added-range-decoration",t.PendingRangeDecoration="pending-range-decoration";const l=T=>{const{keyStrings:D,onAccept:I,onDiscard:R,editor:M}=T,[O,P]=c.default.useState(0),k=(0,c.useCallback)(()=>{I?.()},[I]),F=(0,c.useCallback)(()=>{R?.()},[R]);return(0,m.useDisposable)(()=>M.onDidScrollChange(L=>{const{scrollLeftChanged:N,scrollLeft:U}=L;N&&P(U)}),[M]),c.default.createElement("div",{className:(0,o.default)("kt-inline-diff-accept-partial-widget-container",g.default.inline_diff_accept_partial_widget_container),style:{marginLeft:O}},c.default.createElement("div",{className:g.default.content},c.default.createElement("span",{className:(0,o.default)(g.default.accept_btn,g.default.btn),onClick:k},(0,s.localize)("aiNative.inline.diff.accept"),c.default.createElement("span",null,D.acceptSequence)),c.default.createElement("span",{className:(0,o.default)(g.default.discard_btn,g.default.btn),onClick:F},(0,s.localize)("aiNative.inline.diff.reject"),c.default.createElement("span",null,D.discardSequence))))};let y=n=class extends f.ReactInlineContentWidget{constructor(D,I){super(D),this.editor=D,this.editWidgetOptions=I,this._onAccept=this.registerDispose(new s.Emitter),this.onAccept=this._onAccept.event,this._onDiscard=this.registerDispose(new s.Emitter),this.onDiscard=this._onDiscard.event,this.positionPreference=[a.ContentWidgetPositionPreference.EXACT],this.addedLinesCount=0,this.deletedLinesCount=0,this.status="pending"}get group(){return this._group}getSequenceKeyStrings(){let D=this.keybindingRegistry.getKeybindingsForCommand(_.AI_INLINE_DIFF_PARTIAL_EDIT.id);if(D=D.sort((I,R)=>R.args-I.args),!(!D||D.length!==2&&D.some(I=>(0,s.isUndefined)(I.resolved))))return{acceptSequence:this.keybindingRegistry.acceleratorForSequence(D[0].resolved,"")[0],discardSequence:this.keybindingRegistry.acceleratorForSequence(D[1].resolved,"")[0]}}renderView(){var D;if(!((D=this.editWidgetOptions)===null||D===void 0)&&D.hideAcceptPartialEditWidget)return;const I=this.getSequenceKeyStrings();if(I)return c.default.createElement(l,{keyStrings:I,onAccept:()=>this._onAccept.fire(),onDiscard:()=>this._onDiscard.fire(),editor:this.editor})}id(){return this._id||(this._id=`${n.ID}_${(0,s.uuid)(4)}`),this._id}getClassName(){return g.default.accept_partial_edit_widget_id}recordAddedRangeId(D){this._addedRangeId=D}getAddedRangeId(){return this._addedRangeId}resume(){this.status="pending",this.addedLinesCount=0,this.deletedLinesCount=0,super.resume()}setGroup(D){this._group=D}get isPending(){return this.status==="pending"}accept(D,I){this.status="accept",this.addedLinesCount=D,this.deletedLinesCount=I,super.hide()}get isAccepted(){return this.status==="accept"}discard(D,I){this.status="discard",this.addedLinesCount=D,this.deletedLinesCount=I,super.hide()}get isRejected(){return this.status==="discard"}};t.AcceptPartialEditWidget=y,y.ID="AcceptPartialEditWidgetID",r.__decorate([(0,v.Autowired)(m.KeybindingRegistry),r.__metadata("design:type",Object)],y.prototype,"keybindingRegistry",void 0),t.AcceptPartialEditWidget=y=n=r.__decorate([(0,v.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object,Object])],y);const b=({dom:T,editor:D})=>{const I=c.default.useRef(null),[R,M]=c.default.useState(0),[O,P]=c.default.useState(0);return(0,c.useEffect)(()=>{T&&I&&I.current&&I.current.appendChild(T)},[T,I]),(0,m.useDisposable)(()=>D.onDidScrollChange(k=>{const{scrollLeftChanged:F,scrollLeft:L}=k;F&&M(L)}),[D]),(0,m.useDisposable)(()=>(P(D.getOption(h.EditorOption.layoutInfo).contentLeft),D.onDidChangeConfiguration(k=>{k.hasChanged(h.EditorOption.layoutInfo)&&P(D.getOption(h.EditorOption.layoutInfo).contentLeft)})),[D]),c.default.createElement("div",{className:g.default.inline_diff_remove_zone_fixed_box,style:{marginLeft:O+"px"}},c.default.createElement("div",{className:g.default.inline_diff_remove_zone,ref:I,style:{marginLeft:-R+"px"}}))};class S extends u.ZoneWidget{get isHidden(){return this._hidden}get group(){return this._group}constructor(D,I,R){super(D,R),this.textLines=I,this._hidden=!1,this.status="pending",(0,s.isDefined)(R.isHidden)&&(this._hidden=R.isHidden),(0,s.isDefined)(R.recordPosition)&&(this._recordPosition=R.recordPosition),(0,s.isDefined)(R.undoRedoGroup)&&(this._group=R.undoRedoGroup);const M=this._positionMarkerId;this._disposables.add(M.onDidChange(O=>{const P=M.getRange(0);P&&(this._recordPosition=P.getStartPosition())}))}setGroup(D){this._group=D}_fillContainer(D){D.classList.add(g.default.inline_diff_remove_zone_widget_container),this.root=p.default.createRoot(D)}getRemovedTextLines(){return this.textLines.map(D=>D.text)}get height(){return this.textLines.length}getLastPosition(){return this.position||this._recordPosition}accept(){this.status="accept",this.hide()}discard(){this.status="discard",super.hide()}hide(){this._hidden=!0,super.hide()}resume(){this.status="pending";const D=this.getLastPosition();D&&this.show(D,this.height)}show(D,I){this._hidden=!1,this.status="pending",super.show(D,I)}revealRange(){}create(){super.create(),this.mountRender()}mountRender(){const D=document.createElement("div");(0,E.renderLines)(D,this.editor.getOption(h.EditorOption.tabIndex),this.textLines.map(({text:I,lineTokens:R})=>({content:I,decorations:[],lineTokens:R})),this.editor.getOptions()),this.root.render(c.default.createElement(b,{dom:D,editor:this.editor}))}dispose(){this.root.unmount(),super.dispose()}}t.RemovedZoneWidget=S;class A extends d.DeltaDecorations{constructor(){super(...arguments),this.status="pending"}accept(){this.status="accept",super.hide()}discard(){this.status="discard",super.hide()}}class w extends d.EnhanceDecorationsCollection{createDecorations(D){return new A(D)}}t.AddedRangeDecorationsCollection=w},80715:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LivePreviewDiffDecorationModel=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(43718),v=e(20868),m=e(60304),_=e(72665),s=e(2261),f=e(24347),a=e(25539),h=e(19413),u=e(69820),d=e(77659),E=r.__importDefault(e(71749)),g=e(22169),l=e(54362),y=e(8106);let b=n=class extends p.Disposable{get partialEditWidgetCount(){return this.partialEditWidgetList.length}constructor(A){super(),this.monacoEditor=A,this._onPartialEditWidgetListChange=this.registerDispose(new p.Emitter),this.onPartialEditWidgetListChange=this._onPartialEditWidgetListChange.event,this.options={partialEditWidgetOptions:{}},this.partialEditWidgetList=[],this.removedZoneWidgets=[],this.currentChangeIndex=0,this.model=this.monacoEditor.getModel(),this.undoRedoService=m.StandaloneServices.get(a.IUndoRedoService),this.aiNativeContextKey=this.injector.get(d.AINativeContextKey,[this.monacoEditor.contextKeyService]),this.activeLineDec=this.monacoEditor.createDecorationsCollection(),this.pendingRangeDec=this.monacoEditor.createDecorationsCollection(),this.addDispose(this.inlineStreamDiffService.onAcceptDiscardPartialEdit(w=>{const T=this.monacoEditor.getPosition(),D=this.partialEditWidgetList.filter(I=>!I.isHidden).sort((I,R)=>{var M,O,P,k;const F=((O=(M=I.getPosition())===null||M===void 0?void 0:M.position)===null||O===void 0?void 0:O.lineNumber)||1,L=((k=(P=R.getPosition())===null||P===void 0?void 0:P.position)===null||k===void 0?void 0:k.lineNumber)||1,N=Math.abs(T.lineNumber-F),U=Math.abs(T.lineNumber-L);return N-U});D.length>0&&this.handlePartialEditAction(w?u.EPartialEdit.accept:u.EPartialEdit.discard,D[0])})),this.addedRangeDec=new y.AddedRangeDecorationsCollection(this.monacoEditor),this.addDispose(this.addedRangeDec.onDidDecorationsChange(w=>{this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.get()&&this.partialEditWidgetList.forEach(D=>{const I=w.find(R=>D.getAddedRangeId()===R.id);if(I){const R=I.getRange();D.setOptions({position:{lineNumber:R.startLineNumber,column:1}}),D.layoutContentWidget()}})})),this.addDispose(p.Disposable.create(()=>this.clear()))}clear(){this.clearPendingLine(),this.clearActiveLine(),this.clearAddedLine(),this.clearRemovedWidgets(),this.clearPartialEditWidgetList()}hide(){this.addedRangeDec.getDecorations().forEach(A=>A.hide()),this.partialEditWidgetList.forEach(A=>A.hide()),this.removedZoneWidgets.forEach(A=>A.hide()),this.activeLineDec.clear(),this.pendingRangeDec.clear()}resume(){this.addedRangeDec.getDecorations().forEach(A=>A.status==="pending"&&A.resume()),this.partialEditWidgetList.forEach(A=>A.status==="pending"&&A.resume()),this.removedZoneWidgets.forEach(A=>A.status==="pending"&&A.resume())}initialize(A){this.updateZone(A)}getRemovedWidgets(){return this.removedZoneWidgets}showRemovedWidgetByLineNumber(A,w,T){const D=new v.Position(A,1),I=w.length,R=new y.RemovedZoneWidget(this.monacoEditor,w,{...T,showInHiddenAreas:!0,showFrame:!1,showArrow:!1});R.create(),this.removedZoneWidgets.push(R),T.isHidden?R.hide():R.show(D,I)}updateZone(A){this.zone=A}getZone(){return this.zone}touchActiveLine(A){const w=this.getZone();this.activeLineDec.set([{range:v.Range.fromPositions({lineNumber:w.startLineNumber+A-1,column:0}),options:f.ModelDecorationOptions.register({description:y.ActiveLineDecoration,isWholeLine:!0,className:E.default.inline_diff_current,zIndex:c.StackingLevel.Workbench})}])}doDiscardPartialWidget(A,w,T){let D=null,I=0,R=0;if(w&&w.length>0){const M=w.getRange();D=s.EditOperation.delete(v.Range.lift({startLineNumber:M.startLineNumber,startColumn:M.startColumn,endLineNumber:M.endLineNumber+1,endColumn:1})),I=w.length,w.hide()}if(T){const M=T.getLastPosition(),O=this.model.getEOL(),P=T.getRemovedTextLines();R=P.length;const k=P.join(O)+O;D?D=s.EditOperation.replace(v.Range.lift(D.range),k):D=s.EditOperation.insert(M.delta(1),k),T.hide()}return A.discard(I,R),D}handlePartialEditAction(A,w,T=!0,D=!1){const I=w.getPosition().position,R=this.aiReporter.getRelationId(),M=this.model,O=this.removedZoneWidgets.find(K=>K.getLastPosition().lineNumber===Math.max(1,I.lineNumber-1)),P=this.addedRangeDec.getDecorationByLineNumber(I.lineNumber),k=P?.length||0,F=O?.height||0,L=new a.UndoRedoGroup;w.setGroup(L),O?.setGroup(L),P?.setGroup(L);const N=K=>K.partialEditWidgetList.find(Z=>Z.group===L),U=K=>K.removedZoneWidgets.find(Z=>Z.group===L),W=K=>K.addedRangeDec.getDecorationByGroup(L);let j;const X=O?.getRemovedTextLines().join(`
|
|
30745
|
-
`)||"",V=P?.getRange();V&&(j=M.getValueInRange({...V,endColumn:M.getLineMaxColumn(V.endLineNumber)}));const $=K=>{D&&this.aiReporter.end(R,{message:"discard",success:!0,isDrop:!0,code:j,originCode:X,actionSource:p.ActionSourceEnum.InlineChat,actionType:p.ActionTypeEnum.LineDiscard});const Z=U(K);Z?.discard();const Q=W(K);Q?.discard();const oe=N(K);return this.doDiscardPartialWidget(oe,Q,Z)},Y=K=>{D&&this.aiReporter.end(R,{message:"accept",success:!0,isReceive:!0,code:j,originCode:X,actionSource:p.ActionSourceEnum.InlineChat,actionType:p.ActionTypeEnum.lineAccept});const Z=N(K);Z?.accept(k,F);const Q=U(K);Q?.accept();const oe=W(K);oe?.accept()},G=K=>{const Z=N(K);Z?.resume();const Q=U(K);Q?.resume();const oe=W(K);oe?.resume()};switch(A){case u.EPartialEdit.accept:if(Y(this),T){const K=this.createEditStackElement(L);K.attachModel(this),K.registerUndo(Z=>{G(Z)}),K.registerRedo(Z=>{Y(Z)})}break;case u.EPartialEdit.discard:{const K=$(this);if(K){if(T){const Z=this.createEditStackElement(L);Z.attachModel(this),Z.registerUndo(Q=>{G(Q)}),Z.registerRedo(Q=>{$(Q)})}M.pushStackElement(),M.pushEditOperations(null,[K],()=>null,L),M.pushStackElement()}}break;default:break}const z={uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter(K=>K.isHidden).length,acceptPartialEditCount:this.partialEditWidgetList.filter(K=>K.isAccepted).length,currentPartialEdit:{addedLinesCount:k,deletedLinesCount:F,type:A},...this.getTotalCodeInfo()};this.monacoEditor.focus(),this.inlineDiffService.firePartialEdit(z),this.firePartialEditWidgetList()}firePartialEditWidgetList(){this._onPartialEditWidgetListChange.fire(this.partialEditWidgetList);const A=this.partialEditWidgetList.filter(w=>!w.isHidden);this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(A.length!==0)}createEditStackElement(A){const w=new l.LivePreviewUndoRedoStackElement(this.model);return this.undoRedoService.pushElement(w,A),w}static computeCodeInfo(A,w,T){const D=R(A),I={added:0,deleted:0,changed:0};return A.forEach((M,O)=>{if(M.status==="pending"){const P=w[O],k=T[O],F=P?.length||0,L=k?.height||0;I.added+=F,I.deleted+=L,I.changed+=Math.max(F,L)}}),{totalAddedLinesCount:D.added,totalDeletedLinesCount:D.deleted,totalChangedLinesCount:D.changed,unresolvedAddedLinesCount:I.added,unresolvedDeletedLinesCount:I.deleted,unresolvedChangedLinesCount:I.changed};function R(M){const O={added:0,deleted:0,changed:0};return M.forEach(P=>{const k=P.addedLinesCount,F=P.deletedLinesCount;O.added+=k,O.deleted+=F,O.changed+=Math.max(k,F)}),O}}getTotalCodeInfo(){const A=this.partialEditWidgetList,w=this.addedRangeDec.getDecorations(),T=this.removedZoneWidgets;return n.computeCodeInfo(A,w,T)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(A=>{var w,T;const D=(T=(w=A.getPosition())===null||w===void 0?void 0:w.position)===null||T===void 0?void 0:T.lineNumber;if(D){const I=this.addedRangeDec.getDecorationByLineNumber(D);I&&A.recordAddedRangeId(I.id)}})}acceptUnProcessed(){this.partialEditWidgetList.filter(w=>w.isPending).forEach(w=>{this.handlePartialEditAction(u.EPartialEdit.accept,w,!1)})}discardUnProcessed(){this.partialEditWidgetList.filter(w=>w.isPending).forEach(w=>{this.handlePartialEditAction(u.EPartialEdit.discard,w,!1)})}createPartialEditWidget(A){const w=this.injector.get(y.AcceptPartialEditWidget,[this.monacoEditor,this.options.partialEditWidgetOptions]);w.show({position:{lineNumber:A,column:1}});const T=w.onDispose(()=>{const D=w.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(I=>I.getId()!==D),T.dispose()});return w.addDispose([w.onAccept(()=>{this.handlePartialEditAction(u.EPartialEdit.accept,w,!0,!0)}),w.onDiscard(()=>{this.handlePartialEditAction(u.EPartialEdit.discard,w,!0,!0)})]),w}touchPartialEditWidgets(A){this.clearPartialEditWidgetList(),this.partialEditWidgetList=A.map(w=>this.createPartialEditWidget(w)),this.firePartialEditWidgetList()}touchAddedRange(A){this.addedRangeDec.set(A.map(w=>{const T=w.startPosition,D=w.endPosition,I=w.len;let R=v.Range.fromPositions(T,D),M=E.default.inline_diff_added_range+" ";return I===0&&(R=v.Range.fromPositions(T),M+=E.default.hide),{length:I,range:R,isHidden:I===0,options:f.ModelDecorationOptions.register({description:y.AddedRangeDecoration,isWholeLine:!0,className:M})}})),this.recordPartialEditWidgetWithAddedDec()}touchRemovedWidget(A,w){const T=()=>{this.clearRemovedWidgets(),A.forEach(({textLines:D,position:I})=>{this.showRemovedWidgetByLineNumber(I.lineNumber,D,{})}),w?.()};this.options.renderRemovedWidgetImmediately?T():this.addDispose((0,p.runWhenIdle)(T))}touchPendingRange(A){const w=this.getZone();this.pendingRangeDec.set([{range:v.Range.fromPositions({lineNumber:w.startLineNumber+A.startLineNumber-1,column:0},{lineNumber:w.startLineNumber+A.endLineNumberExclusive-2,column:Number.MAX_SAFE_INTEGER}),options:f.ModelDecorationOptions.register({description:y.PendingRangeDecoration,isWholeLine:!0,className:E.default.inline_diff_pending_range})}])}clearPendingLine(){this.pendingRangeDec.clear()}clearActiveLine(){this.activeLineDec.clear()}clearAddedLine(){this.addedRangeDec.clear()}clearPartialEditWidgetList(){this.partialEditWidgetList.forEach(A=>{A.dispose()}),this.partialEditWidgetList=[],this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(!1)}clearRemovedWidgets(){this.removedZoneWidgets.forEach(A=>{A.dispose()}),this.removedZoneWidgets=[]}revealFirstDiff(){const A=this.removedZoneWidgets[0];if(A){const w=A.getLastPosition();w&&this.monacoEditor.revealLineInCenterIfOutsideViewport(w.lineNumber)}}revealSiblingChange(A){if(this.currentChangeIndex=this.currentChangeIndex+(A==="up"?-1:1),this.currentChangeIndex>=0&&this.currentChangeIndex<this.partialEditWidgetList.length){const T=this.partialEditWidgetList[this.currentChangeIndex].getPosition();if(T?.position)return this.monacoEditor.revealLineInCenter(T.position.lineNumber),this.currentChangeIndex}else this.messageService.info(A==="up"?(0,p.localize)("aiNative.inlineDiff.noMoreChangesUp"):(0,p.localize)("aiNative.inlineDiff.noMoreChangesDown"))}setPreviewerOptions(A){this.options=A}};t.LivePreviewDiffDecorationModel=b,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(p.IAIReporter),r.__metadata("design:type",Object)],b.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(g.InlineStreamDiffService),r.__metadata("design:type",g.InlineStreamDiffService)],b.prototype,"inlineStreamDiffService",void 0),r.__decorate([(0,o.Autowired)(h.InlineDiffServiceToken),r.__metadata("design:type",Object)],b.prototype,"inlineDiffService",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],b.prototype,"messageService",void 0),t.LivePreviewDiffDecorationModel=b=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],b)},19520:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputPreviewDecorationID=void 0,t.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SumiLightBulbWidget=void 0;const n=e(41869),r=e(3908),o=e(19202);class c extends o.LightBulbWidget{_updateLightBulbTitleAndIcon(){super._updateLightBulbTitleAndIcon();const v=super.state;if(v.type!==1)return;let m=super.icon;(v.actions.allAIFixes||v.actions.hasAutoFix&&v.actions.hasAIFix||v.actions.hasAIFix)&&(m=r.Sumicon.magicWand),m&&(this.getDomNode().classList.remove(...this._iconClasses),this.getDomNode().classList.add(...(0,n.asClassNameArrayWrapper)(m)))}}t.SumiLightBulbWidget=c},8191:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RewriteWidget=t.REWRITE_DECORATION_INLINE_ADD=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=n.__importDefault(e(25873)),p=e(76003),v=e(41869),m=n.__importStar(e(20868)),_=e(52659),s=e(90052),f=e(77714),a=e(2261),h=e(87822),u=e(16781),d=n.__importDefault(e(32518)),E={fixedOverflowWidgets:!0,readOnly:!0,domReadOnly:!0,lineNumbers:"off",glyphMargin:!1,scrollBeyondLastLine:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,scrollbar:{horizontal:"hidden",vertical:"hidden",horizontalScrollbarSize:0,verticalScrollbarSize:0,arrowSize:0,verticalSliderSize:0,horizontalSliderSize:0,ignoreHorizontalScrollbarInContentHeight:!0},hover:{enabled:!1},guides:{indentation:!1}};t.REWRITE_DECORATION_INLINE_ADD="rewrite-decoration-inline-add";const g=o.default.memo(y=>{const{editor:b,onReady:S}=y,A=(0,v.useInjectable)(v.MonacoService),w=(0,o.useRef)(null),T=(0,o.useRef)(null),[D,I]=(0,o.useState)(null),[R,M]=(0,o.useState)(0),[O,P]=(0,o.useState)(null),k=(0,o.useCallback)((U,W,j)=>{const X=b.getModel().getEOL();let V=W.startLineNumber,$=W.startColumn;const Y=U.getModel();U.changeDecorations(ne=>{if(U){Y.getAllDecorations().map(he=>he.id).forEach(he=>ne.removeDecoration(he));for(const he of j){if(he.removed)continue;const _e=he.value.split(X);for(let q=0;q<_e.length;q++){const Re=_e[q];q!==0&&(V++,$=1),he.added&&ne.addDecoration(new m.Range(V,$,V,$+Re.length),{description:t.REWRITE_DECORATION_INLINE_ADD,className:d.default.ghost_text_decoration_inline_add}),$+=Re.length}}}});const G=U.getOption(m.editor.EditorOption.lineHeight);U?.setScrollTop(Math.max(W.startLineNumber-1,0)*G);const z=V-W.startLineNumber,K=U.getOption(m.editor.EditorOption.fontInfo).spaceWidth,Z=U.getOption(m.editor.EditorOption.layoutInfo).contentLeft;let Q=0;const oe=Y.getOptions().tabSize;Array.from({length:z+1},(ne,he)=>W.startLineNumber+he).forEach(ne=>{const he=Y.getLineContent(ne);let _e=0;for(const q of he)q===f.space?_e+=oe:_e+=1,Q=Math.max(Q,_e)}),I({width:Q*K+Z*2,height:G*(z+1)})},[D,b]);(0,o.useEffect)(()=>{if(b.getModel())return S&&S({getVirtualEditor:()=>O,renderVirtualEditor:(W,j,X)=>F(W,j,X),renderTextLineThrough:W=>L(W),layout:W=>N(W)}),()=>{O&&O.dispose(),T.current&&(0,v.runWhenIdle)(()=>{var W;(W=T.current)===null||W===void 0||W.unmount(),T.current=null})}},[b,S,O]);const F=(0,o.useCallback)((U,W,j)=>{if(!w.current)return;const X=b.getModel();if(!X)return;let V=O;if(!V){V=A.createCodeEditor(w.current,E);const $=u.StandaloneServices.get(h.IModelService),Y={languageId:X.getLanguageId(),onDidChange:v.Event.None},G=$.createModel("",Y);V.setModel(G),P(V)}V.setValue(U),k(V,W,j)},[w,O]),L=(0,o.useCallback)(U=>{if(!w.current)return;O&&(O.dispose(),P(null));const W=({changes:j})=>{const X=b.getOption(m.editor.EditorOption.lineHeight),V=b.getOption(m.editor.EditorOption.fontInfo).spaceWidth,$=(G,z=d.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,r.default)(d.default.space_span,z),style:{width:`${V*G}px`}},f.space.repeat(G)),Y=(G,z)=>o.default.createElement("span",{className:(0,r.default)(d.default.text_span,z)},G);return o.default.createElement(o.default.Fragment,null,j.map((G,z)=>{let K=!0,Z="",Q=0;const oe=[];for(const ne of G){const{value:he,added:_e,removed:q}=ne;if(q)Z+=he;else{K=!1,Q+=he.length;const Re=he.length-he.trimStart().length,ve=he.length-he.trimEnd().length,ie=he.trim();oe.push($(Re)),ie&&(oe.push(Y(ie,_e?d.default.ghost_text_decoration_inline_add:d.default.ghost_text_decoration)),oe.push($(ve)))}}if(K){const ne=Z.length-Z.trimStart().length,he=Z.length-Z.trimEnd().length,_e=Z.trim();oe.push($(ne,d.default.ghost_text_decoration_remove)),_e&&(oe.push(Y(_e,d.default.ghost_text_decoration_inline_remove)),oe.push($(he,d.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:z,className:d.default.deletions_code_line,style:{height:`${X}px`}},oe)}))};T.current&&(T.current.unmount(),T.current=null),T.current=c.default.createRoot(w.current),T.current.render(o.default.createElement(o.default.Fragment,null,U.map((j,X)=>o.default.createElement(W,{key:X,changes:j.changes}))))},[b,w,O,T]),N=(0,o.useCallback)(U=>{const W=b.getOption(m.editor.EditorOption.fontInfo).spaceWidth;let j=0;for(let X=U.startLineNumber;X<=U.endLineNumber;X++){const V=b.getModel().getLineMaxColumn(X);j=Math.max(j,V)}M(j*W+10)},[b]);return o.default.createElement("div",{className:d.default.rewrite_widget_container,style:{width:D?.width,height:D?.height,marginLeft:R}},o.default.createElement("div",{className:d.default.virtual_editor_container,ref:w}))});let l=class extends _.ReactInlineContentWidget{constructor(){super(...arguments),this.virtualEditorHandler=null,this.positionPreference=[s.ContentWidgetPositionPreference.EXACT],this.defered=new v.Deferred,this.updateFontStyle=()=>{const b=this.editor.getOption(m.editor.EditorOption.fontInfo);this.domNode.style.fontFamily=b.fontFamily,this.domNode.style.fontSize=b.fontSize+"px"}}renderView(){return this.updateFontStyle(),o.default.createElement(g,{editor:this.editor,onReady:b=>{this.defered.resolve(),this.virtualEditorHandler=b}})}id(){return"RewriteWidget"}show(b){const{position:S}=b;if(!S)return;const{lineNumber:A}=S;super.show({position:m.Position.lift({lineNumber:A,column:1})})}setInsertText(b){this.insertText=b}setEditArea(b){this.editArea=b}getEditArea(){return this.editArea}getVirtualEditor(){var b,S;return(S=(b=this.virtualEditorHandler)===null||b===void 0?void 0:b.getVirtualEditor())!==null&&S!==void 0?S:null}renderTextLineThrough(b){var S,A;(S=this.virtualEditorHandler)===null||S===void 0||S.renderTextLineThrough(b),(A=this.virtualEditorHandler)===null||A===void 0||A.layout(this.editArea)}renderVirtualEditor(b,S){this.virtualEditorHandler.renderVirtualEditor(b,this.editArea,S),this.virtualEditorHandler.layout(this.editArea)}accept(){(0,v.isUndefined)(this.insertText)||(this.editor.pushUndoStop(),this.editor.getModel().pushEditOperations(null,[a.EditOperation.replace(m.Range.lift(this.editArea),this.insertText)],()=>null))}};t.RewriteWidget=l,t.RewriteWidget=l=n.__decorate([(0,p.Injectable)({multiple:!0})],l)},19413:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffServiceToken=t.IAIInlineCompletionsProvider=t.EResultKind=t.EInlineChatStatus=t.SumiMCPServerProxyServicePath=t.TokenMCPServerProxyService=t.ChatProxyServiceToken=t.IChatAgentService=t.IChatManagerService=t.IChatInternalService=t.ChatCompletionRequestMessageRoleEnum=t.AT_SIGN_SYMBOL=t.SLASH_SYMBOL=t.AI_MENUBAR_CONTAINER_VIEW_ID=t.BUILTIN_MCP_SERVER_NAME=t.AI_MENU_BAR_DEBUG_TOOLBAR=t.AI_CHAT_LOGO_AVATAR_ID=t.AI_CHAT_CONTAINER_ID=t.AI_CHAT_VIEW_ID=t.AIInlineChatContentWidget=t.IAINativeService=void 0;const n=e(85608),r=e(43718),o=e(66338);n.__exportStar(e(25264),t),t.IAINativeService=Symbol("IAINativeService"),t.AIInlineChatContentWidget=r.AIInlineChatContentWidgetId,t.AI_CHAT_VIEW_ID="AI-Chat",t.AI_CHAT_CONTAINER_ID="AI-Chat-Container",t.AI_CHAT_LOGO_AVATAR_ID="AI-Chat-Logo-Avatar",t.AI_MENU_BAR_DEBUG_TOOLBAR="AI_MENU_BAR_DEBUG_TOOLBAR",t.BUILTIN_MCP_SERVER_NAME="builtin",t.AI_MENUBAR_CONTAINER_VIEW_ID=o.DESIGN_MENUBAR_CONTAINER_VIEW_ID,t.SLASH_SYMBOL="/",t.AT_SIGN_SYMBOL="@";var c;(function(m){m.System="system",m.User="user",m.Assistant="assistant"})(c||(t.ChatCompletionRequestMessageRoleEnum=c={})),t.IChatInternalService=Symbol("IChatInternalService"),t.IChatManagerService=Symbol("IChatManagerService"),t.IChatAgentService=Symbol("IChatAgentService"),t.ChatProxyServiceToken=Symbol("ChatProxyServiceToken"),t.TokenMCPServerProxyService=Symbol("TokenMCPServerProxyService"),t.SumiMCPServerProxyServicePath="SumiMCPServerProxyServicePath";var p;(function(m){m[m.READY=0]="READY",m[m.THINKING=1]="THINKING",m[m.DONE=2]="DONE",m[m.ERROR=3]="ERROR"})(p||(t.EInlineChatStatus=p={}));var v;(function(m){m.ACCEPT="ACCEPT",m.DISCARD="DISCARD",m.REGENERATE="REGENERATE"})(v||(t.EResultKind=v={})),t.IAIInlineCompletionsProvider=Symbol("IAIInlineCompletionsProvider"),t.InlineDiffServiceToken=Symbol("InlineDiffService")},46044:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceToken=void 0,t.LLMContextServiceToken=Symbol("LLMContextService")},64811:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerManagerPath=t.MCPServerManager=void 0,t.MCPServerManager=Symbol("MCPServerManager"),t.MCPServerManagerPath="ServicesMCPServerManager"},25264:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.openAiNativeModels=t.anthropicModels=t.deepSeekModels=void 0,t.deepSeekModels={"deepseek-chat":{maxTokens:8e3,contextWindow:64e3,supportsImages:!1},"deepseek-reasoner":{maxTokens:8e3,contextWindow:64e3,supportsImages:!1,temperature:.7,topP:.95}},t.anthropicModels={"claude-3-7-sonnet-20250219":{maxTokens:8192,contextWindow:2e5,supportsImages:!0},"claude-3-5-sonnet-20241022":{maxTokens:8192,contextWindow:2e5,supportsImages:!0},"claude-3-5-haiku-20241022":{maxTokens:8192,contextWindow:2e5,supportsImages:!1},"claude-3-opus-20240229":{maxTokens:4096,contextWindow:2e5,supportsImages:!0},"claude-3-haiku-20240307":{maxTokens:4096,contextWindow:2e5,supportsImages:!0}},t.openAiNativeModels={"o3-mini":{maxTokens:1e5,contextWindow:2e5,supportsImages:!1},o1:{maxTokens:1e5,contextWindow:2e5,supportsImages:!0},"o1-preview":{maxTokens:32768,contextWindow:128e3,supportsImages:!0},"o1-mini":{maxTokens:65536,contextWindow:128e3,supportsImages:!0},"gpt-4o":{maxTokens:4096,contextWindow:128e3,supportsImages:!0},"gpt-4o-mini":{maxTokens:16384,contextWindow:128e3,supportsImages:!0},"gpt-4.5-preview":{maxTokens:16384,contextWindow:128e3,supportsImages:!0}}},73307:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultChatAgentPromptProvider=t.ChatAgentPromptProvider=void 0;const n=e(85608),r=e(76003),o=e(55113);t.ChatAgentPromptProvider=Symbol("ChatAgentPromptProvider");let c=class{provideContextPrompt(v,m){const _=this.workbenchEditorService.currentEditor,s=_?.currentDocumentModel;return`
|
|
30745
|
+
`)||"",V=P?.getRange();try{V&&(j=M.getValueInRange({...V,endColumn:M.getLineMaxColumn(V.endLineNumber)}))}catch{j=""}const $=K=>{D&&this.aiReporter.end(R,{message:"discard",success:!0,isDrop:!0,code:j,originCode:X,actionSource:p.ActionSourceEnum.InlineChat,actionType:p.ActionTypeEnum.LineDiscard});const Z=U(K);Z?.discard();const Q=W(K);Q?.discard();const oe=N(K);return this.doDiscardPartialWidget(oe,Q,Z)},Y=K=>{D&&this.aiReporter.end(R,{message:"accept",success:!0,isReceive:!0,code:j,originCode:X,actionSource:p.ActionSourceEnum.InlineChat,actionType:p.ActionTypeEnum.lineAccept});const Z=N(K);Z?.accept(k,F);const Q=U(K);Q?.accept();const oe=W(K);oe?.accept()},G=K=>{const Z=N(K);Z?.resume();const Q=U(K);Q?.resume();const oe=W(K);oe?.resume()};switch(A){case u.EPartialEdit.accept:if(Y(this),T){const K=this.createEditStackElement(L);K.attachModel(this),K.registerUndo(Z=>{G(Z)}),K.registerRedo(Z=>{Y(Z)})}break;case u.EPartialEdit.discard:{const K=$(this);if(K){if(T){const Z=this.createEditStackElement(L);Z.attachModel(this),Z.registerUndo(Q=>{G(Q)}),Z.registerRedo(Q=>{$(Q)})}M.pushStackElement(),M.pushEditOperations(null,[K],()=>null,L),M.pushStackElement()}}break;default:break}const z={uri:this.model.uri,totalPartialEditCount:this.partialEditWidgetList.length,resolvedPartialEditCount:this.partialEditWidgetList.filter(K=>K.isHidden).length,acceptPartialEditCount:this.partialEditWidgetList.filter(K=>K.isAccepted).length,currentPartialEdit:{addedLinesCount:k,deletedLinesCount:F,type:A},...this.getTotalCodeInfo()};this.monacoEditor.focus(),this.inlineDiffService.firePartialEdit(z),this.firePartialEditWidgetList()}firePartialEditWidgetList(){this._onPartialEditWidgetListChange.fire(this.partialEditWidgetList);const A=this.partialEditWidgetList.filter(w=>!w.isHidden);this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(A.length!==0)}createEditStackElement(A){const w=new l.LivePreviewUndoRedoStackElement(this.model);return this.undoRedoService.pushElement(w,A),w}static computeCodeInfo(A,w,T){const D=R(A),I={added:0,deleted:0,changed:0};return A.forEach((M,O)=>{if(M.status==="pending"){const P=w[O],k=T[O],F=P?.length||0,L=k?.height||0;I.added+=F,I.deleted+=L,I.changed+=Math.max(F,L)}}),{totalAddedLinesCount:D.added,totalDeletedLinesCount:D.deleted,totalChangedLinesCount:D.changed,unresolvedAddedLinesCount:I.added,unresolvedDeletedLinesCount:I.deleted,unresolvedChangedLinesCount:I.changed};function R(M){const O={added:0,deleted:0,changed:0};return M.forEach(P=>{const k=P.addedLinesCount,F=P.deletedLinesCount;O.added+=k,O.deleted+=F,O.changed+=Math.max(k,F)}),O}}getTotalCodeInfo(){const A=this.partialEditWidgetList,w=this.addedRangeDec.getDecorations(),T=this.removedZoneWidgets;return n.computeCodeInfo(A,w,T)}recordPartialEditWidgetWithAddedDec(){this.partialEditWidgetList.forEach(A=>{var w,T;const D=(T=(w=A.getPosition())===null||w===void 0?void 0:w.position)===null||T===void 0?void 0:T.lineNumber;if(D){const I=this.addedRangeDec.getDecorationByLineNumber(D);I&&A.recordAddedRangeId(I.id)}})}acceptUnProcessed(){this.partialEditWidgetList.filter(w=>w.isPending).forEach(w=>{this.handlePartialEditAction(u.EPartialEdit.accept,w,!1)})}discardUnProcessed(){this.partialEditWidgetList.filter(w=>w.isPending).forEach(w=>{this.handlePartialEditAction(u.EPartialEdit.discard,w,!1)})}createPartialEditWidget(A){const w=this.injector.get(y.AcceptPartialEditWidget,[this.monacoEditor,this.options.partialEditWidgetOptions]);w.show({position:{lineNumber:A,column:1}});const T=w.onDispose(()=>{const D=w.getId();this.partialEditWidgetList=this.partialEditWidgetList.filter(I=>I.getId()!==D),T.dispose()});return w.addDispose([w.onAccept(()=>{this.handlePartialEditAction(u.EPartialEdit.accept,w,!0,!0)}),w.onDiscard(()=>{this.handlePartialEditAction(u.EPartialEdit.discard,w,!0,!0)})]),w}touchPartialEditWidgets(A){this.clearPartialEditWidgetList(),this.partialEditWidgetList=A.map(w=>this.createPartialEditWidget(w)),this.firePartialEditWidgetList()}touchAddedRange(A){this.addedRangeDec.set(A.map(w=>{const T=w.startPosition,D=w.endPosition,I=w.len;let R=v.Range.fromPositions(T,D),M=E.default.inline_diff_added_range+" ";return I===0&&(R=v.Range.fromPositions(T),M+=E.default.hide),{length:I,range:R,isHidden:I===0,options:f.ModelDecorationOptions.register({description:y.AddedRangeDecoration,isWholeLine:!0,className:M})}})),this.recordPartialEditWidgetWithAddedDec()}touchRemovedWidget(A,w){const T=()=>{this.clearRemovedWidgets(),A.forEach(({textLines:D,position:I})=>{this.showRemovedWidgetByLineNumber(I.lineNumber,D,{})}),w?.()};this.options.renderRemovedWidgetImmediately?T():this.addDispose((0,p.runWhenIdle)(T))}touchPendingRange(A){const w=this.getZone();this.pendingRangeDec.set([{range:v.Range.fromPositions({lineNumber:w.startLineNumber+A.startLineNumber-1,column:0},{lineNumber:w.startLineNumber+A.endLineNumberExclusive-2,column:Number.MAX_SAFE_INTEGER}),options:f.ModelDecorationOptions.register({description:y.PendingRangeDecoration,isWholeLine:!0,className:E.default.inline_diff_pending_range})}])}clearPendingLine(){this.pendingRangeDec.clear()}clearActiveLine(){this.activeLineDec.clear()}clearAddedLine(){this.addedRangeDec.clear()}clearPartialEditWidgetList(){this.partialEditWidgetList.forEach(A=>{A.dispose()}),this.partialEditWidgetList=[],this.aiNativeContextKey.inlineDiffPartialEditsIsVisible.set(!1)}clearRemovedWidgets(){this.removedZoneWidgets.forEach(A=>{A.dispose()}),this.removedZoneWidgets=[]}revealFirstDiff(){const A=this.removedZoneWidgets[0];if(A){const w=A.getLastPosition();w&&this.monacoEditor.revealLineInCenterIfOutsideViewport(w.lineNumber)}}revealSiblingChange(A){if(this.currentChangeIndex=this.currentChangeIndex+(A==="up"?-1:1),this.currentChangeIndex>=0&&this.currentChangeIndex<this.partialEditWidgetList.length){const T=this.partialEditWidgetList[this.currentChangeIndex].getPosition();if(T?.position)return this.monacoEditor.revealLineInCenter(T.position.lineNumber),this.currentChangeIndex}else this.messageService.info(A==="up"?(0,p.localize)("aiNative.inlineDiff.noMoreChangesUp"):(0,p.localize)("aiNative.inlineDiff.noMoreChangesDown"))}setPreviewerOptions(A){this.options=A}};t.LivePreviewDiffDecorationModel=b,r.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),r.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),r.__decorate([(0,o.Autowired)(p.IAIReporter),r.__metadata("design:type",Object)],b.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(g.InlineStreamDiffService),r.__metadata("design:type",g.InlineStreamDiffService)],b.prototype,"inlineStreamDiffService",void 0),r.__decorate([(0,o.Autowired)(h.InlineDiffServiceToken),r.__metadata("design:type",Object)],b.prototype,"inlineDiffService",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],b.prototype,"messageService",void 0),t.LivePreviewDiffDecorationModel=b=n=r.__decorate([(0,o.Injectable)({multiple:!0}),r.__metadata("design:paramtypes",[Object])],b)},19520:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineInputPreviewDecorationID=void 0,t.InlineInputPreviewDecorationID="InlineInputPreviewDecorationID"},90058:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SumiLightBulbWidget=void 0;const n=e(41869),r=e(3908),o=e(19202);class c extends o.LightBulbWidget{_updateLightBulbTitleAndIcon(){super._updateLightBulbTitleAndIcon();const v=super.state;if(v.type!==1)return;let m=super.icon;(v.actions.allAIFixes||v.actions.hasAutoFix&&v.actions.hasAIFix||v.actions.hasAIFix)&&(m=r.Sumicon.magicWand),m&&(this.getDomNode().classList.remove(...this._iconClasses),this.getDomNode().classList.add(...(0,n.asClassNameArrayWrapper)(m)))}}t.SumiLightBulbWidget=c},8191:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RewriteWidget=t.REWRITE_DECORATION_INLINE_ADD=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=n.__importDefault(e(25873)),p=e(76003),v=e(41869),m=n.__importStar(e(20868)),_=e(52659),s=e(90052),f=e(77714),a=e(2261),h=e(87822),u=e(16781),d=n.__importDefault(e(32518)),E={fixedOverflowWidgets:!0,readOnly:!0,domReadOnly:!0,lineNumbers:"off",glyphMargin:!1,scrollBeyondLastLine:!1,rulers:void 0,overviewRulerBorder:void 0,overviewRulerLanes:0,padding:{top:0,bottom:0},folding:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!0,scrollbar:{horizontal:"hidden",vertical:"hidden",horizontalScrollbarSize:0,verticalScrollbarSize:0,arrowSize:0,verticalSliderSize:0,horizontalSliderSize:0,ignoreHorizontalScrollbarInContentHeight:!0},hover:{enabled:!1},guides:{indentation:!1}};t.REWRITE_DECORATION_INLINE_ADD="rewrite-decoration-inline-add";const g=o.default.memo(y=>{const{editor:b,onReady:S}=y,A=(0,v.useInjectable)(v.MonacoService),w=(0,o.useRef)(null),T=(0,o.useRef)(null),[D,I]=(0,o.useState)(null),[R,M]=(0,o.useState)(0),[O,P]=(0,o.useState)(null),k=(0,o.useCallback)((U,W,j)=>{const X=b.getModel().getEOL();let V=W.startLineNumber,$=W.startColumn;const Y=U.getModel();U.changeDecorations(ne=>{if(U){Y.getAllDecorations().map(he=>he.id).forEach(he=>ne.removeDecoration(he));for(const he of j){if(he.removed)continue;const _e=he.value.split(X);for(let q=0;q<_e.length;q++){const Re=_e[q];q!==0&&(V++,$=1),he.added&&ne.addDecoration(new m.Range(V,$,V,$+Re.length),{description:t.REWRITE_DECORATION_INLINE_ADD,className:d.default.ghost_text_decoration_inline_add}),$+=Re.length}}}});const G=U.getOption(m.editor.EditorOption.lineHeight);U?.setScrollTop(Math.max(W.startLineNumber-1,0)*G);const z=V-W.startLineNumber,K=U.getOption(m.editor.EditorOption.fontInfo).spaceWidth,Z=U.getOption(m.editor.EditorOption.layoutInfo).contentLeft;let Q=0;const oe=Y.getOptions().tabSize;Array.from({length:z+1},(ne,he)=>W.startLineNumber+he).forEach(ne=>{const he=Y.getLineContent(ne);let _e=0;for(const q of he)q===f.space?_e+=oe:_e+=1,Q=Math.max(Q,_e)}),I({width:Q*K+Z*2,height:G*(z+1)})},[D,b]);(0,o.useEffect)(()=>{if(b.getModel())return S&&S({getVirtualEditor:()=>O,renderVirtualEditor:(W,j,X)=>F(W,j,X),renderTextLineThrough:W=>L(W),layout:W=>N(W)}),()=>{O&&O.dispose(),T.current&&(0,v.runWhenIdle)(()=>{var W;(W=T.current)===null||W===void 0||W.unmount(),T.current=null})}},[b,S,O]);const F=(0,o.useCallback)((U,W,j)=>{if(!w.current)return;const X=b.getModel();if(!X)return;let V=O;if(!V){V=A.createCodeEditor(w.current,E);const $=u.StandaloneServices.get(h.IModelService),Y={languageId:X.getLanguageId(),onDidChange:v.Event.None},G=$.createModel("",Y);V.setModel(G),P(V)}V.setValue(U),k(V,W,j)},[w,O]),L=(0,o.useCallback)(U=>{if(!w.current)return;O&&(O.dispose(),P(null));const W=({changes:j})=>{const X=b.getOption(m.editor.EditorOption.lineHeight),V=b.getOption(m.editor.EditorOption.fontInfo).spaceWidth,$=(G,z=d.default.ghost_text_decoration)=>o.default.createElement("span",{className:(0,r.default)(d.default.space_span,z),style:{width:`${V*G}px`}},f.space.repeat(G)),Y=(G,z)=>o.default.createElement("span",{className:(0,r.default)(d.default.text_span,z)},G);return o.default.createElement(o.default.Fragment,null,j.map((G,z)=>{let K=!0,Z="",Q=0;const oe=[];for(const ne of G){const{value:he,added:_e,removed:q}=ne;if(q)Z+=he;else{K=!1,Q+=he.length;const Re=he.length-he.trimStart().length,ve=he.length-he.trimEnd().length,ie=he.trim();oe.push($(Re)),ie&&(oe.push(Y(ie,_e?d.default.ghost_text_decoration_inline_add:d.default.ghost_text_decoration)),oe.push($(ve)))}}if(K){const ne=Z.length-Z.trimStart().length,he=Z.length-Z.trimEnd().length,_e=Z.trim();oe.push($(ne,d.default.ghost_text_decoration_remove)),_e&&(oe.push(Y(_e,d.default.ghost_text_decoration_inline_remove)),oe.push($(he,d.default.ghost_text_decoration_inline_remove)))}return o.default.createElement("div",{key:z,className:d.default.deletions_code_line,style:{height:`${X}px`}},oe)}))};T.current&&(T.current.unmount(),T.current=null),T.current=c.default.createRoot(w.current),T.current.render(o.default.createElement(o.default.Fragment,null,U.map((j,X)=>o.default.createElement(W,{key:X,changes:j.changes}))))},[b,w,O,T]),N=(0,o.useCallback)(U=>{const W=b.getOption(m.editor.EditorOption.fontInfo).spaceWidth;let j=0;for(let X=U.startLineNumber;X<=U.endLineNumber;X++){const V=b.getModel().getLineMaxColumn(X);j=Math.max(j,V)}M(j*W+10)},[b]);return o.default.createElement("div",{className:d.default.rewrite_widget_container,style:{width:D?.width,height:D?.height,marginLeft:R}},o.default.createElement("div",{className:d.default.virtual_editor_container,ref:w}))});let l=class extends _.ReactInlineContentWidget{constructor(){super(...arguments),this.virtualEditorHandler=null,this.positionPreference=[s.ContentWidgetPositionPreference.EXACT],this.defered=new v.Deferred,this.updateFontStyle=()=>{const b=this.editor.getOption(m.editor.EditorOption.fontInfo);this.domNode.style.fontFamily=b.fontFamily,this.domNode.style.fontSize=b.fontSize+"px"}}renderView(){return this.updateFontStyle(),o.default.createElement(g,{editor:this.editor,onReady:b=>{this.defered.resolve(),this.virtualEditorHandler=b}})}id(){return"RewriteWidget"}show(b){const{position:S}=b;if(!S)return;const{lineNumber:A}=S;super.show({position:m.Position.lift({lineNumber:A,column:1})})}setInsertText(b){this.insertText=b}setEditArea(b){this.editArea=b}getEditArea(){return this.editArea}getVirtualEditor(){var b,S;return(S=(b=this.virtualEditorHandler)===null||b===void 0?void 0:b.getVirtualEditor())!==null&&S!==void 0?S:null}renderTextLineThrough(b){var S,A;(S=this.virtualEditorHandler)===null||S===void 0||S.renderTextLineThrough(b),(A=this.virtualEditorHandler)===null||A===void 0||A.layout(this.editArea)}renderVirtualEditor(b,S){this.virtualEditorHandler.renderVirtualEditor(b,this.editArea,S),this.virtualEditorHandler.layout(this.editArea)}accept(){(0,v.isUndefined)(this.insertText)||(this.editor.pushUndoStop(),this.editor.getModel().pushEditOperations(null,[a.EditOperation.replace(m.Range.lift(this.editArea),this.insertText)],()=>null))}};t.RewriteWidget=l,t.RewriteWidget=l=n.__decorate([(0,p.Injectable)({multiple:!0})],l)},19413:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineDiffServiceToken=t.IAIInlineCompletionsProvider=t.EResultKind=t.EInlineChatStatus=t.SumiMCPServerProxyServicePath=t.TokenMCPServerProxyService=t.ChatProxyServiceToken=t.IChatAgentService=t.IChatManagerService=t.IChatInternalService=t.ChatCompletionRequestMessageRoleEnum=t.AT_SIGN_SYMBOL=t.SLASH_SYMBOL=t.AI_MENUBAR_CONTAINER_VIEW_ID=t.BUILTIN_MCP_SERVER_NAME=t.AI_MENU_BAR_DEBUG_TOOLBAR=t.AI_CHAT_LOGO_AVATAR_ID=t.AI_CHAT_CONTAINER_ID=t.AI_CHAT_VIEW_ID=t.AIInlineChatContentWidget=t.IAINativeService=void 0;const n=e(85608),r=e(43718),o=e(66338);n.__exportStar(e(25264),t),t.IAINativeService=Symbol("IAINativeService"),t.AIInlineChatContentWidget=r.AIInlineChatContentWidgetId,t.AI_CHAT_VIEW_ID="AI-Chat",t.AI_CHAT_CONTAINER_ID="AI-Chat-Container",t.AI_CHAT_LOGO_AVATAR_ID="AI-Chat-Logo-Avatar",t.AI_MENU_BAR_DEBUG_TOOLBAR="AI_MENU_BAR_DEBUG_TOOLBAR",t.BUILTIN_MCP_SERVER_NAME="builtin",t.AI_MENUBAR_CONTAINER_VIEW_ID=o.DESIGN_MENUBAR_CONTAINER_VIEW_ID,t.SLASH_SYMBOL="/",t.AT_SIGN_SYMBOL="@";var c;(function(m){m.System="system",m.User="user",m.Assistant="assistant"})(c||(t.ChatCompletionRequestMessageRoleEnum=c={})),t.IChatInternalService=Symbol("IChatInternalService"),t.IChatManagerService=Symbol("IChatManagerService"),t.IChatAgentService=Symbol("IChatAgentService"),t.ChatProxyServiceToken=Symbol("ChatProxyServiceToken"),t.TokenMCPServerProxyService=Symbol("TokenMCPServerProxyService"),t.SumiMCPServerProxyServicePath="SumiMCPServerProxyServicePath";var p;(function(m){m[m.READY=0]="READY",m[m.THINKING=1]="THINKING",m[m.DONE=2]="DONE",m[m.ERROR=3]="ERROR"})(p||(t.EInlineChatStatus=p={}));var v;(function(m){m.ACCEPT="ACCEPT",m.DISCARD="DISCARD",m.REGENERATE="REGENERATE"})(v||(t.EResultKind=v={})),t.IAIInlineCompletionsProvider=Symbol("IAIInlineCompletionsProvider"),t.InlineDiffServiceToken=Symbol("InlineDiffService")},46044:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceToken=void 0,t.LLMContextServiceToken=Symbol("LLMContextService")},64811:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MCPServerManagerPath=t.MCPServerManager=void 0,t.MCPServerManager=Symbol("MCPServerManager"),t.MCPServerManagerPath="ServicesMCPServerManager"},25264:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.openAiNativeModels=t.anthropicModels=t.deepSeekModels=void 0,t.deepSeekModels={"deepseek-chat":{maxTokens:8e3,contextWindow:64e3,supportsImages:!1},"deepseek-reasoner":{maxTokens:8e3,contextWindow:64e3,supportsImages:!1,temperature:.7,topP:.95}},t.anthropicModels={"claude-3-7-sonnet-20250219":{maxTokens:8192,contextWindow:2e5,supportsImages:!0},"claude-3-5-sonnet-20241022":{maxTokens:8192,contextWindow:2e5,supportsImages:!0},"claude-3-5-haiku-20241022":{maxTokens:8192,contextWindow:2e5,supportsImages:!1},"claude-3-opus-20240229":{maxTokens:4096,contextWindow:2e5,supportsImages:!0},"claude-3-haiku-20240307":{maxTokens:4096,contextWindow:2e5,supportsImages:!0}},t.openAiNativeModels={"o3-mini":{maxTokens:1e5,contextWindow:2e5,supportsImages:!1},o1:{maxTokens:1e5,contextWindow:2e5,supportsImages:!0},"o1-preview":{maxTokens:32768,contextWindow:128e3,supportsImages:!0},"o1-mini":{maxTokens:65536,contextWindow:128e3,supportsImages:!0},"gpt-4o":{maxTokens:4096,contextWindow:128e3,supportsImages:!0},"gpt-4o-mini":{maxTokens:16384,contextWindow:128e3,supportsImages:!0},"gpt-4.5-preview":{maxTokens:16384,contextWindow:128e3,supportsImages:!0}}},73307:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultChatAgentPromptProvider=t.ChatAgentPromptProvider=void 0;const n=e(85608),r=e(76003),o=e(55113);t.ChatAgentPromptProvider=Symbol("ChatAgentPromptProvider");let c=class{provideContextPrompt(v,m){const _=this.workbenchEditorService.currentEditor,s=_?.currentDocumentModel;return`
|
|
30746
30746
|
<additional_data>
|
|
30747
30747
|
Below are some potentially helpful/relevant pieces of information for figuring out to respond
|
|
30748
30748
|
<recently_viewed_files>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensumi/cli-engine",
|
|
3
|
-
"version": "3.8.3-next-
|
|
3
|
+
"version": "3.8.3-next-1741673342.0",
|
|
4
4
|
"description": "Integration engine runtime for opensumi-cli and opensumi extension",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@koa/cors": "^5.0.0",
|
|
28
28
|
"@opensumi/di": "^1.8.0",
|
|
29
|
-
"@opensumi/ide-core-browser": "3.8.3-next-
|
|
30
|
-
"@opensumi/ide-core-common": "3.8.3-next-
|
|
31
|
-
"@opensumi/ide-core-node": "3.8.3-next-
|
|
32
|
-
"@opensumi/ide-express-file-server": "3.8.3-next-
|
|
33
|
-
"@opensumi/ide-extension": "3.8.3-next-
|
|
34
|
-
"@opensumi/ide-i18n": "3.8.3-next-
|
|
35
|
-
"@opensumi/ide-main-layout": "3.8.3-next-
|
|
36
|
-
"@opensumi/ide-startup": "3.8.3-next-
|
|
29
|
+
"@opensumi/ide-core-browser": "3.8.3-next-1741673342.0",
|
|
30
|
+
"@opensumi/ide-core-common": "3.8.3-next-1741673342.0",
|
|
31
|
+
"@opensumi/ide-core-node": "3.8.3-next-1741673342.0",
|
|
32
|
+
"@opensumi/ide-express-file-server": "3.8.3-next-1741673342.0",
|
|
33
|
+
"@opensumi/ide-extension": "3.8.3-next-1741673342.0",
|
|
34
|
+
"@opensumi/ide-i18n": "3.8.3-next-1741673342.0",
|
|
35
|
+
"@opensumi/ide-main-layout": "3.8.3-next-1741673342.0",
|
|
36
|
+
"@opensumi/ide-startup": "3.8.3-next-1741673342.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": "e677348c72d2236dc3177b091f91a6dbb2bdbb5f"
|
|
76
76
|
}
|