@opensumi/cli-engine 3.8.3-next-1746606362.0 → 3.8.3-next-1746610870.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.
@@ -31454,7 +31454,7 @@ The user's OS is ${(0,_.getOperatingSystemName)()}. The absolute path of the use
31454
31454
  `),P=R[R.length-1],k=[{condition:P.includes("`"),action:d},{condition:P.includes("**"),action:b},{condition:P.match(/\*\w/),action:E},{condition:P.match(/(^|\s)__\w/),action:A},{condition:P.match(/(^|\s)_\w/),action:f},{condition:P.match(/(^|\s)\[.*\]\(\w*/),action:l},{condition:P.match(/(^|\s)\[\w/),action:y}];for(const F of k)if(F.condition)return F.action(I)}}},49601:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMentionInput=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(46541),c=e(41869),_=e(81878),v=e(43718),m=e(92323),p=e(87863),s=e(54414),g=e(47720),a=e(83890),h=e(29037),u=e(72665),d=e(51500),E=e(19413),f=e(27397),l=n.__importDefault(e(6960)),y=e(96086),b=e(44692),A=w=>{const{onSend:T,disabled:D=!1,contextService:I}=w,[O,M]=(0,r.useState)(w.value||""),[R,P]=(0,r.useState)(w.images||[]),k=(0,c.useInjectable)(E.IChatInternalService),F=(0,c.useInjectable)(m.CommandService),L=(0,c.useInjectable)(g.FileSearchServicePath),B=(0,c.useInjectable)(c.RecentFilesManager),j=(0,c.useInjectable)(d.IWorkspaceService),W=(0,c.useInjectable)(s.WorkbenchEditorService),U=(0,c.useInjectable)(c.LabelService),Q=(0,c.useInjectable)(u.IMessageService),V=(0,c.useInjectable)(v.ChatFeatureRegistryToken),G=(0,c.useInjectable)(h.OutlineTreeService),Y=(0,r.useRef)([]),H=r.default.useCallback(()=>{F.executeCommand(f.MCPConfigCommands.OPEN_MCP_CONFIG.id)},[F]);(0,r.useEffect)(()=>{w.value!==O&&M(w.value||"")},[w.value]);const $=(0,r.useCallback)(async(me,q=[])=>{me||(me=(await G.resolveChildren())[0]);const Ae=await G.resolveChildren(me);for(const pe of Ae)q.push(pe),a.OutlineCompositeTreeNode.is(pe)&&await $(pe,q);return q},[G]),K=[{id:"code",type:"code",text:"Code",icon:(0,_.getIcon)("codebraces"),getHighestLevelItems:()=>[],getItems:async me=>{if(!me||Y.current.length===0){const q=G.currentUri;if(!q)return[];const Ae=await $();return Y.current=await Promise.all(Ae.map(async pe=>{var ne;const ue=await j.asRelativePath(q);return{id:pe.raw.id,type:b.MentionType.CODE,text:pe.raw.name,symbol:pe.raw,value:pe.raw.id,description:`${ue?.root?ue.path:""}:L${pe.raw.range.startLineNumber}-${pe.raw.range.endLineNumber}`,kind:pe.raw.kind,contextId:`${(ne=G.currentUri)===null||ne===void 0?void 0:ne.codeUri.fsPath}:L${pe.raw.range.startLineNumber}-${pe.raw.range.endLineNumber}`,icon:(0,c.getSymbolIcon)(pe.raw.kind)+" outline-icon"}})),Y.current}else return me=me.toLocaleLowerCase(),Y.current.sort((q,Ae)=>q.text.toLocaleLowerCase().includes(me)&&Ae.text.toLocaleLowerCase().includes(me)?0:q.text.toLocaleLowerCase().includes(me)?-1:Ae.text.toLocaleLowerCase().includes(me)?1:0)}},{id:b.MentionType.FILE,type:b.MentionType.FILE,text:"File",icon:(0,_.getIcon)("file"),getHighestLevelItems:()=>{const me=W.currentEditor,q=me?.currentUri;return q?[{id:q.codeUri.fsPath,type:b.MentionType.FILE,text:q.displayName,value:q.codeUri.fsPath,description:`(${(0,v.localize)("aiNative.chat.defaultContextFile")})`,contextId:q.codeUri.fsPath,icon:U.getIcon(q)}]:[]},getItems:async me=>{if(me){const q=(await j.roots).map(pe=>new v.URI(pe.uri).codeUri.fsPath.toString()),Ae=await L.find(me,{rootUris:q,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,limit:10});return Promise.all(Ae.map(async pe=>{var ne;const ue=new v.URI(pe),Ie=(ne=await j.asRelativePath(ue.parent))===null||ne===void 0?void 0:ne.path;return{id:ue.codeUri.fsPath,type:b.MentionType.FILE,text:ue.displayName,value:ue.codeUri.fsPath,description:Ie||"",contextId:ue.codeUri.fsPath,icon:U.getIcon(ue)}}))}else{const q=await B.getMostRecentlyOpenedFiles();return Promise.all(q.map(async Ae=>{var pe;const ne=new v.URI(Ae),ue=(pe=await j.asRelativePath(ne.parent))===null||pe===void 0?void 0:pe.path;return{id:ne.codeUri.fsPath,type:b.MentionType.FILE,text:ne.displayName,value:ne.codeUri.fsPath,description:ue||"",contextId:ne.codeUri.fsPath,icon:U.getIcon(ne)}}))}}},{id:b.MentionType.FOLDER,type:b.MentionType.FOLDER,text:"Folder",icon:(0,_.getIcon)("folder"),getHighestLevelItems:()=>{var me,q;const Ae=W.currentEditor,pe=(me=Ae?.currentUri)===null||me===void 0?void 0:me.parent;return pe?pe.toString()===((q=j.workspace)===null||q===void 0?void 0:q.uri)?[]:[{id:pe.codeUri.fsPath,type:b.MentionType.FOLDER,text:pe.displayName,value:pe.codeUri.fsPath,description:`(${(0,v.localize)("aiNative.chat.defaultContextFolder")})`,contextId:pe.codeUri.fsPath,icon:(0,_.getIcon)("folder")}]:[]},getItems:async me=>{let q=[];if(me){const Ae=(await j.roots).map(ue=>new v.URI(ue.uri).codeUri.fsPath.toString()),pe=await L.find(me,{rootUris:Ae,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0,excludePatterns:Object.keys(p.defaultFilesWatcherExcludes),limit:10}),ne=Array.from(new Set(pe.map(ue=>new v.URI(ue).parent.toString()).filter(ue=>{var Ie;return ue!==((Ie=j.workspace)===null||Ie===void 0?void 0:Ie.uri.toString())})));return Promise.all(ne.map(async ue=>{var Ie;const xe=new v.URI(ue);return{id:xe.codeUri.fsPath,type:b.MentionType.FOLDER,text:xe.displayName,value:xe.codeUri.fsPath,description:((Ie=await j.asRelativePath(xe.parent))===null||Ie===void 0?void 0:Ie.path)||"",contextId:xe.codeUri.fsPath,icon:(0,_.getIcon)("folder")}}))}else{const Ae=await B.getMostRecentlyOpenedFiles(),pe=Array.from(new Set(Ae.map(ne=>new v.URI(ne).parent.codeUri.fsPath).filter(ne=>{var ue;return ne!==((ue=j.workspace)===null||ue===void 0?void 0:ue.uri.toString())&&ne!=="/"})));q=await Promise.all(pe.map(async ne=>{const ue=new v.URI(ne),Ie=await j.asRelativePath(ue);return{id:ue.codeUri.fsPath,type:b.MentionType.FOLDER,text:ue.displayName,value:ue.codeUri.fsPath,description:Ie?.root?Ie.path:"",contextId:ue.codeUri.fsPath,icon:(0,_.getIcon)("folder")}}))}return q.filter(Ae=>{var pe;return Ae.id!==new v.URI((pe=j.workspace)===null||pe===void 0?void 0:pe.uri).codeUri.fsPath})}}],X=(0,r.useMemo)(()=>({modelOptions:[{label:"QWQ 32B",value:"qwq-32b"},{label:"DeepSeek R1",value:"deepseek-r1"}],defaultModel:w.sessionModelId||"deepseek-r1",buttons:[{id:"mcp-server",icon:"mcp",title:"MCP Server",onClick:H,position:b.FooterButtonPosition.LEFT},{id:"upload-image",icon:"image",title:(0,v.localize)("aiNative.chat.imageUpload"),onClick:()=>{const me=document.createElement("input");me.type="file",me.accept="image/*",me.onchange=q=>{const Ae=q.target.files;Ae?.length&&ie(Array.from(Ae))},me.click()},position:b.FooterButtonPosition.LEFT}],showModelSelector:!0,disableModelSelector:w.disableModelSelector}),[H,w.disableModelSelector,w.sessionModelId]),Z=(0,r.useCallback)(()=>{k.cancelRequest()},[]),oe=(0,r.useCallback)(async(me,q)=>{D||(T(me,R.map(Ae=>Ae.toString()),void 0,void 0,q),P(w.images||[]))},[T,R,D]),ie=(0,r.useCallback)(async me=>{const q=["image/jpeg","image/jpg","image/png","image/webp","image/gif"];if(me.filter(Ie=>!q.includes(Ie.type)).length>0){Q.error("Only JPG, PNG, WebP and GIF images are supported");return}const pe=V.getImageUploadProvider();if(!pe){Q.error("No image upload provider found");return}const ne=await Promise.all(me.map(Ie=>pe.imageUpload(Ie))),ue=[...R,...ne];P(ue)},[R]),he=(0,r.useCallback)(me=>{P(R.filter((q,Ae)=>Ae!==me))},[R]);return r.default.createElement("div",{className:l.default.chat_input_container},R.length>0&&r.default.createElement(S,{images:R,onDelete:he}),r.default.createElement(y.MentionInput,{mentionItems:K,onSend:oe,onStop:Z,loading:D,labelService:U,workspaceService:j,placeholder:(0,v.localize)("aiNative.chat.input.placeholder.default"),footerConfig:X,onImageUpload:ie,contextService:I}))};t.ChatMentionInput=A;const S=({images:w,onDelete:T})=>r.default.createElement("div",null,r.default.createElement("div",{className:l.default.thumbnail_container},w.map((D,I)=>r.default.createElement("div",{key:I,className:l.default.thumbnail},r.default.createElement(o.Image,{src:D.toString()}),r.default.createElement("button",{onClick:()=>T(I),className:l.default.delete_button},r.default.createElement(_.Icon,{iconClass:"codicon codicon-close"}))))))},92635:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(48412),_=e(91416),v=e(78569),m=e(72871),p=e(41869),s=e(81878),g=e(89195),a=e(43718),h=e(52416),u=e(90684),d=e(19413),E=e(56474),f=e(17319),l=n.__importDefault(e(6960)),y=T=>{const D=(0,p.useInjectable)(p.LabelService),I=(0,p.useInjectable)(p.CommandService),O=(L,B,j)=>{let W=D.getIcon(L,{isDirectory:B});return B&&j&&(W+=" expanded"),W},M=(0,o.useMemo)(()=>{const L=B=>{const j=typeof B.type=="number"?B.type===a.FileType.Directory:!!B.children,W=new a.URI(B.uri);return{label:B.label,iconClassName:O(W,j,j),expandable:!0,expanded:!0,children:j?(B.children||[]).map(L):null,uri:W}};return(T.treeData.children||[]).map(L)},[T.treeData]),[R,P]=(0,o.useState)(22),k=(0,o.useRef)(null),F=L=>{k.current=L;const B=()=>{let j=L.getModel().root.branchSize;j<1?j=1:j>20&&(j=20),P(j*22)};B(),L.onDidUpdate(B)};return M.length?o.default.createElement("div",{className:l.default.tree_container},o.default.createElement(_.BasicRecycleTree,{height:R,treeData:M,onContextMenu:L=>L.preventDefault(),onClick:(L,B)=>{!k.current||!B||(v.BasicCompositeTreeNode.is(B)?B.raw.iconClassName=O(B.raw.uri,!0,B.expanded):I.executeCommand(p.EDITOR_COMMANDS.OPEN_RESOURCE.id,B.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:F,treeName:T.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},b=T=>{const{toolCall:D,messageId:I}=T,O=(0,p.useInjectable)(a.ChatAgentViewServiceToken),[M,R]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const P=O.getChatComponent("toolCall");if(P){const{component:F,initialProps:L}=P;R(o.default.createElement(F,{...L,value:D,messageId:I}));return}R(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),O.getChatComponentDeferred("toolCall").promise.then(({component:F,initialProps:L})=>{R(o.default.createElement(F,{...L,value:D,messageId:I}))})},[D.state]),M},A=T=>{const D=(0,p.useInjectable)(a.ChatAgentViewServiceToken),[I,O]=(0,o.useState)(null);return(0,o.useEffect)(()=>{const M=D.getChatComponent(T.component);if(M){const{component:P,initialProps:k}=M;O(o.default.createElement(P,{...k,value:T.value,messageId:T.messageId}));return}O(o.default.createElement("div",null,o.default.createElement(g.Loading,null),o.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),D.getChatComponentDeferred(T.component).promise.then(({component:P,initialProps:k})=>{O(o.default.createElement(P,{...k,value:T.value}))})},[T.component,T.value]),I},S=T=>{var D,I;const{relationId:O,request:M,startTime:R=0,onRegenerate:P,onDidChange:k,onDone:F,agentId:L,command:B,history:j,msgId:W}=T,[,U]=(0,o.useReducer)(pe=>(pe+1)%1e6,0),Q=(0,p.useInjectable)(a.IAIReporter),V=(0,p.useInjectable)(h.IIconService),G=(0,p.useInjectable)(p.IContextKeyService),Y=(0,p.useInjectable)(d.IChatInternalService),H=(0,p.useInjectable)(a.ChatServiceToken),$=(0,p.useInjectable)(d.IChatAgentService),K=(0,p.useInjectable)(a.ChatRenderRegistryToken),[X,Z]=(0,o.useState)(M.response.isComplete?new Set(M.response.responseContents.map((pe,ne)=>pe.kind==="reasoning"?ne:-1).filter(pe=>pe!==-1)):new Set);(0,o.useEffect)(()=>{M.response.isComplete&&Z(new Set(M.response.responseContents.map((pe,ne)=>pe.kind==="reasoning"?ne:-1).filter(pe=>pe!==-1)))},[M.response.isComplete]),(0,o.useEffect)(()=>{const pe=new p.DisposableCollection;return pe.push(M.response.onDidChange(()=>{j.updateAssistantMessage(W,{content:M.response.responseText}),M.response.isComplete&&(F&&F(),Q.end(O,{assistantMessage:M.response.responseText,replytime:Date.now()-R,success:!0,isStop:!1,command:B,agentId:L,messageId:W,sessionId:Y.sessionModel.sessionId})),(0,o.startTransition)(()=>{k?.(),U()})})),()=>pe.dispose()},[O,k,F]);const oe=(0,o.useCallback)(()=>{M.response.reset(),P?.()},[P]),ie=(0,o.useCallback)(pe=>{if(K.chatAIRoleRender){const ne=K.chatAIRoleRender;return o.default.createElement(ne,{content:pe.value})}return o.default.createElement(E.ChatMarkdown,{markdown:pe,fillInIncompleteTokens:!0})},[K,K.chatAIRoleRender]),he=pe=>o.default.createElement(y,{treeData:pe}),me=pe=>o.default.createElement("div",{className:l.default.placeholder},o.default.createElement(s.Icon,{iconClass:V.fromString("$(codicon/sync~spin)")}),o.default.createElement("div",{className:l.default.placeholder_content},ie(pe))),q=o.default.useMemo(()=>M.response.responseContents.map((pe,ne)=>{let ue;if(pe.kind==="asyncContent")ue=me(new u.MarkdownString(pe.content));else if(pe.kind==="treeData")ue=he(pe.treeData);else if(pe.kind==="component")ue=o.default.createElement(A,{component:pe.component,value:pe.value,messageId:W});else if(pe.kind==="toolCall")ue=o.default.createElement(b,{toolCall:pe.content,messageId:W});else if(pe.kind==="reasoning"){const Ie=ne===M.response.responseContents.length-1&&!M.response.isComplete;ue=o.default.createElement("div",{className:(0,r.default)(l.default.reasoning,{[l.default.thinking]:Ie})},o.default.createElement(c.Button,{size:"small",type:"secondary",className:l.default.thinking,onClick:()=>{Ie||(X.has(ne)?X.delete(ne):X.add(ne),Z(new Set(X)))}},o.default.createElement(s.Icon,{iconClass:"codicon codicon-sparkle"}),(0,a.localize)("aiNative.chat.thinking"),Ie?o.default.createElement(g.Loading,null):X.has(ne)?o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-right"}):o.default.createElement(s.Icon,{iconClass:"codicon codicon-chevron-down"})),X.has(ne)?null:o.default.createElement("div",{className:l.default.reasoning_content},ie(new u.MarkdownString(pe.content))))}else ue=ie(pe.content);return o.default.createElement(o.Fragment,{key:`${pe.kind}-${ne}`},ue)}),[M.response.responseContents,X]),Ae=o.default.useMemo(()=>M.response.followups?M.response.followups.map((pe,ne)=>{let ue=null;if(pe.kind==="reply"){const Ie=o.default.createElement("a",{onClick:()=>{H.sendMessage({...$.parseMessage(pe.message),reportExtra:{actionSource:a.ActionSourceEnum.Chat,actionType:a.ActionTypeEnum.Followup}})}},pe.title||pe.message);ue=pe.tooltip?o.default.createElement(m.Tooltip,{title:pe.tooltip},Ie):Ie}else pe.when&&!G.match(pe.when)&&(ue=null),ue=o.default.createElement(c.Button,{type:"default"},pe.title);return ue&&o.default.createElement(o.Fragment,{key:ne},ue)}):null,[M.response.followups]);return M.response.isComplete?o.default.createElement(f.ChatThinkingResult,{hasMessage:M.response.responseParts.length>0||M.response.responseContents.length>0||!!(!((D=M.response.errorDetails)===null||D===void 0)&&D.message),onRegenerate:oe,requestId:M.requestId},o.default.createElement("div",{className:l.default.ai_chat_response_container},!((I=M.response.errorDetails)===null||I===void 0)&&I.message?o.default.createElement("div",{className:l.default.error},o.default.createElement(s.Icon,{className:(0,s.getIcon)("close-circle")}),o.default.createElement("span",null,M.response.errorDetails.message)):o.default.createElement(o.default.Fragment,null,q,Ae?.length!==0&&o.default.createElement("div",{className:l.default.followups},Ae)))):o.default.createElement(f.ChatThinking,{message:M.response.responseText},q)};t.ChatReply=S;const w=T=>{const{chunk:D}=T,I=(0,p.useInjectable)(a.ChatRenderRegistryToken),O=o.default.useMemo(()=>{let M;if(D.kind==="component")M=o.default.createElement(A,{component:D.component,value:D.value});else{let R=o.default.createElement(E.ChatMarkdown,{markdown:D.content,fillInIncompleteTokens:!0});if(I.chatAIRoleRender){const P=I.chatAIRoleRender;R=o.default.createElement(P,{content:D.content})}M=R}return M},[D]);return o.default.createElement(f.ChatThinkingResult,{hasMessage:!0,requestId:T.requestId,showRegenerate:!1},o.default.createElement("div",{className:l.default.ai_chat_response_container},O))};t.ChatNotify=w},17319:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(89195),_=e(68974),v=e(43718),m=e(19413),p=n.__importDefault(e(6960)),s=a=>{const{children:h,message:u,thinkingText:d}=a,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),f=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),l=(0,r.useMemo)(()=>Array.isArray(h)?h.length===0:!h,[h]),y=(0,r.useCallback)(()=>l?f?r.default.createElement(f,{thinkingText:d}):r.default.createElement("span",{className:p.default.thinking_text},d||"Thinking..."):h,[u,h,d,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:p.default.content},y()),r.default.createElement("div",{className:p.default.thinking_container},r.default.createElement("div",{className:p.default.stop},!f&&r.default.createElement("span",{className:p.default.progress_bar},l&&r.default.createElement(_.Progress,{loading:!0,wrapperClassName:p.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const g=({children:a,message:h,onRegenerate:u,requestId:d,hasMessage:E=!0,showRegenerate:f})=>{const l=(0,o.useInjectable)(m.IChatInternalService),[y,b]=(0,r.useState)(l.latestRequestId),A=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const I=l.onChangeRequestId(O=>{b(O)});return()=>I.dispose()},[l]);const S=(0,r.useMemo)(()=>A.chatThinkingResultRender,[A,A.chatThinkingResultRender]),w=(0,r.useCallback)(()=>{u&&u()},[u]),T=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const I=(0,v.localize)("aiNative.chat.stop.immediately");return S?r.default.createElement(S,{thinkingResult:I}):r.default.createElement("span",null,I)}return a},[h,E,a]),D=(0,r.useMemo)(()=>(0,v.isUndefined)(f)?y===d&&!!d:!!f,[y,d,f]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:p.default.content},T()),r.default.createElement("div",{className:p.default.thinking_container},r.default.createElement("div",{className:p.default.bottom_container},r.default.createElement("div",{className:p.default.reset},D?r.default.createElement(c.EnhanceIcon,{icon:"refresh",wrapperClassName:p.default.text_btn,className:p.default.transform,onClick:w,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:p.default.thumbs},r.default.createElement(c.Thumbs,{relationId:d,wrapperClassName:p.default.icon_btn})))))};t.ChatThinkingResult=g},34817:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),_=e(81878),v=e(89195),m=e(43718),p=e(33783),s=e(77633),g=e(25834),a=n.__importDefault(e(16796)),h=e(78112),u=d=>{var E,f,l;const{value:y,messageId:b}=d,[A,S]=(0,o.useState)(!1),w=(0,c.useInjectable)(s.TokenMCPServerRegistry);if(!y||!y.function||!y.id)return null;const T=((E=w.getMCPTool(y.function.name))===null||E===void 0?void 0:E.label)||y.function.name,D=w.getToolComponent(y.function.name),I=P=>{switch(P){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:P||"Unknown",icon:o.default.createElement(_.Icon,{iconClass:"codicon codicon-question"})}}},O=()=>{var P;try{return y.state!=="complete"&&y.state!=="result"?{}:JSON.parse(((P=y.function)===null||P===void 0?void 0:P.arguments)||"{}")}catch{return{}}},M=()=>{S(!A)},R=I(y.state);return D&&(y.state==="complete"||y.state==="result")?o.default.createElement(D,{state:y.state,args:O(),result:y.result,index:y.index,messageId:b,toolCallId:y.id}):o.default.createElement("div",{className:a.default.chat_tool_render},o.default.createElement("div",{className:a.default.tool_header,onClick:M},o.default.createElement("div",{className:a.default.tool_name},o.default.createElement(_.Icon,{iconClass:`codicon codicon-chevron-${A?"down":"right"}`}),o.default.createElement(_.Icon,{size:"small",iconClass:(0,r.default)("codicon codicon-tools",a.default.tool_icon)}),o.default.createElement("span",{className:a.default.tool_label},T)),y.state&&o.default.createElement("div",{className:a.default.tool_state},o.default.createElement("span",{className:a.default.state_icon},R.icon))),o.default.createElement("div",{className:(0,r.default)(a.default.tool_content,{[a.default.expanded]:A})},((f=y?.function)===null||f===void 0?void 0:f.arguments)&&o.default.createElement("div",{className:a.default.tool_arguments},o.default.createElement("div",{className:a.default.section_label},(0,p.localize)("ai.native.mcp.tool.arguments"),":"),o.default.createElement(g.CodeEditorWithHighlight,{input:(l=y?.function)===null||l===void 0?void 0:l.arguments,language:"json",relationId:(0,m.uuid)(4)})),y?.result&&o.default.createElement("div",{className:a.default.tool_result},o.default.createElement("div",{className:a.default.section_label},(0,p.localize)("ai.native.mcp.tool.results"),":"),o.default.createElement(h.ChatToolResult,{result:y.result,relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=u},78112:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolResult=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(33783),c=e(25834),_=n.__importDefault(e(48091)),v=({result:m,relationId:p})=>{const s=r.default.useCallback(h=>{try{return JSON.parse(h).content||[]}catch{return[{type:"text",text:h}]}},[]),g=r.default.useCallback((h,u)=>{switch(h.type){case"text":return h.text?r.default.createElement("div",{key:`text-${u}`,className:_.default.text_content},r.default.createElement(c.CodeEditorWithHighlight,{input:h.text,language:"text",relationId:p||""})):null;case"image":return h.data?r.default.createElement("div",{key:`image-${u}`,className:_.default.image_content},r.default.createElement("img",{src:`data:${h.mimeType||"image/png"};base64,${h.data}`,alt:(0,o.localize)("aiNative.chat.result.image")})):null;default:return null}},[p]),a=r.default.useMemo(()=>s(m),[m,s]);return a.length?r.default.createElement("div",{className:_.default.result_container},a.map((h,u)=>g(h,u))):null};t.ChatToolResult=v},29039:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),c=e(43718),_=e(19413),v=m=>{const{userMessage:p,relationId:s,requestId:g,renderContent:a,startTime:h,agentId:u,command:d}=m,E=(0,o.useInjectable)(_.IChatInternalService),f=(0,o.useInjectable)(c.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(g),f.end(s,{message:p,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:d})},[a,g,s]),r.createElement("div",null,a({userMessage:p}))};t.SlashCustomRender=v},86556:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),_=e(4246),v=e(43718),m=e(90684);e(41937);const p=e(19413),s=e(56474),g=e(17319),a=e(78048),h=n.__importDefault(e(6960)),u=()=>{var d,E;const f=(0,o.useInjectable)(v.ChatServiceToken),l=(0,o.useInjectable)(p.IChatAgentService),y=(0,o.useInjectable)(v.ChatFeatureRegistryToken),b=(0,o.useInjectable)(v.ChatRenderRegistryToken),[A,S]=r.useState([]);(0,o.useUpdateOnEvent)(y.onDidWelcomeMessageChange);const w=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return[];const{sampleQuestions:O=[]}=y.chatWelcomeMessageModel;return O.map(a.extractIcon)},[(d=y.chatWelcomeMessageModel)===null||d===void 0?void 0:d.sampleQuestions]),T=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return"";const{content:O}=y.chatWelcomeMessageModel;return O},[(E=y.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const O=l.onDidChangeAgents(async()=>{const R=(await l.getAllSampleQuestions()).map(a.extractIcon);S(R)});return()=>O.dispose()},[]),!T)return r.createElement(g.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const D=r.useMemo(()=>w.concat(A),[w,A]);return r.useMemo(()=>{if(b.chatWelcomeRender){const O=b.chatWelcomeRender;return r.createElement(O,{message:T,sampleQuestions:D})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(T)?r.createElement(s.ChatMarkdown,{key:"welcome",markdown:T}):T),r.createElement("div",{className:h.default.chat_container_content},D.map((O,M)=>{const R=r.createElement("a",{className:h.default.link_item,onClick:(0,_.withPrevented)(()=>{f.sendMessage({...l.parseMessage(O.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},O.icon?r.createElement(c.Icon,{className:O.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,O.title));return O.tooltip?r.createElement(c.Tooltip,{title:O.tooltip,key:M},R):r.createElement(r.Fragment,{key:M},R)})))},[b.chatWelcomeRender,T,D])};t.WelcomeMessage=u},83933:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},96086:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionInput=t.WHITE_SPACE_TEXT=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),_=e(81878),v=e(89195),m=e(70392),p=n.__importDefault(e(97599)),s=e(80732),g=e(44692);t.WHITE_SPACE_TEXT="&nbsp;";const a=({mentionItems:h=[],onSend:u,onStop:d,loading:E=!1,mentionKeyword:f=g.MENTION_KEYWORD,onSelectionChange:l,onImageUpload:y,labelService:b,workspaceService:A,placeholder:S="Ask anything, @ to mention",footerConfig:w={buttons:[],showModelSelector:!1},contextService:T})=>{const D=o.useRef(null),[I,O]=o.useState({active:!1,startPos:null,filter:"",position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),[M,R]=o.useState(w.defaultModel||""),[P,k]=o.useState({}),[F,L]=o.useState([]),[B,j]=o.useState(-1),[W,U]=o.useState(""),[Q,V]=o.useState(!1),[G,Y]=o.useState({files:[],folders:[]}),H=()=>I.level===0?h:I.parentType?I.loading?P[I.parentType]||[]:P[I.parentType]||[]:[],K=((ve,Se)=>{const[Ce,fe]=o.useState(ve);return o.useEffect(()=>{const Pe=setTimeout(()=>{fe(ve)},Se);return()=>{clearTimeout(Pe)}},[ve,Se]),Ce})(I.secondLevelFilter,300);o.useEffect(()=>{R(w.defaultModel||"")},[w.defaultModel]),o.useEffect(()=>{if(I.level===1&&I.parentType&&K!==void 0){const ve=h.find(Ce=>Ce.id===I.parentType);if(!ve)return;O(Ce=>({...Ce,loading:!0})),(async()=>{try{const Ce=[];if(ve.getHighestLevelItems){const fe=ve.getHighestLevelItems();for(const Pe of fe)Ce.some(Te=>Te.id===Pe.id)||Ce.push(Pe);k(Pe=>({...Pe,[I.parentType]:fe}))}if(ve.getItems)try{const fe=await ve.getItems(K),Pe=[...Ce];for(const Te of fe)Pe.some(Ne=>Ne.id===Te.id)||Pe.push(Te);k(Te=>({...Te,[I.parentType]:Pe}))}catch{O(Pe=>({...Pe,loading:!1}))}O(fe=>({...fe,loading:!1}))}catch{O(fe=>({...fe,loading:!1}))}})()}},[K,I.level,I.parentType]),o.useEffect(()=>{const ve=T?.onDidContextFilesChangeEvent(({attached:Se,attachedFolders:Ce})=>{Y({files:Se,folders:Ce})});return()=>{ve?.dispose()}},[T]);const X=ve=>{const Se=window.getSelection();if(!Se||!Se.rangeCount)return 0;const Ce=Se.getRangeAt(0),fe=Ce.cloneRange();return fe.selectNodeContents(ve),fe.setEnd(Ce.endContainer,Ce.endOffset),fe.toString().length},Z=()=>{Q&&(V(!1),j(-1));const ve=window.getSelection();if(!ve||!ve.rangeCount||!D.current)return;const Se=D.current.textContent||"",Ce=X(D.current);if(Se[Ce-1]===f&&!I.active&&!I.inlineSearchActive&&O({active:!0,startPos:Ce,filter:f,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1}),I.active&&I.level===0&&I.startPos!==null)if(Ce<I.startPos)O(fe=>({...fe,active:!1}));else{const fe=Se.substring(I.startPos-1,Ce);O(Pe=>({...Pe,filter:fe,activeIndex:0}))}if(I.inlineSearchActive&&I.inlineSearchStartPos!==null&&I.parentType){const fe=h.find(Ne=>Ne.id===I.parentType);if(!fe)return;const Pe=`@${fe.type}:`,Te=I.inlineSearchStartPos-Pe.length;if(Te>=0&&Ce>Te+Pe.length){const Ne=Se.substring(Te+Pe.length,Ce);Ne!==I.secondLevelFilter&&O(_e=>({..._e,secondLevelFilter:Ne,active:!0,activeIndex:0}))}else Ce<=Te&&O(Ne=>({...Ne,inlineSearchActive:!1,active:!1}))}if(D.current&&(D.current.scrollHeight>=120?D.current.style.overflowY="auto":D.current.style.overflowY="hidden"),D.current){const fe=D.current.innerHTML;(fe===""||fe==="<br>"||fe==="<br/>")&&(D.current.innerHTML="")}},oe=ve=>{if(ve.key==="Escape"&&(I.active||I.inlineSearchActive)){I.level>0?O(Ce=>({...Ce,level:0,activeIndex:0,secondLevelFilter:"",inlineSearchActive:!1})):O(Ce=>({...Ce,active:!1,inlineSearchActive:!1})),ve.preventDefault();return}if((ve.key==="Backspace"||ve.key==="Delete")&&D.current&&(!D.current.textContent||D.current.textContent.trim()==="")&&T?.cleanFileContext(),ve.key===g.MENTION_KEYWORD&&!I.active&&!I.inlineSearchActive&&D.current){const Ce=X(D.current);O({active:!0,startPos:Ce+1,filter:f,position:{top:0,left:0},activeIndex:0,level:0,parentType:null,secondLevelFilter:"",inlineSearchActive:!1,inlineSearchStartPos:null,loading:!1})}if((ve.key==="ArrowUp"||ve.key==="ArrowDown")&&!ve.shiftKey&&!ve.ctrlKey&&!ve.metaKey&&!ve.altKey){if(!I.active&&!I.inlineSearchActive&&D.current&&F.length>0){const Ce=D.current.innerHTML;if(!Ce||Ce==="<br>"||Q&&B>=0&&F[F.length-1-B]===Ce){ve.preventDefault(),Q||(U(Ce),V(!0));let Pe=B;ve.key==="ArrowUp"?Pe=Math.min(F.length-1,B+1):Pe=Math.max(-1,B-1),j(Pe),Pe===-1?D.current.innerHTML=W:D.current.innerHTML=F[F.length-1-Pe];const Te=document.createRange();Te.selectNodeContents(D.current),Te.collapse(!1);const Ne=window.getSelection();Ne&&(Ne.removeAllRanges(),Ne.addRange(Te));return}}}else Q&&ve.key!=="ArrowUp"&&ve.key!=="ArrowDown"&&(V(!1),j(-1));if(ve.key==="Enter"){if(ve.nativeEvent.isComposing)return;if(!ve.shiftKey&&(ve.preventDefault(),!I.active)){pe();return}}if(!I.active)return;let Se=H();if(I.level===0&&I.filter&&I.filter.length>1){const Ce=I.filter.substring(1).toLowerCase();Se=Se.filter(fe=>fe.text.toLowerCase().includes(Ce))}Se.length!==0&&(ve.key==="ArrowDown"?(O(Ce=>({...Ce,activeIndex:(Ce.activeIndex+1)%Se.length})),ve.preventDefault()):ve.key==="ArrowUp"?(O(Ce=>({...Ce,activeIndex:(Ce.activeIndex-1+Se.length)%Se.length})),ve.preventDefault()):(ve.key==="Enter"||ve.key==="Tab")&&Se.length>0&&(q(Se[I.activeIndex]),ve.preventDefault()))},ie=()=>{},he=async ve=>{const Se=ve.clipboardData.items,Ce=[];for(let Oe=0;Oe<Se.length;Oe++)if(Se[Oe].kind==="file"&&Se[Oe].type.startsWith("image/")){const De=Se[Oe].getAsFile();De&&Ce.push(De)}if(ve.preventDefault(),Ce.length>0&&y){await y(Ce);return}const Pe=ve.clipboardData.getData("text/plain").replace(/\t/g," ").replace(/\n\s*\n/g,`
31455
31455
 
31456
31456
  `).replace(/[ \t]+$/gm,""),Te=window.getSelection();if(!Te||!Te.rangeCount)return;const Ne=Te.getRangeAt(0);Ne.deleteContents();const _e=Pe.split(`
31457
- `),re=document.createDocumentFragment();_e.forEach((Oe,De)=>{const Fe=Oe.replace(/^[ ]+/g,je=>{const gt=document.createElement("span");return gt.innerHTML="\xA0".repeat(je.length),gt.innerHTML}),Ge=document.createElement("span");for(Ge.innerHTML=Fe;Ge.firstChild;)re.appendChild(Ge.firstChild);De<_e.length-1&&re.appendChild(document.createElement("br"))});const ge=re.lastChild;if(Ne.insertNode(re),ge&&ge.parentNode){const Oe=document.createRange();Oe.setStartAfter(ge),Te.removeAllRanges(),Te.addRange(Oe)}Z()};o.useEffect(()=>{D.current&&S&&!D.current.textContent&&D.current.setAttribute("data-placeholder",S)},[S]);const me=ve=>{var Se;I.active&&!(!((Se=document.querySelector(`.${p.default.mention_panel}`))===null||Se===void 0)&&Se.contains(ve.target))&&O(Ce=>({...Ce,active:!1,inlineSearchActive:!1}))};o.useEffect(()=>(document.addEventListener("click",me,!0),()=>{document.removeEventListener("click",me,!0)}),[I.active]);const q=(ve,Se=!1)=>{var Ce;if(!D.current)return;if(ve.getItems){const Ge=window.getSelection();if(!Ge||!Ge.rangeCount)return;if(I.level===0&&I.startPos!==null){let je,gt,ot;const Mt=document.createTreeWalker(D.current,NodeFilter.SHOW_TEXT);let lt=0,At;for(;At=Mt.nextNode();){const rt=((Ce=At.textContent)===null||Ce===void 0?void 0:Ce.length)||0;if(I.startPos-1>=lt&&I.startPos-1<lt+rt){je=At,gt=I.startPos-1-lt;const st=Se?I.startPos+I.filter.length-1:X(D.current);ot=Math.min(st-lt,rt);break}lt+=rt}if(je){const rt=document.createRange();rt.setStart(je,gt),rt.setEnd(je,ot),rt.deleteContents();const st=document.createTextNode(`${f}${ve.type}:`);rt.insertNode(st);const ct=document.createRange();ct.setStartAfter(st),ct.setEndAfter(st),Ge.removeAllRanges(),Ge.addRange(ct),O(bt=>({...bt,active:!0,level:1,parentType:ve.id,inlineSearchActive:!0,inlineSearchStartPos:X(D.current),secondLevelFilter:"",activeIndex:0})),D.current.focus();return}}return}const fe=window.getSelection();if(!fe||!fe.rangeCount)return;if(I.inlineSearchActive&&I.parentType&&I.inlineSearchStartPos!==null){const Ge=h.find(ot=>ot.id===I.parentType);if(!Ge)return;const je=`${f}${Ge.type}:`,gt=I.inlineSearchStartPos-je.length;if(gt>=0){let Ut=function(hn){if(hn.nodeType===3)bt.push({node:hn,start:st,end:st+hn.textContent.length}),st+=hn.textContent.length;else if(hn.nodeType===1){const kn=hn.childNodes||[];for(const fi of Array.from(kn))Ut(fi)}};const ot=document.createElement("span");if(ot.className=p.default.mention_tag,ot.dataset.id=ve.id,ot.dataset.type=ve.type,ot.dataset.contextId=ve.contextId||"",ot.contentEditable="false",ve.type===g.MentionType.FILE||ve.type===g.MentionType.FOLDER){const hn=document.createElement("span");hn.className=(0,r.default)(p.default.mention_icon,ve.type===g.MentionType.FILE?b?.getIcon(new m.URI(ve.text)):(0,_.getIcon)("folder")),ot.appendChild(hn),ve.type===g.MentionType.FOLDER?T?.addFolderToContext(new m.URI(ve.contextId),!0):T?.addFileToContext(new m.URI(ve.contextId),void 0,!0)}else if(ve.type===g.MentionType.CODE){const hn=document.createElement("span");hn.className=(0,r.default)(p.default.mention_icon,ve.kind&&(0,c.getSymbolIcon)(ve.kind)+" outline-icon"),ot.appendChild(hn),ve.symbol&&T?.addFileToContext(new m.URI(ve.contextId),[ve.symbol.range.startLineNumber,ve.symbol.range.endLineNumber],!0)}const Mt=A?.workspace;let lt=ve.text;Mt&&ve.contextId&&(lt=ve.contextId.replace(new m.URI(Mt.uri).codeUri.fsPath,"").slice(1));const At=document.createTextNode(lt);ot.appendChild(At);const rt=document.createRange();let st=0,ct=!1;const bt=[];Ut(D.current);for(const hn of bt){if(gt>=hn.start&&gt<=hn.end){const kn=gt-hn.start;rt.setStart(hn.node,kn),ct=!0}if(ct){const kn=Se?gt+je.length+I.secondLevelFilter.length:X(D.current);if(kn>=hn.start&&kn<=hn.end){const fi=kn-hn.start;rt.setEnd(hn.node,fi);break}}}if(ct){rt.deleteContents(),rt.insertNode(ot);const hn=document.createRange();hn.setStartAfter(ot),hn.setEndAfter(ot),fe.removeAllRanges(),fe.addRange(hn);const kn=document.createTextNode("\xA0");hn.insertNode(kn),hn.setStartAfter(kn),hn.setEndAfter(kn),fe.removeAllRanges(),fe.addRange(hn)}O(hn=>({...hn,active:!1,inlineSearchActive:!1})),D.current.focus();return}}const Pe=document.createElement("span");if(Pe.className=p.default.mention_tag,Pe.dataset.id=ve.id,Pe.dataset.type=ve.type,Pe.dataset.contextId=ve.contextId||"",Pe.contentEditable="false",ve.type==="file"||ve.type==="folder"){const Ge=document.createElement("span");Ge.className=(0,r.default)(p.default.mention_icon,ve.type==="file"?b?.getIcon(new m.URI(ve.text)):(0,_.getIcon)("folder")),Pe.appendChild(Ge)}const Te=A?.workspace;let Ne=ve.text;Te&&ve.contextId&&(Ne=ve.contextId.replace(new m.URI(Te.uri).codeUri.fsPath,"").slice(1));const _e=document.createTextNode(Ne);Pe.appendChild(_e);let re=0,ge=!1;const Oe=[];function De(Ge){if(Ge.nodeType===3)Oe.push({node:Ge,start:re,end:re+Ge.textContent.length}),re+=Ge.textContent.length;else if(Ge.nodeType===1){const je=Ge.childNodes;for(const gt of Array.from(je))De(gt)}}De(D.current);const Fe=document.createRange();if(I.startPos!==null)for(const Ge of Oe){if(I.startPos-1>=Ge.start&&I.startPos-1<=Ge.end){const je=I.startPos-1-Ge.start;Fe.setStart(Ge.node,je),ge=!0}if(ge){const je=Se?I.startPos+I.filter.length-1:X(D.current);if(je>=Ge.start&&je<=Ge.end){const gt=je-Ge.start;Fe.setEnd(Ge.node,gt);break}}}if(ge){Fe.deleteContents(),Fe.insertNode(Pe);const Ge=document.createRange();Ge.setStartAfter(Pe),Ge.setEndAfter(Pe),fe.removeAllRanges(),fe.addRange(Ge);const je=document.createTextNode("\xA0");Ge.insertNode(je),Ge.setStartAfter(je),Ge.setEndAfter(je),fe.removeAllRanges(),fe.addRange(Ge)}O(Ge=>({...Ge,active:!1})),D.current.focus()},Ae=o.useCallback(ve=>{R(ve),l?.(ve)},[M,l]),pe=()=>{if(!D.current)return;const ve=D.current.innerHTML;if(!ve)return;const Se=document.createElement("div");Se.innerHTML=ve,Se.querySelectorAll(`.${p.default.mention_tag}`).forEach(Pe=>{var Te;const Ne=Pe.getAttribute("data-context-id");if(Ne){const _e=document.createTextNode(`{{${f}${Pe.getAttribute("data-type")}:${Ne}}}`);(Te=Pe.parentNode)===null||Te===void 0||Te.replaceChild(_e,Pe)}});let fe=Se.innerHTML;fe=fe.trim().replaceAll(t.WHITE_SPACE_TEXT," "),ve&&(L(Pe=>[...Pe,ve]),j(-1),V(!1)),u&&u(fe,{model:M,...w}),D.current.innerHTML="",D.current&&(D.current.style.overflowY="hidden",D.current.style.height="auto")},ne=o.useCallback(()=>{T?.cleanFileContext()},[T]),ue=o.useCallback(()=>{d&&d()},[d]),Ie=o.useCallback(ve=>(w.buttons||[]).filter(Se=>Se.position===ve).map(Se=>o.createElement(_.Popover,{key:Se.id,overlayClassName:p.default.popover_icon,id:`ai-chat-${Se.id}`,position:_.PopoverPosition.top,title:Se.title},o.createElement(v.EnhanceIcon,{className:(0,r.default)(Se.icon?(0,_.getIcon)(Se.icon):Se.iconClass,p.default[`${Se.id}_logo`]),tabIndex:0,role:"button",ariaLabel:Se.title,onClick:Se.onClick}))),[w.buttons]),xe=o.useMemo(()=>G.files.length>0||G.folders.length>0,[G]);return o.createElement("div",{className:p.default.input_container},I.active&&o.createElement("div",{className:p.default.mention_panel_container},o.createElement(s.MentionPanel,{items:H(),activeIndex:I.activeIndex,onSelectItem:ve=>q(ve,!0),position:{top:0,left:0},filter:I.level===0?I.filter:I.secondLevelFilter,visible:!0,level:I.level,loading:I.loading})),o.createElement("div",{className:p.default.editor_area},o.createElement("div",{ref:D,className:p.default.editor,contentEditable:!0,onInput:Z,onKeyDown:oe,onPaste:he,onCompositionEnd:ie})),o.createElement("div",{className:p.default.footer},o.createElement("div",{className:p.default.left_control},w.showModelSelector&&o.createElement(_.Select,{options:w.modelOptions||[],value:M,onChange:Ae,className:p.default.model_selector,size:"small",disabled:w.disableModelSelector}),Ie(g.FooterButtonPosition.LEFT)),o.createElement("div",{className:p.default.right_control},Ie(g.FooterButtonPosition.RIGHT),xe&&o.createElement(_.Popover,{overlayClassName:p.default.popover_icon,id:"ai-chat-clear-context",position:_.PopoverPosition.top,content:(0,c.localize)("aiNative.chat.context.clear")},o.createElement("div",{className:p.default.context_container,onClick:ne},o.createElement("div",{className:p.default.context_icon},o.createElement(_.Icon,{icon:"out-link"}),o.createElement(_.Icon,{icon:"close"})),o.createElement("div",{className:p.default.context_description},(0,c.formatLocalize)("aiNative.chat.context.description",G.files.length+G.folders.length)))),o.createElement(_.Popover,{overlayClassName:p.default.popover_icon,id:"ai-chat-send",position:_.PopoverPosition.top,content:E?"Stop":"Send"},E?o.createElement(v.EnhanceIcon,{wrapperClassName:p.default.stop_logo,className:(0,r.default)((0,_.getIcon)("stop"),p.default.stop_logo_icon),tabIndex:0,role:"button",ariaLabel:"Stop",onClick:ue}):o.createElement(v.EnhanceIcon,{wrapperClassName:p.default.send_logo,className:(0,r.default)((0,_.getIcon)("send-outlined"),p.default.send_logo_icon),tabIndex:0,role:"button",onClick:pe,ariaLabel:"Send"})))))};t.MentionInput=a},40167:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(81878),_=n.__importDefault(e(97599)),v=({item:m,isActive:p,onClick:s})=>o.createElement("div",{className:`${_.default.mention_item} ${p?_.default.active:""}`,onClick:()=>s(m)},o.createElement("div",{className:_.default.mention_item_left},o.createElement(c.Icon,{className:(0,r.default)(_.default.mention_item_icon,m.icon)}),o.createElement("span",{className:_.default.mention_item_text},m.text),o.createElement("span",{className:_.default.mention_item_description},m.description)),m.getItems&&o.createElement(c.Icon,{className:(0,r.default)(_.default.mention_item_right,(0,c.getIcon)("arrowright"))}));t.MentionItem=v},80732:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionPanel=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(97599)),c=e(40167),_=({items:v,activeIndex:m,onSelectItem:p,position:s,filter:g,visible:a,level:h,loading:u=!1})=>{const d=r.useRef(null);if(r.useEffect(()=>{if(a&&d.current){const l=d.current.querySelector(`.${o.default.mention_item}.${o.default.active}`);l&&l.scrollIntoView({block:"nearest"})}},[m,a]),!a)return null;const f=(()=>{let l=v;if(h===0){if(g&&g.length>1){const y=g.substring(1).toLowerCase();l=v.filter(b=>b.text.toLowerCase().includes(y))}}else g&&g.length>0&&(l=v.filter(y=>y.text.toLowerCase().includes(g.toLowerCase())));return l})();return h===0&&f.length===0?null:r.createElement("div",{ref:d,className:o.default.mention_panel,style:{top:s.top,left:s.left}},u&&r.createElement("div",{className:o.default.loading_bar}),v.length>0?r.createElement("ul",{className:o.default.mention_list},v.map((l,y)=>r.createElement(c.MentionItem,{key:l.id,item:l,isActive:y===m,onClick:()=>p(l,!0)}))):r.createElement("div",{className:o.default.no_results},u?"\u6B63\u5728\u641C\u7D22...":"\u65E0\u5339\u914D\u7ED3\u679C"))};t.MentionPanel=_},44692:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MENTION_KEYWORD=t.MentionType=t.FooterButtonPosition=void 0;var e;(function(r){r.LEFT="left",r.RIGHT="right"})(e||(t.FooterButtonPosition=e={}));var n;(function(r){r.FILE="file",r.FOLDER="folder",r.CODE="code"})(n||(t.MentionType=n={})),t.MENTION_KEYWORD="@"},78048:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),c=(m,p)=>o({...m,position:"right",title:r,className:p,role:1});t.createMessageByUser=c;const _=(m,p)=>o({...m,position:"left",title:"",className:p,role:2});t.createMessageByAI=_;const v=m=>{let{title:p}=m;const{message:s,tooltip:g}=m;let a=m.icon||"";if(!p)return{icon:a,title:s,message:s,tooltip:g};const h=p.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,d,E,f]=h,l=d?d.slice(0,-1):n.CODICON_OWNER;a=(0,n.getExternalIcon)(E,l),f&&(a+=` ${f.slice(1)}`),p=p.slice(u.length)}return{icon:a,title:p,message:s,tooltip:g}};t.extractIcon=v},19957:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(46044);let _=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=_,n.__decorate([(0,r.Autowired)(c.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"llmContextService",void 0),t.LlmContextContribution=_=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],_)},63536:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(25234),_=e(19083),v=e(86560),m=e(96689),p=e(82196),s=e(14951),g=e(6287),a=e(20868);let h=class extends c.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxAttachFoldersLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.attachedFolders=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new v.Emitter,this.hasUserManualReference=!1,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(d,E,f){const l=E.findIndex(y=>{var b,A,S,w;return y.uri.toString()===d.uri.toString()&&((b=y.selection)===null||b===void 0?void 0:b[0])===((A=d.selection)===null||A===void 0?void 0:A[0])&&((S=y.selection)===null||S===void 0?void 0:S[1])===((w=d.selection)===null||w===void 0?void 0:w[1])});l>-1&&E.splice(l,1),E.push(d),E.length>f&&E.shift()}addFolderToList(d,E,f){const l=E.findIndex(y=>y.uri.toString()===d.uri.toString());l>-1&&E.splice(l,1),E.push(d),E.length>f&&E.shift()}addFileToContext(d,E,f=!1){if(!d)return;f&&(this.hasUserManualReference=!0);const l={uri:d,selection:E},y=f?this.attachedFiles:this.recentlyViewFiles,b=f?this.maxAttachFilesLimit:this.maxViewFilesLimit;f&&this.docModelManager.createModelReference(d),this.addFileToList(l,y,b),this.notifyContextChange()}addFolderToContext(d){if(!d)return;const E={uri:d};this.addFolderToList(E,this.attachedFolders,this.maxAttachFoldersLimit),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles=[],this.attachedFolders=[],this.hasUserManualReference=!1,this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,attachedFolders:this.attachedFolders,version:this.contextVersion++}}removeFileFromContext(d,E=!1){const f=E?this.attachedFiles:this.recentlyViewFiles,l=f.findIndex(y=>y.uri.toString()===d.toString());l>-1&&f.splice(l,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(m.EditorDocumentModelCreationEvent,d=>{d.payload.uri.scheme==="file"&&this.addFileToContext(d.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelRemovalEvent,d=>{d.payload.scheme==="file"&&this.removeFileFromContext(d.payload,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelSavedEvent,d=>{d.payload.scheme})),this.disposables.push(this.eventBus.on(p.EditorSelectionChangeEvent,d=>{if(d.payload.selections.length>0){const E=[d.payload.selections[0].selectionStartLineNumber,d.payload.selections[0].positionLineNumber].sort();this.hasUserManualReference||(E[0]===E[1]?this.addFileToContext(d.payload.editorUri,void 0,!1):this.addFileToContext(d.payload.editorUri,E.sort((f,l)=>f-l),!1))}}))}stopAutoCollection(){this.dispose()}async serialize(){const d=this.getAllContextFiles(),E=v.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(d.viewed,E),attachedFiles:this.serializeAttachedFiles(d.attached,E),attachedFolders:await this.serializeAttachedFolders(d.attachedFolders,E)}}async serializeAttachedFolders(d,E){const f=Array.from(new Set(d.map(l=>l.uri.toString())));return Promise.all(f.map(async l=>{var y;const b=new v.URI(l);return`\`\`\`
31457
+ `),re=document.createDocumentFragment();_e.forEach((Oe,De)=>{const Fe=Oe.replace(/^[ ]+/g,je=>{const gt=document.createElement("span");return gt.innerHTML="\xA0".repeat(je.length),gt.innerHTML}),Ge=document.createElement("span");for(Ge.innerHTML=Fe;Ge.firstChild;)re.appendChild(Ge.firstChild);De<_e.length-1&&re.appendChild(document.createElement("br"))});const ge=re.lastChild;if(Ne.insertNode(re),ge&&ge.parentNode){const Oe=document.createRange();Oe.setStartAfter(ge),Te.removeAllRanges(),Te.addRange(Oe)}Z()};o.useEffect(()=>{D.current&&S&&!D.current.textContent&&D.current.setAttribute("data-placeholder",S)},[S]);const me=ve=>{var Se;I.active&&!(!((Se=document.querySelector(`.${p.default.mention_panel}`))===null||Se===void 0)&&Se.contains(ve.target))&&O(Ce=>({...Ce,active:!1,inlineSearchActive:!1}))};o.useEffect(()=>(document.addEventListener("click",me,!0),()=>{document.removeEventListener("click",me,!0)}),[I.active]);const q=(ve,Se=!1)=>{var Ce;if(!D.current)return;if(ve.getItems){const Ge=window.getSelection();if(!Ge||!Ge.rangeCount)return;if(I.level===0&&I.startPos!==null){let je,gt,ot;const Mt=document.createTreeWalker(D.current,NodeFilter.SHOW_TEXT);let lt=0,At;for(;At=Mt.nextNode();){const rt=((Ce=At.textContent)===null||Ce===void 0?void 0:Ce.length)||0;if(I.startPos-1>=lt&&I.startPos-1<lt+rt){je=At,gt=I.startPos-1-lt;const st=Se?I.startPos+I.filter.length-1:X(D.current);ot=Math.min(st-lt,rt);break}lt+=rt}if(je){const rt=document.createRange();rt.setStart(je,gt),rt.setEnd(je,ot),rt.deleteContents();const st=document.createTextNode(`${f}${ve.type}:`);rt.insertNode(st);const ct=document.createRange();ct.setStartAfter(st),ct.setEndAfter(st),Ge.removeAllRanges(),Ge.addRange(ct),O(bt=>({...bt,active:!0,level:1,parentType:ve.id,inlineSearchActive:!0,inlineSearchStartPos:X(D.current),secondLevelFilter:"",activeIndex:0})),D.current.focus();return}}return}const fe=window.getSelection();if(!fe||!fe.rangeCount)return;if(I.inlineSearchActive&&I.parentType&&I.inlineSearchStartPos!==null){const Ge=h.find(ot=>ot.id===I.parentType);if(!Ge)return;const je=`${f}${Ge.type}:`,gt=I.inlineSearchStartPos-je.length;if(gt>=0){let Ut=function(hn){if(hn.nodeType===3)bt.push({node:hn,start:st,end:st+hn.textContent.length}),st+=hn.textContent.length;else if(hn.nodeType===1){const kn=hn.childNodes||[];for(const fi of Array.from(kn))Ut(fi)}};const ot=document.createElement("span");if(ot.className=p.default.mention_tag,ot.dataset.id=ve.id,ot.dataset.type=ve.type,ot.dataset.contextId=ve.contextId||"",ot.contentEditable="false",ve.type===g.MentionType.FILE||ve.type===g.MentionType.FOLDER){const hn=document.createElement("span");hn.className=(0,r.default)(p.default.mention_icon,ve.type===g.MentionType.FILE?b?.getIcon(new m.URI(ve.text)):(0,_.getIcon)("folder")),ot.appendChild(hn),ve.type===g.MentionType.FOLDER?T?.addFolderToContext(new m.URI(ve.contextId),!0):T?.addFileToContext(new m.URI(ve.contextId),void 0,!0)}else if(ve.type===g.MentionType.CODE){const hn=document.createElement("span");hn.className=(0,r.default)(p.default.mention_icon,ve.kind&&(0,c.getSymbolIcon)(ve.kind)+" outline-icon"),ot.appendChild(hn),ve.symbol&&T?.addFileToContext(new m.URI(ve.contextId),[ve.symbol.range.startLineNumber,ve.symbol.range.endLineNumber],!0)}const Mt=A?.workspace;let lt=ve.text;Mt&&ve.contextId&&(lt=ve.contextId.replace(new m.URI(Mt.uri).codeUri.fsPath,"").slice(1));const At=document.createTextNode(lt);ot.appendChild(At);const rt=document.createRange();let st=0,ct=!1;const bt=[];Ut(D.current);for(const hn of bt){if(gt>=hn.start&&gt<=hn.end){const kn=gt-hn.start;rt.setStart(hn.node,kn),ct=!0}if(ct){const kn=Se?gt+je.length+I.secondLevelFilter.length:X(D.current);if(kn>=hn.start&&kn<=hn.end){const fi=kn-hn.start;rt.setEnd(hn.node,fi);break}}}if(ct){rt.deleteContents(),rt.insertNode(ot);const hn=document.createRange();hn.setStartAfter(ot),hn.setEndAfter(ot),fe.removeAllRanges(),fe.addRange(hn);const kn=document.createTextNode("\xA0");hn.insertNode(kn),hn.setStartAfter(kn),hn.setEndAfter(kn),fe.removeAllRanges(),fe.addRange(hn)}O(hn=>({...hn,active:!1,inlineSearchActive:!1})),D.current.focus();return}}const Pe=document.createElement("span");if(Pe.className=p.default.mention_tag,Pe.dataset.id=ve.id,Pe.dataset.type=ve.type,Pe.dataset.contextId=ve.contextId||"",Pe.contentEditable="false",ve.type==="file"||ve.type==="folder"){const Ge=document.createElement("span");Ge.className=(0,r.default)(p.default.mention_icon,ve.type==="file"?b?.getIcon(new m.URI(ve.text)):(0,_.getIcon)("folder")),Pe.appendChild(Ge)}const Te=A?.workspace;let Ne=ve.text;Te&&ve.contextId&&(Ne=ve.contextId.replace(new m.URI(Te.uri).codeUri.fsPath,"").slice(1));const _e=document.createTextNode(Ne);Pe.appendChild(_e);let re=0,ge=!1;const Oe=[];function De(Ge){if(Ge.nodeType===3)Oe.push({node:Ge,start:re,end:re+Ge.textContent.length}),re+=Ge.textContent.length;else if(Ge.nodeType===1){const je=Ge.childNodes;for(const gt of Array.from(je))De(gt)}}De(D.current);const Fe=document.createRange();if(I.startPos!==null)for(const Ge of Oe){if(I.startPos-1>=Ge.start&&I.startPos-1<=Ge.end){const je=I.startPos-1-Ge.start;Fe.setStart(Ge.node,je),ge=!0}if(ge){const je=Se?I.startPos+I.filter.length-1:X(D.current);if(je>=Ge.start&&je<=Ge.end){const gt=je-Ge.start;Fe.setEnd(Ge.node,gt);break}}}if(ge){Fe.deleteContents(),Fe.insertNode(Pe);const Ge=document.createRange();Ge.setStartAfter(Pe),Ge.setEndAfter(Pe),fe.removeAllRanges(),fe.addRange(Ge);const je=document.createTextNode("\xA0");Ge.insertNode(je),Ge.setStartAfter(je),Ge.setEndAfter(je),fe.removeAllRanges(),fe.addRange(Ge)}O(Ge=>({...Ge,active:!1})),D.current.focus()},Ae=o.useCallback(ve=>{R(ve),l?.(ve)},[M,l]),pe=()=>{if(!D.current)return;const ve=D.current.innerHTML;if(!ve)return;const Se=document.createElement("div");Se.innerHTML=ve,Se.querySelectorAll(`.${p.default.mention_tag}`).forEach(Pe=>{var Te;const Ne=Pe.getAttribute("data-context-id");if(Ne){const _e=document.createTextNode(`{{${f}${Pe.getAttribute("data-type")}:${Ne}}}`);(Te=Pe.parentNode)===null||Te===void 0||Te.replaceChild(_e,Pe)}});let fe=Se.innerHTML;fe=fe.trim().replaceAll(t.WHITE_SPACE_TEXT," "),ve&&(L(Pe=>[...Pe,ve]),j(-1),V(!1)),u&&u(fe,{model:M,...w}),D.current.innerHTML="",D.current&&(D.current.style.overflowY="hidden",D.current.style.height="auto")},ne=o.useCallback(()=>{T?.cleanFileContext()},[T]),ue=o.useCallback(()=>{d&&d()},[d]),Ie=o.useCallback(ve=>(w.buttons||[]).filter(Se=>Se.position===ve).map(Se=>o.createElement(_.Popover,{key:Se.id,overlayClassName:p.default.popover_icon,id:`ai-chat-${Se.id}`,position:_.PopoverPosition.top,title:Se.title},o.createElement(v.EnhanceIcon,{className:(0,r.default)(Se.icon?(0,_.getIcon)(Se.icon):Se.iconClass,p.default[`${Se.id}_logo`]),tabIndex:0,role:"button",ariaLabel:Se.title,onClick:Se.onClick}))),[w.buttons]),xe=o.useMemo(()=>G.files.length>0||G.folders.length>0,[G]);return o.createElement("div",{className:p.default.input_container},I.active&&o.createElement("div",{className:p.default.mention_panel_container},o.createElement(s.MentionPanel,{items:H(),activeIndex:I.activeIndex,onSelectItem:ve=>q(ve,!0),position:{top:0,left:0},filter:I.level===0?I.filter:I.secondLevelFilter,visible:!0,level:I.level,loading:I.loading})),o.createElement("div",{className:p.default.editor_area},o.createElement("div",{ref:D,className:p.default.editor,contentEditable:!0,onInput:Z,onKeyDown:oe,onPaste:he,onCompositionEnd:ie})),o.createElement("div",{className:p.default.footer},o.createElement("div",{className:p.default.left_control},w.showModelSelector&&o.createElement(_.Select,{options:w.modelOptions||[],value:M,onChange:Ae,className:p.default.model_selector,size:"small",disabled:w.disableModelSelector}),Ie(g.FooterButtonPosition.LEFT)),o.createElement("div",{className:p.default.right_control},Ie(g.FooterButtonPosition.RIGHT),xe&&o.createElement(_.Popover,{overlayClassName:p.default.popover_icon,id:"ai-chat-clear-context",position:_.PopoverPosition.top,content:(0,c.localize)("aiNative.chat.context.clear")},o.createElement("div",{className:p.default.context_container,onClick:ne},o.createElement("div",{className:p.default.context_icon},o.createElement(_.Icon,{icon:"out-link"}),o.createElement(_.Icon,{icon:"close"})),o.createElement("div",{className:p.default.context_description},(0,c.formatLocalize)("aiNative.chat.context.description",G.files.length+G.folders.length)))),o.createElement(_.Popover,{overlayClassName:p.default.popover_icon,id:"ai-chat-send",position:_.PopoverPosition.top,content:E?"Stop":"Send"},E?o.createElement(v.EnhanceIcon,{wrapperClassName:p.default.stop_logo,className:(0,r.default)((0,_.getIcon)("stop"),p.default.stop_logo_icon),tabIndex:0,role:"button",ariaLabel:"Stop",onClick:ue}):o.createElement(v.EnhanceIcon,{wrapperClassName:p.default.send_logo,className:(0,r.default)((0,_.getIcon)("send-outlined"),p.default.send_logo_icon),tabIndex:0,role:"button",onClick:pe,ariaLabel:"Send"})))))};t.MentionInput=a},40167:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionItem=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(81878),_=n.__importDefault(e(97599)),v=({item:m,isActive:p,onClick:s})=>o.createElement("div",{className:`${_.default.mention_item} ${p?_.default.active:""}`,onClick:()=>s(m)},o.createElement("div",{className:_.default.mention_item_left},o.createElement(c.Icon,{className:(0,r.default)(_.default.mention_item_icon,m.icon)}),o.createElement("span",{className:_.default.mention_item_text},m.text),o.createElement("span",{className:_.default.mention_item_description},m.description)),m.getItems&&o.createElement(c.Icon,{className:(0,r.default)(_.default.mention_item_right,(0,c.getIcon)("arrowright"))}));t.MentionItem=v},80732:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MentionPanel=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=n.__importDefault(e(97599)),c=e(40167),_=({items:v,activeIndex:m,onSelectItem:p,position:s,filter:g,visible:a,level:h,loading:u=!1})=>{const d=r.useRef(null);if(r.useEffect(()=>{if(a&&d.current){const l=d.current.querySelector(`.${o.default.mention_item}.${o.default.active}`);l&&l.scrollIntoView({block:"nearest"})}},[m,a]),!a)return null;const f=(()=>{let l=v;if(h===0){if(g&&g.length>1){const y=g.substring(1).toLowerCase();l=v.filter(b=>b.text.toLowerCase().includes(y))}}else g&&g.length>0&&(l=v.filter(y=>y.text.toLowerCase().includes(g.toLowerCase())));return l})();return h===0&&f.length===0?null:r.createElement("div",{ref:d,className:o.default.mention_panel,style:{top:s.top,left:s.left}},u&&r.createElement("div",{className:o.default.loading_bar}),v.length>0?r.createElement("ul",{className:o.default.mention_list},v.map((l,y)=>r.createElement(c.MentionItem,{key:l.id,item:l,isActive:y===m,onClick:()=>p(l,!0)}))):r.createElement("div",{className:o.default.no_results},u?"\u6B63\u5728\u641C\u7D22...":"\u65E0\u5339\u914D\u7ED3\u679C"))};t.MentionPanel=_},44692:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MENTION_KEYWORD=t.MentionType=t.FooterButtonPosition=void 0;var e;(function(r){r.LEFT="left",r.RIGHT="right"})(e||(t.FooterButtonPosition=e={}));var n;(function(r){r.FILE="file",r.FOLDER="folder",r.CODE="code"})(n||(t.MentionType=n={})),t.MENTION_KEYWORD="@"},78048:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),c=(m,p)=>o({...m,position:"right",title:r,className:p,role:1});t.createMessageByUser=c;const _=(m,p)=>o({...m,position:"left",title:"",className:p,role:2});t.createMessageByAI=_;const v=m=>{let{title:p}=m;const{message:s,tooltip:g}=m;let a=m.icon||"";if(!p)return{icon:a,title:s,message:s,tooltip:g};const h=p.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,d,E,f]=h,l=d?d.slice(0,-1):n.CODICON_OWNER;a=(0,n.getExternalIcon)(E,l),f&&(a+=` ${f.slice(1)}`),p=p.slice(u.length)}return{icon:a,title:p,message:s,tooltip:g}};t.extractIcon=v},19957:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(46044);let _=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=_,n.__decorate([(0,r.Autowired)(c.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"llmContextService",void 0),t.LlmContextContribution=_=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],_)},63536:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(25234),_=e(19083),v=e(86560),m=e(96689),p=e(82196),s=e(14951),g=e(6287),a=e(20868);let h=class extends c.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxAttachFoldersLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.attachedFolders=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new v.Emitter,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(d,E,f){const l=E.findIndex(y=>y.uri.toString()===d.uri.toString());l>-1&&E.splice(l,1),E.push(d),E.length>f&&E.shift()}addFolderToList(d,E,f){const l=E.findIndex(y=>y.uri.toString()===d.uri.toString());l>-1&&E.splice(l,1),E.push(d),E.length>f&&E.shift()}addFileToContext(d,E,f=!1){if(!d)return;const l={uri:d,selection:E},y=f?this.attachedFiles:this.recentlyViewFiles,b=f?this.maxAttachFilesLimit:this.maxViewFilesLimit;f&&this.docModelManager.createModelReference(d),this.addFileToList(l,y,b),this.notifyContextChange()}addFolderToContext(d){if(!d)return;const E={uri:d};this.addFolderToList(E,this.attachedFolders,this.maxAttachFoldersLimit),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles=[],this.attachedFolders=[],this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,attachedFolders:this.attachedFolders,version:this.contextVersion++}}removeFileFromContext(d,E=!1){const f=E?this.attachedFiles:this.recentlyViewFiles,l=f.findIndex(y=>y.uri.toString()===d.toString());l>-1&&f.splice(l,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(m.EditorDocumentModelCreationEvent,d=>{d.payload.uri.scheme==="file"&&this.addFileToContext(d.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelRemovalEvent,d=>{d.payload.scheme==="file"&&this.removeFileFromContext(d.payload,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelSavedEvent,d=>{d.payload.scheme})),this.disposables.push(this.eventBus.on(p.EditorSelectionChangeEvent,d=>{if(d.payload.selections.length>0){const E=[d.payload.selections[0].selectionStartLineNumber,d.payload.selections[0].positionLineNumber].sort();E[0]===E[1]?this.addFileToContext(d.payload.editorUri,void 0,!1):this.addFileToContext(d.payload.editorUri,E.sort((f,l)=>f-l),!1)}}))}stopAutoCollection(){this.dispose()}async serialize(){const d=this.getAllContextFiles(),E=v.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(d.viewed,E),attachedFiles:this.serializeAttachedFiles(d.attached,E),attachedFolders:await this.serializeAttachedFolders(d.attachedFolders,E)}}async serializeAttachedFolders(d,E){const f=Array.from(new Set(d.map(l=>l.uri.toString())));return Promise.all(f.map(async l=>{var y;const b=new v.URI(l);return`\`\`\`
31458
31458
  ${((y=E.relative(b))===null||y===void 0?void 0:y.toString())||"/"}
31459
31459
  ${(await this.getPartiaFolderStructure(b.codeUri.fsPath)).map(S=>`- ${S}`).join(`
31460
31460
  `)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/cli-engine",
3
- "version": "3.8.3-next-1746606362.0",
3
+ "version": "3.8.3-next-1746610870.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-1746606362.0",
30
- "@opensumi/ide-core-common": "3.8.3-next-1746606362.0",
31
- "@opensumi/ide-core-node": "3.8.3-next-1746606362.0",
32
- "@opensumi/ide-express-file-server": "3.8.3-next-1746606362.0",
33
- "@opensumi/ide-extension": "3.8.3-next-1746606362.0",
34
- "@opensumi/ide-i18n": "3.8.3-next-1746606362.0",
35
- "@opensumi/ide-main-layout": "3.8.3-next-1746606362.0",
36
- "@opensumi/ide-startup": "3.8.3-next-1746606362.0",
29
+ "@opensumi/ide-core-browser": "3.8.3-next-1746610870.0",
30
+ "@opensumi/ide-core-common": "3.8.3-next-1746610870.0",
31
+ "@opensumi/ide-core-node": "3.8.3-next-1746610870.0",
32
+ "@opensumi/ide-express-file-server": "3.8.3-next-1746610870.0",
33
+ "@opensumi/ide-extension": "3.8.3-next-1746610870.0",
34
+ "@opensumi/ide-i18n": "3.8.3-next-1746610870.0",
35
+ "@opensumi/ide-main-layout": "3.8.3-next-1746610870.0",
36
+ "@opensumi/ide-startup": "3.8.3-next-1746610870.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": "9cbf8e96dc01a05ed5c04ef25b41ded41da498ef"
75
+ "gitHead": "2349657dfaaf19a8cae746f739305c72625c11ea"
76
76
  }